Core topic

The classes in this topic provide the structure upon which the rest of the library is built.

The central component of the nyxx library is the client: it encapsulates and manages the lifecycle of several components that are responsible for accessing the Discord API. All clients implement the Nyxx interface, and static methods on that same class can be used to create specific client instances (NyxxRest, NyxxOAuth2, or NyxxGateway).

Clients can be configured using ApiOptions and ClientOptions. Some clients will be configured by a subtype of these configuration classes. ApiOptions are used to configure how the client interacts with the Discord API itself, whereas ClientOptions are used to configure client-side only behavior, such as plugins and caching.

All clients will expose a HttpHandler that is used for performing HTTP requests to the Discord API. For more information, see the HTTP topic.

Most users will not interact with the client's HttpHandler, but will rather use the Managers exposed by the client that provide deserialization for Models and Entities, as well as concrete Dart APIs corresponding to API endpoints. Each Manager is usually attached to one or more kinds of Entity, and methods on Entities are usually just shortcuts to a corresponding Manager method. For more information, see the Managers topic.

Managers also provide access to the client's caching system. While caches are stored centrally in a CacheManager, Managers are responsible for creating and updating individual Caches, which can be accessed directly via Manager.cache, by using the Manager.get method, or by using SnowflakeEntity.get (which is a shorthand for Manager.get).

Managers sometimes require the user to specify the structure of an entity to create or update. While Models and Entities are received from the Discord API, Builders allow users to create structures that are sent to the Discord API. For more information, see the Builders topic.

Clients that connect to Discord's Gateway API do so using a Gateway instance. For more information on how the connection lifecycle is managed, see the Gateway topic. For more information on the events the client can receive, see the Events topic.

Finally, clients can be customized by Plugins. These provide a good way to encapsulate functionality and nyxx comes with some built-in plugins. For more information, see the Plugins topic.

Classes

ApiOptions Core
Options for connecting to the Discord API.
Builder<T> Core Builders
Cache<T> Core
A simple cache for SnowflakeEntitys.
CacheConfig<T> Core
The configuration for a Cache instance.
CacheManager Core
A manager for all the caches associated with a client.
ClientOptions Core
Options for controlling the behavior of a Nyxx client.
CreateBuilder<T> Core Builders
Gateway Core Gateway
Handles the connection to Discord's Gateway with shards, manages the client's cache based on Gateway events and provides an interface to the Gateway.
GatewayApiOptions Core Gateway
Options for connecting to the Discord API for making HTTP requests and connecting to the Gateway with a bot token.
GatewayClientOptions Core
Options for controlling the behavior of a NyxxGateway client.
HttpHandler Core HTTP
A handler for making HTTP requests to the Discord API.
ManagedSnowflakeEntity<T extends ManagedSnowflakeEntity<T>> Core Entities
The base class for all SnowflakeEntity's that have a dedicated ReadOnlyManager.
Manager<T extends WritableSnowflakeEntity<T>> Core Managers
Provides the means to interact with the API for a given entity type.
Nyxx Core
The base class for clients interacting with the Discord API.
NyxxGateway Core
A client that can make requests to the HTTP API, connects to the Gateway and is authenticated with a bot token.
NyxxOAuth2 Core
NyxxPlugin<ClientType extends Nyxx> Core Plugins
Provides access to the connection and closing process for implementing plugins.
NyxxPluginState<ClientType extends Nyxx, PluginType extends NyxxPlugin<ClientType>> Core Plugins
Holds the state of a plugin added to a client.
NyxxRest Core
A client that can make requests to the HTTP API and is authenticated with a bot token.
OAuth2ApiOptions Core
Options for connecting the the Discord API using credentials from an OAuth2 flow.
ReadOnlyManager<T extends ManagedSnowflakeEntity<T>> Core Managers
A Manager that provides only read access to the API.
RestApiOptions Core
Options for connecting to the Discord API to make HTTP requests with a bot token.
RestClientOptions Core
Options for controlling the behavior of a NyxxRest client.
Snowflake Core Models
A unique ID used to identify objects in the API.
SnowflakeEntity<T extends SnowflakeEntity<T>> Core Entities
The base class for all entities in the API identified by a Snowflake.
UpdateBuilder<T> Core Builders
WritableSnowflakeEntity<T extends WritableSnowflakeEntity<T>> Core Entities
The base class for all SnowflakeEntity's that have a dedicated Manager.

Exceptions / Errors

OutOfRemainingSessionsError Core
An error thrown when the number of remaining sessions becomes too low.