export type GetApiV1ExportIdFileArgs = {id: number}; export type GetApiV1ExportIdFileOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download an export file * * GET /v1/export/{id}/file */ export const getApiV1ExportIdFile = async (args: GetApiV1ExportIdFileArgs, options: GetApiV1ExportIdFileOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/export/${encodeURIComponent(String(args.id))}/file${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 };