/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 376306e5c5c8 */ import { InvalidateQueryFilters, QueryClient, useQuery, UseQueryResult, useSuspenseQuery, UseSuspenseQueryResult, } from "@tanstack/react-query"; import { GleanBaseError } from "../models/errors/gleanbaseerror.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 { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { useGleanContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildClientAgentsRetrieveSchemasQuery, ClientAgentsRetrieveSchemasQueryData, prefetchClientAgentsRetrieveSchemas, queryKeyClientAgentsRetrieveSchemas, } from "./clientAgentsRetrieveSchemas.core.js"; export { buildClientAgentsRetrieveSchemasQuery, type ClientAgentsRetrieveSchemasQueryData, prefetchClientAgentsRetrieveSchemas, queryKeyClientAgentsRetrieveSchemas, }; export type ClientAgentsRetrieveSchemasQueryError = | errors.ErrorResponse | GleanBaseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * List an agent's schemas * * @remarks * Return [agent](https://developers.glean.com/agents/agents-api)'s input and output schemas. You can use these schemas to detect changes to an agent's input or output structure. */ export function useClientAgentsRetrieveSchemas( agentId: string, locale?: string | undefined, timezoneOffset?: number | undefined, options?: QueryHookOptions< ClientAgentsRetrieveSchemasQueryData, ClientAgentsRetrieveSchemasQueryError >, ): UseQueryResult< ClientAgentsRetrieveSchemasQueryData, ClientAgentsRetrieveSchemasQueryError > { const client = useGleanContext(); return useQuery({ ...buildClientAgentsRetrieveSchemasQuery( client, agentId, locale, timezoneOffset, options, ), ...options, }); } /** * List an agent's schemas * * @remarks * Return [agent](https://developers.glean.com/agents/agents-api)'s input and output schemas. You can use these schemas to detect changes to an agent's input or output structure. */ export function useClientAgentsRetrieveSchemasSuspense( agentId: string, locale?: string | undefined, timezoneOffset?: number | undefined, options?: SuspenseQueryHookOptions< ClientAgentsRetrieveSchemasQueryData, ClientAgentsRetrieveSchemasQueryError >, ): UseSuspenseQueryResult< ClientAgentsRetrieveSchemasQueryData, ClientAgentsRetrieveSchemasQueryError > { const client = useGleanContext(); return useSuspenseQuery({ ...buildClientAgentsRetrieveSchemasQuery( client, agentId, locale, timezoneOffset, options, ), ...options, }); } export function setClientAgentsRetrieveSchemasData( client: QueryClient, queryKeyBase: [ agentId: string, parameters: { locale?: string | undefined; timezoneOffset?: number | undefined; }, ], data: ClientAgentsRetrieveSchemasQueryData, ): ClientAgentsRetrieveSchemasQueryData | undefined { const key = queryKeyClientAgentsRetrieveSchemas(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateClientAgentsRetrieveSchemas( client: QueryClient, queryKeyBase: TupleToPrefixes< [ agentId: string, parameters: { locale?: string | undefined; timezoneOffset?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gleanwork/api-client", "agents", "retrieveSchemas", ...queryKeyBase, ], }); } export function invalidateAllClientAgentsRetrieveSchemas( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gleanwork/api-client", "agents", "retrieveSchemas"], }); }