/* * 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 { GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdRequest, } from "../models/operations/getv1companiescompanyidpayschedulespayscheduleid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPaySchedulesGetQuery, PaySchedulesGetQueryData, prefetchPaySchedulesGet, queryKeyPaySchedulesGet, } from "./paySchedulesGet.core.js"; export { buildPaySchedulesGetQuery, type PaySchedulesGetQueryData, prefetchPaySchedulesGet, queryKeyPaySchedulesGet, }; export type PaySchedulesGetQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a pay schedule * * @remarks * Returns a single pay schedule by UUID. The pay schedule object in Gusto captures the details of when employees work and when they should be paid. A company can have multiple pay schedules. * * scope: `pay_schedules:read` */ export function usePaySchedulesGet( request: GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdRequest, options?: QueryHookOptions< PaySchedulesGetQueryData, PaySchedulesGetQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPaySchedulesGetQuery( client, request, options, ), ...options, }); } /** * Get a pay schedule * * @remarks * Returns a single pay schedule by UUID. The pay schedule object in Gusto captures the details of when employees work and when they should be paid. A company can have multiple pay schedules. * * scope: `pay_schedules:read` */ export function usePaySchedulesGetSuspense( request: GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdRequest, options?: SuspenseQueryHookOptions< PaySchedulesGetQueryData, PaySchedulesGetQueryError >, ): UseSuspenseQueryResult { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPaySchedulesGetQuery( client, request, options, ), ...options, }); } export function setPaySchedulesGetData( client: QueryClient, queryKeyBase: [ companyId: string, payScheduleId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdHeaderXGustoAPIVersion | undefined; }, ], data: PaySchedulesGetQueryData, ): PaySchedulesGetQueryData | undefined { const key = queryKeyPaySchedulesGet(...queryKeyBase); return client.setQueryData(key, data); } export function invalidatePaySchedulesGet( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, payScheduleId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "paySchedules", "get", ...queryKeyBase], }); } export function invalidateAllPaySchedulesGet( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "paySchedules", "get"], }); }