API Types#

When it comes to working with low level API, dealing with raw JSON payloads and handling API payloads manually can be an overwhelming task.

To ease you in this case, Library provides easy to use type defintions for Revolt API that only allow you to properly typehint your application but also get cutting edge autocompletion in your code editor.

Enumerations#

This section documents various enumerations from the Revolt API. All these are type aliases of typing.Literal.

luster.types.EventTypeSend#

The types of websocket events that are sent by the client.

luster.types.EventTypeRecv#

The types of websocket events that are received by the client.

luster.types.EventType#

The types of websocket events. This is equivalent to typing.Union of EventTypeSend and EventTypeRecv.

luster.types.ErrorId#

The error labels often sent in ErrorEvent websocket event.

luster.types.WebsocketVersion#

The versions for Revolt websocket protocol.

luster.types.WebsocketFormat#

The formats used for packets transport in Revolt websocket protocol.

API Models#

This section documents type definitions for various API models. All these type definitions are subclasses of typing.TypedDict.

NodeInfo#

class luster.types.NodeInfo#

Represents the Revolt node info often returned by fetch_api_info() route.

app: str#

The URL pointing to client serving this node.

features: luster.types.node_info.NodeInfoFeatures#

The features enabled on this Revolt node.

revolt: str#

Revolt API version.

vapid: str#

The web push VAPID public key.

ws: str#

The URL used for connecting to websocket.

NodeInfoFeatures#

class luster.types.NodeInfoFeatures#

Represents the features of a Revold node retrieved from NodeInfo

autumn: luster.types.node_info.NodeInfoAutumnFeature#

The file server configuration.

captcha: luster.types.node_info.NodeInfoCaptchaFeature#

The human captcha (hCaptcha) configuration.

email: bool#

Whether email verification is enabled.

invite_only: bool#

Whether the server is invite only.

january: luster.types.node_info.NodeInfoJanuaryFeature#

The proxy service configuration.

voso: luster.types.node_info.NodeInfoVosoFeature#

The voice server configuration.

NodeInfoCaptchaFeature#

class luster.types.NodeInfoCaptchaFeature#

Represents the hCaptcha configuration found in NodeInfoFeatures.captcha field.

enabled: bool#

Whether human captcha is enabled.

key: str#

The client key used for solving the captcha.

NodeInfoAutumnFeature#

class luster.types.NodeInfoAutumnFeature#

Represents the configuration for Autumn file server found in NodeInfoFeatures.autumn field.

enabled: bool#

Whether the service is enabled.

url: str#

The URL pointing to this service.

NodeInfoJanuaryFeature#

class luster.types.NodeInfoJanuaryFeature#

Represents the configuration for January proxy service configuration found in NodeInfoFeatures.january field.

enabled: bool#

Whether the service is enabled.

url: str#

The URL pointing to this service.

NodeInfoVosoFeature#

class luster.types.NodeInfoVosoFeature#

Represents the configuration for Voso voice service configuration found in NodeInfoFeatures.voso field.

enabled: bool#

Whether the service is enabled.

url: str#

The URL pointing to this service.

HTTP Routes#

This section documents type definitions for various HTTP routes. All these type definitions are subclasses of typing.TypedDict.

QueryNodeResponse#

class luster.types.QueryNodeResponse#

Represents the response of HTTPHandler.query_node() or HTTPHandler.fetch_node_info() route.

This is equivalent to NodeInfo.

Websocket Events#

This section documents type definitions for various websocket events. All these type definitions are subclasses of typing.TypedDict.

AuthenticateEvent#

class luster.types.AuthenticateEvent#

Represents an event used for authenticating the session.

token: str#

The token used for authentication.

type: Literal['Authenticate']#

The type of event.

PingEvent#

class luster.types.PingEvent#

Represents an event used for pinging the websocket to keep the connection open.

data: int#

The data to send and receive in Pong event.

type: Literal['Ping']#

The type of event.

BeginTypingEvent#

class luster.types.AuthenticateEvent#

Represents an event used for authenticating the session.

token: str#

The token used for authentication.

type: Literal['Authenticate']#

The type of event.

EndTypingEvent#

class luster.types.EndTypingEvent#

Represents an event used for ending typing indicating in a channel.

channel_id: str#

The channel ID to end typing indicator in.

type: Literal['EndTyping']#

The type of event.

ErrorEvent#

class luster.types.ErrorEvent#

Represents an event indicating that an error happened.

error: ErrorId#

The ID of error.

type: Literal['Error']#

The type of event.

AuthenticatedEvent#

class luster.types.AuthenticatedEvent#

Represents an event indicating that session was authenticated.

type: Literal['Authenticated']#

The type of event.

PongEvent#

class luster.types.PongEvent#

Represents an event indicating acknowledgment of Ping event.

data: int#

The data sent during Ping.

type: Literal['Pong']#

The type of event.

BulkEvent#

class luster.types.BulkEvent#

Represents an event indicating that multiple events occured.

type: Literal['Bulk']#

The type of event.

v: List[luster.types.websocket.BaseWebsocketEvent]#

The list of events that occured.