/* * 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 { AgentRunsStreamAgentRunEventsQueryData, buildAgentRunsStreamAgentRunEventsQuery, prefetchAgentRunsStreamAgentRunEvents, queryKeyAgentRunsStreamAgentRunEvents, } from "./agentRunsStreamAgentRunEvents.core.js"; export { type AgentRunsStreamAgentRunEventsQueryData, buildAgentRunsStreamAgentRunEventsQuery, prefetchAgentRunsStreamAgentRunEvents, queryKeyAgentRunsStreamAgentRunEvents, }; export type AgentRunsStreamAgentRunEventsQueryError = | errors.ErrorEnvelope | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Stream agent run events * * @remarks * Streams Server-Sent Events for the gateway response linked to this agent run. Terminal runs emit a single terminal event and close. */ export function useAgentRunsStreamAgentRunEvents( request: operations.StreamAgentRunEventsRequest, options?: QueryHookOptions< AgentRunsStreamAgentRunEventsQueryData, AgentRunsStreamAgentRunEventsQueryError >, ): UseQueryResult< AgentRunsStreamAgentRunEventsQueryData, AgentRunsStreamAgentRunEventsQueryError > { const client = useSDKContext(); return useQuery({ ...buildAgentRunsStreamAgentRunEventsQuery( client, request, options, ), ...options, }); } /** * Stream agent run events * * @remarks * Streams Server-Sent Events for the gateway response linked to this agent run. Terminal runs emit a single terminal event and close. */ export function useAgentRunsStreamAgentRunEventsSuspense( request: operations.StreamAgentRunEventsRequest, options?: SuspenseQueryHookOptions< AgentRunsStreamAgentRunEventsQueryData, AgentRunsStreamAgentRunEventsQueryError >, ): UseSuspenseQueryResult< AgentRunsStreamAgentRunEventsQueryData, AgentRunsStreamAgentRunEventsQueryError > { const client = useSDKContext(); return useSuspenseQuery({ ...buildAgentRunsStreamAgentRunEventsQuery( client, request, options, ), ...options, }); } export function setAgentRunsStreamAgentRunEventsData( client: QueryClient, queryKeyBase: [ agentId: string, runId: string, parameters: { xOnBehalfOf?: string | undefined }, ], data: AgentRunsStreamAgentRunEventsQueryData, ): AgentRunsStreamAgentRunEventsQueryData | undefined { const key = queryKeyAgentRunsStreamAgentRunEvents(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateAgentRunsStreamAgentRunEvents( client: QueryClient, queryKeyBase: TupleToPrefixes< [ agentId: string, runId: string, parameters: { xOnBehalfOf?: string | undefined }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@meetkai/mka1", "Agent Runs", "streamAgentRunEvents", ...queryKeyBase, ], }); } export function invalidateAllAgentRunsStreamAgentRunEvents( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@meetkai/mka1", "Agent Runs", "streamAgentRunEvents"], }); }