export type CreateApiV1AiAgentsTasksTaskIdStopArgs = {taskId: string}; export type CreateApiV1AiAgentsTasksTaskIdStopOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stop an AI Agent Task * * POST /v1/ai/agents/tasks/{taskId}/stop */ export const createApiV1AiAgentsTasksTaskIdStop = async (args: CreateApiV1AiAgentsTasksTaskIdStopArgs, options?: CreateApiV1AiAgentsTasksTaskIdStopOptions) => { const {baseUrl = "https://eu1.api.matillion.com/dpc", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/ai/agents/tasks/${encodeURIComponent(String(args.taskId))}/stop${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 };