export type ExportSheets = 'Summary' | 'Detail' | 'Analysis' | 'All'; export type ExportFileFormat = 'Excel' | 'EuropeanCsv' | 'AmericanCsv' | 'Tsv' | 'Json' | 'Markdown'; export type GetApiV1ExportsReceiptsbookArgs = {from?: string | undefined, to?: string | undefined, sheets?: ExportSheets | undefined, format?: ExportFileFormat | undefined}; export type GetApiV1ExportsReceiptsbookOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export the receipts accounting register. * * GET /v1/exports/receiptsbook */ export const getApiV1ExportsReceiptsbook = async (args: GetApiV1ExportsReceiptsbookArgs, options?: GetApiV1ExportsReceiptsbookOptions) => { 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.sheets != null) query.append("sheets", String(args.sheets)) if (args.format != null) query.append("format", String(args.format)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/exports/receiptsbook${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 };