export type GetApiApiV1DashboardsIdentifierDownloadJobIdStatusArgs = {identifier: string, jobId: string, userId?: string | undefined}; export type GetApiApiV1DashboardsIdentifierDownloadJobIdStatusOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get download job status * * GET /api/v1/dashboards/{identifier}/download/{jobId}/status */ export const getApiApiV1DashboardsIdentifierDownloadJobIdStatus = async (args: GetApiApiV1DashboardsIdentifierDownloadJobIdStatusArgs, options: GetApiApiV1DashboardsIdentifierDownloadJobIdStatusOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.userId != null) query.append("userId", String(args.userId)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/dashboards/${encodeURIComponent(String(args.identifier))}/download/${encodeURIComponent(String(args.jobId))}/status${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 };