export type ArchiveCompanyRequest = {reason_category: 'didnt_work_out' | 'too_expensive' | 'just_testing' | 'other', reason?: (string | null) | undefined}; export type DeleteApiCompaniesCompanyIdArgs = {company_id: string, body: ArchiveCompanyRequest | null}; export type DeleteApiCompaniesCompanyIdOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Company * * DELETE /companies/{company_id} */ export const deleteApiCompaniesCompanyId = async (args: DeleteApiCompaniesCompanyIdArgs, options: DeleteApiCompaniesCompanyIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/companies/${encodeURIComponent(String(args.company_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };