export type DeleteApiCustomersCustomerIdArgs = {customer_id: string, 'X-API-Key'?: (string | null) | undefined}; export type DeleteApiCustomersCustomerIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete Customer * * DELETE /customers/{customer_id} */ export const deleteApiCustomersCustomerId = async (args: DeleteApiCustomersCustomerIdArgs, options: DeleteApiCustomersCustomerIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-API-Key'] != null) headers.set("X-API-Key", String(args['X-API-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/customers/${encodeURIComponent(String(args.customer_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };