export type GetApiApiJobsDownloadJobIdArgs = {jobId: string}; export type GetApiApiJobsDownloadJobIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Allowed user roles:


after the download job is completed, get the file (if not SFTP'ed). WARNING: files are deleted after being downloaded * * GET /api/jobs/download/{jobId} */ export const getApiApiJobsDownloadJobId = async (args: GetApiApiJobsDownloadJobIdArgs, options?: GetApiApiJobsDownloadJobIdOptions) => { const {baseUrl = "https://api.burstiq.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/api/jobs/download/${encodeURIComponent(String(args.jobId))}${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.blob() };