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.UnionofEventTypeSendandEventTypeRecv.
- luster.types.ErrorId#
The error labels often sent in
ErrorEventwebsocket event.
- luster.types.WebsocketVersion#
The versions for Revolt websocket protocol.
- luster.types.WebsocketFormat#
The formats used for packets transport in Revolt websocket protocol.
- luster.types.FileType#
The types of file.
- luster.types.FileTag#
The tags or buckets that a file can be uploaded to.
- luster.types.PresenceType#
The presence states of a user.
- luster.types.RelationshipStatus#
The status of a relationship.
- luster.types.UserRemoveField#
The fields that can be removed from a user object by editing it.
- luster.types.ChannelTypeServer#
The channel types related to a server.
- luster.types.ChannelTypePrivate#
The channel types for private channels.
- luster.types.ChannelType#
All channel types.
- luster.types.ChannelRemoveField#
The fields that can be removed from channel object by editing it.
- luster.types.ServerRemoveField#
The fields that can be removed from server object by editing it.
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.- features: luster.types.node_info.NodeInfoFeatures#
The features enabled on this Revolt node.
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.
- january: luster.types.node_info.NodeInfoJanuaryFeature#
The proxy service configuration.
- voso: luster.types.node_info.NodeInfoVosoFeature#
The voice server configuration.
NodeInfoCaptchaFeature#
NodeInfoAutumnFeature#
NodeInfoJanuaryFeature#
NodeInfoVosoFeature#
User#
- class luster.types.User#
Represents a user’s structure.
- avatar: NotRequired[Optional[File]]#
The user’s avatar.
- bot: NotRequired[Optional[PartialUserBot]]#
If the user is a bot, includes the partial bot information.
- relations: NotRequired[Optional[List[Relationship]]]#
The user’s relationships with other users.
- relationship: NotRequired[Optional[RelationshipStatus]]#
The user’s relationship with other users or themselves.
Status#
- class luster.types.Status#
Represents the status of a user.
- presence: NotRequired[Optional[PresenceType]]#
The current presence state of the user.
Profile#
PartialUserBot#
Relationship#
- class luster.types.Relationship#
Represents a relationship of a user with another user.
- status: RelationshipStatus#
The current relationship status.
Server#
- class luster.types.Server#
Represents a server.
- banner: typing_extensions.NotRequired[Optional[luster.types.file.File]]#
The banner of this server.
- categories: typing_extensions.NotRequired[Optional[List[luster.types.channels.Category]]]#
The list of categories in this server.
- icon: typing_extensions.NotRequired[Optional[luster.types.file.File]]#
The icon of this server.
- roles: Dict[str, luster.types.roles.Role]#
The server roles, the key is ID of role with value being the role.
- system_messages: typing_extensions.NotRequired[Optional[luster.types.servers.SystemMessages]]#
The system messages channels in this server.
SystemMessages#
- class luster.types.SystemMessages#
Represents the system messages channels in a
Server.- user_banned: typing_extensions.NotRequired[Optional[str]]#
The ID of channel in which message is sent when a user is banned.
- user_joined: typing_extensions.NotRequired[Optional[str]]#
The ID of channel in which message is sent when a user joins.
Category#
Role#
- class luster.types.Role#
Represents a role in a server.
- colour: typing_extensions.NotRequired[Optional[str]]#
The color of this role, this can be any valid CSS color.
- permissions: luster.types.roles.Permissions#
The permissions of this role.
Permissions#
SavedMessages#
DirectMessage#
Group#
- class luster.types.Group#
Represents a group channel between two or more users.
- channel_type: Literal['Group']#
The type of this channel.
- icon: typing_extensions.NotRequired[Optional[luster.types.file.File]]#
The icon of this group.
TextChannel#
VoiceChannel#
ServerChannel#
- luster.types.ServerChannel#
A type alias for
typing.Unionof various Server channels.This currently includes:
PrivateChannel#
- luster.types.PrivateChannel#
A type alias for
typing.Unionof various private channel types.This currently includes:
DirectMessages
Channel#
- luster.types.Channel#
A type alias for
typing.Unionof all channel types mentioned above.
HTTP Routes#
This section documents type definitions for various HTTP routes. All these type definitions
are subclasses of typing.TypedDict.
QueryNodeResponse#
FetchSelfResponse#
EditUserJSON#
- class luster.types.EditUserJSON#
Represents the JSON body for
HTTPHandler.edit_user()route.- remove: NotRequired[List[UserRemoveField]]#
The list of fields to remove from user.
EditUserResponse#
FetchUserResponse#
ChangeUsernameJSON#
ChangeUsernameResponse#
FetchProfileResponse#
UploadFileResponse#
CreateServerJSON#
CreateServerResponse#
- class luster.types.CreateServerResponse#
Represents the response for
luster.HTTPHandler.create_server()route.- channels: List[Union[luster.types.channels.TextChannel, luster.types.channels.VoiceChannel]]#
The server’s channels.
- server: luster.types.servers.Server#
The created server.
FetchServerResponse#
- class luster.types.FetchServerResponse#
Represents the response for
luster.HTTPHandler.fetch_server()route.This is equivalent to
Servertype.
EditServerJSON#
- class luster.types.EditServerJSON#
Represents the JSON body for
luster.HTTPHandler.edit_server()route.- remove: List[ServerRemoveField]#
The fields to remove from server object.
- system_messages: SystemMessages#
The system message channels in this server.
EditServerResponse#
- class luster.types.EditServerResponse#
Represents the response for
luster.HTTPHandler.edit_server()route.This is equivalent to
Servertype.
DeleteServerResponse#
- luster.types.DeleteServerResponse#
A type alias representing response of
luster.HTTPHandler.delete_server()route.
MarkServerAsReadResponse#
- luster.types.MarkServerAsReadResponse#
A type alias representing response of
luster.HTTPHandler.mark_server_as_read()route.
CreateServerChannelJSON#
- class luster.types.CreateServerChannelJSON#
Represents the JSON body for
luster.HTTPHandler.create_server_channel()route.- channel_type: NotRequired[ChannelTypeServer]#
Text).
- Type
The type of channel to create (default
CreateServerChannelResponse#
- luster.types.CreateServerChannelResponse#
A type alias representing response of
luster.HTTPHandler.create_server_channel()route.
FetchDirectMessageChannelsResponse#
- luster.types.FetchDirectMessageChannelsResponse#
A type alias representing the response of
luster.HTTPHandler.fetch_direct_message_channels()route.This is equivalent to
typing.ListofDirectMessageandGroup.
OpenDirectMessageResponse#
- luster.types.OpenDirectMessageResponse#
A type alias representing the response of
luster.HTTPHandler.open_direct_message()route.This is equivalent to
typing.UnionofDirectMessageandSavedMessages.
FetchChannelResponse#
- luster.types.FetchChannelResponse#
A type alias representing the response of
luster.HTTPHandler.fetch_channel()route.This is equivalent to
Channel.
DeleteChannelResponse#
- luster.types.DeleteChannelResponse#
A type alias representing the response of
luster.HTTPHandler.close_channel()route.This is equivalent to Literal[
None].
EditChannelJSON#
- class luster.types.EditChannelJSON#
Represents the JSON body for
luster.HTTPHandler.edit_channel()route.- remove: NotRequired[List[ChannelRemoveField]]#
The list of fields to remove.
EditChannelResponse#
- luster.types.EditChannelResponse#
A type alias representing the response of
luster.HTTPHandler.edit_channel()route.This is equivalent to
Channel.
CreateGroupJSON#
- class luster.types.CreateGroupJSON#
Represents the JSON body for
luster.HTTPHandler.create_group()route.
CreateGroupResponse#
- class luster.types.CreateGroupResponse#
Represents the response of
luster.HTTPHandler.create_group()route.This is equivalent to
Group.
FetchGroupMembersResponse#
- luster.types.FetchGroupMembersResponse#
A type alias representing the response of
luster.HTTPHandler.fetch_group_members()route.
AddGroupMemberResponse#
- luster.types.AddGroupMemberResponse#
A type alias representing the response of
luster.HTTPHandler.add_group_member()route.
RemoveGroupMemberResponse#
- luster.types.RemoveGroupMemberResponse#
A type alias representing the response of
luster.HTTPHandler.remove_group_member()route.
SetChannelRolePermissionJSON#
- class luster.types.SetChannelRolePermissionJSON#
Represents the JSON body for
luster.HTTPHandler.set_channel_role_permission()route.- permissions: luster.types.roles.RequestPermissions#
The new permissions for the role.
SetChannelRolePermissionResponse#
- luster.types.SetChannelRolePermissionResponse#
A type alias representing the response of
luster.HTTPHandler.set_channel_role_permission().
SetChannelDefaultPermissionJSON#
- class luster.types.SetChannelDefaultPermissionJSON#
Represents the JSON body for
luster.HTTPHandler.set_channel_default_permission()route.- permissions: luster.types.roles.RequestPermissions#
The new permissions for the default role.
SetChannelDefaultPermissionResponse#
- luster.types.SetChannelDefaultPermissionResponse#
A type alias representing the response of
luster.HTTPHandler.set_channel_default_permission().
SetServerRolePermissionJSON#
- class luster.types.SetServerRolePermissionJSON#
Represents the JSON body for
luster.HTTPHandler.set_server_role_permission()route.- permissions: luster.types.roles.RequestPermissions#
The new permissions.
SetServerRolePermissionResponse#
- luster.types.SetServerRolePermissionResponse#
A type alias representing the response of
luster.HTTPHandler.set_server_role_permission().
SetServerDefaultPermissionJSON#
SetServerDefaultPermissionResponse#
- luster.types.SetServerDefaultPermissionResponse#
A type alias representing the response of
luster.HTTPHandler.set_server_default_permission().
Websocket Events#
This section documents type definitions for various websocket events. All these type definitions
are subclasses of typing.TypedDict.
AuthenticateEvent#
PingEvent#
BeginTypingEvent#
EndTypingEvent#
ErrorEvent#
AuthenticatedEvent#
PongEvent#
BulkEvent#
ReadyEvent#
- class luster.types.ReadyEvent#
Represents an event indicating that client is ready.
- channels: List[Union[luster.types.channels.TextChannel, luster.types.channels.VoiceChannel, luster.types.channels.SavedMessages, luster.types.channels.DirectMessage, luster.types.channels.Group]]#
The list of channels.
- emojis: typing_extensions.NotRequired[List[Any]]#
The list of servers.
- servers: List[luster.types.servers.Server]#
The list of servers.
- type: Literal['Ready']#
The type of event.
- users: List[luster.types.users.User]#
The list of users the client can see.
UserUpdateEvent#
UserUpdateEventData#
- class luster.types.UserUpdateEventData#
Represents the data inside a
UserUpdateEvent.This is equivalent to a “partial” user. All the fields in this type are optional.
- avatar: luster.types.file.File#
The avatar of this user.
- profile: luster.types.users.Profile#
The profile of this user.
- status: luster.types.users.Status#
The user’s current status.
UserRelationshipEvent#
- class luster.types.UserRelationshipEvent#
Represents an event indicating update of relationship with another user.
- status: RelationshipStatus#
The new relationship status.
- type: Literal['UserRelationship']#
The type of event.
ServerCreateEvent#
- class luster.types.ServerCreateEvent#
Represents an event indicating creation/joining of a server.
- channels: List[Union[luster.types.channels.TextChannel, luster.types.channels.VoiceChannel]]#
The channels of this server.
- server: luster.types.servers.Server#
The joined server.
- type: Literal['ServerCreate']#
The type of event.
ServerUpdateEvent#
ServerUpdateEventData#
- class luster.types.ServerUpdateEventData#
Represents the data inside a
ServerUpdateEvent.This is equivalent to a “partial” server. All the fields in this type are optional.
- banner: luster.types.file.File#
The banner of server.
- categories: List[luster.types.channels.Category]#
The categories of server.
- icon: luster.types.file.File#
The icon of user.
- system_messages: luster.types.servers.SystemMessages#
The channel assignments for system messages in the server.
ServerDeleteEvent#
ChannelCreateEvent#
ChannelUpdateEvent#
ChannelUpdateEventData#
- class luster.types.ChannelUpdateEventData#
Represents the updated data in a
ChannelUpdateEvent.- default_permissions: luster.types.roles.Permissions#
The default permissions for this channel.
- icon: Optional[luster.types.file.File]#
The icon of channel.
- role_permissions: Dict[str, luster.types.roles.Permissions]#
A mapping with key being role ID and value being role
Permissions.
ChannelDeleteEvent#
ChannelGroupJoinEvent#
ChannelGroupLeaveEvent#
ServerRoleUpdateEvent#
ServerRoleUpdateEventData#
- class luster.types.ServerRoleUpdateEventData#
Represents the data of
ServerRoleUpdateEvent.This is roughly equivalent to a role but all fields are optional.
- permissions: luster.types.roles.Permissions#
The permissions of role.