/* * 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 { GetV1PaymentReceiptsPayrollsPayrollUuidHeaderXGustoAPIVersion, GetV1PaymentReceiptsPayrollsPayrollUuidRequest, } from "../models/operations/getv1paymentreceiptspayrollspayrolluuid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPayrollsGetReceiptQuery, PayrollsGetReceiptQueryData, prefetchPayrollsGetReceipt, queryKeyPayrollsGetReceipt, } from "./payrollsGetReceipt.core.js"; export { buildPayrollsGetReceiptQuery, type PayrollsGetReceiptQueryData, prefetchPayrollsGetReceipt, queryKeyPayrollsGetReceipt, }; export type PayrollsGetReceiptQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a single payroll receipt * * @remarks * Returns a payroll receipt. * * Notes: * * 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 usePayrollsGetReceipt( request: GetV1PaymentReceiptsPayrollsPayrollUuidRequest, options?: QueryHookOptions< PayrollsGetReceiptQueryData, PayrollsGetReceiptQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPayrollsGetReceiptQuery( client, request, options, ), ...options, }); } /** * Get a single payroll receipt * * @remarks * Returns a payroll receipt. * * Notes: * * 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 usePayrollsGetReceiptSuspense( request: GetV1PaymentReceiptsPayrollsPayrollUuidRequest, options?: SuspenseQueryHookOptions< PayrollsGetReceiptQueryData, PayrollsGetReceiptQueryError >, ): UseSuspenseQueryResult< PayrollsGetReceiptQueryData, PayrollsGetReceiptQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPayrollsGetReceiptQuery( client, request, options, ), ...options, }); } export function setPayrollsGetReceiptData( client: QueryClient, queryKeyBase: [ payrollUuid: string, parameters: { xGustoAPIVersion?: | GetV1PaymentReceiptsPayrollsPayrollUuidHeaderXGustoAPIVersion | undefined; }, ], data: PayrollsGetReceiptQueryData, ): PayrollsGetReceiptQueryData | undefined { const key = queryKeyPayrollsGetReceipt(...queryKeyBase); return client.setQueryData(key, data); } export function invalidatePayrollsGetReceipt( client: QueryClient, queryKeyBase: TupleToPrefixes< [ payrollUuid: string, parameters: { xGustoAPIVersion?: | GetV1PaymentReceiptsPayrollsPayrollUuidHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Payrolls", "getReceipt", ...queryKeyBase, ], }); } export function invalidateAllPayrollsGetReceipt( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Payrolls", "getReceipt"], }); }