/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { agentRunsCreateAgentRun } from "../funcs/agentRunsCreateAgentRun.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import * as errors from "../models/errors/index.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKError } from "../models/errors/sdkerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { useSDKContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type AgentRunsCreateAgentRunMutationVariables = { request: operations.CreateAgentRunRequest; options?: RequestOptions; }; export type AgentRunsCreateAgentRunMutationData = components.AgentRun; export type AgentRunsCreateAgentRunMutationError = | errors.ErrorEnvelope | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Start a saved agent run * * @remarks * Starts an asynchronous background run for a saved agent and returns the queued run record. Use the run retrieval endpoint to poll status or the events endpoint to stream progress. */ export function useAgentRunsCreateAgentRunMutation( options?: MutationHookOptions< AgentRunsCreateAgentRunMutationData, AgentRunsCreateAgentRunMutationError, AgentRunsCreateAgentRunMutationVariables >, ): UseMutationResult< AgentRunsCreateAgentRunMutationData, AgentRunsCreateAgentRunMutationError, AgentRunsCreateAgentRunMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildAgentRunsCreateAgentRunMutation(client, options), ...options, }); } export function mutationKeyAgentRunsCreateAgentRun(): MutationKey { return ["@meetkai/mka1", "Agent Runs", "createAgentRun"]; } export function buildAgentRunsCreateAgentRunMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: AgentRunsCreateAgentRunMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyAgentRunsCreateAgentRun(), mutationFn: function agentRunsCreateAgentRunMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(agentRunsCreateAgentRun( client$, request, mergedOptions, )); }, }; }