export type BankBilletCancelObject = {cancellation_reason?: (1 | 2 | 3 | 4 | 5 | null) | undefined}; export type UpdateApiV1BankBilletsIdCancelArgs = {'User-Agent'?: string | undefined, 'X-Idempotency-Key'?: string | undefined, id: string, body: BankBilletCancelObject}; export type UpdateApiV1BankBilletsIdCancelOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancelar o Boleto * * PUT /v1/bank_billets/{id}/cancel */ export const updateApiV1BankBilletsIdCancel = async (args: UpdateApiV1BankBilletsIdCancelArgs, options?: UpdateApiV1BankBilletsIdCancelOptions) => { const {baseUrl = "https://api-sandbox.kobana.com.br", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) if (args['X-Idempotency-Key'] != null) headers.set("X-Idempotency-Key", String(args['X-Idempotency-Key'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/bank_billets/${encodeURIComponent(String(args.id))}/cancel${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 };