/* * 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 { GetV1EmployeesEmployeeIdJobsHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdJobsQueryParamInclude, GetV1EmployeesEmployeeIdJobsRequest, } from "../models/operations/getv1employeesemployeeidjobs.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildJobsAndCompensationsGetJobsQuery, JobsAndCompensationsGetJobsQueryData, prefetchJobsAndCompensationsGetJobs, queryKeyJobsAndCompensationsGetJobs, } from "./jobsAndCompensationsGetJobs.core.js"; export { buildJobsAndCompensationsGetJobsQuery, type JobsAndCompensationsGetJobsQueryData, prefetchJobsAndCompensationsGetJobs, queryKeyJobsAndCompensationsGetJobs, }; export type JobsAndCompensationsGetJobsQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get jobs for an employee * * @remarks * Get all of the jobs that an employee holds. * Note: Compensation data (pay rate, payment unit, and related fields) represents sensitive employee pay information. When retrieving employee job data, these fields (`rate`, `payment_unit`, `current_compensation_uuid`, `compensations`) are only returned when the `compensations:read` scope is included. This allows you to access employee and job metadata without exposing pay rates. * * Compensation data in the response requires the `compensations:read` scope. * * scope: `jobs:read` */ export function useJobsAndCompensationsGetJobs( request: GetV1EmployeesEmployeeIdJobsRequest, options?: QueryHookOptions< JobsAndCompensationsGetJobsQueryData, JobsAndCompensationsGetJobsQueryError >, ): UseQueryResult< JobsAndCompensationsGetJobsQueryData, JobsAndCompensationsGetJobsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildJobsAndCompensationsGetJobsQuery( client, request, options, ), ...options, }); } /** * Get jobs for an employee * * @remarks * Get all of the jobs that an employee holds. * Note: Compensation data (pay rate, payment unit, and related fields) represents sensitive employee pay information. When retrieving employee job data, these fields (`rate`, `payment_unit`, `current_compensation_uuid`, `compensations`) are only returned when the `compensations:read` scope is included. This allows you to access employee and job metadata without exposing pay rates. * * Compensation data in the response requires the `compensations:read` scope. * * scope: `jobs:read` */ export function useJobsAndCompensationsGetJobsSuspense( request: GetV1EmployeesEmployeeIdJobsRequest, options?: SuspenseQueryHookOptions< JobsAndCompensationsGetJobsQueryData, JobsAndCompensationsGetJobsQueryError >, ): UseSuspenseQueryResult< JobsAndCompensationsGetJobsQueryData, JobsAndCompensationsGetJobsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildJobsAndCompensationsGetJobsQuery( client, request, options, ), ...options, }); } export function setJobsAndCompensationsGetJobsData( client: QueryClient, queryKeyBase: [ employeeId: string, parameters: { page?: number | undefined; per?: number | undefined; include?: GetV1EmployeesEmployeeIdJobsQueryParamInclude | undefined; xGustoAPIVersion?: | GetV1EmployeesEmployeeIdJobsHeaderXGustoAPIVersion | undefined; }, ], data: JobsAndCompensationsGetJobsQueryData, ): JobsAndCompensationsGetJobsQueryData | undefined { const key = queryKeyJobsAndCompensationsGetJobs(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateJobsAndCompensationsGetJobs( client: QueryClient, queryKeyBase: TupleToPrefixes< [ employeeId: string, parameters: { page?: number | undefined; per?: number | undefined; include?: GetV1EmployeesEmployeeIdJobsQueryParamInclude | undefined; xGustoAPIVersion?: | GetV1EmployeesEmployeeIdJobsHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "jobsAndCompensations", "getJobs", ...queryKeyBase, ], }); } export function invalidateAllJobsAndCompensationsGetJobs( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "jobsAndCompensations", "getJobs"], }); }