/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { payrollCancellationsGetV1PayrollBatchesPayrollBatchUuid } from "../funcs/payrollCancellationsGetV1PayrollBatchesPayrollBatchUuid.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1PayrollBatchesPayrollBatchUuidHeaderXGustoAPIVersion, GetV1PayrollBatchesPayrollBatchUuidRequest, GetV1PayrollBatchesPayrollBatchUuidResponse, GetV1PayrollBatchesPayrollBatchUuidSecurity, } from "../models/operations/getv1payrollbatchespayrollbatchuuid.js"; import { unwrapAsync } from "../types/fp.js"; export type PayrollCancellationsGetV1PayrollBatchesPayrollBatchUuidQueryData = GetV1PayrollBatchesPayrollBatchUuidResponse; export function prefetchPayrollCancellationsGetV1PayrollBatchesPayrollBatchUuid( queryClient: QueryClient, client$: GustoEmbeddedCore, security: GetV1PayrollBatchesPayrollBatchUuidSecurity, request: GetV1PayrollBatchesPayrollBatchUuidRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildPayrollCancellationsGetV1PayrollBatchesPayrollBatchUuidQuery( client$, security, request, options, ), }); } export function buildPayrollCancellationsGetV1PayrollBatchesPayrollBatchUuidQuery( client$: GustoEmbeddedCore, security: GetV1PayrollBatchesPayrollBatchUuidSecurity, request: GetV1PayrollBatchesPayrollBatchUuidRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise< PayrollCancellationsGetV1PayrollBatchesPayrollBatchUuidQueryData >; } { return { queryKey: queryKeyPayrollCancellationsGetV1PayrollBatchesPayrollBatchUuid( request.payrollBatchUuid, { xGustoAPIVersion: request.xGustoAPIVersion }, ), queryFn: async function payrollCancellationsGetV1PayrollBatchesPayrollBatchUuidQueryFn( ctx, ): Promise< PayrollCancellationsGetV1PayrollBatchesPayrollBatchUuidQueryData > { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync( payrollCancellationsGetV1PayrollBatchesPayrollBatchUuid( client$, security, request, mergedOptions, ), ); }, }; } export function queryKeyPayrollCancellationsGetV1PayrollBatchesPayrollBatchUuid( payrollBatchUuid: string, parameters: { xGustoAPIVersion?: | GetV1PayrollBatchesPayrollBatchUuidHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "Payroll Cancellations", "getV1PayrollBatchesPayrollBatchUuid", payrollBatchUuid, parameters, ]; }