export type ExportSheets = 'Summary' | 'Detail' | 'Analysis' | 'All'; export type ExportFileFormat = 'Excel' | 'EuropeanCsv' | 'AmericanCsv' | 'Tsv' | 'Json' | 'Markdown'; export type GetApiV1ExportsExpensechargesArgs = {from?: string | undefined, to?: string | undefined, supplierId?: number | undefined, searchTerm?: string | undefined, sheets?: ExportSheets | undefined, format?: ExportFileFormat | undefined}; export type GetApiV1ExportsExpensechargesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export purchase invoices (expense charges). * * GET /v1/exports/expensecharges */ export const getApiV1ExportsExpensecharges = async (args: GetApiV1ExportsExpensechargesArgs, options?: GetApiV1ExportsExpensechargesOptions) => { const {baseUrl = "https://api.altoviz.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.from != null) query.append("from", String(args.from)) if (args.to != null) query.append("to", String(args.to)) if (args.supplierId != null) query.append("supplierId", String(args.supplierId)) if (args.searchTerm != null) query.append("searchTerm", String(args.searchTerm)) if (args.sheets != null) query.append("sheets", String(args.sheets)) if (args.format != null) query.append("format", String(args.format)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/exports/expensecharges${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 undefined };