export type UpdateApiV1DischargesIdReprocessArgs = {id: string, 'User-Agent'?: string | undefined}; export type UpdateApiV1DischargesIdReprocessOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reprocessar CNAB * * PUT /v1/discharges/{id}/reprocess */ export const updateApiV1DischargesIdReprocess = async (args: UpdateApiV1DischargesIdReprocessArgs, options?: UpdateApiV1DischargesIdReprocessOptions) => { const {baseUrl = "https://api-sandbox.kobana.com.br", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/discharges/${encodeURIComponent(String(args.id))}/reprocess${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };