export type ExportSheets = 'Summary' | 'Detail' | 'Analysis' | 'All'; export type ExportFileFormat = 'Excel' | 'EuropeanCsv' | 'AmericanCsv' | 'Tsv' | 'Json' | 'Markdown'; export type GetApiV1ExportsCommitmentsArgs = {from?: string | undefined, to?: string | undefined, sheets?: ExportSheets | undefined, format?: ExportFileFormat | undefined}; export type GetApiV1ExportsCommitmentsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export commitments / due dates (customer, supplier, colleague). * Pass `types[]=Customer&types[]=Supplier` etc. to restrict by type. * * GET /v1/exports/commitments */ export const getApiV1ExportsCommitments = async (args: GetApiV1ExportsCommitmentsArgs, options?: GetApiV1ExportsCommitmentsOptions) => { 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/commitments${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 };