/* * 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 { GetV1EmployeeBenefitsEmployeeBenefitIdHeaderXGustoAPIVersion, GetV1EmployeeBenefitsEmployeeBenefitIdRequest, } from "../models/operations/getv1employeebenefitsemployeebenefitid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildEmployeeBenefitsRetrieveQuery, EmployeeBenefitsRetrieveQueryData, prefetchEmployeeBenefitsRetrieve, queryKeyEmployeeBenefitsRetrieve, } from "./employeeBenefitsRetrieve.core.js"; export { buildEmployeeBenefitsRetrieveQuery, type EmployeeBenefitsRetrieveQueryData, prefetchEmployeeBenefitsRetrieve, queryKeyEmployeeBenefitsRetrieve, }; export type EmployeeBenefitsRetrieveQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get an employee benefit * * @remarks * Employee benefits represent an employee enrolled in a particular company benefit. It includes information specific to that employee’s enrollment. * * Benefits containing PHI are only visible to applications with the `employee_benefits:read:phi` scope. * * scope: `employee_benefits:read` */ export function useEmployeeBenefitsRetrieve( request: GetV1EmployeeBenefitsEmployeeBenefitIdRequest, options?: QueryHookOptions< EmployeeBenefitsRetrieveQueryData, EmployeeBenefitsRetrieveQueryError >, ): UseQueryResult< EmployeeBenefitsRetrieveQueryData, EmployeeBenefitsRetrieveQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildEmployeeBenefitsRetrieveQuery( client, request, options, ), ...options, }); } /** * Get an employee benefit * * @remarks * Employee benefits represent an employee enrolled in a particular company benefit. It includes information specific to that employee’s enrollment. * * Benefits containing PHI are only visible to applications with the `employee_benefits:read:phi` scope. * * scope: `employee_benefits:read` */ export function useEmployeeBenefitsRetrieveSuspense( request: GetV1EmployeeBenefitsEmployeeBenefitIdRequest, options?: SuspenseQueryHookOptions< EmployeeBenefitsRetrieveQueryData, EmployeeBenefitsRetrieveQueryError >, ): UseSuspenseQueryResult< EmployeeBenefitsRetrieveQueryData, EmployeeBenefitsRetrieveQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildEmployeeBenefitsRetrieveQuery( client, request, options, ), ...options, }); } export function setEmployeeBenefitsRetrieveData( client: QueryClient, queryKeyBase: [ employeeBenefitId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeeBenefitsEmployeeBenefitIdHeaderXGustoAPIVersion | undefined; }, ], data: EmployeeBenefitsRetrieveQueryData, ): EmployeeBenefitsRetrieveQueryData | undefined { const key = queryKeyEmployeeBenefitsRetrieve(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateEmployeeBenefitsRetrieve( client: QueryClient, queryKeyBase: TupleToPrefixes< [ employeeBenefitId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeeBenefitsEmployeeBenefitIdHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "employeeBenefits", "retrieve", ...queryKeyBase, ], }); } export function invalidateAllEmployeeBenefitsRetrieve( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "employeeBenefits", "retrieve"], }); }