UNPKG

@starsched/sdk

Version:

ABA clinic control and management service API SDK

47 lines (46 loc) 1.24 kB
export class Companies { httpClient; constructor(httpClient) { this.httpClient = httpClient; } async getMyCompanies(options) { const response = await this.httpClient.get('/v1/companies/mine', options); if (!response.ok) { return { data: null, error: response.body }; } return { data: response.body, error: null }; } async create(input, options) { const response = await this.httpClient.post('/v1/companies', input, options); if (!response.ok) { return { data: null, error: response.body }; } return { data: response.body, error: null }; } async update(input, options) { const { company_id, ...inputBody } = input; const response = await this.httpClient.put(`/v1/companies/${company_id}`, inputBody, options); if (!response.ok) { return { data: null, error: response.body }; } return { data: response.body, error: null }; } }