Skip to main content

index/classes/EventsQueryService.md

Reads stored events and their statistics (Admin API key or Overseer JWT).

Example​

const events = new EventsQueryService(httpClient, undefined, jwtAuth);
const stats = await events.getEventStats();
const page = await events.queryEvents({ eventTypes: ['token_buy'], page: 1, limit: 50 });

Extends​

  • StreamTokenServiceBase

Constructors​

Constructor​

new EventsQueryService(http, adminApiKey?, jwtAuth?, debugMode?, userApiKey?): EventsQueryService

Parameters​

ParameterType
httpHttpClient
adminApiKey?string
jwtAuth?JwtAuth
debugMode?boolean
userApiKey?string

Returns​

EventsQueryService

Overrides​

StreamTokenServiceBase.constructor

Methods​

getEventStats()​

getEventStats(): Promise<EventStats>

Aggregate event statistics for the dashboard cards.

Returns​

Promise<EventStats>

Throws​

ConfigurationError when neither an admin API key nor a JWT is configured

Throws​

NetworkError when the request fails or the body is not the statistics shape

Since​

9.0.0


queryEvents()​

queryEvents(options?): Promise<QueryEventsResult>

One page of stored events (offset paging: page, limit).

Only the filters given are sent. eventTypes / categories go as repeated array parameters.

Parameters​

ParameterType
options?QueryEventsOptions

Returns​

Promise<QueryEventsResult>

Throws​

ValidationError for a limit outside 1..100, a page below 1 or an unknown sort / preset / source

Throws​

ConfigurationError when neither an admin API key nor a JWT is configured

Throws​

NetworkError when the request fails or the body is not the events shape

Since​

9.0.0


setJwtAuth()​

setJwtAuth(jwtAuth): void

Set the JWT authentication manager

This allows dynamic configuration of JWT auth after service creation.

Parameters​

ParameterTypeDescription
jwtAuthJwtAuthJWT auth manager instance

Returns​

void

Inherited from​

StreamTokenServiceBase.setJwtAuth