export type UpdateApiCompaniesIdArgs = {id: number, body: {name: string, owner_id: number, website?: string | undefined, phones?: Array | undefined, address?: ({street?: string | undefined, city?: string | undefined, state?: string | undefined, postal_code?: string | undefined}) | undefined, country_code?: string | undefined, entered_by_id?: number | undefined, social_media_urls?: Array | undefined, notes?: string | undefined, is_hot?: boolean | undefined, key_technologies?: string | undefined, billing_contact_id?: number | undefined, custom_fields?: Array | undefined, user_groups?: Array | undefined}}; export type UpdateApiCompaniesIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a company * * PUT /companies/{id} */ export const updateApiCompaniesId = async (args: UpdateApiCompaniesIdArgs, options?: UpdateApiCompaniesIdOptions) => { const {baseUrl = "https://api.catsone.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/companies/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };