Person entity operations.
Methods
# static create(body, optionsopt) → {Promise.<ServiceResponse>}
Creates a new Person entity.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
body |
Object
|
||
data |
Object
|
Person field values. |
|
groups |
Array.<string>
|
<optional> |
Group names to add the person to. Names are resolved to humanIds automatically. |
employments |
Array.<{humanId: string, roles: Array.<{role: string, status: ('active'|'paused'|'separated'|'retired'|'inactive')}>}>
|
<optional> |
OUs to immediately employ this person in. Each entry must include |
options |
Object
|
<optional> |
|
return |
boolean
|
<optional> |
When |
Promise.<ServiceResponse>
Example
const { result } = await customers.Person.create(
{
data: { firstName: 'Ada', lastName: 'Lovelace' },
groups: ['group-admins'],
employments: [{ humanId: 'ou-engineering', roles: [{ role: 'Engineer', status: 'active' }] }]
},
{ return: true }
)
# static delete(humanId) → {Promise.<ServiceResponse>}
Deletes a Person entity.
Parameters:
| Name | Type | Description |
|---|---|---|
humanId |
string
|
The person's human-readable identifier. |
Promise.<ServiceResponse>
# static removeEmployment(personHumanId, ouHumanId) → {Promise.<ServiceResponse>}
Removes an employment relationship from a person.
Parameters:
| Name | Type | Description |
|---|---|---|
personHumanId |
string
|
The person's human-readable identifier. |
ouHumanId |
string
|
The OU's human-readable identifier. |
Promise.<ServiceResponse>
# static update(humanId, body) → {Promise.<ServiceResponse>}
Updates an existing Person entity.
Parameters:
| Name | Type | Description |
|---|---|---|
humanId |
string
|
The person's human-readable identifier. |
body |
Object
|
Update payload. |
Promise.<ServiceResponse>
# static upsertEmployment(personHumanId, ouHumanId, roles, optionsopt) → {Promise.<ServiceResponse>}
Adds or updates an employment relationship between a person and an OU.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
personHumanId |
string
|
The person's human-readable identifier. |
|
ouHumanId |
string
|
The OU's human-readable identifier. |
|
roles |
Array.<{role: string, status: ('active'|'paused'|'separated'|'retired'|'inactive')}>
|
Required. Each entry needs |
|
options |
Object
|
<optional> |
|
return |
boolean
|
<optional> |
When |
Promise.<ServiceResponse>
Example
await customers.Person.upsertEmployment('person-ada', 'ou-engineering', [
{ role: 'Engineer', status: 'active' }
])