export type DtosCompanyEditable = {status?: ('Active' | 'Inactive' | 'Demo') | undefined, agent_id?: string | undefined, teams?: Array | undefined, open_enrollment_start_date?: string | undefined, open_enrollment_end_date?: string | undefined}; export type PatchApiVVersionCompaniesIdArgs = {id: string, version: string, body: DtosCompanyEditable}; export type PatchApiVVersionCompaniesIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * company * * PATCH /v{version}/companies/{id} */ export const patchApiVVersionCompaniesId = async (args: PatchApiVVersionCompaniesIdArgs, options: PatchApiVVersionCompaniesIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v${encodeURIComponent(String(args.version))}/companies/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };