/* * 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 { UnprocessableEntityError } from "../models/errors/unprocessableentityerror.js"; import { GetV1CompaniesCompanyIdEmployeesPaymentDetailsHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdEmployeesPaymentDetailsRequest, } from "../models/operations/getv1companiescompanyidemployeespaymentdetails.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQuery, EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData, prefetchEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails, queryKeyEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails, } from "./employeesGetV1CompaniesCompanyIdEmployeesPaymentDetails.core.js"; export { buildEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQuery, type EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData, prefetchEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails, queryKeyEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails, }; export type EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get employee payment details for a company * * @remarks * Fetches payment details for employees in a given company. Results are paginated. * * Use the `employee_uuid` query parameter to filter for a single employee. * Use the `payroll_uuid` query parameter to filter for employees on a specific payroll. * Providing both `employee_uuid` and `payroll_uuid` will result in a 422 error. * An empty array is returned if the company has no employees or if no employees match the filter criteria. * * The `encrypted_account_number` in the `splits` array is only visible if the `employee_payment_methods:read:account_number` scope is present. * * scope: `employee_payment_methods:read` */ export function useEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails( request: GetV1CompaniesCompanyIdEmployeesPaymentDetailsRequest, options?: QueryHookOptions< EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData, EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryError >, ): UseQueryResult< EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData, EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQuery( client, request, options, ), ...options, }); } /** * Get employee payment details for a company * * @remarks * Fetches payment details for employees in a given company. Results are paginated. * * Use the `employee_uuid` query parameter to filter for a single employee. * Use the `payroll_uuid` query parameter to filter for employees on a specific payroll. * Providing both `employee_uuid` and `payroll_uuid` will result in a 422 error. * An empty array is returned if the company has no employees or if no employees match the filter criteria. * * The `encrypted_account_number` in the `splits` array is only visible if the `employee_payment_methods:read:account_number` scope is present. * * scope: `employee_payment_methods:read` */ export function useEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsSuspense( request: GetV1CompaniesCompanyIdEmployeesPaymentDetailsRequest, options?: SuspenseQueryHookOptions< EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData, EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryError >, ): UseSuspenseQueryResult< EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData, EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQuery( client, request, options, ), ...options, }); } export function setEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdEmployeesPaymentDetailsHeaderXGustoAPIVersion | undefined; employeeUuid?: string | undefined; payrollUuid?: string | undefined; page?: number | undefined; per?: number | undefined; }, ], data: EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData, ): | EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData | undefined { const key = queryKeyEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails( ...queryKeyBase, ); return client.setQueryData< EmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetailsQueryData >(key, data); } export function invalidateEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesCompanyIdEmployeesPaymentDetailsHeaderXGustoAPIVersion | undefined; employeeUuid?: string | undefined; payrollUuid?: string | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Employees", "getV1CompaniesCompanyIdEmployeesPaymentDetails", ...queryKeyBase, ], }); } export function invalidateAllEmployeesGetV1CompaniesCompanyIdEmployeesPaymentDetails( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Employees", "getV1CompaniesCompanyIdEmployeesPaymentDetails", ], }); }