export type CustomerName = {firstName?: string | undefined, lastName?: string | undefined}; export type CustomerUpdateRequest20230401 = {dateOfBirth?: string | undefined, email?: string | undefined, externalCustomerId?: string | undefined, name?: CustomerName | undefined, phone?: string | undefined, status?: string | undefined}; export type PatchApiAccountsCustomersCustomerIdArgs = {customerId: string, body: CustomerUpdateRequest20230401}; export type PatchApiAccountsCustomersCustomerIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a customer * * PATCH /accounts/customers/{customerId} */ export const patchApiAccountsCustomersCustomerId = async (args: PatchApiAccountsCustomersCustomerIdArgs, options?: PatchApiAccountsCustomersCustomerIdOptions) => { const {baseUrl = "https://api-sb.meld.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/customers/${encodeURIComponent(String(args.customerId))}${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 res.blob() };