export type CustomerObject = {id?: string | undefined, name?: string | undefined, phone?: string | undefined, email?: string | undefined, address?: string | undefined, city?: string | undefined, postalCode?: string | undefined, country: string, locale?: string | undefined, createdAt?: string | undefined, updatedAt?: string | undefined}; export type UpdateApiCustomersCustomerIdArgs = {customerId: string, body: CustomerObject}; export type UpdateApiCustomersCustomerIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update customer details * * PUT /customers/{customerId} */ export const updateApiCustomersCustomerId = async (args: UpdateApiCustomersCustomerIdArgs, options?: UpdateApiCustomersCustomerIdOptions) => { const {baseUrl = "https://api.test.bictorys.com/pay/v1", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-API-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/customers/${encodeURIComponent(String(args.customerId))}${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 };