/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { payrollsGetPayStub } from "../funcs/payrollsGetPayStub.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubHeaderXGustoAPIVersion, GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubResponse, } from "../models/operations/getv1payrollspayrolluuidemployeesemployeeuuidpaystub.js"; import { unwrapAsync } from "../types/fp.js"; export type PayrollsGetPayStubQueryData = GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubResponse; export function prefetchPayrollsGetPayStub( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildPayrollsGetPayStubQuery( client$, request, options, ), }); } export function buildPayrollsGetPayStubQuery( client$: GustoEmbeddedCore, request: GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyPayrollsGetPayStub( request.payrollId, request.employeeId, { xGustoAPIVersion: request.xGustoAPIVersion }, ), queryFn: async function payrollsGetPayStubQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(payrollsGetPayStub( client$, request, mergedOptions, )); }, }; } export function queryKeyPayrollsGetPayStub( payrollId: string, employeeId: string, parameters: { xGustoAPIVersion?: | GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "Payrolls", "getPayStub", payrollId, employeeId, parameters, ]; }