/* * 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 { GetV1JobsJobIdHeaderXGustoAPIVersion, GetV1JobsJobIdQueryParamInclude, GetV1JobsJobIdRequest, } from "../models/operations/getv1jobsjobid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildJobsAndCompensationsGetJobQuery, JobsAndCompensationsGetJobQueryData, prefetchJobsAndCompensationsGetJob, queryKeyJobsAndCompensationsGetJob, } from "./jobsAndCompensationsGetJob.core.js"; export { buildJobsAndCompensationsGetJobQuery, type JobsAndCompensationsGetJobQueryData, prefetchJobsAndCompensationsGetJob, queryKeyJobsAndCompensationsGetJob, }; export type JobsAndCompensationsGetJobQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a job * * @remarks * Get a job. * * 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 useJobsAndCompensationsGetJob( request: GetV1JobsJobIdRequest, options?: QueryHookOptions< JobsAndCompensationsGetJobQueryData, JobsAndCompensationsGetJobQueryError >, ): UseQueryResult< JobsAndCompensationsGetJobQueryData, JobsAndCompensationsGetJobQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildJobsAndCompensationsGetJobQuery( client, request, options, ), ...options, }); } /** * Get a job * * @remarks * Get a job. * * 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 useJobsAndCompensationsGetJobSuspense( request: GetV1JobsJobIdRequest, options?: SuspenseQueryHookOptions< JobsAndCompensationsGetJobQueryData, JobsAndCompensationsGetJobQueryError >, ): UseSuspenseQueryResult< JobsAndCompensationsGetJobQueryData, JobsAndCompensationsGetJobQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildJobsAndCompensationsGetJobQuery( client, request, options, ), ...options, }); } export function setJobsAndCompensationsGetJobData( client: QueryClient, queryKeyBase: [ jobId: string, parameters: { include?: GetV1JobsJobIdQueryParamInclude | undefined; xGustoAPIVersion?: GetV1JobsJobIdHeaderXGustoAPIVersion | undefined; }, ], data: JobsAndCompensationsGetJobQueryData, ): JobsAndCompensationsGetJobQueryData | undefined { const key = queryKeyJobsAndCompensationsGetJob(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateJobsAndCompensationsGetJob( client: QueryClient, queryKeyBase: TupleToPrefixes< [ jobId: string, parameters: { include?: GetV1JobsJobIdQueryParamInclude | undefined; xGustoAPIVersion?: GetV1JobsJobIdHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "jobsAndCompensations", "getJob", ...queryKeyBase, ], }); } export function invalidateAllJobsAndCompensationsGetJob( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "jobsAndCompensations", "getJob"], }); }