export type PatchApiV3CustomersIdNameArgs = {id: string, body: {name: string}}; export type PatchApiV3CustomersIdNameOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update customer name * * PATCH /v3/customers/{id}/name */ export const patchApiV3CustomersIdName = async (args: PatchApiV3CustomersIdNameArgs, options?: PatchApiV3CustomersIdNameOptions) => { 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))}/name${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 };