UNPKG

@sociate/sociate-api-sdk

Version:

Javascript client for Sociate AI APIs

45 lines (44 loc) 1.43 kB
export class CompanyAPI { httpClient; constructor(httpClient) { this.httpClient = httpClient; } /** * Get All Companies * @description Get a list of all the companies * @param params - The parameters for the request * @returns The response indicating the success of the operation */ async get(params) { const queryParams = new URLSearchParams(params).toString(); return await this.httpClient.get(`/companies?${queryParams}`); } /** * Create Company * @description Create a company * @param params - The parameters for the request * @returns The response indicating the success of the operation */ async create(params) { return await this.httpClient.post('/companies', params); } /** * Delete Company * @description Delete a company * @param id - The company ID */ async delete(params) { return await this.httpClient.delete(`/companies/${params.id}`); } /** * Get Users * @description Get a list of users from a company * @param params - The parameters for the request * @returns The list of users from the company */ async getUsers(params) { const { id, ...rest } = params; const queryParams = new URLSearchParams(rest).toString(); return await this.httpClient.get(`/companies/${id}/users?${queryParams}`); } }