@nuralogix.ai/dfx-api-client
Version:
DeepAffex API JavaScript Client Library
161 lines (100 loc) • 3.72 kB
Markdown
[@nuralogix.ai/dfx-api-client](../../index.md) / [HTTP](../../http/index.md) / Profiles
# Profiles
Profiles end points
Profiles are elements of user accounts. A single user account
may maintain a number of profiles to help segment different
types of users.
### Sample code
```js
const apiClient = client();
const response = await apiClient.http.profiles.retrieve('your-profile-id');
const { status, body } = response;
if (status !== '200') {
/**
* TypeScript knows that once we are inside this block, the only response
* shape that matches a non "200" response is the ErrorResponse
*/
throw body;
}
/** Otherwise the shape of the response is ProfileRetrieve200Response */
console.log(body.Name);
```
### Methods
- [create](index.md#create)
- [list](index.md#list)
- [listByUser](index.md#listbyuser)
- [remove](index.md#remove)
- [retrieve](index.md#retrieve)
- [update](index.md#update)
### create
▸ **create**(`data`)
Creates a user profile under a main user account.
User profiles may be used to segment different accounts
for measurements.
Endpoint Action ID = 400
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`ProfileCreateRequest`](interfaces/ProfileCreateRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`ProfileCreate200Response`](interfaces/ProfileCreate200Response.md)\>
___
### list
▸ **list**(`data`)
Lists specific profiles managed under the current user account.
Endpoint Action ID = 402
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`ProfileListRequest`](interfaces/ProfileListRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`ProfileList200Response`](interfaces/ProfileList200Response.md)\>
___
### listByUser
▸ **listByUser**(`userId`, `data`)
Lists specific profiles managed under a single user account
specified by the ID in the request parameters.
Endpoint Action ID = 403
#### Parameters
| Name | Type |
| :------ | :------ |
| `userId` | `string` |
| `data` | [`ProfileListByUserRequest`](interfaces/ProfileListByUserRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`ProfileListByUser200Response`](interfaces/ProfileListByUser200Response.md)\>
___
### remove
▸ **remove**(`profileId`)
Removes the user profile entirely. It also deletes any related
meta fields associated with the profile.
Endpoint Action ID = 404
#### Parameters
| Name | Type |
| :------ | :------ |
| `profileId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`ProfileRemove200Response`](interfaces/ProfileRemove200Response.md)\>
___
### retrieve
▸ **retrieve**(`profileId`)
Retrieves a single user Profile specified by ID.
Endpoint Action ID = 401
#### Parameters
| Name | Type |
| :------ | :------ |
| `profileId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`ProfileRetrieve200Response`](interfaces/ProfileRetrieve200Response.md)\>
___
### update
▸ **update**(`profileId`, `data`)
Updates a specific user profile. To update status the valid
options are: ACTIVE and INACTIVE.
Endpoint Action ID = 405
#### Parameters
| Name | Type |
| :------ | :------ |
| `profileId` | `string` |
| `data` | [`ProfileUpdateRequest`](interfaces/ProfileUpdateRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`ProfileUpdate200Response`](interfaces/ProfileUpdate200Response.md)\>