export type GetApiV1AdminTasksIdBlobSeqArgs = {id: number, seq: number}; export type GetApiV1AdminTasksIdBlobSeqOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * 管理员下载异步任务结果 blob * * GET /v1/admin/tasks/{id}/blob/{seq} */ export const getApiV1AdminTasksIdBlobSeq = async (args: GetApiV1AdminTasksIdBlobSeqArgs, options: GetApiV1AdminTasksIdBlobSeqOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/v1/admin/tasks/${encodeURIComponent(String(args.id))}/blob/${encodeURIComponent(String(args.seq))}${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() };