@nuralogix.ai/dfx-api-client
Version:
DeepAffex API JavaScript Client Library
430 lines (256 loc) • 11.3 kB
Markdown
[@nuralogix.ai/dfx-api-client](../../index.md) / [HTTP](../../http/index.md) / Organizations
# Organizations
Organizations end points
This set of endpoints covers functions that allow to access
resources on the Organizational level. All endpoints require
Researcher, Lead or Admin access.
### Sample code
```js
const apiClient = client();
const response = await apiClient.http.organizations.retrieveLogo('your-org-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 OrgLogo200Response */
console.log(body.data);
```
### Methods
- [createUser](index.md#createuser)
- [deleteOrgMeasurement](index.md#deleteorgmeasurement)
- [deletePartnerMeasurement](index.md#deletepartnermeasurement)
- [listMeasurements](index.md#listmeasurements)
- [listProfiles](index.md#listprofiles)
- [login](index.md#login)
- [registerLicense](index.md#registerlicense)
- [removeUser](index.md#removeuser)
- [retrieve](index.md#retrieve)
- [retrieveLogo](index.md#retrievelogo)
- [retrieveMeasurement](index.md#retrievemeasurement)
- [retrieveProfile](index.md#retrieveprofile)
- [retrieveUser](index.md#retrieveuser)
- [unregisterLicense](index.md#unregisterlicense)
- [updateProfile](index.md#updateprofile)
- [updateUser](index.md#updateuser)
- [users](index.md#users)
### createUser
▸ **createUser**(`data`)
Creates a user under the organization. Available only to an Administrator.
An email will be sent to submitted Email address with a link to setup password
for the account. To create a user under your organization. You will need to be
logged in as a DFX_LEAD, DFX_ORG_ADMIN
Endpoint Action ID = 713
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`OrgCreateUserRequest`](./interfaces/OrgCreateUserRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgCreateUser200Response`](./interfaces/OrgCreateUser200Response.md)\>
___
### deleteOrgMeasurement
▸ **deleteOrgMeasurement**(`orgId`)
Only DFX_ORG_ADMIN has permission to delete all measurment for their own organization.
Endpoint Action ID = 721
#### Parameters
| Name | Type |
| :------ | :------ |
| `orgId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgDeleteSelfMeasurements200Response`](./interfaces/OrgDeleteSelfMeasurements200Response.md)\>
___
### deletePartnerMeasurement
▸ **deletePartnerMeasurement**(`orgId`, `partnerId`)
Only DFX_ORG_ADMIN has permission to delete all measurements of
specific PartnerIDs for their own organization.
Endpoint Action ID = 722
#### Parameters
| Name | Type |
| :------ | :------ |
| `orgId` | `string` |
| `partnerId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgDeletePartnerMeasurements200Response`](./interfaces/OrgDeletePartnerMeasurements200Response.md)\>
___
### listMeasurements
▸ **listMeasurements**(`data`)
Similar to `measurements.list` endpoint but retrieves all
measurements across an Organization.
Accessible by users with Researcher or Admin role.
Endpoint Action ID = 703
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`OrgMeasurementsRequest`](./interfaces/OrgMeasurementsRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgRegisterLicense200Response`](./interfaces/OrgRegisterLicense200Response.md)\>
___
### listProfiles
▸ **listProfiles**(`data`)
Similar to `profiles.list` endpoint but retrieves profiles across the Organization.
Accessible by users with Researcher or Admin role.
Endpoint Action ID = 710
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`OrgListProfileRequest`](./interfaces/OrgListProfileRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgListProfiles200Response`](./interfaces/OrgListProfiles200Response.md)\>
___
### login
▸ **login**(`data`)
Login and obtain User Token.
Note: Token obtained from this endpoint does not allow you to
take Measurements and is intended for viewing purposes only.
Note: MFAToken parameter is required only when 2FA authentication is enabled.
Endpoint Action ID = 717
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`OrgLoginRequest`](./interfaces/OrgLoginRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgLogin200Response`](./interfaces/OrgLogin200Response.md)\>
___
### registerLicense
▸ **registerLicense**(`data`)
Allows consumers to exchange a license key for a device token.
This endpoint is accessible publically to all consuming clients.
License keys are mapped against an organization. Upon submitting a registration key
and relevant information associated with the device to be registered, DFX API will
respond with a referencing DeviceID and a token for future device-specific API
requests. The resulting token is a Device Token.
The longevity and allowed origins of the token can be controlled by TokenExpiresIn and
TokenSubject optional parameters.
TokenExpiresIn specifies token validity duration in seconds. Effective duration will be
calculated as a minimum of TokenExpiresIn, license Expiration date and organization's
SessionMaxDurationseconds; i.e., this parameter can only be used to further reduce token's lifespan.
TokenSubject locks the host which is allowed to use the token for its communication with DeepAffex.
When set, the server will compare the token value with HTTP request's Referer header and reject the
request if those don't match.
Note: Please make sure to store the obtained token locally as most Licenses (e.g. Trial) allow for a
limited number of registered Devices. To unregister a Device and get back one license, call the
unregisterLicense method with your Device Token.
Endpoint Action ID = 705
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`OrgRegisterLicenseRequest`](./interfaces/OrgRegisterLicenseRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgRegisterLicense200Response`](./interfaces/OrgRegisterLicense200Response.md)\>
___
### removeUser
▸ **removeUser**(`userId`)
Similar to `users.remove` endpoint but performed by an Organization's Admin.
Accessible only by users with Admin role.
Endpoint Action ID = 715
#### Parameters
| Name | Type |
| :------ | :------ |
| `userId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgDeleteUser200Response`](./interfaces/OrgDeleteUser200Response.md)\>
___
### retrieve
▸ **retrieve**()
Retrieves information related to the current organization account.
Endpoint Action ID = 700
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgRetrieveInformation200Response`](./interfaces/OrgRetrieveInformation200Response.md)\>
___
### retrieveLogo
▸ **retrieveLogo**(`orgId`)
Retrieves an Organization logo. This endpoint will return a buffer containing a logo
Endpoint Action ID = 708
#### Parameters
| Name | Type |
| :------ | :------ |
| `orgId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgLogo200Response`](./interfaces/OrgLogo200Response.md)\>
___
### retrieveMeasurement
▸ **retrieveMeasurement**(`measurementId`)
Similar to `measurements.retrieve` endpoint but retrieves a
measurement across the Organization.
Accessible by users with Researcher or Admin role.
Endpoint Action ID = 704
#### Parameters
| Name | Type |
| :------ | :------ |
| `measurementId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgRetrieveMeasurement200Response`](./interfaces/OrgRetrieveMeasurement200Response.md)\>
___
### retrieveProfile
▸ **retrieveProfile**(`profileId`)
Similar to `profiles.retrieve` endpoint but retrieves a profile from the Organization
Accessible by users with Researcher or Admin role.
Endpoint Action ID = 711
#### Parameters
| Name | Type |
| :------ | :------ |
| `profileId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgRetrieveProfile200Response`](./interfaces/OrgRetrieveProfile200Response.md)\>
___
### retrieveUser
▸ **retrieveUser**(`userId`)
Similar to `users.retrieve` endpoint but retrieves a user from the Organization.
Accessible only by users with Admin role.
Endpoint Action ID = 712
#### Parameters
| Name | Type |
| :------ | :------ |
| `userId` | `string` |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgRetrieveUser200Response`](./interfaces/OrgRetrieveUser200Response.md)\>
___
### unregisterLicense
▸ **unregisterLicense**()
Send the Device Token as the Authorization header to decommission a registered device.
Note that this does not delete the Device.
Endpoint Action ID = 706
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgUnregisterLicense200Response`](./interfaces/OrgUnregisterLicense200Response.md)\>
___
### updateProfile
▸ **updateProfile**(`profileId`, `data`)
Similar to `profiles.update` endpoint but updates a Profile from the Organization.
Accessible by users with Researcher or Admin role.
Endpoint Action ID = 716
#### Parameters
| Name | Type |
| :------ | :------ |
| `profileId` | `string` |
| `data` | [`OrgUpdateProfileRequest`](./interfaces/OrgUpdateProfileRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgUpdateProfile200Response`](./interfaces/OrgUpdateProfile200Response.md)\>
___
### updateUser
▸ **updateUser**(`userId`, `data`)
Similar to `users.update` endpoint but updates a User from the Organization.
Accessible only by users with Admin role.
Endpoint Action ID = 714
#### Parameters
| Name | Type |
| :------ | :------ |
| `userId` | `string` |
| `data` | [`OrgUpdateUserRequest`](./interfaces/OrgUpdateUserRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgUpdateUser200Response`](./interfaces/OrgUpdateUser200Response.md)\>
___
### users
▸ **users**(`data`)
Retrieves a list of users in the current organization.
This endpoint can filter by groups and account creation start
and end dates to make sorting and filtering easier.
Endpoint Action ID = 702
#### Parameters
| Name | Type |
| :------ | :------ |
| `data` | [`OrgUsersRequest`](./interfaces/OrgUsersRequest.md) |
#### Returns
`Promise`<[`ErrorResponse`](../../interfaces/ErrorResponse.md) \| [`OrgRegisterLicense200Response`](./interfaces/OrgRegisterLicense200Response.md)\>