/* * 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 { GetAchTransactionsHeaderXGustoAPIVersion, GetAchTransactionsRequest, } from "../models/operations/getachtransactions.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { AchTransactionsGetAllQueryData, buildAchTransactionsGetAllQuery, prefetchAchTransactionsGetAll, queryKeyAchTransactionsGetAll, } from "./achTransactionsGetAll.core.js"; export { type AchTransactionsGetAllQueryData, buildAchTransactionsGetAllQuery, prefetchAchTransactionsGetAll, queryKeyAchTransactionsGetAll, }; export type AchTransactionsGetAllQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get all ACH transactions for a company * * @remarks * Fetches all ACH transactions for a company. * * scope: `ach_transactions:read` */ export function useAchTransactionsGetAll( request: GetAchTransactionsRequest, options?: QueryHookOptions< AchTransactionsGetAllQueryData, AchTransactionsGetAllQueryError >, ): UseQueryResult< AchTransactionsGetAllQueryData, AchTransactionsGetAllQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildAchTransactionsGetAllQuery( client, request, options, ), ...options, }); } /** * Get all ACH transactions for a company * * @remarks * Fetches all ACH transactions for a company. * * scope: `ach_transactions:read` */ export function useAchTransactionsGetAllSuspense( request: GetAchTransactionsRequest, options?: SuspenseQueryHookOptions< AchTransactionsGetAllQueryData, AchTransactionsGetAllQueryError >, ): UseSuspenseQueryResult< AchTransactionsGetAllQueryData, AchTransactionsGetAllQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildAchTransactionsGetAllQuery( client, request, options, ), ...options, }); } export function setAchTransactionsGetAllData( client: QueryClient, queryKeyBase: [ companyUuid: string, parameters: { xGustoAPIVersion?: GetAchTransactionsHeaderXGustoAPIVersion | undefined; contractorPaymentUuid?: string | undefined; payrollUuid?: string | undefined; transactionType?: string | undefined; paymentDirection?: string | undefined; page?: number | undefined; per?: number | undefined; }, ], data: AchTransactionsGetAllQueryData, ): AchTransactionsGetAllQueryData | undefined { const key = queryKeyAchTransactionsGetAll(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateAchTransactionsGetAll( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyUuid: string, parameters: { xGustoAPIVersion?: GetAchTransactionsHeaderXGustoAPIVersion | undefined; contractorPaymentUuid?: string | undefined; payrollUuid?: string | undefined; transactionType?: string | undefined; paymentDirection?: string | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "achTransactions", "getAll", ...queryKeyBase, ], }); } export function invalidateAllAchTransactionsGetAll( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "achTransactions", "getAll"], }); }