/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { wireInRequestsGet } from "../funcs/wireInRequestsGet.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetWireInRequestsWireInRequestUuidHeaderXGustoAPIVersion, GetWireInRequestsWireInRequestUuidRequest, GetWireInRequestsWireInRequestUuidResponse, } from "../models/operations/getwireinrequestswireinrequestuuid.js"; import { unwrapAsync } from "../types/fp.js"; export type WireInRequestsGetQueryData = GetWireInRequestsWireInRequestUuidResponse; export function prefetchWireInRequestsGet( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetWireInRequestsWireInRequestUuidRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildWireInRequestsGetQuery( client$, request, options, ), }); } export function buildWireInRequestsGetQuery( client$: GustoEmbeddedCore, request: GetWireInRequestsWireInRequestUuidRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyWireInRequestsGet(request.wireInRequestUuid, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function wireInRequestsGetQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(wireInRequestsGet( client$, request, mergedOptions, )); }, }; } export function queryKeyWireInRequestsGet( wireInRequestUuid: string, parameters: { xGustoAPIVersion?: | GetWireInRequestsWireInRequestUuidHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "wireInRequests", "get", wireInRequestUuid, parameters, ]; }