export type UpdateApiContactsIdArgs = {id: number, body: {first_name: string, last_name: string, owner_id: number, company_id: number, title?: string | undefined, reports_to_id?: number | undefined, has_left_company?: boolean | undefined, emails?: Array | undefined, phones?: Array | undefined, address?: ({street?: string | undefined, city?: string | undefined, state?: string | undefined, postal_code?: string | undefined}) | undefined, country_code?: string | undefined, social_media_urls?: Array | undefined, is_hot?: boolean | undefined, notes?: string | undefined, custom_fields?: Array | undefined}}; export type UpdateApiContactsIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a contact * * PUT /contacts/{id} */ export const updateApiContactsId = async (args: UpdateApiContactsIdArgs, options?: UpdateApiContactsIdOptions) => { 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(/\/+$/, '')}/contacts/${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 };