/* * 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 { GetV1ContractorsContractorUuidPaymentsHeaderXGustoAPIVersion, GetV1ContractorsContractorUuidPaymentsRequest, } from "../models/operations/getv1contractorscontractoruuidpayments.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildContractorPaymentsGetV1ContractorsContractorUuidPaymentsQuery, ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData, prefetchContractorPaymentsGetV1ContractorsContractorUuidPayments, queryKeyContractorPaymentsGetV1ContractorsContractorUuidPayments, } from "./contractorPaymentsGetV1ContractorsContractorUuidPayments.core.js"; export { buildContractorPaymentsGetV1ContractorsContractorUuidPaymentsQuery, type ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData, prefetchContractorPaymentsGetV1ContractorsContractorUuidPayments, queryKeyContractorPaymentsGetV1ContractorsContractorUuidPayments, }; export type ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get contractor payments * * @remarks * Returns a paginated list of payments for a single contractor. * * Results are sortable by `check_date` or `created_at`. Append `:asc` or `:desc` to control direction (e.g., `check_date:desc`). * * scope: `contractor_pay_stubs:read` */ export function useContractorPaymentsGetV1ContractorsContractorUuidPayments( request: GetV1ContractorsContractorUuidPaymentsRequest, options?: QueryHookOptions< ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData, ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryError >, ): UseQueryResult< ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData, ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildContractorPaymentsGetV1ContractorsContractorUuidPaymentsQuery( client, request, options, ), ...options, }); } /** * Get contractor payments * * @remarks * Returns a paginated list of payments for a single contractor. * * Results are sortable by `check_date` or `created_at`. Append `:asc` or `:desc` to control direction (e.g., `check_date:desc`). * * scope: `contractor_pay_stubs:read` */ export function useContractorPaymentsGetV1ContractorsContractorUuidPaymentsSuspense( request: GetV1ContractorsContractorUuidPaymentsRequest, options?: SuspenseQueryHookOptions< ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData, ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryError >, ): UseSuspenseQueryResult< ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData, ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildContractorPaymentsGetV1ContractorsContractorUuidPaymentsQuery( client, request, options, ), ...options, }); } export function setContractorPaymentsGetV1ContractorsContractorUuidPaymentsData( client: QueryClient, queryKeyBase: [ contractorUuid: string, parameters: { xGustoAPIVersion?: | GetV1ContractorsContractorUuidPaymentsHeaderXGustoAPIVersion | undefined; sortBy?: string | undefined; page?: number | undefined; per?: number | undefined; }, ], data: ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData, ): | ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData | undefined { const key = queryKeyContractorPaymentsGetV1ContractorsContractorUuidPayments( ...queryKeyBase, ); return client.setQueryData< ContractorPaymentsGetV1ContractorsContractorUuidPaymentsQueryData >(key, data); } export function invalidateContractorPaymentsGetV1ContractorsContractorUuidPayments( client: QueryClient, queryKeyBase: TupleToPrefixes< [ contractorUuid: string, parameters: { xGustoAPIVersion?: | GetV1ContractorsContractorUuidPaymentsHeaderXGustoAPIVersion | undefined; sortBy?: string | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Contractor Payments", "getV1ContractorsContractorUuidPayments", ...queryKeyBase, ], }); } export function invalidateAllContractorPaymentsGetV1ContractorsContractorUuidPayments( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Contractor Payments", "getV1ContractorsContractorUuidPayments", ], }); }