1.0.1 • Published 2 years ago

ch-integratedservicesfunctionsapp-client v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Azure Functions App Client

Overview

Client libaray for CloudHospital.IntegratedServicesFunctionsApp Azure Functions App.

Usages

Install

$ npm i --save @cloudhospital/integratedservicesfunctionsapp.client

Example

import { CreateGitHubIssueClient } from '@cloudhospital/integratedservicesfunctionsapp.client';
import { type GitHubIssueRequestModel } from '@cloudhospital/integratedservicesfunctionsapp.client';

// ...

const createGitHubIssueClient = new CreateGitHubIssueClient({
    apiKey: '<api-key>',
    baseUrl: '<Base url of Azure Functions App>',
});

let model: GitHubIssueRequestModel;

try {
    throw new Error('Test error');
} catch (err) {
    if (err instanceof Error) {
        model = {
            owner: process.env.OWNER ?? '',
            repo: process.env.REPO ?? '',
            stage: process.env.STAGE ?? '',
            error: {
                message: err.message,
                stack: err.stack,
            },
        };

        await createGitHubIssueClient.requestAsync(model);
    }
}