/* * 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 { GetV1TerminationsEmployeeIdHeaderXGustoAPIVersion, GetV1TerminationsEmployeeIdRequest, } from "../models/operations/getv1terminationsemployeeid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildEmployeeEmploymentsGetV1TerminationsEmployeeIdQuery, EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData, prefetchEmployeeEmploymentsGetV1TerminationsEmployeeId, queryKeyEmployeeEmploymentsGetV1TerminationsEmployeeId, } from "./employeeEmploymentsGetV1TerminationsEmployeeId.core.js"; export { buildEmployeeEmploymentsGetV1TerminationsEmployeeIdQuery, type EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData, prefetchEmployeeEmploymentsGetV1TerminationsEmployeeId, queryKeyEmployeeEmploymentsGetV1TerminationsEmployeeId, }; export type EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get an employee termination * * @remarks * Terminations are created whenever an employee is scheduled to leave the company. The only things required are an effective date (their last day of work) and whether they should receive their wages in a one-off termination payroll or with the rest of the company. * * Note that some states require employees to receive their final wages within 24 hours (unless they consent otherwise,) in which case running a one-off payroll may be the only option. * * scope: `employments:read` */ export function useEmployeeEmploymentsGetV1TerminationsEmployeeId( request: GetV1TerminationsEmployeeIdRequest, options?: QueryHookOptions< EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData, EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryError >, ): UseQueryResult< EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData, EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildEmployeeEmploymentsGetV1TerminationsEmployeeIdQuery( client, request, options, ), ...options, }); } /** * Get an employee termination * * @remarks * Terminations are created whenever an employee is scheduled to leave the company. The only things required are an effective date (their last day of work) and whether they should receive their wages in a one-off termination payroll or with the rest of the company. * * Note that some states require employees to receive their final wages within 24 hours (unless they consent otherwise,) in which case running a one-off payroll may be the only option. * * scope: `employments:read` */ export function useEmployeeEmploymentsGetV1TerminationsEmployeeIdSuspense( request: GetV1TerminationsEmployeeIdRequest, options?: SuspenseQueryHookOptions< EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData, EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryError >, ): UseSuspenseQueryResult< EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData, EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildEmployeeEmploymentsGetV1TerminationsEmployeeIdQuery( client, request, options, ), ...options, }); } export function setEmployeeEmploymentsGetV1TerminationsEmployeeIdData( client: QueryClient, queryKeyBase: [ employeeId: string, parameters: { xGustoAPIVersion?: | GetV1TerminationsEmployeeIdHeaderXGustoAPIVersion | undefined; }, ], data: EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData, ): EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData | undefined { const key = queryKeyEmployeeEmploymentsGetV1TerminationsEmployeeId( ...queryKeyBase, ); return client.setQueryData< EmployeeEmploymentsGetV1TerminationsEmployeeIdQueryData >(key, data); } export function invalidateEmployeeEmploymentsGetV1TerminationsEmployeeId( client: QueryClient, queryKeyBase: TupleToPrefixes< [ employeeId: string, parameters: { xGustoAPIVersion?: | GetV1TerminationsEmployeeIdHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "employeeEmployments", "getV1TerminationsEmployeeId", ...queryKeyBase, ], }); } export function invalidateAllEmployeeEmploymentsGetV1TerminationsEmployeeId( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "employeeEmployments", "getV1TerminationsEmployeeId", ], }); }