/* * 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 { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { GetCompaniesCompanyUuidWireInRequestUuidHeaderXGustoAPIVersion, GetCompaniesCompanyUuidWireInRequestUuidRequest, } from "../models/operations/getcompaniescompanyuuidwireinrequestuuid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildWireInRequestsListQuery, prefetchWireInRequestsList, queryKeyWireInRequestsList, WireInRequestsListQueryData, } from "./wireInRequestsList.core.js"; export { buildWireInRequestsListQuery, prefetchWireInRequestsList, queryKeyWireInRequestsList, type WireInRequestsListQueryData, }; export type WireInRequestsListQueryError = | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get all Wire In Requests for a company * * @remarks * Fetches all Wire In Requests for a company. * * scope: `payrolls:read` */ export function useWireInRequestsList( request: GetCompaniesCompanyUuidWireInRequestUuidRequest, options?: QueryHookOptions< WireInRequestsListQueryData, WireInRequestsListQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildWireInRequestsListQuery( client, request, options, ), ...options, }); } /** * Get all Wire In Requests for a company * * @remarks * Fetches all Wire In Requests for a company. * * scope: `payrolls:read` */ export function useWireInRequestsListSuspense( request: GetCompaniesCompanyUuidWireInRequestUuidRequest, options?: SuspenseQueryHookOptions< WireInRequestsListQueryData, WireInRequestsListQueryError >, ): UseSuspenseQueryResult< WireInRequestsListQueryData, WireInRequestsListQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildWireInRequestsListQuery( client, request, options, ), ...options, }); } export function setWireInRequestsListData( client: QueryClient, queryKeyBase: [ companyUuid: string, parameters: { xGustoAPIVersion?: | GetCompaniesCompanyUuidWireInRequestUuidHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ], data: WireInRequestsListQueryData, ): WireInRequestsListQueryData | undefined { const key = queryKeyWireInRequestsList(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateWireInRequestsList( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyUuid: string, parameters: { xGustoAPIVersion?: | GetCompaniesCompanyUuidWireInRequestUuidHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "wireInRequests", "list", ...queryKeyBase, ], }); } export function invalidateAllWireInRequestsList( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "wireInRequests", "list"], }); }