/* * 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 { 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 { buildLlmPromptsListVersionsQuery, LlmPromptsListVersionsQueryData, prefetchLlmPromptsListVersions, queryKeyLlmPromptsListVersions, } from "./llmPromptsListVersions.core.js"; export { buildLlmPromptsListVersionsQuery, type LlmPromptsListVersionsQueryData, prefetchLlmPromptsListVersions, queryKeyLlmPromptsListVersions, }; export type LlmPromptsListVersionsQueryError = | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * List versions * * @remarks * Returns the version history of a prompt, ordered by version number. */ export function useLlmPromptsListVersions( request: operations.ListPromptVersionsRequest, options?: QueryHookOptions< LlmPromptsListVersionsQueryData, LlmPromptsListVersionsQueryError >, ): UseQueryResult< LlmPromptsListVersionsQueryData, LlmPromptsListVersionsQueryError > { const client = useSDKContext(); return useQuery({ ...buildLlmPromptsListVersionsQuery( client, request, options, ), ...options, }); } /** * List versions * * @remarks * Returns the version history of a prompt, ordered by version number. */ export function useLlmPromptsListVersionsSuspense( request: operations.ListPromptVersionsRequest, options?: SuspenseQueryHookOptions< LlmPromptsListVersionsQueryData, LlmPromptsListVersionsQueryError >, ): UseSuspenseQueryResult< LlmPromptsListVersionsQueryData, LlmPromptsListVersionsQueryError > { const client = useSDKContext(); return useSuspenseQuery({ ...buildLlmPromptsListVersionsQuery( client, request, options, ), ...options, }); } export function setLlmPromptsListVersionsData( client: QueryClient, queryKeyBase: [ id: string, parameters: { limit?: number | undefined; order?: operations.ListPromptVersionsQueryParamOrder | undefined; xOnBehalfOf?: string | undefined; }, ], data: LlmPromptsListVersionsQueryData, ): LlmPromptsListVersionsQueryData | undefined { const key = queryKeyLlmPromptsListVersions(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateLlmPromptsListVersions( client: QueryClient, queryKeyBase: TupleToPrefixes< [ id: string, parameters: { limit?: number | undefined; order?: operations.ListPromptVersionsQueryParamOrder | undefined; xOnBehalfOf?: string | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@meetkai/mka1", "prompts", "listVersions", ...queryKeyBase], }); } export function invalidateAllLlmPromptsListVersions( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@meetkai/mka1", "prompts", "listVersions"], }); }