/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { InvalidateQueryFilters, QueryClient, useQuery, UseQueryResult, useSuspenseQuery, UseSuspenseQueryResult, } from "@tanstack/react-query"; import { GustoEmbeddedError } from "../models/errors/gustoembeddederror.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { GetV1TokenInfoRequest, XGustoAPIVersion, } from "../models/operations/getv1tokeninfo.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildIntrospectionGetInfoQuery, IntrospectionGetInfoQueryData, prefetchIntrospectionGetInfo, queryKeyIntrospectionGetInfo, } from "./introspectionGetInfo.core.js"; export { buildIntrospectionGetInfoQuery, type IntrospectionGetInfoQueryData, prefetchIntrospectionGetInfo, queryKeyIntrospectionGetInfo, }; export type IntrospectionGetInfoQueryError = | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get info about the current access token * * @remarks * Returns scope and resource information associated with the current access token. Use this endpoint to verify the following for the current access token: * * Resource (company, employee, contractor, or application) and resource owner * * Access level */ export function useIntrospectionGetInfo( request: GetV1TokenInfoRequest, options?: QueryHookOptions< IntrospectionGetInfoQueryData, IntrospectionGetInfoQueryError >, ): UseQueryResult< IntrospectionGetInfoQueryData, IntrospectionGetInfoQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildIntrospectionGetInfoQuery( client, request, options, ), ...options, }); } /** * Get info about the current access token * * @remarks * Returns scope and resource information associated with the current access token. Use this endpoint to verify the following for the current access token: * * Resource (company, employee, contractor, or application) and resource owner * * Access level */ export function useIntrospectionGetInfoSuspense( request: GetV1TokenInfoRequest, options?: SuspenseQueryHookOptions< IntrospectionGetInfoQueryData, IntrospectionGetInfoQueryError >, ): UseSuspenseQueryResult< IntrospectionGetInfoQueryData, IntrospectionGetInfoQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildIntrospectionGetInfoQuery( client, request, options, ), ...options, }); } export function setIntrospectionGetInfoData( client: QueryClient, queryKeyBase: [ parameters: { xGustoAPIVersion?: XGustoAPIVersion | undefined }, ], data: IntrospectionGetInfoQueryData, ): IntrospectionGetInfoQueryData | undefined { const key = queryKeyIntrospectionGetInfo(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateIntrospectionGetInfo( client: QueryClient, queryKeyBase: TupleToPrefixes< [parameters: { xGustoAPIVersion?: XGustoAPIVersion | undefined }] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Introspection", "getInfo", ...queryKeyBase, ], }); } export function invalidateAllIntrospectionGetInfo( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Introspection", "getInfo"], }); }