/* * 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 { GetV1CompaniesPayrollBlockersCompanyUuidHeaderXGustoAPIVersion, GetV1CompaniesPayrollBlockersCompanyUuidRequest, } from "../models/operations/getv1companiespayrollblockerscompanyuuid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPayrollsGetBlockersQuery, PayrollsGetBlockersQueryData, prefetchPayrollsGetBlockers, queryKeyPayrollsGetBlockers, } from "./payrollsGetBlockers.core.js"; export { buildPayrollsGetBlockersQuery, type PayrollsGetBlockersQueryData, prefetchPayrollsGetBlockers, queryKeyPayrollsGetBlockers, }; export type PayrollsGetBlockersQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get all payroll blockers for a company * * @remarks * Returns a list of reasons that prevent the company from running payrolls. See the [Payroll Blockers guide](doc:payroll-blockers) for a complete list of reasons. The list is empty if there are no payroll blockers. * * scope: `payrolls:run` */ export function usePayrollsGetBlockers( request: GetV1CompaniesPayrollBlockersCompanyUuidRequest, options?: QueryHookOptions< PayrollsGetBlockersQueryData, PayrollsGetBlockersQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPayrollsGetBlockersQuery( client, request, options, ), ...options, }); } /** * Get all payroll blockers for a company * * @remarks * Returns a list of reasons that prevent the company from running payrolls. See the [Payroll Blockers guide](doc:payroll-blockers) for a complete list of reasons. The list is empty if there are no payroll blockers. * * scope: `payrolls:run` */ export function usePayrollsGetBlockersSuspense( request: GetV1CompaniesPayrollBlockersCompanyUuidRequest, options?: SuspenseQueryHookOptions< PayrollsGetBlockersQueryData, PayrollsGetBlockersQueryError >, ): UseSuspenseQueryResult< PayrollsGetBlockersQueryData, PayrollsGetBlockersQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPayrollsGetBlockersQuery( client, request, options, ), ...options, }); } export function setPayrollsGetBlockersData( client: QueryClient, queryKeyBase: [ companyUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesPayrollBlockersCompanyUuidHeaderXGustoAPIVersion | undefined; }, ], data: PayrollsGetBlockersQueryData, ): PayrollsGetBlockersQueryData | undefined { const key = queryKeyPayrollsGetBlockers(...queryKeyBase); return client.setQueryData(key, data); } export function invalidatePayrollsGetBlockers( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesPayrollBlockersCompanyUuidHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Payrolls", "getBlockers", ...queryKeyBase, ], }); } export function invalidateAllPayrollsGetBlockers( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Payrolls", "getBlockers"], }); }