UNPKG

@oystehr/sdk

Version:

Oystehr SDK

129 lines (126 loc) 7.08 kB
// AUTOGENERATED -- DO NOT EDIT import { OystehrClientRequest, UserDeleteParams, UserGetParams, UserGetResponse, UserInviteParams, UserInviteResponse, UserListResponse, UserListV2Params, UserListV2Response, UserMeResponse, UserResetMfaParams, UserResetPasswordLinkParams, UserUpdateParams, UserUpdateResponse, } from '../..'; import { SDKResource } from '../../client/client'; import { OystehrConfig } from '../../config'; export class User extends SDKResource { constructor(config: OystehrConfig) { super(config); } #baseUrlThunk(): string { return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1'; } /** * Get your own User details. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Fetch details about the calling User. This endpoint has no access policy requirements, it is available to all authenticated Users. */ me(request?: OystehrClientRequest): Promise<UserMeResponse> { return this.request('/user/me', 'get', this.#baseUrlThunk.bind(this))(request); } /** * Get the User with the provided ID. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `App:GetUser` * Access Policy Resource: `App:User` */ get(params: UserGetParams, request?: OystehrClientRequest): Promise<UserGetResponse> { return this.request('/user/{id}', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Update the User with the provided ID. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `App:UpdateUser` * Access Policy Resource: `App:User` */ update(params: UserUpdateParams, request?: OystehrClientRequest): Promise<UserUpdateResponse> { return this.request('/user/{id}', 'patch', this.#baseUrlThunk.bind(this))(params, request); } /** * Delete the User with the provided ID. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `App:DeleteUser` * Access Policy Resource: `App:User` */ delete(params: UserDeleteParams, request?: OystehrClientRequest): Promise<void> { return this.request('/user/{id}', 'delete', this.#baseUrlThunk.bind(this))(params, request); } /** * Reset MFA for the User with the provided ID. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `App:ResetUserMFA` * Access Policy Resource: `App:User` */ resetMfa(params: UserResetMfaParams, request?: OystehrClientRequest): Promise<void> { return this.request('/user/{id}/reset-mfa', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Creates a password reset link for the User with the provided ID. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `App:GetUserPasswordResetLink` * Access Policy Resource: `App:User` */ resetPasswordLink(params: UserResetPasswordLinkParams, request?: OystehrClientRequest): Promise<void> { return this.request('/user/{id}/reset-password-link', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Invite a User to the Project. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `App:CreateUser` * Access Policy Resource: `App:User` */ invite(params: UserInviteParams, request?: OystehrClientRequest): Promise<UserInviteResponse> { return this.request('/user/invite', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * DEPRECATED. Please use [v2/list](https://api-reference.oystehr.com/reference/get_user-v2-list) instead. * * Get all Users in the Project. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `App:ListAllUsers` * Access Policy Resource: `App:User` */ list(request?: OystehrClientRequest): Promise<UserListResponse> { return this.request('/user', 'get', this.#baseUrlThunk.bind(this))(request); } /** * Get Users in the Project with pagination, sort, sort order and filtering. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `Project:ListAllUsers` * Access Policy Resource: `Project:Settings` */ listV2(params: UserListV2Params, request?: OystehrClientRequest): Promise<UserListV2Response>; /** * Get Users in the Project with pagination, sort, sort order and filtering. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `Project:ListAllUsers` * Access Policy Resource: `Project:Settings` */ listV2(request?: OystehrClientRequest): Promise<UserListV2Response>; /** * Get Users in the Project with pagination, sort, sort order and filtering. [Users](https://docs.oystehr.com/oystehr/services/app/users/) are the people who log into the [Applications](https://docs.oystehr.com/oystehr/services/app/applications/) you configure for securing the apps you build on top of Oystehr. * * Access Policy Action: `Project:ListAllUsers` * Access Policy Resource: `Project:Settings` */ listV2( params?: UserListV2Params | OystehrClientRequest, request?: OystehrClientRequest ): Promise<UserListV2Response> { return this.request('/user/v2/list', 'get', this.#baseUrlThunk.bind(this))(params, request); } }