/** * HTTP request methods. * * HTTP defines a set of request methods to indicate the desired action to be * performed for a given resource. Although they can also be nouns, these * request methods are sometimes referred as HTTP verbs. Each of them implements * a different semantic, but some common features are shared by a group of them: * e.g. a request method can be safe, idempotent, or cacheable. * * @public */ declare enum HTTPMethod { /** * The `DELETE` method deletes the specified resource. */ DELETE = "DELETE", /** * The `GET` method requests a representation of the specified resource. * Requests using GET should only retrieve data. */ GET = "GET", /** * The PATCH method is used to apply partial modifications to a resource. */ PATCH = "PATCH", /** * The `POST` method is used to submit an entity to the specified resource, * often causing a change in state or side effects on the server. */ POST = "POST", /** * The `PUT` method replaces all current representations of the target * resource with the request payload. */ PUT = "PUT", /** * The CONNECT method starts two-way communications with the requested * resource. It can be used to open a tunnel. */ CONNECT = "CONNECT" } /** * 200 - 299 */ declare enum HttpSuccessfulResponseStatus { OK = "200" } /** @internal */ type HttpSuccessfulResponseStatusCodes = `${HttpSuccessfulResponseStatus}`; /** * 300 - 399 */ declare enum HttpRedirectionResponseStatus { NotModified = "304" } /** @internal */ type HttpRedirectionResponseStatusCodes = `${HttpRedirectionResponseStatus}`; /** * 400 - 499 */ declare enum HttpClientResponseStatus { BadRequest = "400", Unauthorized = "401", Forbidden = "403", NotFound = "404", NotAcceptable = "406", RequestTimeout = "408", /** * Returned as `MFA_ENROLLMENT_EXPIRED` when a staged MFA enrolment has * lapsed. */ Gone = "410", TooManyRequests = "429" } /** @internal */ type HttpClientResponseStatusCodes = `${HttpClientResponseStatus}`; /** * 500 - 599 */ declare enum HttpServerResponseStatus { InternalServerError = "500", BadGateway = "502", ServiceUnavailable = "503", GatewayTimeout = "504" } /** @internal */ type HttpServerResponseStatusCodes = `${HttpServerResponseStatus}`; declare enum FetchErrors { UNSUPPORTED_RESPONSE_CONTENT_TYPE = "UNSUPPORTED_RESPONSE_CONTENT_TYPE", UNEXPECTED_ERROR = "UNEXPECTED_ERROR", SYNTAX_ERROR = "SYNTAX_ERROR", UNKNOWN = "UNKNOWN" } /** @internal */ type FetchErrorsCodes = `${FetchErrors}`; declare enum OnBeforeRESTCallErrors { ON_BEFORE_REST_CALL_ERROR = "ON_BEFORE_REST_CALL_ERROR" } /** @internal */ type OnBeforeRESTCallErrorCodes = `${OnBeforeRESTCallErrors}`; type HeadersObject = { [key: string]: string; }; interface IBeforeRESTCallError { Code: OnBeforeRESTCallErrorCodes; Message: OnBeforeRESTCallErrorCodes; } interface IBeforeRESTCallSuccess { Code: 'SUCCESS'; Message: 'SUCCESS'; } declare abstract class Main { protected parent: IClient; /** @internal */ constructor(parent: IClient); protected onBeforeRESTCall(): Promise; protected getDefaults(method: HTTPMethod): { baseUrl: string; method: HTTPMethod; headers: Headers; }; protected getHeaderWithDeviceToken(): Headers; protected getHeaderWithUserToken(): Headers; protected getHeaderWithSessionEnabled(): Headers; /** * Authorization plus `x-nura-session`, so a token minted by an authenticated * call is session bound in the same way as one minted by a login. */ protected getHeaderWithUserTokenAndSessionEnabled(): Headers; } /** * Base shape for a Response. This interface is extended * to provide the specific shape for the responses * of each resource+verb. */ interface Response { status: string; body?: unknown; headers: Headers | HeadersObject; } interface HttpError { Code: string; Message: string; } /** @noInheritDoc */ interface HttpErrorResponse extends Response { status: HttpClientResponseStatusCodes | HttpServerResponseStatusCodes; body: HttpError; } interface FetchError { Code: FetchErrorsCodes; Message: FetchErrorsCodes; } /** @noInheritDoc */ interface FetchErrorResponse extends Response { status: FetchErrorsCodes; body: FetchError; } interface OnBeforeRESTCallError { Code: OnBeforeRESTCallErrorCodes; Message: OnBeforeRESTCallErrorCodes; } /** @noInheritDoc */ interface OnBeforeRESTCallErrorResponse extends Response { status: OnBeforeRESTCallErrorCodes; body: OnBeforeRESTCallError; } type ErrorResponse = HttpErrorResponse | FetchErrorResponse | OnBeforeRESTCallErrorResponse; /** * Reset password link */ interface AuthResetPasswordLink { success: boolean; } /** @noInheritDoc */ interface AuthResetPasswordLink200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Reset password link response */ body: AuthResetPasswordLink; } /** * Login code sent */ interface AuthLoginCodeSent { success: boolean; } /** @noInheritDoc */ interface AuthLoginCodeSent200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Login code sent response */ body: AuthLoginCodeSent; } /** * Renew token */ interface AuthRenewToken { Token: string; RefreshToken: string; } /** @noInheritDoc */ interface AuthRenewToken200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Renew token response */ body: AuthRenewToken; } interface AuthSendResetMobile { success: boolean; } /** @noInheritDoc */ interface AuthSendResetMobile200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Send reset mobile response */ body: AuthSendResetMobile; } interface AuthGetOrgClientCredentials { orgName: string; logoURL: string; userPoolId: string; nativeAuthEnabled: boolean; cognitoDomainUrl: string; identityProviders: Array<{ iconURL: string; displayName: string; identityProviderName: string; }>; } /** @noInheritDoc */ interface AuthGetOrgClientCredentials200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: AuthGetOrgClientCredentials; } /** * Authenticate */ interface AuthAuthenticate { OrganizationID: string; ID: string; Type: string; SessionGen: number; Region: string; exp: number; iat: number; iss: string; RoleID: string; Policies: { LoginUser: boolean; }; Permissions: object; } /** @noInheritDoc */ interface AuthAuthenticate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Authenticate body response */ body: AuthAuthenticate; } /** * Validate */ interface AuthValidate { OrganizationID: string; ID: string; Type: string; SessionGen: number; Region: string; exp: number; iat: number; iss: string; RoleID: string; Policies: { LoginUser: boolean; }; Permissions: object; } /** @noInheritDoc */ interface AuthValidate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Validate body response */ body: AuthValidate; } /** * SSO Token */ interface AuthSSOToken { idToken: string; accessToken: string; refreshToken: string; expiresIn: number; tokenType: string; } /** @noInheritDoc */ interface AuthSSOToken200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * SSO Token body response */ body: AuthSSOToken; } /** * Auth generate token */ interface AuthGenerateToken { Token: string; } /** @noInheritDoc */ interface AuthGenerateToken200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Generate Token body response */ body: AuthGenerateToken; } /** * Reset password link request */ interface AuthResetPasswordLinkRequest { Email: string; /** organization_identifier */ Identifier: string; } /** * Login code request */ interface AuthLoginCodeRequest { PhoneNumber: string; /** organization_identifier */ Identifier: string; } /** * Renew token request */ interface AuthRenewTokenRequest { Token: string; RefreshToken: string; } interface AuthSendResetMobileRequest { Email?: string; PhoneNumber?: string; } /** * SSO Token request */ interface AuthSSOTokenRequest { redirectURL: string; orgIdentifier: string; /** AWS code */ code: string; } interface AuthGenerateTokenRequest { Token: string; RefreshToken: string; } /** * Auths end points * * These endpoints provide user/device authentication. */ declare class Auths extends Main { /** * Request to send password reset link to user's email. * * Endpoint Action ID = 2300 */ requestResetPasswordLink(data: AuthResetPasswordLinkRequest): Promise; /** * Request to send password reset link to user's email. * * Edpoint Action ID = 2302 */ sendResetMobile(data: AuthSendResetMobileRequest): Promise; /** * Request to send login code. * * Endpoint Action ID = 2303 */ requestLoginCode(data: AuthLoginCodeRequest): Promise; /** * Renew user/device access and refresh token. When you register a license or login with * user's credentials, a pair of Token and RefreshToken is sent to a client. The client * needs to send the matching pair to exchange it with a new pair. The old pair will not * be valid after calling this endpoint. RefreshToken is one-time use. * * Endpoint Action ID = 2304 */ renew(data: AuthRenewTokenRequest, tokenType: 'device' | 'user'): Promise; /** * Generates a general token. * * Endpoint Action ID = 2305 */ generateToken(data: AuthGenerateTokenRequest): Promise; /** * Returns organization client credentials. * * Endpoint Action ID = 2306 */ getOrgClientCredentials(orgId: string): Promise; /** * Validates a token passed as a authentication header and returns the decoded token with permissions. * * Endpoint Action ID = unknown at this time */ authenticate(): Promise; /** * Validates a token passed as a authentication header and returns the decoded token with permissions. * * Endpoint Action ID = unknown at this time */ validate(): Promise; /** * Exchange Cognito code for Cognito Access token and Refresh token * * Endpoint Action ID = unknown at this time */ ssoToken(data: AuthSSOTokenRequest): Promise; } /** * Multi-factor authentication channel. * * TOTP (authenticator app) is the only channel supported by the API. * Requesting any other channel on `POST /users/mfa/setup` is rejected with a 400. */ declare enum MFAChannel { TOTP = "totp" } /** @internal */ type MFAChannelValues = `${MFAChannel}`; /** * Per-session MFA state, carried as the `MFAStatus` claim of every token. * * * `none` - no MFA was applied to this session (the user is not enrolled and * the organization policy does not require enrolment), or the token is a * Device / Organization token. * * `pending` - a restricted token. It is proof of password only and is * rejected with `MFA_PENDING` on every endpoint other than `/users/mfa/*` * and `/users/logout`. Expires 300 seconds after it was minted. * * `verified` - the MFA challenge, or the enrolment verification, completed * for this session. */ declare enum MFAStatus { NONE = "none", PENDING = "pending", VERIFIED = "verified" } /** @internal */ type MFAStatusValues = `${MFAStatus}`; /** * MFA error codes returned by the API. * * These are the values of the `Code` field on an error response body, so a * consumer can branch on them instead of matching on `Message` strings. */ declare enum MFAErrorCode { /** * HTTP 403 - the token carries `MFAStatus: 'pending'` and the endpoint is * not one of `/users/mfa/setup`, `/users/mfa/verify`, `/users/mfa/status` * or `/users/logout`. * * Note: this is also reachable from `POST /auths/renew` and * `POST /auths/generateToken`; a pending pair can neither be renewed nor * exchanged for a full token. */ MFA_PENDING = "MFA_PENDING", /** * HTTP 401 - the submitted TOTP code did not verify. Nothing was written, * so the same code entry can be retried. */ INVALID_MFA_CODE = "INVALID_MFA_CODE", /** * HTTP 410 - the staged enrolment expired (or `setup` was never called), so * there is nothing to verify against. Call `setupMfa` again with the same * token to stage a fresh binding URI. */ MFA_ENROLLMENT_EXPIRED = "MFA_ENROLLMENT_EXPIRED", /** * HTTP 403 - `setupMfa` was called with a pending token by a user who is * already enrolled. Changing the factor of an enrolled user requires a * verified session plus password re-authentication. */ MFA_ALREADY_ENROLLED = "MFA_ALREADY_ENROLLED", /** * HTTP 401 - the `Password` submitted to re-authenticate an MFA * configuration change (`setupMfa` on an enrolled user, or `deleteMfa`) * was missing or incorrect. */ INVALID_PASSWORD = "INVALID_PASSWORD", /** * HTTP 403 - self-service removal was refused because the organization * policy requires MFA for the caller's role. Only an admin can override * the policy, through `deleteMfaForUser`. * * Note that a user in a required role therefore cannot unenrol themselves at * all; a client should not offer the action to them. */ MFA_REQUIRED_BY_POLICY = "MFA_REQUIRED_BY_POLICY", /** * HTTP 401 - the token is session bound (`x-nura-session`) and its session * has expired, was logged out, or was superseded by a newer pair. * * Note: this is also reachable from `POST /auths/renew` and * `POST /auths/generateToken`. */ ERR_SESSION_EXPIRED = "ERR_SESSION_EXPIRED" } /** @internal */ type MFAErrorCodeValues = `${MFAErrorCode}`; /** * MFA obligation of a single role. * * `required` means enrolment is required by the organization: it governs * whether an unenrolled user may obtain a full session. It does not govern the * login challenge, which is enrolment driven - an enrolled user is always * challenged, whatever `required` says. */ interface MFARolePolicy { required: boolean; channels: MFAChannelValues[]; } /** * Organization MFA policy as returned to a client, scoped by the API to the * caller's own role. * * It is therefore a single-key object - `{ "": { required, * channels } }` - or `{}` when the caller's role has no entry, which is * semantically `{ required: false }`. It is never the full multi-role policy. * * See {@link MFAFullPolicy} for the unscoped shape used on the administration * write paths. */ type MFAPolicy = Record; /** * Organization MFA policy in its persisted, multi-role form - * `{ "ROLE_ID": { required, channels } }`. * * This is the shape accepted by the policy write paths. Updates merge the * supplied role entries over the stored policy, so entries that are left out * are preserved. Roles absent from the policy are treated as * `{ required: false }`. */ type MFAFullPolicy = Record; /** * The four MFA claims carried by every token, mirroring the * `GET /users/mfa/status` response field for field. * * This package does not decode tokens; the type is exported so that consumers * decoding the token payload themselves can type the result. */ interface MFATokenClaims { /** Per-session MFA state. */ MFAStatus: MFAStatusValues; /** The enrolled channel, or `null` when the user is not enrolled. */ MFAChannel: MFAChannelValues | null; /** Whether the user is enrolled. Always equals `MFAChannel !== null`. */ MFAEnrolled: boolean; /** Whether the organization policy requires enrolment for the user's role. */ MFARequired: boolean; } /** * Payload of a decoded access token. * * The MFA claims are a mint-time snapshot: `MFAStatus` is the session's own * state, while `MFAChannel`, `MFAEnrolled` and `MFARequired` are database facts * as of the mint and are re-derived on every renewal. * `GET /users/mfa/status` remains the live read. */ interface TokenClaims extends MFATokenClaims { /** User or Device UUID. */ ID: string; OrganizationID: string; Type: 'User' | 'Device' | 'Organization'; DeviceID?: string; /** Version counter used to invalidate all outstanding sessions. */ SessionGen: number; Region: string; /** Present only on tokens minted with the `x-nura-session` header. */ sessionId?: string; /** Expiry, in epoch milliseconds. */ exp: number; /** Issued at, in epoch milliseconds. */ iat: number; /** Issuer, `urn:deepaffex`. */ iss: string; } /** * Login envelope returned when the user is enrolled. * * No access or refresh token is issued yet. Prompt for the authenticator code * and submit it, together with `MFAChallengeToken`, to `verifyMfa`. * `MFAPolicy` is deliberately absent from this envelope. */ interface MFAChallengeEnvelope { action: 'mfa_challenge'; MFAChannel: MFAChannelValues; /** * Short-lived token that carries the login through the challenge. It is a * token with `MFAStatus: 'pending'`, so it can also be used as the * `Authorization` bearer on the `/users/mfa/*` calls that complete the flow. */ MFAChallengeToken: string; } /** * Login envelope returned when the organization policy requires MFA for the * user's role but the user is not enrolled yet. * * `Token` is a limited token with `MFAStatus: 'pending'` and a 300 second * expiry which only reaches `/users/mfa/*` and `/users/logout`. Drive the * enrolment flow with it: `setupMfa` to obtain a binding URI for the QR code, * then `verifyMfa` with the code from the authenticator app to obtain the full * token pair. * * No refresh token is issued: a pending pair can neither be renewed nor * exchanged, so the session either completes MFA within the expiry window or * the user logs in again. */ interface MFAPendingEnvelope { Token: string; /** * Never issued on the pending envelope. * * @deprecated Not a real field - it is declared as `undefined` so that this * envelope stays distinguishable from a full token pair. */ RefreshToken?: undefined; MFAPolicy: MFAPolicy; } /** A full access and refresh token pair. */ interface FullTokenPair { Token: string; RefreshToken: string; } /** @noInheritDoc */ interface MFAErrorResponse extends HttpErrorResponse { status: HttpClientResponseStatusCodes | HttpServerResponseStatusCodes; /** * MFA error response */ body: { Code: MFAErrorCodeValues; Message: string; }; } /** * Body of a `VALIDATION_ERROR` (HTTP 400) response. * * The shape is not MFA specific - the API answers any request that fails field * validation this way - but the MFA endpoints are where a client meets it most, * since `Channel`, `Code` and `MFAChallengeToken` are all validated. Note that * `Message` is empty on these responses, so anything user facing has to be built * from `Errors`. * * `Errors` is keyed by request field name. The values are not uniform: a missing * field gives a list of message strings, e.g. * `{ Code: ['Code is required'] }`, while a disallowed value gives a rule and * its permitted set, e.g. `{ Channel: [['VALID_PROPERTIES', ['totp']]] }`. */ interface ValidationError { Code: 'VALIDATION_ERROR'; Errors: Record; /** Always empty on a validation error - read `Errors` instead. */ Message: string; } /** @noInheritDoc */ interface ValidationErrorResponse extends HttpErrorResponse { status: HttpClientResponseStatusCodes; /** * Validation error response */ body: ValidationError; } /** * Narrows a login response body to the MFA challenge envelope, i.e. the user * is enrolled and must supply an authenticator code to finish logging in. */ declare const isMFAChallenge: (body: unknown) => body is MFAChallengeEnvelope; /** * Narrows a login response body to the pending envelope, i.e. enrolment is * required and the user has not enrolled yet. The token it carries only * reaches the MFA and logout endpoints. */ declare const isMFAPending: (body: unknown) => body is MFAPendingEnvelope; /** * Narrows a login response body to the ordinary outcome: a full access and * refresh token pair, ready to use. */ declare const isFullTokenPair: (body: unknown) => body is FullTokenPair; /** * Narrows an error response to one carrying an MFA error code, so that the * `Code` field can be compared against {@link MFAErrorCode} instead of * matching on the message text. */ declare const isMFAError: (response: Response) => response is MFAErrorResponse; /** * Narrows an error response to a field-validation failure, so `Errors` can be * read to build per-field messages. * * Note that a validation failure is answered before the MFA gates are reached, * so a malformed request is a 400 here rather than the 403 the same call would * get once the body is valid. */ declare const isValidationError: (response: Response) => response is ValidationErrorResponse; type DeviceTypeIDStrings = keyof typeof DeviceTypeID; /** * Status response */ interface OrgRegisterLicenseRequest { /** * IPHONE = All iPhone devices * * IPAD = All generations of iPad devices * * DARWIN = Desktop MacOS based systems * * ANDROID_PHONE = All Android based phone devices * * WINDOWS = Desktop Windows64 based systems * * WIN32 = Desktop Windows32 based systems * * WINDOWS_TABLET = Windows-based tablet devices * * LINUX = Linux based devices * * DEBIAN = Debian based devices */ DeviceTypeID: DeviceTypeIDStrings; /** License key */ Key: string; Name: string; Identifier: string; Version: string; TokenExpiresIn?: number; TokenSubject?: string; } interface OrgUsersRequest { /** filter by user's Status. */ statusId: string | null; /** filter by user's email */ userName: string | null; /** filter by user's Role. */ roleId: string | null; /** filter by user's gender. */ gender: string | null; /** Account creation start date in the format YYYY-MM-DD */ date: string | null; /** Account creation end date in the format YYYY-MM-DD. */ endDate: string | null; /** default limit: 25 */ limit: string | null; /** default offset: 0 */ offset: string | null; } interface OrgMeasurementsRequest { /** filter by measurement Status ID. */ statusId: string | null; /** filter by a Profile ID. */ userProfileID: string | null; /** filter by a Profile name */ userProfileName: string | null; /** filter by studyID */ studyID: string | null; /** filter by user email. */ userName: string | null; /** The date to return measurements for yyyy-mm-dd. */ date: string | null; /** End date for range of measurements to receive. */ endDate: string | null; /** default limit: 50 */ limit: string | null; /** default offset: 0 */ offset: string | null; /** filter by a Device ID. */ deviceID: string | null; /** filter by a partner ID. */ partnerId: string | null; /** filter by mode. */ mode: string | null; sortBy: string | null; sortOrder: string | null; region: string | null; } interface OrgListProfileRequest { /** filter by profile StatusID. */ statusId?: string; /** Profile owner's email to filter by. Example: john@doe.com. */ ownerUser?: string; /** Profile's name to filter by. Example: john@doe.com */ userProfileName?: string; /** filter by creation date. */ created?: string; /** filter by date. */ date?: string; /** filter by end date */ endDate?: string; /** default limit: 25 */ limit?: string; /** default offset: 0 */ offset?: string; } interface OrgCreateUserRequest { FirstName: string; LastName: string; Email: string; Gender: string; DateOfBirth: string; RoleID: string; Password: string; organizationConfigLinkID?: string; expireAt?: string; } interface OrgUpdateUserRequest { FirstName: string; LastName: string; Gender: string; DateOfBirth: string; HeightCm: string; WeightKg: string; } interface OrgUpdateProfileRequest { Name: string; Email: string; Status: string; } interface OrgLoginRequest { Email: string; Password: string; Identifier: string; /** * @deprecated Removed by the API in release 2.92.0 and ignored if sent. MFA * is now a two-step flow: this endpoint answers with a challenge envelope and * the code is submitted to `users.verifyMfa`. */ MFAToken?: number; /** * Access token lifetime, in seconds. It can only shorten the token relative * to the configured maximum, never extend it. * * The value survives a login interrupted by MFA: it is carried on the * challenge or pending token and applied to the full token minted by * `users.verifyMfa`, so it does not need to be supplied again. */ TokenExpiresIn?: number; /** * Refresh token lifetime, in seconds. * * Note: unlike `TokenExpiresIn` this is not carried across an MFA challenge - * a refresh token minted by `users.verifyMfa` always takes the configured * default lifetime. */ RefreshTokenExpiresIn?: number; } interface OrgContactUserRequest { Email: string; Type: string; } /** * Organization update request - `PATCH /organizations` * * Only `MFAPolicy` is typed here. API release 2.92.0 reinstates this route * specifically to serve the org-admin MFA policy path, and no other updatable * field is specified by that release - confirm any additional fields against the * API before adding them. */ interface OrgUpdateRequest { /** * MFA policy entries to apply, in the persisted multi-role shape. * * The supplied entries are merged over the stored policy, so roles left out * are preserved. `channels` must be a subset of `['totp']`. * * A caller may only set entries for roles in its `rolesCanUpdate` set * **excluding its own role** - the anti-self-exemption rule. A DFX_ORG_ADMIN * therefore cannot modify the DFX_ORG_ADMIN entry, and attempting it is * rejected with a 403. Setting your own role requires the Super Admin path, * `organizationsPrivate.update`. */ MFAPolicy?: MFAFullPolicy; } /** * Device type */ interface DeviceType { ID: string; Name: string; Description: string; IsMobile: boolean; IsTablet: boolean; IsDesktop: boolean; } /** @noInheritDoc */ interface DeviceTypes200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Device type response */ body: DeviceType[]; } /** * Device retrieve */ interface DeviceRetrieve { Name: string; DeviceTypeID: DeviceTypeIDStrings; StatusID: string; Identifier: string; Version: string; Created: number; Updated: number; count: string; Region: string; } /** @noInheritDoc */ interface DeviceRetrieve200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Device retrieve response */ body: DeviceRetrieve; } /** * Device created */ interface DeviceCreated { ID: string; } /** @noInheritDoc */ interface DeviceCreated200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Device created response */ body: DeviceCreated; } /** @noInheritDoc */ interface DeviceUpdated200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** @noInheritDoc */ interface DeviceDeleted200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * Device list */ interface Device { ID: string; Name: string; DeviceTypeID: DeviceTypeIDStrings; StatusID: string; Identifier: string; Version: string; Measurements: number; LicenseID: string; Region: string; Created: number; Updated: number; TotalCount: number; } /** @noInheritDoc */ interface DeviceList200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * List of existing devices in an organization */ body: Device[]; } /** @noInheritDoc */ interface DeviceDeleteMeasurements200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * Device license */ interface DeviceLicense { ID: string; LicenseType: string; StatusID: string; Expiration: number; MaxDevices: number; } /** @noInheritDoc */ interface DeviceRetrieveLicenseId200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Device retrieve license ID response */ body: DeviceLicense; } /** * Device create request */ interface DeviceCreateRequest { Name: string; DeviceTypeID: DeviceTypeIDStrings; Identifier: string; Version: string; } /** * Device update request */ interface DeviceUpdateRequest { Name: string; DeviceTypeID: DeviceTypeIDStrings; Status: string; Identifier: string; Version: string; } /** * Device list request */ interface DeviceListRequest { statusId: string | null; unique: string | null; deviceTypeID: DeviceTypeIDStrings | null; name: string | null; version: string | null; date: string | null; endDate: string | null; limit: string | null; offset: string | null; licenseID: string | null; } /** * Devices end points * * Devices can be used to record the platform by which a measurement * captured was conducted on. The DeviceTypeID references a pre-defined * set of devices with the following chart. New Device Types cannot be * created by organizations and are managed by the API specifically. * Devices types can be retrieved from a dedicated endpoint returning * all their values and meanings. */ declare class Devices extends Main { /** * Retrieves a list of allowed device types. * * Endpoint Action ID = 900 */ types(): Promise; /** * Retrieves a single reference to a device. The body response includes details * about the device and the number of measurements that have been associated with it. * * Endpoint Action ID = 902 */ retrieve(id: string): Promise; /** * Creates a new device reference to associate with measurements. * Each device is mapped to a device type ID. * * Endpoint Action ID = 903 */ create(data: DeviceCreateRequest): Promise; /** * Updates a device reference via the UUID supplied. * * Endpoint Action ID = 904 */ update(id: string, data: DeviceUpdateRequest): Promise; /** * Deletes a device from the dataset. * * Endpoint Action ID = 905 */ remove(id: string): Promise; /** * Retrieves a list of existing devices in an organization. * * Endpoint Action ID = 906 */ list(data?: DeviceListRequest): Promise; /** * Only DFX_ORG_ADMIN has permission to delete all measurements of a * specific device for their own organization. * * Endpoint Action ID = 907 */ deleteDeviceMeasurement(id: string): Promise; /** * We want to extend the EP to use deviceID (instead of {ID}) in the device token * to extract license information and return to client. * * Endpoint Action ID = 908 */ retrieveLicenseId(): Promise; } interface ConsentObj { description: string; data_controller: { company: string; contact: string; email: string; }; purposes: { authorized: boolean; purpose: string; description: string; }[]; policy_url: string; policy_version: string; collection_mode: string; } /** * Enum for possible Status ID codes * @readonly * @enum {string} */ declare enum StatusID { ACTIVE = "ACTIVE", MAINTENANCE = "MAINTENANCE", ERROR = "ERROR", LATENCY = "LATENCY" } type GeneralStatusIDStrings = keyof typeof StatusID; /** * Server Status response */ interface GeneralServerStatus { /** * ACTIVE = Online and fully operational * * MAINTENANCE = Offline for maintenance * * ERROR = Offline due to an error * * LATENCY = API is experience latency or a general slowdown */ StatusID: GeneralStatusIDStrings; /** API version */ Version: string; /** the location of the API by cluster */ Region: string; /** when false means that user login (and thus a user token) is required for making measurements. */ AllowAnonymous: boolean; } /** * Mime type */ interface GeneralMIMEType { /** GUID */ ID: string; Mime: string; Name: string; } interface GeneralVerifyToken { ActiveLicense: boolean; DeviceID: string; ID: string; OrganizationID: string; Region: string; RemainingMeasurement: number | null; RoleID: string; SessionGen: number; Type: string; exp: number; iat: number; iss: string; } interface GeneralRegions { 'as-east': 'AS East'; 'as-hk': 'AS Hong Kong'; 'cn-north': 'cn-north-1'; 'cn-west': 'cn-northwest-1'; 'eu-central': 'EU Central'; 'na-east': 'NA East'; 'sa-east': 'SA East'; } /** * Available Status */ interface GeneralStatus { Description: string; ID: string; Name: string; } /** * Available Roles */ interface GeneralRoles { Description: string; ID: string; Name: string; } /** @noInheritDoc */ interface GeneralServerStatus200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Server Status */ body: GeneralServerStatus; } /** @noInheritDoc */ interface GeneralListAcceptedMIMETypes200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * List accepted Mime types */ body: GeneralMIMEType[]; } /** @noInheritDoc */ interface GeneralVerifyToken200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Verify token */ body: GeneralVerifyToken; } /** @noInheritDoc */ interface GeneralRegions200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Regions */ body: GeneralRegions; } /** @noInheritDoc */ interface GeneralListAvailableStatuses200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * List Available Statuses */ body: GeneralStatus[]; } /** @noInheritDoc */ interface GeneralListAvailableRoles200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * List Available roles */ body: GeneralRoles[]; } interface RolesInteractionTree { rolesKeysArray: string[]; roleNames: object; rolesNamesAsSelectInput: Array<{ id: string; name: string; }>; rolesCanChangeSelfRole: Record; rolesCanCreate: Record; rolesCanDelete: Record; rolesCanInterchangeOtherRoles: Record; rolesCanList: Record; rolesCanRead: Record; rolesCanUpdate: Record; } /** @noInheritDoc */ interface GetRolesInteractionTree200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: RolesInteractionTree; } interface Prescription { config: string; } /** @noInheritDoc */ interface GetPrescription200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: Prescription; } interface RetrieveConsent200Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: ConsentObj; } interface CreateConsent { success: true; } interface CreateConsent200Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: CreateConsent; } interface UpdateConsent { success: true; } interface UpdateConsent200Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UpdateConsent; } /** * General end points */ declare class General extends Main { /** * An endpoint that propagates the current API health status and * other information. This can be used during an apps initial boot * process to determine the accessibility of the API and propagate * a general status message to users. * * Endpoint Action ID = 100 */ status(): Promise; /** * Returns a list of system-wide accepted Mime types and their IDs. * * Endpoint Action ID = 101 */ listAcceptedMimeTypes(): Promise; /** * Retrieves a list of available User Roles. * * Endpoint Action ID = 102 */ listAvailableUserRoles(): Promise; /** * Retrieves a list of available status codes that can be used throughout * the application to update the StatusID field of various resources. * * Endpoint Action ID = 104 */ listAvailableStatuses(): Promise; /** * Checks validity of your Token and returns its encoded info. * * Endpoint Action ID = 107 */ verifyToken(token: string): Promise; /** * Return the list of regions available for clusters. * * Endpoint Action ID = 108 */ regions(): Promise; /** * Retrieve consent. * * Endpoint Action ID = 109 */ retrieveConsent(): Promise; /** * Create consent. * * Endpoint Action ID = 110 */ createConsent(data: ConsentObj): Promise; /** * Update consent. * * Endpoint Action ID = 111 */ updateConsent(data: ConsentObj): Promise; /** * Return the list of regions available for clusters. * * Endpoint Action ID = 113 */ getRolesInteractionTree(): Promise; /** * Retrieve a user Prescription * * Endpoint Action ID = 114 */ getPrescription(prescriptionId: string): Promise; } /** * License */ interface License { Created: number | null; ID: string | null; StatusID: string | null; Expiration: string | null; MaxDevices: number | null; OrganizationID: string | null; DeviceRegistrations: number | null; LicenseTypeID: string | null; LicenseType: string | null; SDKPlatforms: string[]; Username: string | null; TotalCount?: number | null; } /** @noInheritDoc */ interface LicensesListLicenses200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: License[]; } interface OrgLicenses { ID: string; LicenseType: string; StatusID: string; Expiration: number; Key: string; MaxDevices: number; Created: number; DeviceRegistrations: number; TotalCount: number; } /** @noInheritDoc */ interface LicensesListOrgLicenses200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * List of available licenses response */ body: OrgLicenses[]; } interface LicensesUpdateLicense { success: boolean; } /** @noInheritDoc */ interface LicensesUpdateLicense200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: LicensesUpdateLicense; } interface LicensesRemoveLicense { success: boolean; } /** @noInheritDoc */ interface LicensesRemoveLicense200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: LicensesRemoveLicense; } interface LicensesCreateLicense { ID: string; } /** @noInheritDoc */ interface LicensesCreateLicense200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: LicensesCreateLicense; } interface RetrieveOrgLicense { Created: number | null; ID: string | null; StatusID: string | null; Expiration: string | null; Key: string | null; MaxDevices: number | null; LicenseType: string | null; LicenseTypeID: string | null; DeviceRegistrations: number | null; SDKPlatforms: string[] | null; } /** @noInheritDoc */ interface LicensesRetrieveOrgLicense200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: RetrieveOrgLicense; } /** @noInheritDoc */ interface LicensesRetrieveLicense200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: License; } interface LicenseType { ID: string; RoleID: string; } /** @noInheritDoc */ interface LicensesListLicenseTypes200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: LicenseType[]; } interface LicensesUpdateLicenseRequest { StatusID: string | null; LicenseTypeID: string | null; MaxDevices: number | null; Expiration: string | null; SDKPlatforms: string[] | null; } interface LicensesCreateLicenseRequest { OrganizationID: string | null; LicenseType: string | null; MaxDevices: number | null; Expiration: string | null; SDKPlatforms: string[] | null; } interface LicensesListOrgLicensesRequest { limit?: number; offset?: number; date?: string; endDate?: string; sortBy?: string; sortOrder?: 'ASC' | 'DESC'; licenseType?: string; statusId?: string; } interface LicensesListRequest { date?: string; endDate?: string; licenseType?: string; limit?: number; offset?: number; orgId?: string; sortBy?: string; sortOrder?: 'ASC' | 'DESC'; statusId?: string; userName?: string; } /** * Licenses end points * * These endpoints allow you to list the Licenses available to * your User/Organization. */ declare class Licenses extends Main { /** * Retrieve License * * Endpoint Action ID = 1404 */ retrieveLicense(id: string): Promise; /** * List licenses * * Endpoint Action ID = 1405 * */ listLicenses(data?: LicensesListRequest): Promise; /** * List org licenses * * Endpoint Action ID = 1406 * */ listOrgLicenses(data?: LicensesListOrgLicensesRequest): Promise; /** * Create License * * Endpoint Action ID = 1407 */ createLicense(data: LicensesCreateLicenseRequest): Promise; /** * Update License * * Endpoint Action ID = 1408 */ updateLicense(licenseId: string, data: LicensesUpdateLicenseRequest): Promise; /** * Remove License * * Endpoint Action ID = 1409 */ removeLicense(licenseId: string): Promise; /** * Retrieve Org License * * Endpoint Action ID = 1411 */ retrieveOrgLicense(id: string): Promise; /** * List License Types * * Endpoint Action ID = 1412 */ listLicenseTypes(): Promise; } /** * Measurement Created */ interface MeasurementCreated { ID: string; } /** @noInheritDoc */ interface MeasurementCreated200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Measurement Created response */ body: MeasurementCreated; } /** * Measurement retrieve */ interface MeasurementRetrieve { Created: number; Updated: number; ID: string; OrganizationID: string; StatusID: string; UserID: string; UserProfileID: string; DeviceID: string; StudyID: string; Resolution: number; DeviceVersion: string; Comments: object; Mode: string; City: string; State: string; Country: string; Region: string; PartnerID: string; Results: object; SignalNames: object; SignalDescriptions: object; SignalConfig: object; SignalUnits: object; DataSizeBytes: number; } /** @noInheritDoc */ interface MeasurementRetrieved200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Measurement retrieved response */ body: MeasurementRetrieve; } /** * Measurement list */ interface MeasurementList { ID: string; UserID: string; UserProfileID: string | null; UserProfileName: string | null; DeviceID: string | null; StudyID: string; StatusID: string; DeviceVersion: string | null; Mode: string; Created: number; Updated: number; TotalCount: number; } /** @noInheritDoc */ interface MeasurementList200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Measurement retrieved response */ body: MeasurementList[]; } /** * Measurement add data */ interface MeasurementAddData { ID: string; ChunkOrder: number; } /** @noInheritDoc */ interface MeasurementAddData200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Measurement add data response */ body: MeasurementAddData; } /** @noInheritDoc */ interface MeasurementDelete200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * Measurement create request */ interface MeasurementCreateRequest { StudyID: string; Resolution: number; /** User Profile ID (optional) */ UserProfileID?: string; /** Optional or mandatory depending on license policy */ PartnerID?: string; } /** * Measurement add data request */ interface MeasurementAddDataRequest { Action: string; /** base64-encoded payload */ Payload: string; } /** * Measurement list request */ interface MeasurementListRequest { statusId: string | null; userProfileId: string | null; userProfileName: string | null; studyId: string | null; partnerId: string | null; date: string | null; endDate: string | null; limit: string | null; offset: string | null; deviceID: string | null; userName?: string | null; sortBy: string | null; sortOrder: string | null; mode?: string | null; } /** * Measurements end points * * Measurements are individual one-time captures of blood flow data. * A single measurement record could represent multiple models of data analysis, * hence this data structure supports lookup parameters to filter them. * * Note: A valid License is required in order to create Measurements and submit * data chunks for processing. Please make sure to call Register License endpoint * first to receive a Device Token that grants access to these functions. * Next, in order to have your user information associated with the measurements, * you can use the User Login endpoint to obtain a User Token, which can be used to take * measurements as well. * * Important: If your License Type is SDK_DEVICE, you must login and obtain a User Token * as this License Type only allows you to perform a login operation. */ declare class Measurements extends Main { /** * Returns the results of a measurement request specified by * the UUID in the endpoint request. This payload will change * according to the different requested signals. * * Endpoint Action ID = 500 */ retrieve(id: string, tokenType: 'user' | 'device'): Promise; /** * Provides a historical list of measurements captured by the API store. The results * of the measurements are captured and only displayed for the current application * providers token designator. Each record has a status representing its cycle in the system: * * Status Message | Description * * CAPTURING | A new record was created and results are being received. * * PROCESSING | Capture is complete and the record is processing. * * COMPLETE | The analysis is complete and ready for consumption. * * ERROR | An error occurred during processing. * * INCOMPLETE | Capturing process returned as incomplete/not enough data. * * Endpoint Action ID = 501 */ list(data?: MeasurementListRequest): Promise; /** * Begins a new data capture session and returns a measurement ID * property, which should be referenced for adding data chunks and * retreiving results. * * Resolution: currently can be either 0 or 100. (default is 100) * * * 100 means the result set will have 100% of the original size * * * 0 returns 1 value per signal * * PartnerID is mandatory or optional (based on License policy). * * Endpoint Action ID = 504 */ create(data: MeasurementCreateRequest): Promise; /** * Adds collected blood-flow data to a specific measurement. Upon submitting a * chunk of data, the API will return a MeasurementDataID value representing * the received chunk. Data must be sent to the server in the order produced by * the DFX SDK. If a chunk it sent out of order, the server will return an error. * Please ensure that new chunks are only sent after the server responds with a * MeasurementDataID. * * Submitting measurements has three stages: * * a) starting, * * b) measurement body, * * c) closing a measurement. * * Each of these phases have the same payload structure however a different Action * flag is to be sent with each request and must follow the CHUNK::ACTION format. * * Measurement Actions | Description * * FIRST::PROCESS | Start a new measurement (drop any existing), Process results * * FIRST::IGNORE | Start a new measurement (drop any existing), Do not process * * CHUNK::PROCESS | Arbitrary block of TOI data and process results * * CHUNK::IGNORE | Arbitrary block of TOI data and do not process results * * LAST::PROCESS | Finish a measurement cycle and process results * * LAST::IGNORE | Finish a measurement cycle and do not process * * `Payload` is binary data that can currently only be obtained by using our SDK. * The Payload (binary content) field must be `base64-encoded`. * * Note: This endpoint is a subject to request throttling, you must not submit more * data than can be obtained in real time. i.e., do not send more than five seconds * of chunk data over the course of five seconds of real time. * * Response Error Codes Explanation: * * * "RATE_LIMIT": You have sent too many chunks in a given time period. See the Note above. * * "MEASUREMENT_CLOSED": Requested Measurement is already finished. You need to create a new Measurement. * * "MISALIGNED_CHUNK": Chunk Order was mismatched. i.e., ChunkOrder 2 was sent before ChunkOrder 1. * * "INVALID_MEASUREMENT": Requested Measurement ID was not found. * * "UNPACKER_RPC_ERROR": Payload validation has been failed. Reason(s) will be provided in error message. * * Endpoint Action ID = 506 */ data(id: string, data: MeasurementAddDataRequest): Promise; /** * Only DFX_ORG_ADMIN has permission to delete a specific measurment by * measurement ID for its own organization. * * Endpoint Action ID = 507 */ delete(id: string): Promise; } /** * Organization retrieve information */ interface OrgRetrieveInformation { ID: string; Name: string; Identifier: string; StatusID: string; Contact: string; Email: string; PasswordMinLength: number; AdminPasswordMinLength: number; PasswordRequireCharacterClasses: number; PasswordRequireUppercase: boolean; PasswordRequireLowercase: boolean; PasswordRequireDigits: boolean; PasswordRequireSpecial: boolean; PasswordRotateDays: number; RequireUniquePasswordsCount: number; SessionMaxDurationSeconds: number; SessionIdleDurationSeconds: number; OrgAddresses: any[]; LivenessConfig: { VisageLiveness: boolean; FakeDetection: boolean; SNRThresholding: boolean; }; /** * The organization MFA policy. * * It is specified to be scoped to the caller's own role - a single-key object, * or `{}` when that role has no entry. Note that as of the 2026-07-22 QA build * this path still returns the full multi-role object; the scoping requirement * (V2API-3522) was raised later and is not deployed yet. Do not rely on the * single-key shape here until it is - unlike the login responses, which are * correctly scoped. * * Absent on API builds older than 2.92.0. */ MFAPolicy?: MFAPolicy; Created: number; Updated: number; } /** @noInheritDoc */ interface OrgRetrieveInformation200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization retrieve information response */ body: OrgRetrieveInformation; } /** * Organization measurement info */ interface OrgMeasurementInfo { ID: string; OrganizationID: string; StatusID: string; UserID: string; UserProfileID: string | null; DeviceID: string; StudyID: string; Resolution: number; DeviceVersion: string | null; Comments: object; Mode: string; City: string; State: string; Country: string; Region: string; PartnerID: string | null; Results: object; SignalNames: object; SignalDescriptions: object; SignalConfig: object; SignalUnits: object; DataSizeBytes: number; Created: number; Updated: number; } /** @noInheritDoc */ interface OrgRetrieveMeasurement200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization retrieve measurement info response */ body: OrgMeasurementInfo; } /** * Organization registered license */ interface OrgRegisteredLicense { DeviceID: string; Token: string; RefreshToken: string; /** Role associated with your License */ RoleID: string; /** User account associated with your License */ UserID: string; } /** @noInheritDoc */ interface OrgRegisterLicense200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization register license response */ body: OrgRegisteredLicense; } /** @noInheritDoc */ interface OrgUnregisterLicense200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * Organization logo */ interface OrgLogo { data: string; } /** @noInheritDoc */ interface OrgLogo200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization logo */ body: OrgLogo; } /** * Organization profile */ interface OrgProfile { ID: string; Name: string; Email: string; Status: string; MeasurementCount: string; OwnerUser: string | null; Created: number; Updated: number; TotalCount: number; } /** @noInheritDoc */ interface OrgListProfiles200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization list profiles */ body: OrgProfile[]; } /** * Organization user profile */ interface OrgUserProfile { ID: string; Name: string; Email: string; Status: string; MeasurementCount: number; Created: number; Updated: number; } /** @noInheritDoc */ interface OrgRetrieveProfile200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization retrieve user profile */ body: OrgUserProfile; } /** * Organization user */ interface OrgUser { Gender: string; DateOfBirth: string | null; Created: number; Updated: number; ID: string; OrganizationID: string; RoleID: string; StatusID: string; Email: string; Password: string; FirstName: string | null; LastName: string | null; ResetToken: string | null; ResetTokenDate: string | null; AvatarURI: string | null; IsVerified: boolean; VerificationCode: string; PhoneNumber: string | null; DeviceID: string; HeightCm: number | null; WeightKg: number | null; LoginMethod: string; SSOID: string | null; Region: string; } /** @noInheritDoc */ interface OrgRetrieveUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization retrieve user */ body: OrgUser; } /** * Organization create user */ interface OrgCreateUser { ID: string; ResetToken: string; } /** @noInheritDoc */ interface OrgCreateUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization create user response */ body: OrgCreateUser; } /** * Organization update user */ interface OrgUpdateUser { success: boolean; } /** @noInheritDoc */ interface OrgUpdateUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization update user response */ body: OrgUpdateUser; } /** * Organization delete user */ interface OrgDeleteUser { success: boolean; } /** @noInheritDoc */ interface OrgDeleteUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization delete user response */ body: OrgDeleteUser; } /** @noInheritDoc */ interface OrgUpdateProfile200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * Organization login - the ordinary outcome, with the token claim * `MFAStatus: 'none'`. */ interface OrgLogin { Token: string; RefreshToken: string; /** * The organization MFA policy, scoped by the API to the caller's own role, so * a single-key object or `{}`. * * Absent on API builds older than 2.92.0. */ MFAPolicy?: MFAPolicy; } /** * The three envelopes `POST /organizations/auth` can answer with. * * Narrow the body before reading tokens off it - {@link isFullTokenPair}, * {@link isMFAChallenge} and {@link isMFAPending} are exported for that: * * ```ts * const { status, body } = await client.http.organizations.login(data, true); * if (status !== '200') return; * if (isMFAChallenge(body)) { * // enrolled: prompt for the authenticator code, then * // users.verifyMfa({ Code, MFAChallengeToken: body.MFAChallengeToken }, true) * } else if (isMFAPending(body)) { * // enrolment required: users.setupMfa({ Channel: MFAChannel.TOTP }), * // render the QR code, then users.verifyMfa({ Code }, true) * } else { * // logged in: body.Token and body.RefreshToken are both present * } * ``` */ type OrgLoginBody = OrgLogin | MFAChallengeEnvelope | MFAPendingEnvelope; /** @noInheritDoc */ interface OrgLogin200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization login response */ body: OrgLoginBody; } /** @noInheritDoc */ interface OrgDeleteSelfMeasurements200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** @noInheritDoc */ interface OrgDeletePartnerMeasurements200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } interface OrgPasswordPolicy { PasswordMinLength: number; AdminPasswordMinLength: number; PasswordMaxLength: number; PasswordRequireUppercase: boolean; PasswordRequireLowercase: boolean; PasswordRequireDigits: boolean; PasswordRequireSpecial: boolean; PasswordSpecialCharacters: string; PasswordRotateDays: number; RequireUniquePasswordsCount: number; LimitLoginAttemptsCountPerWindow: number; LimitLoginAttemptsWindowDurationSeconds: number; LoginAttemptsLockoutDurationSeconds: number; SessionMaxDurationSeconds: number; SessionIdleDurationSeconds: number; LimitVerificationAttemptsCountPerWindow: number; LimitVerificationAttemptsWindowDurationSeconds: number; } /** @noInheritDoc */ interface OrgPasswordPolicy200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization password policy response */ body: OrgPasswordPolicy; } /** * Organization update */ interface OrgUpdate { success: boolean; } /** @noInheritDoc */ interface OrgUpdate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization update response */ body: OrgUpdate; } interface OrgContactUser { success: boolean; } /** @noInheritDoc */ interface OrgContactUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organization contact user response */ body: OrgContactUser; } /** * Organization 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. */ declare class Organizations extends Main { /** * Retrieves information related to the current organization account. * * Endpoint Action ID = 700 */ retrieve(tokenType: 'device' | 'user'): Promise; /** * 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 */ users(data?: OrgUsersRequest): Promise; /** * Similar to `measurements.list` endpoint but retrieves all * measurements across an Organization. * * Accessible by users with Researcher or Admin role. * * Endpoint Action ID = 703 */ listMeasurements(data?: OrgMeasurementsRequest): Promise; /** * Similar to `measurements.retrieve` endpoint but retrieves a * measurement across the Organization. * * Accessible by users with Researcher or Admin role. * * Endpoint Action ID = 704 */ retrieveMeasurement(measurementId: string, expandResults?: boolean): Promise; /** * 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 */ registerLicense(data: OrgRegisterLicenseRequest, enableSession: boolean): Promise; /** * 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 */ unregisterLicense(): Promise; /** * Retrieves an Organization logo. This endpoint will return a buffer containing a logo * * Endpoint Action ID = 708 */ retrieveLogo(orgId: string): Promise; /** * Similar to `profiles.list` endpoint but retrieves profiles across the Organization. * * Accessible by users with Researcher or Admin role. * * Endpoint Action ID = 710 */ listProfiles(data?: OrgListProfileRequest): Promise; /** * Similar to `profiles.retrieve` endpoint but retrieves a profile from the Organization * * Accessible by users with Researcher or Admin role. * * Endpoint Action ID = 711 */ retrieveProfile(profileId: string): Promise; /** * Similar to `users.retrieve` endpoint but retrieves a user from the Organization. * * Accessible only by users with Admin role. * * Endpoint Action ID = 712 */ retrieveUser(userId: string): Promise; /** * 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 */ createUser(data: OrgCreateUserRequest): Promise; /** * Similar to `users.update` endpoint but updates a User from the Organization. * * Accessible only by users with Admin role. * * Endpoint Action ID = 714 */ updateUser(userId: string, data: OrgUpdateUserRequest): Promise; /** * Similar to `users.remove` endpoint but performed by an Organization's Admin. * * Accessible only by users with Admin role. * * Endpoint Action ID = 715 */ removeUser(userId: string): Promise; /** * Similar to `profiles.update` endpoint but updates a Profile from the Organization. * * Accessible by users with Researcher or Admin role. * * Endpoint Action ID = 716 */ updateProfile(profileId: string, data: OrgUpdateProfileRequest): Promise; /** * 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: this endpoint answers with one of three envelopes - see * {@link OrgLoginBody}. Narrow the body before reading tokens off it. The * session is only populated for the ordinary outcome, a full token pair; for * the MFA challenge and pending outcomes it is left untouched, and the flow is * completed through `users.setupMfa` / `users.verifyMfa`. * * Endpoint Action ID = 717 */ login(data: OrgLoginRequest, enableSession: boolean): Promise; /** * Updates the organization. As of API release 2.92.0 this route is reinstated * to serve the org-admin MFA policy path; it requires the * ORGANIZATION_UPDATE permission. * * Entries are merged over the stored policy, so roles left out are preserved. * A caller may only set roles in its own `rolesCanUpdate` set **excluding its * own role** - so a DFX_ORG_ADMIN cannot relax the DFX_ORG_ADMIN entry, and * trying to is a 403. Use `organizationsPrivate.update` (Super Admin, * GLOBAL_ACCESS) to set any role including your own. * * Endpoint Action ID = 720 */ update(data: OrgUpdateRequest): Promise; /** * Contact User * * Endpoint Actions ID = 719 */ contactUser(data: OrgContactUserRequest): Promise; /** * Only DFX_ORG_ADMIN has permission to delete all measurment for their own organization. * * Endpoint Action ID = 721 */ deleteOrgMeasurement(orgId: string): Promise; /** * Only DFX_ORG_ADMIN has permission to delete all measurements of * specific PartnerIDs for their own organization. * * Endpoint Action ID = 722 */ deletePartnerMeasurement(orgId: string, partnerId: string): Promise; /** * * Returns the password policy for an organization * * Endpoint Action ID = 723 */ getPasswordPolicy(): Promise; } /** * Organizations private list request */ interface OrganizationsPrivateListRequest { limit: number | null; offset: number | null; date: string | null; endDate: string | null; sortBy: string | null; sortOrder?: 'ASC' | 'DESC'; name: string | null; statusId: string | null; } interface OrganizationsPrivateTemplateAddRequest { StudyTemplateID: string | null; SavePayloads: boolean | null; SavePayloadImages: boolean | null; SaveResults: boolean | null; RemainingMeasurement?: number | null; IsHardLimit?: boolean | null; } interface OrganizationsPrivateTemplateUpdateRequest { StudyTemplateID: string | null; SavePayloads?: boolean | null; SavePayloadImages?: boolean | null; SaveResults?: boolean | null; RemainingMeasurement?: number | null; IsHardLimit?: boolean | null; } interface OrganizationsPrivateCreateAdmin$1 { Email: string; OrgAdminRegion: string; Password: string; } interface OrganizationsPrivateUpdateLogoRequest { Logo: string; } interface OrgAddress { Line1: string | null; Line2: string | null; City: string | null; State: string | null; Country: string | null; PostalCode: string | null; Region: string | null; } interface LivenessConfig { VisageLiveness: boolean | null; FakeDetection: boolean | null; SNRThresholding: boolean | null; } interface OrganizationsPrivateUpdateRequest { Created: string | null; Updated: number | null; ID: string | null; Name: string | null; Identifier: string | null; StatusID: string | null; Logo: string | null; BrandID: string | null; Contact: string | null; Email: string | null; ConsentId: string | null; OrgAddresses: OrgAddress[]; LivenessConfig: LivenessConfig; LogoURL?: string; /** * MFA policy entries to apply, in the persisted multi-role shape. This is the * Super Admin path, so any role may be set, including DFX_ORG_ADMIN. * * The supplied entries are merged over the stored policy, so roles left out * are preserved. `channels` must be a subset of `['totp']`; any other value is * rejected with a 400. */ MFAPolicy?: MFAFullPolicy; } interface OrganizationsPrivateCreateRequest { OrgAddresses: OrgAddress[]; OrgAdminRegion: string | null; Identifier: string | null; Name: string | null; Contact: string | null; Email: string | null; OrgAdminFirstName: string | null; OrgAdminLastName: string | null; OrgAdminEmail: string | null; NotifyAdmin?: boolean; Logo?: string; LivenessConfig?: LivenessConfig; LogoURL?: string; } interface IdentityProvidersUpdateRequest { cognitoName: string; cognitoType: 'SAML' | 'Facebook' | 'Google' | 'LoginWithAmazon' | 'SignInWithApple' | 'OIDC'; displayName: string; details: object; } /** * Organizations private list users */ interface OrganizationsPrivateListUsers { Created: number; DateOfBirth: string | null; Email: string | null; FirstName: string | null; Gender: string | null; ID: string; LastName: string | null; MFAEnabled: boolean; PasswordSetDate: string; PhoneNumber: string | null; Region: string; RoleID: string; TotalCount: number; } /** @noInheritDoc */ interface OrganizationsPrivateListUsers200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private list users */ body: OrganizationsPrivateListUsers; } /** * Organizations private list */ interface OrganizationsPrivateList { BrandID: string | null; ConsentId: string | null; Contact: string | null; Created: number; Email: string | null; ID: string; Identifier: string; LivenessConfig: LivenessConfig; Logo: string | null; Name: string | null; OrgAddresses: Array<{ Address: OrgAddress; AddressID: string; ID: string; OrganizationID: string; }>; PublicKey: string | null; StatusID: string | null; TotalCount: number; Updated: number; LogoURL?: string; } /** @noInheritDoc */ interface OrganizationsPrivateList200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private list response */ body: OrganizationsPrivateList; } /** * Organizations Private Template Add */ interface OrganizationsPrivateTemplateAdd { ID: string; } /** @noInheritDoc */ interface OrganizationsPrivateTemplateAdd200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private template add response */ body: OrganizationsPrivateTemplateAdd; } /** * Organizations Private Template Remove */ interface OrganizationsPrivateTemplateRemove { success: boolean; } /** @noInheritDoc */ interface OrganizationsPrivateTemplateRemove200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private template add response */ body: OrganizationsPrivateTemplateRemove; } /** * Organizations Private Template List */ type OrganizationsPrivateTemplateList = Array<{ ID: string | null; OrganizationID: string | null; StudyTemplateID: string | null; SavePayloads: boolean | null; SavePayloadImages: boolean | null; SaveResults: boolean | null; RemainingMeasurement: number | null; NotificationSent: boolean | null; IsHardLimit: boolean | null; StartDate: string | null; EndDate: string | null; }>; /** @noInheritDoc */ interface OrganizationsPrivateTemplateList200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private template list response */ body: OrganizationsPrivateTemplateList; } /** * Organizations Private List Admins */ type OrganizationsPrivateListAdmins = Array<{ ID: string | null; Email: string | null; Created: string | null; RoleID: string | null; }>; /** @noInheritDoc */ interface OrganizationsPrivateListAdmins200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private template list response */ body: OrganizationsPrivateListAdmins; } /** * Organizations Private Create Admin */ interface OrganizationsPrivateCreateAdmin { UserID: string | null; } /** @noInheritDoc */ interface OrganizationsPrivateCreateAdmin200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private template create admin */ body: OrganizationsPrivateCreateAdmin; } /** * Organizations Private Remove Admin */ interface OrganizationsPrivateRemoveAdmin { success: boolean; } /** @noInheritDoc */ interface OrganizationsPrivateRemoveAdmin200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private template create admin response */ body: OrganizationsPrivateRemoveAdmin; } /** * Organizations Private Update Logo */ interface OrganizationsPrivateUpdateLogo { success: boolean; } /** @noInheritDoc */ interface OrganizationsPrivateUpdateLogo200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private update logo response */ body: OrganizationsPrivateUpdateLogo; } /** * Organizations Private Template Update */ interface OrganizationsPrivateTemplateUpdate { success: boolean; } /** @noInheritDoc */ interface OrganizationsPrivateTemplateUpdate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Organizations private template update response */ body: OrganizationsPrivateTemplateUpdate; } interface OrganizationsPrivateUpdate { success: boolean; } /** @noInheritDoc */ interface OrganizationsPrivateUpdate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: OrganizationsPrivateUpdate; } interface OrganizationsPrivateRetrieve { Created: string | null; Updated: number | null; ID: string | null; Name: string | null; Identifier: string | null; StatusID: string | null; Logo: string | null; BrandID: string | null; Contact: string | null; Email: string | null; ConsentId: string | null; OrgAddresses: OrgAddress[]; LivenessConfig: LivenessConfig; LogoURL?: string; /** * The persisted, multi-role MFA policy. This cross-organization * administration read is not scoped to the caller's role, unlike * `organizations.retrieve`. * * Absent on API builds older than 2.92.0. */ MFAPolicy?: MFAFullPolicy; } /** @noInheritDoc */ interface OrganizationsPrivateRetrieve200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: OrganizationsPrivateRetrieve; } interface Create { success: boolean; ID: string; } /** @noInheritDoc */ interface OrganizationsPrivateCreate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: Create; } interface IdentityProvidersUpdate { success: boolean; } /** @noInheritDoc */ interface IdentityProvidersUpdate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: IdentityProvidersUpdate; } /** * Organizations Private end points * */ declare class OrganizationsPrivate extends Main { /** * Organizations Private list * * Endpoint Action ID = 1200 */ list(data?: OrganizationsPrivateListRequest): Promise; /** * Organizations Private Create * * Endpoint Action ID = 1201 */ create(data: OrganizationsPrivateCreateRequest): Promise; /** * Organizations Private Update * * Endpoint Action ID = 1202 */ update(orgId: string, data: OrganizationsPrivateUpdateRequest): Promise; /** * Organizations Private template add * * Endpoint Action ID = 1203 */ templateAdd(orgId: string, data: OrganizationsPrivateTemplateAddRequest): Promise; /** * Organizations Private template remove * * Endpoint Action ID = 1204 */ templateRemove(orgId: string, templateId: string): Promise; /** * Organizations Private * * Endpoint Action ID = 1205 */ retrieve(id: string): Promise; /** * Organizations Private template list * * Endpoint Action ID = 1206 */ templateList(orgId: string): Promise; /** * Organizations Private list admins * * Endpoint Action ID = 1207 */ listAdmins(orgId: string): Promise; /** * Organizations Private create admin * * Endpoint Action ID = 1208 */ createAdmin(orgId: string, data: OrganizationsPrivateCreateAdmin$1): Promise; /** * Organizations Private create admin * * Endpoint Action ID = 1209 */ removeAdmin(orgId: string, userId: string): Promise; /** * Organizations Private list users * * Endpoint Action ID = 1210 */ listUsers(orgId: string): Promise; /** * Organizations Private update logo * * Endpoint Action ID = 1212 */ updateLogo(orgId: string, data: OrganizationsPrivateUpdateLogoRequest): Promise; /** * Organizations Private template update * * Endpoint Action ID = 1213 */ templateUpdate(orgId: string, data: OrganizationsPrivateTemplateUpdateRequest): Promise; /** * Update Identity Providers * * Endpoint Action ID = 1218 */ updateIdentityProviders(orgId: string, data: IdentityProvidersUpdateRequest): Promise; } /** * Profile created */ interface ProfileCreated { ID: string; } /** @noInheritDoc */ interface ProfileCreate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Profile created response */ body: ProfileCreated; } /** * Profile retrieve */ interface ProfileRetrieve { ID: string; Name: string; Email: string; Status: string; MeasurementCount: number; Created: number; Updated: number; } /** @noInheritDoc */ interface ProfileRetrieve200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Profile retrieve response */ body: ProfileRetrieve; } /** * Profile list */ interface ProfileList { ID: string; OwnerUserEmail: string; Name: string; Email: string; Status: string; MeasurementCount: number; Created: number; Updated: number; TotalCount: string; } /** @noInheritDoc */ interface ProfileList200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Profile list response */ body: ProfileList[]; } /** @noInheritDoc */ interface ProfileListByUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Profile list by user response */ body: ProfileRetrieve[]; } /** @noInheritDoc */ interface ProfileRemove200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** @noInheritDoc */ interface ProfileUpdate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * Profile create request */ interface ProfileCreateRequest { Name: string; Email: string; } /** * Profile list request */ interface ProfileListRequest { userProfileName: string; status: string; /** default 25 */ limit: number; /** default 0 */ offset: number; sortBy: string | null; sortOrder: string | null; date?: string | null; endDate?: string | null; ownerUser?: string | null; } /** * Profile list request */ interface ProfileListByUserRequest { userProfileName: string; status: string; /** default 25 */ limit: number; /** default 0 */ offset: number; } /** * Profile update request */ interface ProfileUpdateRequest { Name: string; Email: string; Status: string; } /** * 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. */ declare class Profiles extends Main { /** * Creates a user profile under a main user account. * User profiles may be used to segment different accounts * for measurements. * * Endpoint Action ID = 400 */ create(data: ProfileCreateRequest): Promise; /** * Retrieves a single user Profile specified by ID. * * Endpoint Action ID = 401 */ retrieve(profileId: string): Promise; /** * Lists specific profiles managed under the current user account. * * Endpoint Action ID = 402 */ list(data?: ProfileListRequest): Promise; /** * Lists specific profiles managed under a single user account * specified by the ID in the request parameters. * * Endpoint Action ID = 403 */ listByUser(userId: string, data?: ProfileListByUserRequest): Promise; /** * Removes the user profile entirely. It also deletes any related * meta fields associated with the profile. * * Endpoint Action ID = 404 */ remove(profileId: string): Promise; /** * Updates a specific user profile. To update status the valid * options are: ACTIVE and INACTIVE. * * Endpoint Action ID = 405 */ update(profileId: string, data: ProfileUpdateRequest): Promise; } /** * Reports count */ interface ReportsCount { MeasurementCount: number; } /** @noInheritDoc */ interface ReportsCount200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Reports count response */ body: ReportsCount; } /** * Reports make */ interface ReportsMake { url: string; resultsFound: boolean; } /** @noInheritDoc */ interface ReportsMake200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Reports make response */ body: ReportsMake; } /** * Reports count request */ interface ReportsCountRequest { FileName?: string; StudyID?: string; UserID?: string; MeasurementID?: string; OrganizationID?: string; Email?: string; StartDate?: string; EndDate?: string; Page?: number; Format: 'csv' | 'hdf5'; } /** * Reports Make request */ interface ReportsMakeRequest { FileName?: string; StudyID?: string; UserID?: string; MeasurementID?: string; OrganizationID?: string; Email?: string; StartDate?: string; EndDate?: string; Page?: number; Format: 'csv' | 'hdf5'; } /** * Reports end points * */ declare class Reports extends Main { /** * Count reports * * Endpoint Action ID = 1301 */ reportCount(data: ReportsCountRequest): Promise; /** * Make a report * * Endpoint Action ID = 1302 */ makeReport(data: ReportsMakeRequest): Promise; } /** * Study Type */ interface StudyType { ID: string; StatusID: string; Name: string; Description: string; } /** @noInheritDoc */ interface StudyTypes200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Study Types response */ body: StudyType[]; } /** * Study template */ interface StudyTemplate { ID: string; StatusID: string; Name: string; Description: string; BundleID: string | null; Config: object; StudyTypeID: string; Signals: string[]; Created: number; } /** @noInheritDoc */ interface StudyTemplates200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Study templates response */ body: StudyTemplate[]; } /** * Study retrieve */ interface StudyRetrieve { ID: string; Name: string; Description: string; StatusID: string; OrganizationID: string; StudyTemplateID: string; StudyTemplateName: string; Measurements: number; Participants: number; Signals: string[]; Created: number; Updated: number; } /** @noInheritDoc */ interface StudyRetrieve200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Study retrieve response */ body: StudyRetrieve; } /** * Study */ interface Study { ID: string; Name: string; Description: string; StudyTemplateID: string; Measurements: number; Participants: number; StatusID: string; Created: number; Updated: number; TotalCount: number; } /** @noInheritDoc */ interface StudyList200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Array of studies */ body: Study[]; } /** * Study SDK config data */ interface StudySdkConfigData { ConfigFile: string; MD5Hash: string; } /** @noInheritDoc */ interface StudySdkConfigData200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Study SDK config data */ body: StudySdkConfigData; } /** * Study created */ interface StudyCreate { ID: string; } /** @noInheritDoc */ interface StudyCreate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Study created response */ body: StudyCreate; } /** * Study updated */ interface StudyUpdate { success: boolean; } /** @noInheritDoc */ interface StudyUpdate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Study updated response */ body: StudyUpdate; } /** * Study deleted */ interface StudyDelete { success: boolean; } /** @noInheritDoc */ interface StudyDelete200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * Study deleted response */ body: StudyDelete; } /** @noInheritDoc */ interface StudyDeleteMeasurements200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * Study templates request */ interface StudyTemplatesRequest { status?: string; type?: string; limit?: number; offset?: number; sortBy?: string; sortOrder?: string; } /** * Study RetrieveSdkConfigData request */ interface StudyRetrieveSdkConfigDataRequest { StudyID: string; SDKID?: string; MD5Hash?: string; } /** * Study create request */ interface StudyCreateRequest { Name: string; Description: string; StudyTemplateID: string; Config: Record; } /** * Study update request */ interface StudyUpdateRequest { Name: string; Description: string; StatusID: string; Config: Record; } /** * Study list request */ interface StudyListRequest { statusId: string | null; limit: number | null; offset: number | null; sortBy: string | null; sortOrder: string | null; date: string | null; endDate: string | null; name: string | null; } /** * Studies end points * * Studies are organized segments of analyses that guide the measurement process. * Studies consist of Types, Templates and Assets. A study type is a general, * high-level grouping for studies. A template is a pre-built study standard * created and made available by the Nuralogix team. Templates are version * controlled and named for use with a study. */ declare class Studies extends Main { /** * Retrieves a list of studies that act as templates or base types. * Types can be filtered by the Status querystring value. This is useful * for looking up all studies and current. * * Endpoint Action ID = 800 */ types(statusId: string | null): Promise; /** * Retrieves a list of study templates that exist in a particular organization. * * Endpoint Action ID = 801 */ templates(data?: StudyTemplatesRequest): Promise; /** * Retrieves a study record with it's definitions and values. * It also displays the amount of measurements captured in it to date. * * Endpoint Action ID = 804 */ retrieve(studyId: string): Promise; /** * Lists all the studies created in an organization. * * Endpoint Action ID = 805 */ list(data?: StudyListRequest): Promise; /** * Retrieves a study's binary config data that has to be used to initialize the DFX SDK Factory object. * Get the SDKID parameter by calling GetSDKId on the DFX SDK Factory object. A response of 304 means * that existing file in hand is up to date. * * Endpoint Action ID = 806 */ retrieveSdkConfigData(data: StudyRetrieveSdkConfigDataRequest): Promise; /** * Creates a new study within an organization. Studies must be based on a specific StudyTemplateID. * Passing in config will override values available in the StudyType definition template. * * Endpoint Action ID = 80x */ create(data: StudyCreateRequest): Promise; /** * Updates a particular study record with new information. Organizations can set the status of a * particular study as well to record their general activity and visibility. Study templates * cannot be revised after a study is created. * * Endpoint Action ID = 807 */ update(studyId: string, data: StudyUpdateRequest): Promise; /** * Deletes a study. However, if there are any measurements taken under that Study * already, it cannot be deleted. * * Endpoint Action ID = 808 */ remove(studyId: string): Promise; /** * Only DFX_ORG_ADMIN has permission to delete all measuremenet of specific study * for its own organization. * * Endpoint Action ID = 811 */ deleteStudyMeasurement(studyId: string): Promise; } interface Template { Config: object; Created: string; Description: string; ID: string; Name: string; StatusID: string; StudyTypeID: string; Updated: string; TotalCount?: number; } type ListTemplates = Template[]; /** @noInheritDoc */ interface TemplatesListTemplates200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: ListTemplates; } type RetrieveTemplate = Template; /** @noInheritDoc */ interface TemplatesRetrieveTemplate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: RetrieveTemplate; } interface UpdateSignals { success: boolean; } /** @noInheritDoc */ interface TemplatesUpdateSignals200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UpdateSignals; } type ListSignals = Array<{ CaptureTimeMinimum: number | null; Config: { category: string; }; Created: string; DefaultUpdateRateSec: number | null; Description: string | null; ID: string; Name: string | null; ResultTimeMinimum: number | null; Unit: string | null; Version: string | null; id: string; }>; /** @noInheritDoc */ interface TemplatesListSignals200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: ListSignals; } interface CreateTemplate { ID: string; } /** @noInheritDoc */ interface TemplatesCreateTemplate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: CreateTemplate; } interface TemplatesCreateConfigFile { success: boolean; } /** @noInheritDoc */ interface TemplatesCreateConfigFile200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: TemplatesCreateConfigFile; } interface TemplatesDeleteConfigFile { success: boolean; } /** @noInheritDoc */ interface TemplatesDeleteConfigFile200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: TemplatesDeleteConfigFile; } type TemplatesListConfigFiles = Array<{ StudyTemplateID: string | null; SDKID: string | null; Created: string | null; MD5Hash: string | null; TotalCount?: number | null; }>; /** @noInheritDoc */ interface TemplatesListConfigFiles200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: TemplatesListConfigFiles; } interface ListTypes { Description: string; ID: string; Name: string; StatusID: string; } /** @noInheritDoc */ interface TemplatesListTypes200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: ListTypes[]; } interface DeleteTemplate { success: boolean; } /** @noInheritDoc */ interface TemplatesDeleteTemplate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: DeleteTemplate; } interface UpdateTemplate { success: boolean; } /** @noInheritDoc */ interface TemplatesUpdateTemplate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UpdateTemplate; } interface UpdateSignalsRequest { StudySignals: { SignalID: string; UpdateRateSec: number | null; }; } interface TemplatesCreateTemplateRequest { StudyTypeID: string | null; Name: string | null; Description: string | null; Config?: object; } interface TemplatesCreateConfigFileRequest { StudyTemplateID: string; SDKID: string; File: string; } interface TemplatesListConfigFilesRequest { limit?: number; offset?: number; date?: string; endDate?: string; studyTemplateId?: string; sdkId?: string; } interface TemplatesUpdateTemplateRequest { ID: string | null; StatusID: string | null; StudyTypeID: string | null; Name: string | null; Description: string | null; Config: object; Created: string | null; Updated: string | null; StudySignals: Array<{ SignalID: null; UpdateRateSec: null; }>; } interface TemplatesListRequest { limit: string | null; offset: string | null; sortBy: string | null; sortOrder: string | null; date: string | null; endDate: string | null; name: string | null; statusId: string | null; studyTypeId: string | null; } /** * Templates end points * */ declare class Templates extends Main { /** * List templates * * Endpoint Action ID = 1100 */ listTemplates(data?: TemplatesListRequest): Promise; /** * List template types * * Endpoint Action ID = 1101 */ listTypes(): Promise; /** * List templates * * Endpoint Action ID = 1102 */ listSignals(): Promise; /** * List templates * * Endpoint Action ID = 1104 */ retrieveTemplate(templateId: string): Promise; /** * Delete template * * Endpoint Action ID = 1106 */ deleteTemplate(templateId: string): Promise; /** * Update template * * Endpoint Action ID = 1107 */ updateTemplate(templateId: string, data: TemplatesUpdateTemplateRequest): Promise; /** * Create Template * * Endpoint Action ID 1105 */ createTemplate(data: TemplatesCreateTemplateRequest): Promise; /** * List templates * * Endpoint Action ID = 1108 */ updateSignals(templateId: string, data: UpdateSignalsRequest): Promise; /** * List config files * * Endpoint Action ID = 1110 */ listConfigFiles(data?: TemplatesListConfigFilesRequest): Promise; /** * Create config file * * Endpoint Action ID = 1111 */ createConfigFile(data: TemplatesCreateConfigFileRequest): Promise; /** * Create config file * * Endpoint Action ID = 1112 */ deleteConfigFile(StudyTemplateID: string, SDKID: string): Promise; } /** * User created */ interface UserCreated { /** * New user GUID */ ID: string; } /** @noInheritDoc */ interface UserCreate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User create response */ body: UserCreated; } /** * Authenticated user - the ordinary login outcome, with the token claim * `MFAStatus: 'none'`. */ interface UserAuthenticated { Token: string; RefreshToken: string; /** * The organization MFA policy, scoped by the API to the caller's own role, so * a single-key object or `{}`. * * Absent on API builds older than 2.92.0. */ MFAPolicy?: MFAPolicy; } /** * The three envelopes `POST /users/auth` can answer with. * * Narrow the body before reading tokens off it - {@link isFullTokenPair}, * {@link isMFAChallenge} and {@link isMFAPending} are exported for that: * * ```ts * const { status, body } = await client.http.users.login({ Email, Password }); * if (status !== '200') return; * if (isMFAChallenge(body)) { * // enrolled: prompt for the authenticator code, then * // users.verifyMfa({ Code, MFAChallengeToken: body.MFAChallengeToken }) * } else if (isMFAPending(body)) { * // enrolment required: users.setupMfa({ Channel: MFAChannel.TOTP }), * // render the QR code, then users.verifyMfa({ Code }) * } else { * // logged in: body.Token and body.RefreshToken are both present * } * ``` */ type UserLoginBody = UserAuthenticated | MFAChallengeEnvelope | MFAPendingEnvelope; /** @noInheritDoc */ interface UserLogin200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User login response */ body: UserLoginBody; } /** * User account information */ interface UserAccountInformation { Gender: string; DateOfBirth: string; Created: number; Updated: number; ID: string; OrganizationID: string; RoleID: string; StatusID: string; Email: string; Password: string; FirstName: string; LastName: string; ResetToken: string | null; ResetTokenDate: string | null; AvatarURI: string | null; IsVerified: boolean; VerificationCode: string | null; PhoneNumber: string | null; DeviceID: string | null; HeightCm: string | null; WeightKg: string | null; LoginMethod: string; SSOID: string | null; Region: string; MFAEnabled: boolean; } /** @noInheritDoc */ interface UserAccountInfo200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User account information */ body: UserAccountInformation; } /** @noInheritDoc */ interface UserRemove200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** @noInheritDoc */ interface UserUpdate200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * User role */ interface UserRole { ID: string; Name: string; Description: string; Organization: string; } /** @noInheritDoc */ interface UserRetrieveRole200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User role response */ body: UserRole; } /** * User verify */ interface UserVerify { success: boolean; } /** @noInheritDoc */ interface UserVerify200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User verify response */ body: UserVerify; } /** * User verify */ interface UserAccountVerificationCode { success: boolean; Message: string; } /** @noInheritDoc */ interface UserAccountVerificationCode200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User account verification code */ body: UserAccountVerificationCode; } /** * User login with phone code - the ordinary outcome, with the token claim * `MFAStatus: 'none'`. * * Phone possession counts as the first factor only; when the user is enrolled, * TOTP is still required as the second. */ interface UserLoginWithPhoneCode { Token: string; RefreshToken: string; /** * The organization MFA policy, scoped by the API to the caller's own role, so * a single-key object or `{}`. * * Absent on API builds older than 2.92.0. */ MFAPolicy?: MFAPolicy; } /** * The three envelopes `POST /users/auth/code` can answer with. * * See {@link UserLoginBody} for how to narrow it. */ type UserLoginWithPhoneCodeBody = UserLoginWithPhoneCode | MFAChallengeEnvelope | MFAPendingEnvelope; /** @noInheritDoc */ interface UserLoginWithPhoneCode200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User login with phone code response */ body: UserLoginWithPhoneCodeBody; } /** @noInheritDoc */ interface UserDelete200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; } /** * User change password */ interface UserChangePassword { success: boolean; } /** @noInheritDoc */ interface UserChangePassword200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User change password response */ body: UserChangePassword; } /** * User create two-factor auth secret request */ interface UserCreateTwoFactorAuthSecretRequest { secretBase32Encoded: string; url: string; qrcode: string; } /** @noInheritDoc */ interface UserCreateTwoFactorAuthSecret200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User create two-factor auth secret response */ body: UserCreateTwoFactorAuthSecretRequest; } /** * User enable two-factor auth for logged in user */ interface UserEnableTwoFactorAuthForLoggedInUser { success: boolean; } /** @noInheritDoc */ interface UserEnableTwoFactorAuthForLoggedInUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User enable two-factor auth for logged in user response */ body: UserEnableTwoFactorAuthForLoggedInUser; } /** * User disable two-factor auth for logged in user */ interface UserDisableTwoFactorAuthForLoggedInUser { success: boolean; } /** @noInheritDoc */ interface UserDisableTwoFactorAuthForLoggedInUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User disable wo-factor auth for logged in user response */ body: UserDisableTwoFactorAuthForLoggedInUser; } /** * User disable two-factor auth for specified user */ interface UserDisableTwoFactorAuthForSpecifiedUser { success: boolean; } /** @noInheritDoc */ interface UserDisableTwoFactorAuthForSpecifiedUser200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User disable wo-factor auth for specified user response */ body: UserDisableTwoFactorAuthForSpecifiedUser; } /** * User logout */ interface UserLogout { success: boolean; } /** @noInheritDoc */ interface UserLogout200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User logout response */ body: UserLogout; } /** * User recovery verification code */ interface UserRecoveryVerificationCode { success: boolean; message: string; } /** @noInheritDoc */ interface UserRecoveryVerificationCode200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * User recovery verification code */ body: UserRecoveryVerificationCode; } interface UserRecoveryVerificationCodeErrorResponse extends HttpErrorResponse { status: HttpClientResponseStatusCodes | HttpServerResponseStatusCodes; /** * User recovery verification code error response */ body: { Code: string; Message: string; remainingLockoutDurationSec: number; }; } interface UserVerifyErrorResponse extends HttpErrorResponse { status: HttpClientResponseStatusCodes | HttpServerResponseStatusCodes; /** * User verify error response */ body: { Code: string; Message: string; remainingLockoutDurationSec: number; }; } interface UserAccountVerificationCodeErrorResponse extends HttpErrorResponse { status: HttpClientResponseStatusCodes | HttpServerResponseStatusCodes; /** * User account verification code error response */ body: { Code: string; Message: string; remainingLockoutDurationSec: number; }; } interface UserResetPassword { success: boolean; } /** @noInheritDoc */ interface UserResetPassword200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UserResetPassword; } interface UserSendReset { success: boolean; } /** @noInheritDoc */ interface UserSendReset200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UserSendReset; } interface UserSignup { success: boolean; } /** @noInheritDoc */ interface UserSignup200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UserSignup; } interface UserRequestLoginCode { success: boolean; } /** @noInheritDoc */ interface UserRequestLoginCode200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UserRequestLoginCode; } interface UserPrescription { id: string; organizationConfigLinkID: string; studyName: string; studyID: string; creator: { firstName: string; lastName: string; }; expireAt: string; deletedAt: string; } /** @noInheritDoc */ interface GetUserPrescription200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UserPrescription[]; } interface DeletePrescription { success: boolean; } /** @noInheritDoc */ interface DeletePrescription200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: DeletePrescription; } interface CreatePrescription { Created: number; Updated: number; ID: string; UserID: string; OrganizationConfigLinkID: string; ExpireAt: string | null; DeletedAt: string | null; } /** @noInheritDoc */ interface CreatePrescription200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: CreatePrescription; } interface ResendPrescription { success: boolean; } /** @noInheritDoc */ interface ResendPrescription200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: ResendPrescription; } interface UpdatePrescription { Created: number; Updated: number; ID: string; UserID: string; OrganizationConfigLinkID: string; ExpireAt: string | null; DeletedAt: string | null; } /** @noInheritDoc */ interface UpdatePrescription200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: UpdatePrescription; } interface GetMyPrescription { id: string; organizationConfigLinkID: string; studyName: string; studyID: string; creator: { firstName: string; lastName: string; }; expireAt: string; deletedAt: string; } /** @noInheritDoc */ interface GetMyPrescription200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; body: GetMyPrescription[]; } /** * MFA setup */ interface UserMfaSetup { success: boolean; /** * The `otpauth://` URI to render as a QR code for the authenticator app. * * Nothing is persisted yet: the proposed factor is staged for 10 minutes and * is written to the account only once `verifyMfa` succeeds. An already * enrolled user keeps their current factor working until the replacement is * verified. * * Note: every call stages a fresh secret and invalidates the previous * staging, and the URI's label is identical each time. A client that lets the * user retry should tell them to remove any previously added authenticator * entry, or they will end up with several indistinguishable ones and read * codes from the wrong factor. */ bindingUri: string; } /** @noInheritDoc */ interface UserMfaSetup200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * MFA setup response */ body: UserMfaSetup; } /** * MFA challenge */ interface UserMfaChallenge { success: boolean; } /** @noInheritDoc */ interface UserMfaChallenge200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * MFA challenge response. On TOTP this is a no-op success - no code is * pushed, the user reads it from the authenticator app. */ body: UserMfaChallenge; } /** * MFA verify - a full token pair whose claim `MFAStatus` is `verified`. */ interface UserMfaVerify { Token: string; RefreshToken: string; /** * Present when the call completed an enrolment from an already full session * (voluntary enrolment or a device change), absent when it completed a login * challenge. */ success?: boolean; /** * Present when the call completed an enrolment from an already full session. */ enrolled?: boolean; } /** @noInheritDoc */ interface UserMfaVerify200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * MFA verify response */ body: UserMfaVerify; } /** * MFA status. Mirrors the four MFA claims carried by every token. */ interface UserMfaStatus { /** The enrolled channel, or `null` when the user is not enrolled. */ channel: MFAChannelValues | null; /** Whether the user is enrolled - the persisted fact. */ enrolled: boolean; /** * Whether the calling session completed MFA. Derived from the request token's * `MFAStatus` claim, not from stored state. */ verified: boolean; /** Whether the organization policy requires enrolment for the user's role. */ required: boolean; } /** @noInheritDoc */ interface UserMfaStatus200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * MFA status response */ body: UserMfaStatus; } /** * MFA delete */ interface UserMfaDelete { success: boolean; } /** @noInheritDoc */ interface UserMfaDelete200Response extends Response { status: HttpSuccessfulResponseStatusCodes | HttpRedirectionResponseStatusCodes; /** * MFA delete response */ body: UserMfaDelete; } /** * User create request */ interface UserCreateRequest { FirstName?: string; LastName?: string; Email?: string; Password: string; PhoneNumber?: string; Gender?: string; DateOfBirth?: string; HeightCm?: string; WeightKg?: string; } /** * User login request */ interface UserLoginRequest { Email: string; Password: string; /** * @deprecated Removed by the API in release 2.92.0 and ignored if sent. MFA * is now a two-step flow: this endpoint answers with an * {@link MFAChallengeEnvelope} and the code is submitted to * `users.verifyMfa`. */ MFAToken?: string; /** * Access token lifetime, in seconds. It can only shorten the token relative * to the configured maximum, never extend it. * * The value survives a login interrupted by MFA: it is carried on the * challenge or pending token and applied to the full token minted by * `users.verifyMfa`, so it does not need to be supplied again. */ TokenExpiresIn?: string; } /** * User update request */ interface UserUpdateRequest { FirstName?: string; LastName?: string; Email: string; Password: string; PhoneNumber: string; Gender?: string; DateOfBirth?: string; HeightCm?: string; WeightKg?: string; } /** * User verify request */ interface UserVerifyRequest { VerificationCode: string; ID: string; } /** * User login with phone code request */ interface UserLoginWithPhoneCodeRequest { LoginCode: number; PhoneNumber: string; OrgKey: string; TokenExpiresIn?: number; RefreshTokenExpiresIn?: number; } /** * User change password request */ interface UserChangePasswordRequest { Identifier: string; Email: string; Password: string; NewPassword: string; } /** * User Enable Two-factor authentication for logged in user request */ interface UserTwoFactorAuthForLoggedInUserRequest { MFASecret: string; MFAToken: number; } /** * MFA setup request - `POST /users/mfa/setup` */ interface UserMfaSetupRequest { /** * The channel to enrol. TOTP is the only channel the API accepts; any other * value is rejected with a 400. */ Channel: MFAChannelValues; /** * Current password, required only when an already enrolled user changes * device. First-time enrolment does not take a password, and neither do * accounts that cannot log in with a password (SSO or phone-code accounts) - * those re-verify against the currently enrolled factor instead. */ Password?: string; } /** * MFA challenge request - `POST /users/mfa/challenge` */ interface UserMfaChallengeRequest { /** * The challenge token returned by the login call. */ MFAChallengeToken: string; } /** * MFA verify request - `POST /users/mfa/verify` */ interface UserMfaVerifyRequest { /** * The code read from the authenticator app. */ Code: string; /** * The challenge token from the login response, when this call completes a * login challenge. Omitted when a pending or full session token is * completing an enrolment. */ MFAChallengeToken?: string; } /** * MFA delete request - `DELETE /users/mfa` */ interface UserMfaDeleteRequest { /** * Current password, verified against the stored hash. Omit it for accounts * that cannot log in with a password (SSO or phone-code accounts), which are * exempt from re-authentication and gated by the verified session alone. */ Password?: string; } /** * User Reset Password */ interface UserResetPasswordRequest { ResetToken: string; Password: string; OTP?: string; } interface UserSignupRequest { Email: string; FirstName: string; LastName: string; Password: string; Industry: string; Region: string; } interface UpdatePrescriptionRequest { organizationConfigLinkID: string; expireAt?: string; } interface CreatePrescriptionRequest { organizationConfigLinkID: string; expireAt?: string; } /** * Users end points */ declare class Users extends Main { /** * Creates a new user in the organization, checking for existing user * details against the user list. Email + Password OR PhoneNumber fields * are required. If both are provided, Email + Password will be used to * create User account. The rest of the fields are optional. * Endpoint Action ID = 200 */ create(data: UserCreateRequest, tokenType: 'device' | 'user'): Promise; /** * Logs a user into a new session using Email and Password and responds with a User Token. * The Token must be passed to every subsequent API call to the server. * * Note: you need to obtain a Device Token first to be able to login through this endpoint. * * Note: this endpoint answers with one of three envelopes - see * {@link UserLoginBody}. Narrow the body before reading tokens off it. The * session is only populated for the ordinary outcome, a full token pair; for * the MFA challenge and pending outcomes it is left untouched, and the flow * is completed through `setupMfa` / `verifyMfa`. * * Endpoint Action ID = 201 */ login(data: UserLoginRequest): Promise; /** * Retrieves User account information based on the provided User Token. * * Endpoint Action ID = 202 */ retrieve(): Promise; /** * Removes the entire user account, profiles, and all measurement * data associated with it. The account to be deleted is derived * from the User Token. * * Endpoint Action ID = 206 */ remove(): Promise; /** * Updates a user's account information with new details. This * endpoint will only update fields supplied to it, hence sending * only First Name or Last Name will exclusively update those values. * * Endpoint Action ID = 208 */ update(data: UserUpdateRequest): Promise; /** * Password reset, sends email to user * * Endpoint Action ID = 209 */ sendReset(email: string, identifier: string): Promise; /** * Resets User's password * * Endpoint Action ID = 210 */ resetPassword(data: UserResetPasswordRequest): Promise; /** * Retrieves User's Role. * * Endpoint Action ID = 211 */ retrieveUserRole(): Promise; /** * Verifies User's email address. * * Endpoint Action ID = 212 */ verifyUserAccount(data: UserVerifyRequest): Promise; /** * Sends an account verification code to the user's * email address. The code is used to verify the account * through the account verification endpoint. * * Endpoint Action ID = 213 */ sendAccountActivationCode(userId: string, orgKey: string): Promise; /** * Signup * * Endpoint Action ID = 215 */ signup(data: UserSignupRequest): Promise; /** * Signup * /users/auth/code/:OrgKey/:PhoneNumber * Endpoint Action ID = 216 */ requestLoginCode(orgKey: string, phoneNumber: string): Promise; /** * Use previously requested 6-digit code to login * into a new session and obtain UserToken. * * Note: phone possession counts as the first factor only. When the user is * enrolled in MFA this endpoint answers with an MFA challenge instead of a * token pair - see {@link UserLoginWithPhoneCodeBody}. The session is only * populated for the ordinary outcome, a full token pair. * * Endpoint Action ID = 217 */ loginWithPhoneCode(data: UserLoginWithPhoneCodeRequest, enableSession: boolean): Promise; /** * Only DFX_ORG_ADMIN has permission to delete all * measurement of specific user for its own organization. * * Endpoint Action ID = 219 */ delete(userId: string): Promise; /** * This End Point allow user to change password for already verified user. * * Endpoint Action ID = 220 */ changePassword(data: UserChangePasswordRequest): Promise; /** * Creates a base32 secret, url and a QR code (both derived from the secret) * that are compatible with Google Authenticator or similar two-factor token * generation application. The secret can be used to enable 2FA for given * user, and QR code can be used to configure compatible application to * generate login tokens for it. This is the first of two API calls needed * to configure 2FA for a user. * * Endpoint Action ID = 221 * * @deprecated The `/users/mfa/secret` endpoint was removed by the API in * release 2.92.0 and this call will fail against it. Use {@link setupMfa}, * which returns a binding URI to render as a QR code. */ createTwoFactorAuthSecret(): Promise; /** * Enables 2FA for logged in user using an MFASecret (created * by /users/mfa/secret endpoint) and MFAToken (derived from * MFASecret by scanning a QR code by Google Authenticator or * compatible app). * * This is the second of two API calls needed to configure 2FA for * a user.The complete workflow would be as follows: * * Logged in user calls /users/mfa/enable and stores * `secretBase32Encoded` and `qrcode` properties. * * User scans `qrcode` by 2FA token generation app. * * User POSTs `secretBase32Encoded` as `MFASecret` and 2FA app * temporary token as `MFAToken` to `/users/mfa/enable` endpoint. * * Endpoint Action ID = 222 * * @deprecated Superseded in API release 2.92.0 by the staged enrolment flow. * Use {@link setupMfa} followed by {@link verifyMfa}. */ enableTwoFactorAuthForLoggedInUser(data: UserTwoFactorAuthForLoggedInUserRequest): Promise; /** * Disables 2FA for logged in user. * * Endpoint Action ID = 223 * * @deprecated As of API release 2.92.0 this route requires the current * `Password` in the request body, which this call does not send. Use * {@link deleteMfa}. */ disableTwoFactorAuthForLoggedInUser(): Promise; /** * Disables 2FA for user by its ID. This is a privileged * operation that requires ORG_ADMIN permissions. * * Endpoint Action ID = 224 * * @deprecated Renamed by the API in release 2.92.0. Use * {@link deleteMfaForUser}, which is the same route under its current name * and permission (MFA_ADMIN). */ disableTwoFactorAuthForSpecifiedUser(userId: string): Promise; /** * Stages a TOTP enrolment and returns the binding URI to render as a QR code * for the authenticator app. * * Nothing is persisted by this call: the proposed factor is staged for 10 * minutes and is written to the account only once `verifyMfa` succeeds with a * code from it. An already enrolled user keeps their current factor working * until the replacement is verified. * * Who may call it: * * A user holding a pending token (`MFAStatus: 'pending'`), but only while * they are not enrolled. A pending token against an enrolled account is * rejected with `MFA_ALREADY_ENROLLED`. * * An enrolled user changing device, who must hold a verified session and * submit their current `Password`. Accounts that cannot log in with a * password re-verify against the currently enrolled factor instead. * * `POST /users/mfa/setup` */ setupMfa(data: UserMfaSetupRequest): Promise; /** * Requests delivery of an MFA code for a login challenge. * * On TOTP - the only channel the API supports - this is a no-op success: no * code is pushed, the user reads it from their authenticator app. It is kept * as part of the surface so a client can follow the same challenge sequence * whatever the channel. * * `POST /users/mfa/challenge` */ challengeMfa(data: UserMfaChallengeRequest): Promise; /** * Submits an authenticator code and, on success, exchanges it for a full * token pair whose claim `MFAStatus` is `verified`. The session is populated * with the new pair. * * It completes either of two flows: * * A login challenge - pass the `MFAChallengeToken` from the login response * alongside the `Code`. * * An enrolment staged by `setupMfa` - the staged factor is committed on * success. Nothing is written if the code is wrong, so the code entry can * be retried while the staging is still alive. * * Note: the call is authenticated with the User Token held in the session, so * for the login challenge and pending flows store the token the login handed * back first - `setSession({ userToken: MFAChallengeToken })` for the * challenge envelope, or the pending envelope's `Token`. * * `enableSession` honours `x-nura-session` exactly as the login endpoints do, * so a token minted by completing MFA can be session bound in the same way. * * `POST /users/mfa/verify` */ verifyMfa(data: UserMfaVerifyRequest, enableSession: boolean): Promise; /** * Retrieves the calling user's MFA state - `{ channel, enrolled, verified, * required }`. * * `enrolled`, `channel` and `required` are read live from the database; * `verified` reflects the calling token's own `MFAStatus` claim. The four * fields mirror the MFA claims carried by every token, so a client that * decodes the token does not need this round trip. * * The endpoint is purely informational: enforcement happens at login. * * `GET /users/mfa/status` */ getMfaStatus(): Promise; /** * Removes the calling user's own MFA enrolment. * * This is a deletion, not a toggle: there is no switched-off-but-retained * factor, so re-enabling MFA means enrolling again from `setupMfa`. Every * outstanding token for the user is invalidated, so the user has to log in * again. * * Requires the current `Password`, verified against the stored hash. Accounts * that cannot log in with a password are exempt and should omit it. Removal * is refused when the organization policy requires MFA for the caller's role * - only an admin can override that, through `deleteMfaForUser`. * * `DELETE /users/mfa` */ deleteMfa(data?: UserMfaDeleteRequest): Promise; /** * Removes another user's MFA enrolment. Requires the MFA_ADMIN permission, * and the target user must belong to the caller's own organization. * * Unlike `deleteMfa` this path overrides the organization policy and takes no * password. Every outstanding token for the target user is invalidated. * * `DELETE /users/:userId/mfa` */ deleteMfaForUser(userId: string): Promise; /** * Logs user out from all its sessions at once. * * Endpoint Action ID = 226 */ logout(): Promise; /** * Recovery Verification Code * * Endpoint Action ID = 228 */ recoveryVerificationCode(userId: string): Promise; /** * User Prescription * * Endpoint Action ID = 229 */ getUserPrescription(userId: string): Promise; /** * Delete Prescription * * Endpoint Action ID = 230 */ deletePrescription(id: string): Promise; /** * Create Prescription * * Endpoint Action ID = 231 */ createPrescription(userId: string, data: CreatePrescriptionRequest): Promise; /** * Resend Prescription * * Endpoint Action ID = 231 */ resendPrescription(userId: string): Promise; /** * Update Prescription * * Endpoint Action ID = 232 */ updatePrescription(userId: string, data: UpdatePrescriptionRequest): Promise; /** * Get My Prescription * * Endpoint Action ID = 233 */ getMyPrescription(): Promise; } /** * WebSocket transport class */ declare class WS { #private; protected parent: IClient; onmessage: WsMsgFunction; onclose: WsCloseFunction; onerror: WsErrorFunction; constructor(parent: IClient); /** * Opens a socket connection */ connect(token: string): void; /** * Closes the socket connection */ disconnect(): void; protected onSocketOpen(e: Event): void; protected onSocketMessage(e: MessageEvent): void; /** * Sends a message * * @param actionId End point action ID * @param data message body * @returns message */ sendMessage(actionId: ActionIdValues, data: any): void; } /** * HTTP(s) and WebSocket URLs */ interface IUrl { http: URL; wss: URL; } type EnumValues = T[keyof T] extends string ? `${T[keyof T]}` : never; type ActionIdValues = EnumValues<{ [K in keyof typeof ActionId]: EnumValues<(typeof ActionId)[K]>; }>; type WsMsgFunction = (requestId: string, status: string, message: unknown, actionId: ActionIdValues) => void; type WsCloseFunction = (event: CloseEvent) => void; type WsErrorFunction = (event: Event) => void; /** * Config */ interface IConfig { url?: IUrl; } /** * Session */ interface ISession { deviceToken?: string; deviceRefreshToken?: string; userToken?: string; userRefreshToken?: string; deviceId?: string; roleId?: string; userId?: string; selectedStudy?: string; lastMeasurementId?: string; studyCfgHash?: string; studyCfgData?: string; } interface IBaseClient { onBeforeRESTCall: () => Promise; onAfterRESTCall: (status: string, error: unknown) => Promise; http: { /** * General end points */ general: General; /** * User end points */ users: Users; /** * Profiles end points */ profiles: Profiles; /** * Measurements end points */ measurements: Measurements; /** * Organization end points */ organizations: Organizations; /** * Studies end points */ studies: Studies; /** * Devices end points */ devices: Devices; /** * Licenses end points */ licenses: Licenses; /** * Auths end points */ auths: Auths; /** * Reports end points */ reports: Reports; /** * Organizations private end points */ organizationsPrivate: OrganizationsPrivate; /** * Templates end points */ templates: Templates; }; websocket: WS; } /** * Client */ interface IClient extends IBaseClient { getSession: () => ISession; setSession: (sessionInfo: ISession) => void; getUrl: () => string; setUrl: (http: string, wss: string) => void; version: () => string; } /** * Four-digit WebSocket Action IDs */ declare enum AUTHS { SEND_RESET = "2300" } declare enum DEVICES { TYPES = "0900" } declare enum GENERAL { STATUS = "0100", MIME_TYPES = "0101" } declare enum LICENSES { CREATE_LICENSE_ALLOWED_STUDY = "1400" } declare enum MEASUREMENTS { DATA = "0506", SUBSCRIBE_RESULTS = "0510" } declare enum ORGANIZATIONS { RETRIEVE = "0700", LOGIN_WITH_TOKEN = "0718" } declare enum ORGANIZATIONS_PRIVATE { LIST = "1200" } declare enum PROFILES { CREATE = "0400" } declare enum REPORTS { REPORT_READY = "1300" } declare enum STUDIES { TYPES = "0800" } declare enum TEMPLATES { LIST_TEMPLATES = "1100" } declare enum USERS { CREATE = "0200" } declare const ActionId: { AUTHS: typeof AUTHS; DEVICES: typeof DEVICES; GENERAL: typeof GENERAL; LICENSES: typeof LICENSES; MEASUREMENTS: typeof MEASUREMENTS; ORGANIZATIONS: typeof ORGANIZATIONS; ORGANIZATIONS_PRIVATE: typeof ORGANIZATIONS_PRIVATE; PROFILES: typeof PROFILES; REPORTS: typeof REPORTS; STUDIES: typeof STUDIES; TEMPLATES: typeof TEMPLATES; USERS: typeof USERS; }; /** * Enum for Device Type IDs * @readonly * @enum {string} */ declare enum DeviceTypeID { IPHONE = "IPHONE", IPAD = "IPAD", DARWIN = "DARWIN", ANDROID_PHONE = "ANDROID_PHONE", WINDOWS = "WINDOWS", WIN32 = "WIN32", WINDOWS_TABLET = "WINDOWS_TABLET", LINUX = "LINUX", DEBIAN = "DEBIAN" } /** * Example usage: * * ```js * import client from '@nuralogix.ai/dfx-api-client'; * * const apiClient = client(); * // or * const api = 'api.deepaffex.ai'; * * const apiClient = client({ url: { http: new URL(`https://${api}`), wss: new URL(`wss://${api}`) }, onBeforeRESTCall: async () => {}, onAfterRESTCall: async (status: string, error: unknown) => {}, }); * * // You can also use the `new` keyword when initializing the client * const apiClient = new client(); * * apiClient.websocket.onmessage = (requestId: string, status: string, message: any, actionId: ActionIdValues) => { console.log(requestId, status, message, messageType); } * * apiClient.websocket.onclose = (e: CloseEvent) => { console.log('connection closed!', e.code, e.reason, e.wasClean); } * * apiClient.websocket.onerror = (e: Event) => { console.log('error', e); } * ``` * * @param {Object} [config] An optional config parameter. */ declare const client: (config?: IConfig) => IClient; declare const enums: { ActionId: { AUTHS: typeof AUTHS; DEVICES: typeof DEVICES; GENERAL: typeof GENERAL; LICENSES: typeof LICENSES; MEASUREMENTS: typeof MEASUREMENTS; ORGANIZATIONS: typeof ORGANIZATIONS; ORGANIZATIONS_PRIVATE: typeof ORGANIZATIONS_PRIVATE; PROFILES: typeof PROFILES; REPORTS: typeof REPORTS; STUDIES: typeof STUDIES; TEMPLATES: typeof TEMPLATES; USERS: typeof USERS; }; DeviceTypeID: typeof DeviceTypeID; MFAChannel: typeof MFAChannel; MFAStatus: typeof MFAStatus; MFAErrorCode: typeof MFAErrorCode; }; export { type ActionIdValues, type FullTokenPair, type MFAChallengeEnvelope, MFAChannel, MFAErrorCode, type MFAErrorResponse, type MFAFullPolicy, type MFAPendingEnvelope, type MFAPolicy, type MFARolePolicy, MFAStatus, type MFATokenClaims, type TokenClaims, type ValidationError, type ValidationErrorResponse, client as default, enums, isFullTokenPair, isMFAChallenge, isMFAError, isMFAPending, isValidationError };