export type GetApi0JobsJobWatchArgs = {job: string, minseq?: (number | null) | undefined}; export type GetApi0JobsJobWatchOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /0/jobs/{job}/watch */ export const getApi0JobsJobWatch = async (args: GetApi0JobsJobWatchArgs, options: GetApi0JobsJobWatchOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.minseq != null) query.append("minseq", String(args.minseq)) const url = `${baseUrl.replace(/\/+$/, '')}/0/jobs/${encodeURIComponent(String(args.job))}/watch${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() };