export type UpdateClientContactEmailDto = {email: string, purpose: 'personal' | 'work' | null, isPrimary?: boolean | undefined}; export type UpdateClientContactPhoneNumberDto = {phoneNumber: string, purpose: 'personal' | 'work' | null, isPrimary?: boolean | undefined}; export type DateISO = string; export type UpdateClientContactDto = {role?: (string | null) | undefined, department?: (string | null) | undefined, firstName?: string | undefined, lastName?: string | undefined, emails?: Array | undefined, phoneNumbers?: Array | undefined, mainContactId?: string | undefined, stageId?: string | undefined, startDate?: DateISO | undefined, endDate?: (DateISO | null) | undefined}; export type PatchApiClientsContactsIdArgs = {id: string, body: UpdateClientContactDto}; export type PatchApiClientsContactsIdOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update client contact * * PATCH /clients/contacts/{id} */ export const patchApiClientsContactsId = async (args: PatchApiClientsContactsIdArgs, options: PatchApiClientsContactsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/clients/contacts/${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 };