export type GetApiV1RemittancesIdRawArgs = {id: string, 'User-Agent'?: string | undefined}; export type GetApiV1RemittancesIdRawOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Raw(text/plain) do CNAB * * GET /v1/remittances/{id}/raw */ export const getApiV1RemittancesIdRaw = async (args: GetApiV1RemittancesIdRawArgs, options?: GetApiV1RemittancesIdRawOptions) => { const {baseUrl = "https://api-sandbox.kobana.com.br", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") 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/remittances/${encodeURIComponent(String(args.id))}/raw${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };