export type UpdateCustomerCustomFieldV3Dto = {manufacturerCustomFieldId?: string | undefined, customFieldValue: string, isPurchaseOrder?: boolean | undefined}; export type UpdateApiV3CustomersIdCustomFieldArgs = {id: string, body: Array}; export type UpdateApiV3CustomersIdCustomFieldOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update customer custom fields * * PUT /v3/customers/{id}/custom-field */ export const updateApiV3CustomersIdCustomField = async (args: UpdateApiV3CustomersIdCustomFieldArgs, options?: UpdateApiV3CustomersIdCustomFieldOptions) => { const {baseUrl = "https://integrators.prod.api.tabsplatform.com", fetch: fetchFn = fetch, customHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (customHeader !== undefined) headers.set("Authorization", customHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v3/customers/${encodeURIComponent(String(args.id))}/custom-field${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 };