export type GetApiV1MessagesBatchesMessageBatchIdResultsArgs = {message_batch_id: string, 'anthropic-version'?: string | undefined, 'anthropic-workspace-id'?: string | undefined}; export type GetApiV1MessagesBatchesMessageBatchIdResultsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve Message Batch results * * GET /v1/messages/batches/{message_batch_id}/results */ export const getApiV1MessagesBatchesMessageBatchIdResults = async (args: GetApiV1MessagesBatchesMessageBatchIdResultsArgs, options?: GetApiV1MessagesBatchesMessageBatchIdResultsOptions) => { const {baseUrl = "https://api.anthropic.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/x-jsonl") if (args['anthropic-version'] != null) headers.set("anthropic-version", String(args['anthropic-version'])) if (args['anthropic-workspace-id'] != null) headers.set("anthropic-workspace-id", String(args['anthropic-workspace-id'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/messages/batches/${encodeURIComponent(String(args.message_batch_id))}/results${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() };