/* * 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 { GetV1ContractorPaymentGroupsContractorPaymentGroupIdHeaderXGustoAPIVersion, GetV1ContractorPaymentGroupsContractorPaymentGroupIdRequest, } from "../models/operations/getv1contractorpaymentgroupscontractorpaymentgroupid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildContractorPaymentGroupsGetQuery, ContractorPaymentGroupsGetQueryData, prefetchContractorPaymentGroupsGet, queryKeyContractorPaymentGroupsGet, } from "./contractorPaymentGroupsGet.core.js"; export { buildContractorPaymentGroupsGetQuery, type ContractorPaymentGroupsGetQueryData, prefetchContractorPaymentGroupsGet, queryKeyContractorPaymentGroupsGet, }; export type ContractorPaymentGroupsGetQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a contractor payment group * * @remarks * Returns a contractor payment group with all associated contractor payments. * * scope: `payrolls:read` */ export function useContractorPaymentGroupsGet( request: GetV1ContractorPaymentGroupsContractorPaymentGroupIdRequest, options?: QueryHookOptions< ContractorPaymentGroupsGetQueryData, ContractorPaymentGroupsGetQueryError >, ): UseQueryResult< ContractorPaymentGroupsGetQueryData, ContractorPaymentGroupsGetQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildContractorPaymentGroupsGetQuery( client, request, options, ), ...options, }); } /** * Get a contractor payment group * * @remarks * Returns a contractor payment group with all associated contractor payments. * * scope: `payrolls:read` */ export function useContractorPaymentGroupsGetSuspense( request: GetV1ContractorPaymentGroupsContractorPaymentGroupIdRequest, options?: SuspenseQueryHookOptions< ContractorPaymentGroupsGetQueryData, ContractorPaymentGroupsGetQueryError >, ): UseSuspenseQueryResult< ContractorPaymentGroupsGetQueryData, ContractorPaymentGroupsGetQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildContractorPaymentGroupsGetQuery( client, request, options, ), ...options, }); } export function setContractorPaymentGroupsGetData( client: QueryClient, queryKeyBase: [ contractorPaymentGroupUuid: string, parameters: { xGustoAPIVersion?: | GetV1ContractorPaymentGroupsContractorPaymentGroupIdHeaderXGustoAPIVersion | undefined; }, ], data: ContractorPaymentGroupsGetQueryData, ): ContractorPaymentGroupsGetQueryData | undefined { const key = queryKeyContractorPaymentGroupsGet(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateContractorPaymentGroupsGet( client: QueryClient, queryKeyBase: TupleToPrefixes< [ contractorPaymentGroupUuid: string, parameters: { xGustoAPIVersion?: | GetV1ContractorPaymentGroupsContractorPaymentGroupIdHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "contractorPaymentGroups", "get", ...queryKeyBase, ], }); } export function invalidateAllContractorPaymentGroupsGet( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "contractorPaymentGroups", "get"], }); }