/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { contractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf } from "../funcs/contractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1ContractorPaymentsContractorPaymentIdPdfHeaderXGustoAPIVersion, GetV1ContractorPaymentsContractorPaymentIdPdfRequest, GetV1ContractorPaymentsContractorPaymentIdPdfResponse, } from "../models/operations/getv1contractorpaymentscontractorpaymentidpdf.js"; import { unwrapAsync } from "../types/fp.js"; export type ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData = GetV1ContractorPaymentsContractorPaymentIdPdfResponse; export function prefetchContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1ContractorPaymentsContractorPaymentIdPdfRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQuery( client$, request, options, ), }); } export function buildContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQuery( client$: GustoEmbeddedCore, request: GetV1ContractorPaymentsContractorPaymentIdPdfRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise< ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData >; } { return { queryKey: queryKeyContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( request.contractorPaymentId, { xGustoAPIVersion: request.xGustoAPIVersion }, ), queryFn: async function contractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryFn( ctx, ): Promise< ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData > { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync( contractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( client$, request, mergedOptions, ), ); }, }; } export function queryKeyContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( contractorPaymentId: string, parameters: { xGustoAPIVersion?: | GetV1ContractorPaymentsContractorPaymentIdPdfHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "contractorPayments", "getV1ContractorPaymentsContractorPaymentIdPdf", contractorPaymentId, parameters, ]; }