/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { employeeBenefitsRetrieve } from "../funcs/employeeBenefitsRetrieve.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeeBenefitsEmployeeBenefitIdHeaderXGustoAPIVersion, GetV1EmployeeBenefitsEmployeeBenefitIdRequest, GetV1EmployeeBenefitsEmployeeBenefitIdResponse, } from "../models/operations/getv1employeebenefitsemployeebenefitid.js"; import { unwrapAsync } from "../types/fp.js"; export type EmployeeBenefitsRetrieveQueryData = GetV1EmployeeBenefitsEmployeeBenefitIdResponse; export function prefetchEmployeeBenefitsRetrieve( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeeBenefitsEmployeeBenefitIdRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildEmployeeBenefitsRetrieveQuery( client$, request, options, ), }); } export function buildEmployeeBenefitsRetrieveQuery( client$: GustoEmbeddedCore, request: GetV1EmployeeBenefitsEmployeeBenefitIdRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyEmployeeBenefitsRetrieve(request.employeeBenefitId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function employeeBenefitsRetrieveQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(employeeBenefitsRetrieve( client$, request, mergedOptions, )); }, }; } export function queryKeyEmployeeBenefitsRetrieve( employeeBenefitId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeeBenefitsEmployeeBenefitIdHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "employeeBenefits", "retrieve", employeeBenefitId, parameters, ]; }