export type UpdateCustomerAutoChargeV3Dto = {autocharge: boolean}; export type UpdateApiV3CustomersIdAutochargeArgs = {id: string, body: UpdateCustomerAutoChargeV3Dto}; export type UpdateApiV3CustomersIdAutochargeOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update customer auto-charge * * PUT /v3/customers/{id}/autocharge */ export const updateApiV3CustomersIdAutocharge = async (args: UpdateApiV3CustomersIdAutochargeArgs, options?: UpdateApiV3CustomersIdAutochargeOptions) => { 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))}/autocharge${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 };