export type GetApiV1WorkflowsExecutionsExecutionIdLogsStreamArgs = {execution_id: string, run_id?: (string | null) | undefined, activity_id?: (string | null) | undefined, after?: (string | null) | undefined, last_event_id?: (string | null) | undefined, 'Last-Event-ID'?: (string | null) | undefined}; export type GetApiV1WorkflowsExecutionsExecutionIdLogsStreamOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stream Workflow Execution Logs * * GET /v1/workflows/executions/{execution_id}/logs/stream */ export const getApiV1WorkflowsExecutionsExecutionIdLogsStream = async (args: GetApiV1WorkflowsExecutionsExecutionIdLogsStreamArgs, options?: GetApiV1WorkflowsExecutionsExecutionIdLogsStreamOptions) => { const {baseUrl = "https://api.mistral.ai", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/event-stream") if (args.run_id != null) query.append("run_id", String(args.run_id)) if (args.activity_id != null) query.append("activity_id", String(args.activity_id)) if (args.after != null) query.append("after", String(args.after)) if (args.last_event_id != null) query.append("last_event_id", String(args.last_event_id)) if (args['Last-Event-ID'] != null) headers.set("Last-Event-ID", String(args['Last-Event-ID'])) if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/workflows/executions/${encodeURIComponent(String(args.execution_id))}/logs/stream${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.text() };