/* * 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 { GetV1CompaniesCompanyIdPaySchedulesHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdPaySchedulesRequest, } from "../models/operations/getv1companiescompanyidpayschedules.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPaySchedulesGetAllQuery, PaySchedulesGetAllQueryData, prefetchPaySchedulesGetAll, queryKeyPaySchedulesGetAll, } from "./paySchedulesGetAll.core.js"; export { buildPaySchedulesGetAllQuery, type PaySchedulesGetAllQueryData, prefetchPaySchedulesGetAll, queryKeyPaySchedulesGetAll, }; export type PaySchedulesGetAllQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get the pay schedules for a company * * @remarks * Returns all pay schedules for a company. The pay schedule object 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 usePaySchedulesGetAll( request: GetV1CompaniesCompanyIdPaySchedulesRequest, options?: QueryHookOptions< PaySchedulesGetAllQueryData, PaySchedulesGetAllQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPaySchedulesGetAllQuery( client, request, options, ), ...options, }); } /** * Get the pay schedules for a company * * @remarks * Returns all pay schedules for a company. The pay schedule object 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 usePaySchedulesGetAllSuspense( request: GetV1CompaniesCompanyIdPaySchedulesRequest, options?: SuspenseQueryHookOptions< PaySchedulesGetAllQueryData, PaySchedulesGetAllQueryError >, ): UseSuspenseQueryResult< PaySchedulesGetAllQueryData, PaySchedulesGetAllQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPaySchedulesGetAllQuery( client, request, options, ), ...options, }); } export function setPaySchedulesGetAllData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdPaySchedulesHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ], data: PaySchedulesGetAllQueryData, ): PaySchedulesGetAllQueryData | undefined { const key = queryKeyPaySchedulesGetAll(...queryKeyBase); return client.setQueryData(key, data); } export function invalidatePaySchedulesGetAll( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdPaySchedulesHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "paySchedules", "getAll", ...queryKeyBase, ], }); } export function invalidateAllPaySchedulesGetAll( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "paySchedules", "getAll"], }); }