export type GetApiV2JobJobIdOutputArgs = {jobId: string}; export type GetApiV2JobJobIdOutputOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Job Output * * GET /v2/job/{jobId}/output */ export const getApiV2JobJobIdOutput = async (args: GetApiV2JobJobIdOutputArgs, options?: GetApiV2JobJobIdOutputOptions) => { const {baseUrl = "https://api.alianza.com", fetch: fetchFn = fetch, XAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/job/${encodeURIComponent(String(args.jobId))}/output${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() };