export type GetApiEuWithdrawalsExportArgs = {format?: ('csv' | 'xls' | 'xlsx') | undefined, order_increment_id?: string | undefined, customer_email?: string | undefined, status?: string | undefined, channel_code?: string | undefined, received_at_from?: string | undefined, received_at_to?: string | undefined, confirmation_sent_at_from?: string | undefined, confirmation_sent_at_to?: string | undefined}; export type GetApiEuWithdrawalsExportOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export EU withdrawals as csv, xls or xlsx * * GET /eu-withdrawals/export */ export const getApiEuWithdrawalsExport = async (args: GetApiEuWithdrawalsExportArgs, options?: GetApiEuWithdrawalsExportOptions) => { const {baseUrl = "http://localhost:8000/api/admin", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/csv") if (args.format != null) query.append("format", String(args.format)) if (args.order_increment_id != null) query.append("order_increment_id", String(args.order_increment_id)) if (args.customer_email != null) query.append("customer_email", String(args.customer_email)) if (args.status != null) query.append("status", String(args.status)) if (args.channel_code != null) query.append("channel_code", String(args.channel_code)) if (args.received_at_from != null) query.append("received_at_from", String(args.received_at_from)) if (args.received_at_to != null) query.append("received_at_to", String(args.received_at_to)) if (args.confirmation_sent_at_from != null) query.append("confirmation_sent_at_from", String(args.confirmation_sent_at_from)) if (args.confirmation_sent_at_to != null) query.append("confirmation_sent_at_to", String(args.confirmation_sent_at_to)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/eu-withdrawals/export${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() };