/* * 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 { UnprocessableEntityError } from "../models/errors/unprocessableentityerror.js"; import { GetEventsHeaderXGustoAPIVersion, GetEventsRequest, GetEventsSecurity, QueryParamSortOrder, } from "../models/operations/getevents.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildEventsGetQuery, EventsGetQueryData, prefetchEventsGet, queryKeyEventsGet, } from "./eventsGet.core.js"; export { buildEventsGetQuery, type EventsGetQueryData, prefetchEventsGet, queryKeyEventsGet, }; export type EventsGetQueryError = | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get all events * * @remarks * Fetch all events, going back up to 30 days, that your partner application has the required scopes for. Note that a partner does NOT have to have verified webhook subscriptions in order to utilize this endpoint. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `events:read` */ export function useEventsGet( security: GetEventsSecurity, request: GetEventsRequest, options?: QueryHookOptions, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildEventsGetQuery( client, security, request, options, ), ...options, }); } /** * Get all events * * @remarks * Fetch all events, going back up to 30 days, that your partner application has the required scopes for. Note that a partner does NOT have to have verified webhook subscriptions in order to utilize this endpoint. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `events:read` */ export function useEventsGetSuspense( security: GetEventsSecurity, request: GetEventsRequest, options?: SuspenseQueryHookOptions, ): UseSuspenseQueryResult { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildEventsGetQuery( client, security, request, options, ), ...options, }); } export function setEventsGetData( client: QueryClient, queryKeyBase: [ parameters: { xGustoAPIVersion?: GetEventsHeaderXGustoAPIVersion | undefined; startingAfterUuid?: string | undefined; resourceUuid?: string | undefined; limit?: string | undefined; eventType?: string | undefined; sortOrder?: QueryParamSortOrder | undefined; }, ], data: EventsGetQueryData, ): EventsGetQueryData | undefined { const key = queryKeyEventsGet(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateEventsGet( client: QueryClient, queryKeyBase: TupleToPrefixes< [parameters: { xGustoAPIVersion?: GetEventsHeaderXGustoAPIVersion | undefined; startingAfterUuid?: string | undefined; resourceUuid?: string | undefined; limit?: string | undefined; eventType?: string | undefined; sortOrder?: QueryParamSortOrder | undefined; }] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Events", "get", ...queryKeyBase], }); } export function invalidateAllEventsGet( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Events", "get"], }); }