export type PatchApiContactsContactIdArgs = {contactId: string, body: {firstName?: (string | null) | undefined, lastName?: (string | null) | undefined, email?: (string | null) | undefined, phone?: (string | null) | undefined, occupation?: (string | null) | undefined, gender?: (string | null) | undefined, birthdate?: (string | null) | undefined, age?: (number | null) | undefined, notes?: (string | null) | undefined, tags?: ({add?: (Array<{id?: string | undefined, name?: string | undefined}>) | undefined, remove?: (Array<{id?: string | undefined, name?: string | undefined}>) | undefined, set?: (Array<{id?: string | undefined, name?: string | undefined}>) | undefined}) | undefined, customProperties?: ({[key: string]: string | number}) | undefined}}; export type PatchApiContactsContactIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a contact * * PATCH /contacts/{contactId} */ export const patchApiContactsContactId = async (args: PatchApiContactsContactIdArgs, options?: PatchApiContactsContactIdOptions) => { const {baseUrl = "https://messenger-public-api.cogfy.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/contacts/${encodeURIComponent(String(args.contactId))}${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 };