export type GetApiV2JobsJobIdExportArgs = {jobId: number, type: string}; export type GetApiV2JobsJobIdExportOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Export a Job * * GET /v2/jobs/{jobId}/export */ export const getApiV2JobsJobIdExport = async (args: GetApiV2JobsJobIdExportArgs, options?: GetApiV2JobsJobIdExportOptions) => { const {baseUrl = "https://api.lilt.com", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.type != null) query.append("type", String(args.type)) if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/jobs/${encodeURIComponent(String(args.jobId))}/export${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 };