/* * 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 { GetV1ContractorPaymentsContractorPaymentUuidReceiptHeaderXGustoAPIVersion, GetV1ContractorPaymentsContractorPaymentUuidReceiptRequest, } from "../models/operations/getv1contractorpaymentscontractorpaymentuuidreceipt.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildContractorPaymentsGetReceiptQuery, ContractorPaymentsGetReceiptQueryData, prefetchContractorPaymentsGetReceipt, queryKeyContractorPaymentsGetReceipt, } from "./contractorPaymentsGetReceipt.core.js"; export { buildContractorPaymentsGetReceiptQuery, type ContractorPaymentsGetReceiptQueryData, prefetchContractorPaymentsGetReceipt, queryKeyContractorPaymentsGetReceipt, }; export type ContractorPaymentsGetReceiptQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a single contractor payment receipt * * @remarks * Returns a contractor payment receipt. * * Notes: * * Receipts are only available for direct deposit payments and are only available once those payments have been funded. * * Payroll Receipt requests for payrolls which do not have receipts available (e.g. payment by check) will return a 404 status. * * Hour and dollar amounts are returned as string representations of numeric decimals. * * Dollar amounts are represented to the cent. * * If no data has yet be inserted for a given field, it defaults to “0.00” (for fixed amounts). * * scope: `payrolls:read` */ export function useContractorPaymentsGetReceipt( request: GetV1ContractorPaymentsContractorPaymentUuidReceiptRequest, options?: QueryHookOptions< ContractorPaymentsGetReceiptQueryData, ContractorPaymentsGetReceiptQueryError >, ): UseQueryResult< ContractorPaymentsGetReceiptQueryData, ContractorPaymentsGetReceiptQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildContractorPaymentsGetReceiptQuery( client, request, options, ), ...options, }); } /** * Get a single contractor payment receipt * * @remarks * Returns a contractor payment receipt. * * Notes: * * Receipts are only available for direct deposit payments and are only available once those payments have been funded. * * Payroll Receipt requests for payrolls which do not have receipts available (e.g. payment by check) will return a 404 status. * * Hour and dollar amounts are returned as string representations of numeric decimals. * * Dollar amounts are represented to the cent. * * If no data has yet be inserted for a given field, it defaults to “0.00” (for fixed amounts). * * scope: `payrolls:read` */ export function useContractorPaymentsGetReceiptSuspense( request: GetV1ContractorPaymentsContractorPaymentUuidReceiptRequest, options?: SuspenseQueryHookOptions< ContractorPaymentsGetReceiptQueryData, ContractorPaymentsGetReceiptQueryError >, ): UseSuspenseQueryResult< ContractorPaymentsGetReceiptQueryData, ContractorPaymentsGetReceiptQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildContractorPaymentsGetReceiptQuery( client, request, options, ), ...options, }); } export function setContractorPaymentsGetReceiptData( client: QueryClient, queryKeyBase: [ contractorPaymentUuid: string, parameters: { xGustoAPIVersion?: | GetV1ContractorPaymentsContractorPaymentUuidReceiptHeaderXGustoAPIVersion | undefined; }, ], data: ContractorPaymentsGetReceiptQueryData, ): ContractorPaymentsGetReceiptQueryData | undefined { const key = queryKeyContractorPaymentsGetReceipt(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateContractorPaymentsGetReceipt( client: QueryClient, queryKeyBase: TupleToPrefixes< [ contractorPaymentUuid: string, parameters: { xGustoAPIVersion?: | GetV1ContractorPaymentsContractorPaymentUuidReceiptHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "contractorPayments", "getReceipt", ...queryKeyBase, ], }); } export function invalidateAllContractorPaymentsGetReceipt( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "contractorPayments", "getReceipt"], }); }