/* * 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 { GetV1EmployeesEmployeeIdRehireHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdRehireRequest, } from "../models/operations/getv1employeesemployeeidrehire.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildEmployeeEmploymentsGetRehireQuery, EmployeeEmploymentsGetRehireQueryData, prefetchEmployeeEmploymentsGetRehire, queryKeyEmployeeEmploymentsGetRehire, } from "./employeeEmploymentsGetRehire.core.js"; export { buildEmployeeEmploymentsGetRehireQuery, type EmployeeEmploymentsGetRehireQueryData, prefetchEmployeeEmploymentsGetRehire, queryKeyEmployeeEmploymentsGetRehire, }; export type EmployeeEmploymentsGetRehireQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get an employee rehire * * @remarks * Retrieve an employee's rehire, which contains information on when the employee returns to work. * * scope: `employments:read` */ export function useEmployeeEmploymentsGetRehire( request: GetV1EmployeesEmployeeIdRehireRequest, options?: QueryHookOptions< EmployeeEmploymentsGetRehireQueryData, EmployeeEmploymentsGetRehireQueryError >, ): UseQueryResult< EmployeeEmploymentsGetRehireQueryData, EmployeeEmploymentsGetRehireQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildEmployeeEmploymentsGetRehireQuery( client, request, options, ), ...options, }); } /** * Get an employee rehire * * @remarks * Retrieve an employee's rehire, which contains information on when the employee returns to work. * * scope: `employments:read` */ export function useEmployeeEmploymentsGetRehireSuspense( request: GetV1EmployeesEmployeeIdRehireRequest, options?: SuspenseQueryHookOptions< EmployeeEmploymentsGetRehireQueryData, EmployeeEmploymentsGetRehireQueryError >, ): UseSuspenseQueryResult< EmployeeEmploymentsGetRehireQueryData, EmployeeEmploymentsGetRehireQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildEmployeeEmploymentsGetRehireQuery( client, request, options, ), ...options, }); } export function setEmployeeEmploymentsGetRehireData( client: QueryClient, queryKeyBase: [ employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdRehireHeaderXGustoAPIVersion | undefined; }, ], data: EmployeeEmploymentsGetRehireQueryData, ): EmployeeEmploymentsGetRehireQueryData | undefined { const key = queryKeyEmployeeEmploymentsGetRehire(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateEmployeeEmploymentsGetRehire( client: QueryClient, queryKeyBase: TupleToPrefixes< [ employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdRehireHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "employeeEmployments", "getRehire", ...queryKeyBase, ], }); } export function invalidateAllEmployeeEmploymentsGetRehire( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "employeeEmployments", "getRehire"], }); }