export type GetApiV1DashboardExportInvoicesArgs = {selected_columns: string, limit?: number | undefined, page?: number | undefined, 'created_at[gte]'?: string | undefined, 'created_at[lte]'?: string | undefined}; export type GetApiV1DashboardExportInvoicesOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export All Invoices to Excel * * GET /v1/dashboard-export/invoices */ export const getApiV1DashboardExportInvoices = async (args: GetApiV1DashboardExportInvoicesArgs, options?: GetApiV1DashboardExportInvoicesOptions) => { const {baseUrl = "https://testapi.payarc.net", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.selected_columns != null) query.append("selected_columns", String(args.selected_columns)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.page != null) query.append("page", String(args.page)) if (args['created_at[gte]'] != null) query.append("created_at[gte]", String(args['created_at[gte]'])) if (args['created_at[lte]'] != null) query.append("created_at[lte]", String(args['created_at[lte]'])) if (sec0 !== undefined) headers.set("Authorization", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/v1/dashboard-export/invoices${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() };