/* * 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 { GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsRequest, } from "../models/operations/getv1companiescompanyidunprocessedterminationpayperiods.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPaySchedulesGetUnprocessedTerminationPeriodsQuery, PaySchedulesGetUnprocessedTerminationPeriodsQueryData, prefetchPaySchedulesGetUnprocessedTerminationPeriods, queryKeyPaySchedulesGetUnprocessedTerminationPeriods, } from "./paySchedulesGetUnprocessedTerminationPeriods.core.js"; export { buildPaySchedulesGetUnprocessedTerminationPeriodsQuery, type PaySchedulesGetUnprocessedTerminationPeriodsQueryData, prefetchPaySchedulesGetUnprocessedTerminationPeriods, queryKeyPaySchedulesGetUnprocessedTerminationPeriods, }; export type PaySchedulesGetUnprocessedTerminationPeriodsQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get termination pay periods for a company * * @remarks * When a payroll admin terminates an employee and selects "Dismissal Payroll" as the employee's final payroll, their last pay period will appear on the list. * * This endpoint returns the unprocessed pay periods for past and future terminated employees in a given company. * * scope: `payrolls:read` */ export function usePaySchedulesGetUnprocessedTerminationPeriods( request: GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsRequest, options?: QueryHookOptions< PaySchedulesGetUnprocessedTerminationPeriodsQueryData, PaySchedulesGetUnprocessedTerminationPeriodsQueryError >, ): UseQueryResult< PaySchedulesGetUnprocessedTerminationPeriodsQueryData, PaySchedulesGetUnprocessedTerminationPeriodsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPaySchedulesGetUnprocessedTerminationPeriodsQuery( client, request, options, ), ...options, }); } /** * Get termination pay periods for a company * * @remarks * When a payroll admin terminates an employee and selects "Dismissal Payroll" as the employee's final payroll, their last pay period will appear on the list. * * This endpoint returns the unprocessed pay periods for past and future terminated employees in a given company. * * scope: `payrolls:read` */ export function usePaySchedulesGetUnprocessedTerminationPeriodsSuspense( request: GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsRequest, options?: SuspenseQueryHookOptions< PaySchedulesGetUnprocessedTerminationPeriodsQueryData, PaySchedulesGetUnprocessedTerminationPeriodsQueryError >, ): UseSuspenseQueryResult< PaySchedulesGetUnprocessedTerminationPeriodsQueryData, PaySchedulesGetUnprocessedTerminationPeriodsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPaySchedulesGetUnprocessedTerminationPeriodsQuery( client, request, options, ), ...options, }); } export function setPaySchedulesGetUnprocessedTerminationPeriodsData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsHeaderXGustoAPIVersion | undefined; }, ], data: PaySchedulesGetUnprocessedTerminationPeriodsQueryData, ): PaySchedulesGetUnprocessedTerminationPeriodsQueryData | undefined { const key = queryKeyPaySchedulesGetUnprocessedTerminationPeriods( ...queryKeyBase, ); return client.setQueryData< PaySchedulesGetUnprocessedTerminationPeriodsQueryData >(key, data); } export function invalidatePaySchedulesGetUnprocessedTerminationPeriods( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "paySchedules", "getUnprocessedTerminationPeriods", ...queryKeyBase, ], }); } export function invalidateAllPaySchedulesGetUnprocessedTerminationPeriods( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "paySchedules", "getUnprocessedTerminationPeriods", ], }); }