UNPKG

@oystehr/sdk

Version:

Oystehr SDK

107 lines (104 loc) 5.82 kB
// AUTOGENERATED -- DO NOT EDIT import { OystehrClientRequest, ZambdaCreateParams, ZambdaCreateResponse, ZambdaDeleteParams, ZambdaExecuteParams, ZambdaExecutePublicParams, ZambdaExecutePublicResponse, ZambdaExecuteResponse, ZambdaGetParams, ZambdaGetResponse, ZambdaListResponse, ZambdaS3UploadParams, ZambdaS3UploadResponse, ZambdaUpdateParams, ZambdaUpdateResponse, } from '../..'; import { SDKResource } from '../../client/client'; import { OystehrConfig } from '../../config'; import * as ext from './zambda-ext'; export class Zambda extends SDKResource { constructor(config: OystehrConfig) { super(config); } #baseUrlThunk(): string { return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1'; } uploadFile = ext.uploadFile; /** * Get a list of all Zambda Functions in the Project. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Access Policy Action: `Zambda:ListAllFunctions` * Access Policy Resource: `Zambda:Function` */ list(request?: OystehrClientRequest): Promise<ZambdaListResponse> { return this.request('/zambda', 'get', this.#baseUrlThunk.bind(this))(request); } /** * Create a new Zambda Function. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Access Policy Action: `Zambda:CreateFunction` * Access Policy Resource: `Zambda:Function` */ create(params: ZambdaCreateParams, request?: OystehrClientRequest): Promise<ZambdaCreateResponse> { return this.request('/zambda', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Get the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Access Policy Action: `Zambda:GetFunction` * Access Policy Resource: `Zambda:Function` */ get(params: ZambdaGetParams, request?: OystehrClientRequest): Promise<ZambdaGetResponse> { return this.request('/zambda/{id}', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Update the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Access Policy Action: `Zambda:UpdateFunction` * Access Policy Resource: `Zambda:Function` */ update(params: ZambdaUpdateParams, request?: OystehrClientRequest): Promise<ZambdaUpdateResponse> { return this.request('/zambda/{id}', 'patch', this.#baseUrlThunk.bind(this))(params, request); } /** * Delete the Zambda Function with the provided ID or name. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Access Policy Action: `Zambda:DeleteFunction` * Access Policy Resource: `Zambda:Function` */ delete(params: ZambdaDeleteParams, request?: OystehrClientRequest): Promise<void> { return this.request('/zambda/{id}', 'delete', this.#baseUrlThunk.bind(this))(params, request); } /** * Execute the [Authenticated Zambda Function](https://docs.oystehr.com/oystehr/services/zambda/types/authenticated/) with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Access Policy Action: `Zambda:InvokeFunction` * Access Policy Resource: `Zambda:Function` */ execute(params: ZambdaExecuteParams, request?: OystehrClientRequest): Promise<ZambdaExecuteResponse> { return this.request('/zambda/{id}/execute', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Execute the [Public Zambda Function](https://docs.oystehr.com/oystehr/services/zambda/types/public/) with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Execute a zambda that has method http_open. This endpoint is public so there are no access policy requirements. */ executePublic( params: ZambdaExecutePublicParams, request?: OystehrClientRequest ): Promise<ZambdaExecutePublicResponse> { return this.request('/zambda/{id}/execute-public', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Returns a URL that is used to deploy code to the Zambda Function with the provided ID. [Zambdas](https://docs.oystehr.com/oystehr/services/zambda/) are functions that can be used to execute your code. They can be used to process data received from Oystehr's APIs or to perform operations on third-party services. * * Access Policy Action: `Zambda:UpdateFunction` * Access Policy Resource: `Zambda:Function` */ s3Upload(params: ZambdaS3UploadParams, request?: OystehrClientRequest): Promise<ZambdaS3UploadResponse> { return this.request('/zambda/{id}/s3-upload', 'post', this.#baseUrlThunk.bind(this))(params, request); } }