/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { introspectionGetInfo } from "../funcs/introspectionGetInfo.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1TokenInfoRequest, GetV1TokenInfoResponse, XGustoAPIVersion, } from "../models/operations/getv1tokeninfo.js"; import { unwrapAsync } from "../types/fp.js"; export type IntrospectionGetInfoQueryData = GetV1TokenInfoResponse; export function prefetchIntrospectionGetInfo( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1TokenInfoRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildIntrospectionGetInfoQuery( client$, request, options, ), }); } export function buildIntrospectionGetInfoQuery( client$: GustoEmbeddedCore, request: GetV1TokenInfoRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyIntrospectionGetInfo({ xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function introspectionGetInfoQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(introspectionGetInfo( client$, request, mergedOptions, )); }, }; } export function queryKeyIntrospectionGetInfo( parameters: { xGustoAPIVersion?: XGustoAPIVersion | undefined }, ): QueryKey { return ["@gusto/embedded-api", "Introspection", "getInfo", parameters]; }