/* * 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 { GetV1ContractorPaymentsContractorPaymentIdPdfHeaderXGustoAPIVersion, GetV1ContractorPaymentsContractorPaymentIdPdfRequest, } from "../models/operations/getv1contractorpaymentscontractorpaymentidpdf.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQuery, ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData, prefetchContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf, queryKeyContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf, } from "./contractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf.core.js"; export { buildContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQuery, type ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData, prefetchContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf, queryKeyContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf, }; export type ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a contractor payment PDF * * @remarks * Get a PDF document for a single contractor payment. * * scope: `payrolls:read` */ export function useContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( request: GetV1ContractorPaymentsContractorPaymentIdPdfRequest, options?: QueryHookOptions< ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData, ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryError >, ): UseQueryResult< ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData, ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQuery( client, request, options, ), ...options, }); } /** * Get a contractor payment PDF * * @remarks * Get a PDF document for a single contractor payment. * * scope: `payrolls:read` */ export function useContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfSuspense( request: GetV1ContractorPaymentsContractorPaymentIdPdfRequest, options?: SuspenseQueryHookOptions< ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData, ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryError >, ): UseSuspenseQueryResult< ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData, ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQuery( client, request, options, ), ...options, }); } export function setContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfData( client: QueryClient, queryKeyBase: [ contractorPaymentId: string, parameters: { xGustoAPIVersion?: | GetV1ContractorPaymentsContractorPaymentIdPdfHeaderXGustoAPIVersion | undefined; }, ], data: ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData, ): | ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData | undefined { const key = queryKeyContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( ...queryKeyBase, ); return client.setQueryData< ContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdfQueryData >(key, data); } export function invalidateContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( client: QueryClient, queryKeyBase: TupleToPrefixes< [ contractorPaymentId: string, parameters: { xGustoAPIVersion?: | GetV1ContractorPaymentsContractorPaymentIdPdfHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "contractorPayments", "getV1ContractorPaymentsContractorPaymentIdPdf", ...queryKeyBase, ], }); } export function invalidateAllContractorPaymentsGetV1ContractorPaymentsContractorPaymentIdPdf( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "contractorPayments", "getV1ContractorPaymentsContractorPaymentIdPdf", ], }); }