@oystehr/sdk
Version:
Oystehr SDK
118 lines (115 loc) • 6.29 kB
text/typescript
// AUTOGENERATED -- DO NOT EDIT
import {
M2mCreateParams,
M2mCreateResponse,
M2mDeleteParams,
M2mGetParams,
M2mGetResponse,
M2mListResponse,
M2mListV2Params,
M2mListV2Response,
M2mMeResponse,
M2mRotateSecretParams,
M2mRotateSecretResponse,
M2mUpdateParams,
M2mUpdateResponse,
OystehrClientRequest,
} from '../..';
import { SDKResource } from '../../client/client';
import { OystehrConfig } from '../../config';
export class M2m extends SDKResource {
constructor(config: OystehrConfig) {
super(config);
}
#baseUrlThunk(): string {
return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
}
/**
* DEPRECATED. Please use [v2/list](https://api-reference.oystehr.com/reference/get_m2m-v2-list) instead.
*
* Get a list of all M2M Clients. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:ListAllM2MClients`
* Access Policy Resource: `IAM:M2MClient`
*/
list(request?: OystehrClientRequest): Promise<M2mListResponse> {
return this.request('/m2m', 'get', this.#baseUrlThunk.bind(this))(request);
}
/**
* Create a new M2M Client. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:CreateM2MClient`
* Access Policy Resource: `IAM:M2MClient`
*/
create(params: M2mCreateParams, request?: OystehrClientRequest): Promise<M2mCreateResponse> {
return this.request('/m2m', 'post', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Get information about the calling M2M Client. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:GetM2MClient`
* Access Policy Resource: `IAM:M2MClient`
*/
me(request?: OystehrClientRequest): Promise<M2mMeResponse> {
return this.request('/m2m/me', 'get', this.#baseUrlThunk.bind(this))(request);
}
/**
* Get the M2M Client with the provided ID. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:GetM2MClient`
* Access Policy Resource: `IAM:M2MClient`
*/
get(params: M2mGetParams, request?: OystehrClientRequest): Promise<M2mGetResponse> {
return this.request('/m2m/{id}', 'get', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Update the M2M Client with the provided ID. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:UpdateM2MClient`
* Access Policy Resource: `IAM:M2MClient`
*/
update(params: M2mUpdateParams, request?: OystehrClientRequest): Promise<M2mUpdateResponse> {
return this.request('/m2m/{id}', 'patch', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Delete the M2M Client with the provided ID. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:DeleteM2MClient`
* Access Policy Resource: `IAM:M2MClient`
*/
delete(params: M2mDeleteParams, request?: OystehrClientRequest): Promise<void> {
return this.request('/m2m/{id}', 'delete', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Rotate the client secret for the M2M Client with the provided ID. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:RotateM2MClientSecret`
* Access Policy Resource: `IAM:M2MClient`
*/
rotateSecret(params: M2mRotateSecretParams, request?: OystehrClientRequest): Promise<M2mRotateSecretResponse> {
return this.request('/m2m/{id}/rotate-secret', 'post', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Get M2M clients in the Project with pagination, sort, sort order and filtering. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:ListAllM2MClients`
* Access Policy Resource: `IAM:M2MClient`
*/
listV2(params: M2mListV2Params, request?: OystehrClientRequest): Promise<M2mListV2Response>;
/**
* Get M2M clients in the Project with pagination, sort, sort order and filtering. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:ListAllM2MClients`
* Access Policy Resource: `IAM:M2MClient`
*/
listV2(request?: OystehrClientRequest): Promise<M2mListV2Response>;
/**
* Get M2M clients in the Project with pagination, sort, sort order and filtering. [M2M Clients](https://docs.oystehr.com/oystehr/services/iam/m2m-clients) are used to access Oystehr APIs from scripts and server-side code like [Zambda Functions](https://docs.oystehr.com/oystehr/services/zambda).
*
* Access Policy Action: `App:ListAllM2MClients`
* Access Policy Resource: `IAM:M2MClient`
*/
listV2(params?: M2mListV2Params | OystehrClientRequest, request?: OystehrClientRequest): Promise<M2mListV2Response> {
return this.request('/m2m/v2/list', 'get', this.#baseUrlThunk.bind(this))(params, request);
}
}