/* * 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 { GetV1CompaniesCompanyIdPaySchedulesAssignmentsHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdPaySchedulesAssignmentsRequest, } from "../models/operations/getv1companiescompanyidpayschedulesassignments.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPaySchedulesGetAssignmentsQuery, PaySchedulesGetAssignmentsQueryData, prefetchPaySchedulesGetAssignments, queryKeyPaySchedulesGetAssignments, } from "./paySchedulesGetAssignments.core.js"; export { buildPaySchedulesGetAssignmentsQuery, type PaySchedulesGetAssignmentsQueryData, prefetchPaySchedulesGetAssignments, queryKeyPaySchedulesGetAssignments, }; export type PaySchedulesGetAssignmentsQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get pay schedule assignments for a company * * @remarks * This endpoint returns the current pay schedule assignment for a company, with pay schedule and employee/department mappings depending on the pay schedule type. * * scope: `pay_schedules:read` */ export function usePaySchedulesGetAssignments( request: GetV1CompaniesCompanyIdPaySchedulesAssignmentsRequest, options?: QueryHookOptions< PaySchedulesGetAssignmentsQueryData, PaySchedulesGetAssignmentsQueryError >, ): UseQueryResult< PaySchedulesGetAssignmentsQueryData, PaySchedulesGetAssignmentsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPaySchedulesGetAssignmentsQuery( client, request, options, ), ...options, }); } /** * Get pay schedule assignments for a company * * @remarks * This endpoint returns the current pay schedule assignment for a company, with pay schedule and employee/department mappings depending on the pay schedule type. * * scope: `pay_schedules:read` */ export function usePaySchedulesGetAssignmentsSuspense( request: GetV1CompaniesCompanyIdPaySchedulesAssignmentsRequest, options?: SuspenseQueryHookOptions< PaySchedulesGetAssignmentsQueryData, PaySchedulesGetAssignmentsQueryError >, ): UseSuspenseQueryResult< PaySchedulesGetAssignmentsQueryData, PaySchedulesGetAssignmentsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPaySchedulesGetAssignmentsQuery( client, request, options, ), ...options, }); } export function setPaySchedulesGetAssignmentsData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdPaySchedulesAssignmentsHeaderXGustoAPIVersion | undefined; }, ], data: PaySchedulesGetAssignmentsQueryData, ): PaySchedulesGetAssignmentsQueryData | undefined { const key = queryKeyPaySchedulesGetAssignments(...queryKeyBase); return client.setQueryData(key, data); } export function invalidatePaySchedulesGetAssignments( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdPaySchedulesAssignmentsHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "paySchedules", "getAssignments", ...queryKeyBase, ], }); } export function invalidateAllPaySchedulesGetAssignments( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "paySchedules", "getAssignments"], }); }