/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { InvalidateQueryFilters, QueryClient, useQuery, UseQueryResult, useSuspenseQuery, UseSuspenseQueryResult, } from "@tanstack/react-query"; import { GustoEmbeddedError } from "../models/errors/gustoembeddederror.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { NotFoundErrorObject } from "../models/errors/notfounderrorobject.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { GetV1CompaniesCompanyIdContractorPaymentGroupsHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdContractorPaymentGroupsRequest, } from "../models/operations/getv1companiescompanyidcontractorpaymentgroups.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildContractorPaymentGroupsGetListQuery, ContractorPaymentGroupsGetListQueryData, prefetchContractorPaymentGroupsGetList, queryKeyContractorPaymentGroupsGetList, } from "./contractorPaymentGroupsGetList.core.js"; export { buildContractorPaymentGroupsGetListQuery, type ContractorPaymentGroupsGetListQueryData, prefetchContractorPaymentGroupsGetList, queryKeyContractorPaymentGroupsGetList, }; export type ContractorPaymentGroupsGetListQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get contractor payment groups for a company * * @remarks * Returns a list of minimal contractor payment groups within a given time period, including totals but not associated contractor payments. * * scope: `payrolls:read` */ export function useContractorPaymentGroupsGetList( request: GetV1CompaniesCompanyIdContractorPaymentGroupsRequest, options?: QueryHookOptions< ContractorPaymentGroupsGetListQueryData, ContractorPaymentGroupsGetListQueryError >, ): UseQueryResult< ContractorPaymentGroupsGetListQueryData, ContractorPaymentGroupsGetListQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildContractorPaymentGroupsGetListQuery( client, request, options, ), ...options, }); } /** * Get contractor payment groups for a company * * @remarks * Returns a list of minimal contractor payment groups within a given time period, including totals but not associated contractor payments. * * scope: `payrolls:read` */ export function useContractorPaymentGroupsGetListSuspense( request: GetV1CompaniesCompanyIdContractorPaymentGroupsRequest, options?: SuspenseQueryHookOptions< ContractorPaymentGroupsGetListQueryData, ContractorPaymentGroupsGetListQueryError >, ): UseSuspenseQueryResult< ContractorPaymentGroupsGetListQueryData, ContractorPaymentGroupsGetListQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildContractorPaymentGroupsGetListQuery( client, request, options, ), ...options, }); } export function setContractorPaymentGroupsGetListData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { startDate?: string | undefined; endDate?: string | undefined; page?: number | undefined; per?: number | undefined; xGustoAPIVersion?: | GetV1CompaniesCompanyIdContractorPaymentGroupsHeaderXGustoAPIVersion | undefined; }, ], data: ContractorPaymentGroupsGetListQueryData, ): ContractorPaymentGroupsGetListQueryData | undefined { const key = queryKeyContractorPaymentGroupsGetList(...queryKeyBase); return client.setQueryData( key, data, ); } export function invalidateContractorPaymentGroupsGetList( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { startDate?: string | undefined; endDate?: string | undefined; page?: number | undefined; per?: number | undefined; xGustoAPIVersion?: | GetV1CompaniesCompanyIdContractorPaymentGroupsHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "contractorPaymentGroups", "getList", ...queryKeyBase, ], }); } export function invalidateAllContractorPaymentGroupsGetList( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "contractorPaymentGroups", "getList"], }); }