Hugh Jeremy edited this page Aug 14, 2018 · 11 revisions

Documentation > Entity

An Amatino entity is a economic unit to be described by accounting information. Entities are described by Accounts and Transactions.

Examples of an Entity include a legal company, a consolidated group of companies, a project, or even a person.

Users may be granted fine-grained permissions to read and or write to individual Accounts within an Entity.

Properties

.session - Session

The Session used to retrieve or create this Entity.

Example: See Session object


.id - String

A unique Amatino identifier for this Entity

Example: "oB3cjSNKXklkJ4Tb"


.name - String

The friendly name of this Entity

Example: "MegaCorp"


.ownerId - Number

A unique identifier of the Amatino User who owns this Entity

Example: 689323


.permissionsGraph - Object

A description of the permissions granted to Amatino Users with respect to this Entity.

Example: {'9523413': {'56': {'write': False, 'read': True}}, '5235891': {'56': {'write': True, 'read': True}, '725': {'write': False, 'read': True}}}

Note: Expect the permissions graph to be refactored as an expressive object in future, with methods such as .grantsReadTo(user)


.description - String

Friendly description of this Entity

Example: "A company devoted to complete and utter world domination"


.regionId - Number

The integer identification of the Region in which this Entity is physically stored

Example: 4


.active - Boolean

A flag indicating whether this Entity is active, or is deleted

Example: true

Methods

static .create()

Parameters

  1. session: Session
  2. name: String - "My First Entity"
  3. description: String - "Cayman Islands holding company"
  4. storageRegionId: [Optional]Number - 4 or null
  5. callback: (Error, Entity)

Example

const _ = Entity.create(
  session,
  "My First Entity",
  "Cayman Islands holding company",
  null,
  (error, entity) => {
    console.log(entity.name) // Logs "My First Entity"
});

static .retrieve()

Parameters

  1. session: Session
  2. entityId: String
  3. callback: (Error, Entity)

Example

const _ = Entity.retrieve(
  session,
  "oB3cjSNKXklkJ4Tb",
  (error, entity) => {
    console.log(entity.id) // Logs "oB3cjSNKXklkJ4Tb"
});

.update()

Not implemented


.delete()

Not implemented

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.