export type GetApiV1WorkflowsDeploymentsNameLogsStreamArgs = {name: string, worker_name?: (string | null) | undefined, workflow_name?: (string | null) | undefined, after?: (string | null) | undefined, last_event_id?: (string | null) | undefined, 'Last-Event-ID'?: (string | null) | undefined}; export type GetApiV1WorkflowsDeploymentsNameLogsStreamOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stream Deployment Logs * * GET /v1/workflows/deployments/{name}/logs/stream */ export const getApiV1WorkflowsDeploymentsNameLogsStream = async (args: GetApiV1WorkflowsDeploymentsNameLogsStreamArgs, options?: GetApiV1WorkflowsDeploymentsNameLogsStreamOptions) => { 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.worker_name != null) query.append("worker_name", String(args.worker_name)) if (args.workflow_name != null) query.append("workflow_name", String(args.workflow_name)) 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/deployments/${encodeURIComponent(String(args.name))}/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() };