export type GetApiReportsTransactionsReportIdFileArgs = {reportId: string, file: string}; export type GetApiReportsTransactionsReportIdFileOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download report file * * GET /reports/transactions/{reportId}/{file} */ export const getApiReportsTransactionsReportIdFile = async (args: GetApiReportsTransactionsReportIdFileArgs, options: GetApiReportsTransactionsReportIdFileOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (ApiKey !== undefined) headers.set("Authorization", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/reports/transactions/${encodeURIComponent(String(args.reportId))}/${encodeURIComponent(String(args.file))}${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.blob() };