/* * 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 { GetV1CompaniesCompanyIdContractorsPaymentDetailsHeaderXGustoAPIVersion, GetV1CompaniesCompanyIdContractorsPaymentDetailsRequest, } from "../models/operations/getv1companiescompanyidcontractorspaymentdetails.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQuery, ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData, prefetchContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails, queryKeyContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails, } from "./contractorsGetV1CompaniesCompanyIdContractorsPaymentDetails.core.js"; export { buildContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQuery, type ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData, prefetchContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails, queryKeyContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails, }; export type ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * List contractor payment details * * @remarks * Get payment details for contractors in a company. This endpoint returns a list of all contractors * associated with the specified company, including their payment methods and bank account details * if they are paid via direct deposit. * * For contractors paid by direct deposit, the response includes their bank account information * with sensitive data masked for security. The payment details also include information about * how their payments are split if they have multiple bank accounts configured. * * For contractors paid by check, only the basic payment method information is returned. * * ### Response Details * - For direct deposit contractors: * - Bank account details (masked) * - Payment splits configuration * - Routing numbers * - Account types * - For check payments: * - Basic payment method designation * * ### Common Use Cases * - Fetching contractor payment information for payroll processing * - Verifying contractor payment methods * - Reviewing payment split configurations * * `encrypted_account_number` is available only with the additional scope `contractor_payment_methods:read:account_numbers`. * * scope: `contractor_payment_methods:read` */ export function useContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails( request: GetV1CompaniesCompanyIdContractorsPaymentDetailsRequest, options?: QueryHookOptions< ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData, ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryError >, ): UseQueryResult< ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData, ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQuery( client, request, options, ), ...options, }); } /** * List contractor payment details * * @remarks * Get payment details for contractors in a company. This endpoint returns a list of all contractors * associated with the specified company, including their payment methods and bank account details * if they are paid via direct deposit. * * For contractors paid by direct deposit, the response includes their bank account information * with sensitive data masked for security. The payment details also include information about * how their payments are split if they have multiple bank accounts configured. * * For contractors paid by check, only the basic payment method information is returned. * * ### Response Details * - For direct deposit contractors: * - Bank account details (masked) * - Payment splits configuration * - Routing numbers * - Account types * - For check payments: * - Basic payment method designation * * ### Common Use Cases * - Fetching contractor payment information for payroll processing * - Verifying contractor payment methods * - Reviewing payment split configurations * * `encrypted_account_number` is available only with the additional scope `contractor_payment_methods:read:account_numbers`. * * scope: `contractor_payment_methods:read` */ export function useContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsSuspense( request: GetV1CompaniesCompanyIdContractorsPaymentDetailsRequest, options?: SuspenseQueryHookOptions< ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData, ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryError >, ): UseSuspenseQueryResult< ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData, ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQuery( client, request, options, ), ...options, }); } export function setContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { contractorUuid?: string | undefined; contractorPaymentGroupUuid?: string | undefined; xGustoAPIVersion?: | GetV1CompaniesCompanyIdContractorsPaymentDetailsHeaderXGustoAPIVersion | undefined; }, ], data: ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData, ): | ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData | undefined { const key = queryKeyContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails( ...queryKeyBase, ); return client.setQueryData< ContractorsGetV1CompaniesCompanyIdContractorsPaymentDetailsQueryData >(key, data); } export function invalidateContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { contractorUuid?: string | undefined; contractorPaymentGroupUuid?: string | undefined; xGustoAPIVersion?: | GetV1CompaniesCompanyIdContractorsPaymentDetailsHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Contractors", "getV1CompaniesCompanyIdContractorsPaymentDetails", ...queryKeyBase, ], }); } export function invalidateAllContractorsGetV1CompaniesCompanyIdContractorsPaymentDetails( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Contractors", "getV1CompaniesCompanyIdContractorsPaymentDetails", ], }); }