new ChinoAPIUsers(baseUrl, customerId, customerKey)
Create a caller for Users Chino APIs
Parameters:
Name | Type | Default | Description |
---|---|---|---|
baseUrl |
string | The url endpoint for APIs |
|
customerId |
string | The Chino customer id or bearer token |
|
customerKey |
string | null | null | The Chino customer key or null (not provided) |
Methods
create(userSchemaId, data) → {Promise.<objects.User, objects.ChinoException>}
Create a new user inside selected user schema by its id with data as user information
Parameters:
Name | Type | Description |
---|---|---|
userSchemaId |
string | |
data |
object |
Returns:
A promise that return a User object if resolved, otherwise throw a ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.User, objects.ChinoException>
current() → {Promise.<objects.User, objects.ChinoException>}
Return information about current user NOTE: need to be authenticated with bearer token
Returns:
A promise that return a User object if resolved, otherwise throw a ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.User, objects.ChinoException>
delete(userId, force) → {Promise.<objects.Success, objects.ChinoException>}
Deactivate (or delete) selected user by its id
Parameters:
Name | Type | Default | Description |
---|---|---|---|
userId |
string | ||
force |
boolean | false | If true delete user information otherwise only deactivate it. Default value is false (deactivate) |
Returns:
A promise that return a Success object if resolved, otherwise throw a ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.Success, objects.ChinoException>
details(userId) → {Promise.<objects.User, objects.ChinoException>}
Return information about selected user by its id
Parameters:
Name | Type | Description |
---|---|---|
userId |
string |
Returns:
A promise that return a User object if resolved, otherwise throw a ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.User, objects.ChinoException>
list(userSchemaId, offset, limit) → {Promise.<Array, objects.ChinoException>}
Return a list of current users inside the selected user schema by its id
Parameters:
Name | Type | Default | Description |
---|---|---|---|
userSchemaId |
string | ||
offset |
int | 0 | |
limit |
int | 10 |
Returns:
A promise that return a list of User object if resolved, otherwise throw a ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<Array, objects.ChinoException>
partialUpdate(userId, data) → {Promise.<objects.User, objects.ChinoException>}
Update a specific part of information about selected user by its id with data as information
Parameters:
Name | Type | Description |
---|---|---|
userId |
string | |
data |
object |
Returns:
A promise that return a User object if resolved, otherwise throw a ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.User, objects.ChinoException>
update(userId, data) → {Promise.<objects.User, objects.ChinoException>}
Update information about selected user by its id with data as new user information
Parameters:
Name | Type | Description |
---|---|---|
userId |
string | |
data |
object |
Returns:
A promise that return a User object if resolved, otherwise throw a ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.User, objects.ChinoException>