/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { InvalidateQueryFilters, QueryClient, useQuery, UseQueryResult, useSuspenseQuery, UseSuspenseQueryResult, } from "@tanstack/react-query"; 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 { useSDKContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { AgentsGetAgentQueryData, buildAgentsGetAgentQuery, prefetchAgentsGetAgent, queryKeyAgentsGetAgent, } from "./agentsGetAgent.core.js"; export { type AgentsGetAgentQueryData, buildAgentsGetAgentQuery, prefetchAgentsGetAgent, queryKeyAgentsGetAgent, }; export type AgentsGetAgentQueryError = | errors.ErrorEnvelope | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Retrieve an agent */ export function useAgentsGetAgent( request: operations.GetAgentRequest, options?: QueryHookOptions, ): UseQueryResult { const client = useSDKContext(); return useQuery({ ...buildAgentsGetAgentQuery( client, request, options, ), ...options, }); } /** * Retrieve an agent */ export function useAgentsGetAgentSuspense( request: operations.GetAgentRequest, options?: SuspenseQueryHookOptions< AgentsGetAgentQueryData, AgentsGetAgentQueryError >, ): UseSuspenseQueryResult { const client = useSDKContext(); return useSuspenseQuery({ ...buildAgentsGetAgentQuery( client, request, options, ), ...options, }); } export function setAgentsGetAgentData( client: QueryClient, queryKeyBase: [ agentId: string, parameters: { xOnBehalfOf?: string | undefined }, ], data: AgentsGetAgentQueryData, ): AgentsGetAgentQueryData | undefined { const key = queryKeyAgentsGetAgent(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateAgentsGetAgent( client: QueryClient, queryKeyBase: TupleToPrefixes< [agentId: string, parameters: { xOnBehalfOf?: string | undefined }] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@meetkai/mka1", "Agents", "getAgent", ...queryKeyBase], }); } export function invalidateAllAgentsGetAgent( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@meetkai/mka1", "Agents", "getAgent"], }); }