export type UpsertCustomerBodyDto = {channel_phone_number?: string | undefined, channel_id?: string | undefined, channel: 'whatsapp' | 'web-whatsapp' | 'webchat', stageId?: string | undefined, agentId?: string | undefined, contact_phone_number?: string | undefined, external_user_id?: string | undefined, contact_email?: string | undefined, contact_name?: string | undefined, meta_data: {[key: string]: unknown}, custom_field_values?: Array<{key: string, value: string}> | undefined}; export type CreateApiApiPublicCustomerUpsertInfoArgs = {'x-api-key': string, body: UpsertCustomerBodyDto}; export type CreateApiApiPublicCustomerUpsertInfoOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upsert a contact * * POST /api/public/customer/upsert/info */ export const createApiApiPublicCustomerUpsertInfo = async (args: CreateApiApiPublicCustomerUpsertInfoArgs, options?: CreateApiApiPublicCustomerUpsertInfoOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/public/customer/upsert/info${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };