/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { contractorPaymentGroupsGetList } from "../funcs/contractorPaymentGroupsGetList.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1CompaniesCompanyIdContractorPaymentGroupsHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdContractorPaymentGroupsRequest, GetV1CompaniesCompanyIdContractorPaymentGroupsResponse, } from "../models/operations/getv1companiescompanyidcontractorpaymentgroups.js"; import { unwrapAsync } from "../types/fp.js"; export type ContractorPaymentGroupsGetListQueryData = GetV1CompaniesCompanyIdContractorPaymentGroupsResponse; export function prefetchContractorPaymentGroupsGetList( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1CompaniesCompanyIdContractorPaymentGroupsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildContractorPaymentGroupsGetListQuery( client$, request, options, ), }); } export function buildContractorPaymentGroupsGetListQuery( client$: GustoEmbeddedCore, request: GetV1CompaniesCompanyIdContractorPaymentGroupsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyContractorPaymentGroupsGetList(request.companyId, { startDate: request.startDate, endDate: request.endDate, page: request.page, per: request.per, xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function contractorPaymentGroupsGetListQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(contractorPaymentGroupsGetList( client$, request, mergedOptions, )); }, }; } export function queryKeyContractorPaymentGroupsGetList( companyId: string, parameters: { startDate?: string | undefined; endDate?: string | undefined; page?: number | undefined; per?: number | undefined; xGustoAPIVersion?: | GetV1CompaniesCompanyIdContractorPaymentGroupsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "contractorPaymentGroups", "getList", companyId, parameters, ]; }