export type CreateApiV1WorkflowsExecutionsExecutionIdCancelArgs = {execution_id: string}; export type CreateApiV1WorkflowsExecutionsExecutionIdCancelOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel Workflow Execution * * POST /v1/workflows/executions/{execution_id}/cancel */ export const createApiV1WorkflowsExecutionsExecutionIdCancel = async (args: CreateApiV1WorkflowsExecutionsExecutionIdCancelArgs, options?: CreateApiV1WorkflowsExecutionsExecutionIdCancelOptions) => { const {baseUrl = "https://api.mistral.ai", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKey !== undefined) headers.set('authorization', `Bearer ${ApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/workflows/executions/${encodeURIComponent(String(args.execution_id))}/cancel${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };