revoltgo

package module
v0.0.0-...-eeea8c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: BSD-3-Clause Imports: 25 Imported by: 8

README

Introduction

RevoltGo logo RGO

Purpose

RevoltGo is a low-level API wrapper for the Revolt API focused on performance and maintainability.

Context

Since July 2023 and until now, it has been the only mature Revolt Go library that, in my opinion, does things right. Other projects had poor API coverage, no consistency or maintenance, and questionable code/design choices. They've since been removed from Awesome-Stoat's Go list, leaving this as the only survivor.

Applications

This library can be used for bots, self-bots, and clients

Support

The fastest way to contact me is via the Revolt support server dedicated for this project. Of course, you can always create an issue or a PR.

Features

Performance
  • MessagePack websocket transport with code-generated serialisers; no reflection, field look-ups, or runtime schema discovery. JSON inter-op is kept where the API requires it.
  • Pay only for what you use; we inspect websocket event types and drop them without ever decoding it.
  • Low-level bindings, minimal opinionation; you have full access to all the data the API/WS sends, no abstractions.
  • Zero-copy frame handling; websocket frames are processed straight from the network buffer.
  • Lock-free event dispatch; websocket frames are processed in parallel, and never content on a shared mutex.
State
  • Optional, per-object caching; track users, servers, channels, members, emojis, or none of it
  • Ergonomic reads; slice getters, iterators, and counts for cached objects
  • Opportunistic refresh; use HTTP responses to further synchronise the state
  • Consistent, race-protected; the library does its own house-keeping so that your code never sees a half-updated world
Authentication
  • Bots and self-bots; both supported first-class.
  • Express login; trade credentials for a re-usable token, get up and running fast.
Developer experience
  • Targets latest Go releases and up-to-date dependencies; no leaning on something three years stale
  • Consistent naming scheme; every type's name builds on each-other, creating predictable patterns
  • REST API ratelimit handling with safeguards against leaking your token
  • Utilities; permission calculator, enums for almost everything, and helper functions
  • Debug toggles for HTTP and WebSocket for when you need to see what's actually on the wire

Getting started

Installation

Assuming that you have a working Go environment ready, run one of the following commands to install the library. If you do not have a Go environment ready, see how to set it up here

Stable release
go get github.com/sentinelb51/revoltgo
Latest release
go get github.com/sentinelb51/revoltgo@latest

Usage

Now that the package is installed, you will have to import it

import "github.com/sentinelb51/revoltgo"

Then, construct a new session using your bots token, and store it in a variable. This "session" is a centralised store of all API and websocket methods at your fingertips, relevant to the bot you're about to connect with.

session := revoltgo.New("your token here")

Finally, open the websocket connection to Revolt API. Your bot will attempt to login, and if successful, will receive events from the Revolt websocket about the world it's in. Make sure to handle the error, as it can indicate any problem that could arise during the connection.

err := session.Open()

To ensure the program keeps running, and accepts signals such as Ctrl + C, make a channel and wait for a signal from said channel:

sc := make(chan os.Signal, 1)

signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc

Examples

The following examples are available in the examples directory:

  • ping_bot.go: A bot that responds to the !ping command.
  • selfbot.go: A self-bot that responds to the !ping command.
  • uploads.go: A bot that uploads the RevoltGo logo using the command "!upload"

Resource usage

The resource utilisation of the library depends on how many handlers are registered and how many objects are cached in the state. More handlers will increase CPU usage, while more objects in the state will increase memory usage.

For programs that need to be as lightweight as possible (and do not care about caching objects), they can disable state tracking by passing a revoltgo.StateConfig to Session.Open:

type StateConfig struct {
    TrackUsers        bool
    TrackServers      bool
    TrackChannels     bool
    TrackMembers      bool
    TrackEmojis       bool
    TrackAPICalls     bool
    TrackBulkAPICalls bool
}
Windows platforms

Standalone, with state enabled, the library uses:

  • ~0.00% CPU
  • ~4-5 MB of RAM

The memory usage is expected to grow with state enabled as more objects get cached.

Linux platforms

Not tested, but it's expected to be around the same.

License: BSD 3-Clause

RevoltGo is licensed under the BSD 3-Clause License. What this means is that:

You are allowed to:
  • Modify the code, and distribute your own versions.
  • Use this library in personal, open-source, or commercial projects.
  • Include it in proprietary software, without making your project open-source.
You are not allowed to:
  • Remove or alter the license and copyright notice.
  • Use the name "RevoltGo" or its contributors for endorsements without permission.
  • Hold the author liable for any damages arising from the use of the software.

Documentation

Overview

Package revoltgo is a wrapper for the Revolt API with low-level bindings

	Made by @sentinelb51
	For support, join our revolt server on the GitHub README file
	To compile correctly, always run beforehand:
		/tools/msgp_codegen.py  (ensures all msgp code is generated: revoltgo_msgp_gen.go)
		/tools/build_hash.py    (updates the COMMIT variable in this file)

   Todo: do we need state.go to track VoiceStates?

Index

Constants

View Source
const (
	URLUser              = "/users/%s"
	URLUserMeUsername    = "/users/@me/username"
	URLUserMutual        = URLUser + "/mutual"
	URLUserDM            = URLUser + "/dm"
	URLUserFlags         = URLUser + "/flags"
	URLUserFriend        = URLUser + "/friend"
	URLUserBlock         = URLUser + "/block"
	URLUserProfile       = URLUser + "/profile"
	URLUserRelationships = URLUser + "/relationships"
	URLUserDefaultAvatar = URLUser + "/default_avatar"

	URLServer            = "/servers/%s"
	URLServerAck         = URLServer + "/ack"
	URLServerChannels    = URLServer + "/channels"
	URLServerMembers     = URLServer + "/members"
	URLServerRoles       = URLServer + "/roles"
	URLServerRole        = URLServer + "/roles/%s"
	URLServerPermissions = URLServer + "/permissions/%s"
	URLServerInvites     = URLServer + "/invites"
	URLServerEmojis      = URLServer + "/emojis"
	URLServerRolesRanks  = URLServer + "/roles/ranks"
	URLServerBans        = URLServer + "/bans"
	URLServerBan         = URLServerBans + "/%s"
	URLServerMember      = URLServerMembers + "/%s"

	URLChannel                 = "/channels/%s"
	URLChannelAckMessage       = URLChannel + "/ack/%s"
	URLChannelJoinCall         = URLChannel + "/join_call"
	URLChannelEndRing          = URLChannel + "/end_ring/%s"
	URLChannelInvites          = URLChannel + "/invites"
	URLChannelPermission       = URLChannel + "/permissions/%s"
	URLChannelRecipient        = URLChannel + "/recipients/%s"
	URLChannelSearch           = URLChannel + "/search"
	URLChannelWebhooks         = URLChannel + "/webhooks"
	URLChannelMessages         = URLChannel + "/messages"
	URLChannelMessage          = URLChannelMessages + "/%s"
	URLChannelMembers          = URLChannel + "/members"
	URLChannelMessageReactions = URLChannelMessage + "/reactions"
	URLChannelMessageReaction  = URLChannelMessageReactions + "/%s"
	URLChannelMessagePin       = URLChannelMessages + "/%s/pin"

	URLWebhooks           = "/webhooks/%s"
	URLWebhookToken       = URLWebhooks + "/%s"
	URLWebhookTokenGitHub = URLWebhookToken + "/github"

	URLInvites = "/invites/%s"

	URLBots      = "/bots/%s"
	URLBotInvite = URLBots + "/invite"

	URLAuth        = "/auth"
	URLAuthMFA     = URLAuth + "/mfa/%s"
	URLAuthAccount = URLAuth + "/account/%s"
	URLAuthSession = URLAuth + "/session/%s"

	URLCustom      = "/custom"
	URLCustomEmoji = URLCustom + "/emoji/%s"

	URLOnboard = "/onboard/%s"

	URLSync = "/sync/%s"

	URLPush = "/push/%s"

	URLSafetyReport = "/safety/report"

	URLPolicy = "/policy/%s"
)
View Source
const (
	UserPermissionAccess      = 1 << 0
	UserPermissionViewProfile = 1 << 1
	UserPermissionSendMessage = 1 << 2
	UserPermissionInvite      = 1 << 3
)
View Source
const (
	PermissionManageChannel       = 1 << 0
	PermissionManageServer        = 1 << 1
	PermissionManagePermissions   = 1 << 2
	PermissionManageRole          = 1 << 3
	PermissionManageCustomisation = 1 << 4
	PermissionKickMembers         = 1 << 6
	PermissionBanMembers          = 1 << 7
	PermissionTimeoutMembers      = 1 << 8
	PermissionAssignRoles         = 1 << 9
	PermissionChangeNickname      = 1 << 10
	PermissionManageNicknames     = 1 << 11
	PermissionChangeAvatar        = 1 << 12
	PermissionRemoveAvatars       = 1 << 13
	PermissionViewChannel         = 1 << 20
	PermissionReadMessageHistory  = 1 << 21
	PermissionSendMessage         = 1 << 22
	PermissionManageMessages      = 1 << 23
	PermissionManageWebhooks      = 1 << 24
	PermissionInviteOthers        = 1 << 25
	PermissionSendEmbeds          = 1 << 26
	PermissionUploadFiles         = 1 << 27
	PermissionMasquerade          = 1 << 28
	PermissionReact               = 1 << 29
	PermissionConnect             = 1 << 30
	PermissionSpeak               = 1 << 31
	PermissionVideo               = 1 << 32
	PermissionMuteMembers         = 1 << 33
	PermissionDeafenMembers       = 1 << 34
	PermissionMoveMembers         = 1 << 35
	PermissionListen              = 1 << 36
	PermissionMentionEveryone     = 1 << 37
	PermissionMentionRoles        = 1 << 38
	PermissionGrantAllSafe        = 0x000F_FFFF_FFFF_FFFF
)
View Source
const (
	VERSION        = "v3.0.0"
	MainCommitsURL = "https://api.github.com/repos/sentinelb51/revoltgo/commits/main"
)
View Source
const (
	UserRelationsTypeNone         = "None"
	UserRelationsTypeUser         = "User"
	UserRelationsTypeFriend       = "Friend"
	UserRelationsTypeOutgoing     = "Outgoing"
	UserRelationsTypeIncoming     = "Incoming"
	UserRelationsTypeBlocked      = "Blocked"
	UserRelationsTypeBlockedOther = "BlockedOther"
)
View Source
const ExpressLoginFile string = ".auth_token"

Variables

View Source
var COMMIT = "9f8e300a18637a2edb5bdae18bc628d7c8712aea"

Functions

func AddHandler

func AddHandler[T any](s *Session, handler func(*Session, T))

AddHandler registers an event handler using generics. It infers the event name from the handler's argument type, removing the need for a type switch.

func BaseURL

func BaseURL() string

func CDNURL

func CDNURL() string

func EndpointAuthAccount

func EndpointAuthAccount(action string) string

func EndpointAuthAccountChange

func EndpointAuthAccountChange(detail string) string

func EndpointAuthAccountVerify

func EndpointAuthAccountVerify(code string) string

func EndpointAuthMFA

func EndpointAuthMFA(action string) string

func EndpointAuthSession

func EndpointAuthSession(action string) string

func EndpointAutumn

func EndpointAutumn(tag string) string

func EndpointAutumnFile

func EndpointAutumnFile(tag, id, size string) (url string)

func EndpointBot

func EndpointBot(bID string) string

func EndpointBotInvite

func EndpointBotInvite(bID string) string

func EndpointChannel

func EndpointChannel(cID string) string

func EndpointChannelAckMessage

func EndpointChannelAckMessage(cID, mID string) string

func EndpointChannelEndRing

func EndpointChannelEndRing(cID, uID string) string

func EndpointChannelInvites

func EndpointChannelInvites(cID string) string

func EndpointChannelJoinCall

func EndpointChannelJoinCall(cID string) string

func EndpointChannelMembers

func EndpointChannelMembers(cID string) string

func EndpointChannelMessage

func EndpointChannelMessage(cID, mID string) string

func EndpointChannelMessagePin

func EndpointChannelMessagePin(cID, mID string) string

func EndpointChannelMessageReaction

func EndpointChannelMessageReaction(cID, mID, rID string) string

func EndpointChannelMessageReactions

func EndpointChannelMessageReactions(cID, mID string) string

func EndpointChannelMessages

func EndpointChannelMessages(cID string) string

func EndpointChannelPermission

func EndpointChannelPermission(cID, rID string) string

func EndpointChannelRecipients

func EndpointChannelRecipients(cID, uID string) string

func EndpointChannelSearch

func EndpointChannelSearch(cID string) string

func EndpointChannelWebhooks

func EndpointChannelWebhooks(cID string) string

func EndpointCustomEmoji

func EndpointCustomEmoji(eID string) string

func EndpointInvite

func EndpointInvite(sID string) string

func EndpointOnboard

func EndpointOnboard(action string) string

func EndpointPolicy

func EndpointPolicy(action string) string

func EndpointPush

func EndpointPush(action string) string

func EndpointServer

func EndpointServer(sID string) string

func EndpointServerAck

func EndpointServerAck(sID string) string

func EndpointServerBan

func EndpointServerBan(sID, uID string) string

func EndpointServerBans

func EndpointServerBans(sID string) string

func EndpointServerChannels

func EndpointServerChannels(sID string) string

func EndpointServerEmojis

func EndpointServerEmojis(sID string) string

func EndpointServerInvites

func EndpointServerInvites(sID string) string

func EndpointServerMember

func EndpointServerMember(sID, mID string) string

func EndpointServerMembers

func EndpointServerMembers(sID string, excludeOffline bool) string

func EndpointServerPermissions

func EndpointServerPermissions(sID, rID string) string

func EndpointServerRole

func EndpointServerRole(sID, rID string) string

func EndpointServerRoles

func EndpointServerRoles(sID string) string

func EndpointServerRolesRanks

func EndpointServerRolesRanks(sID string) string

func EndpointSync

func EndpointSync(id string) string

func EndpointSyncSettings

func EndpointSyncSettings(action string) string

EndpointSyncSettings supports either "set" or "fetch" as action.

func EndpointUser

func EndpointUser(uID string) string

func EndpointUserBlock

func EndpointUserBlock(uID string) string

func EndpointUserDM

func EndpointUserDM(uID string) string

func EndpointUserDefaultAvatar

func EndpointUserDefaultAvatar(uID string) string

func EndpointUserFlags

func EndpointUserFlags(uID string) string

func EndpointUserFriend

func EndpointUserFriend(uID string) string

func EndpointUserMutual

func EndpointUserMutual(uID string) string

func EndpointUserProfile

func EndpointUserProfile(uID string) string

func EndpointWebhook

func EndpointWebhook(wID string) string

func EndpointWebhookGitHub

func EndpointWebhookGitHub(wID, token string) string

func EndpointWebhookToken

func EndpointWebhookToken(wID, token string) string

func HasUpdate

func HasUpdate() bool

func NewWithLogin

func NewWithLogin(data LoginParams) (*Session, LoginResponse, error)

NewWithLogin exchanges an email and password for a session token, and then creates a new session. You are expected to store and re-use the token for future sessions.

func SetBaseURL

func SetBaseURL(newURL string) error

SetBaseURL sets the base URL for the API. Call before opening any sessions; this is not mutex-protected.

func SetCDNURL

func SetCDNURL(newURL string) error

SetCDNURL sets the base URL for the CDN (Autumn). Call before opening any sessions; this is not mutex-protected.

func WebhookFromURL

func WebhookFromURL(uri string) (wID, wToken string, err error)

WebhookFromURL extracts the webhook ID and token from a full webhook URL, for example: https://stoat.chat/api/webhooks/08UE096D31N8ZM7PJFAHFSST8R/5uC1w7KjCixSD49XFOQ2qEkLo3ukvWDbK6_EEfZ-1gqRYRiVaXI8mYrSDjRv0T1y

Types

type Account

type Account struct {
	ID    string `msg:"_id" json:"_id,omitempty"`
	Email string `msg:"email" json:"email,omitempty"`
}

func (Account) MarshalMsg

func (z Account) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Account) Msgsize

func (z Account) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Account) UnmarshalMsg

func (z *Account) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AccountChangeEmailParams

type AccountChangeEmailParams struct {
	Email           string `msg:"email" json:"email,omitempty"`
	CurrentPassword string `msg:"current_password" json:"current_password,omitempty"`
}

func (AccountChangeEmailParams) MarshalMsg

func (z AccountChangeEmailParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AccountChangeEmailParams) Msgsize

func (z AccountChangeEmailParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AccountChangeEmailParams) UnmarshalMsg

func (z *AccountChangeEmailParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AccountChangePasswordParams

type AccountChangePasswordParams struct {
	Password        string `msg:"password" json:"password,omitempty"`
	CurrentPassword string `msg:"current_password" json:"current_password,omitempty"`
}

func (AccountChangePasswordParams) MarshalMsg

func (z AccountChangePasswordParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AccountChangePasswordParams) Msgsize

func (z AccountChangePasswordParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AccountChangePasswordParams) UnmarshalMsg

func (z *AccountChangePasswordParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AccountCreateParams

type AccountCreateParams struct {
	Email    string `msg:"email" json:"email,omitempty"`
	Password string `msg:"password" json:"password,omitempty"`
	Invite   string `msg:"invite" json:"invite,omitempty"`
	Captcha  string `msg:"captcha" json:"captcha,omitempty"`
}

func (*AccountCreateParams) MarshalMsg

func (z *AccountCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*AccountCreateParams) Msgsize

func (z *AccountCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AccountCreateParams) UnmarshalMsg

func (z *AccountCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AccountDeleteConfirmParams

type AccountDeleteConfirmParams struct {
	Token string `msg:"token" json:"token,omitempty"`
}

func (AccountDeleteConfirmParams) MarshalMsg

func (z AccountDeleteConfirmParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AccountDeleteConfirmParams) Msgsize

func (z AccountDeleteConfirmParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AccountDeleteConfirmParams) UnmarshalMsg

func (z *AccountDeleteConfirmParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AccountReverifyParams

type AccountReverifyParams struct {
	Email   string `msg:"email" json:"email,omitempty"`
	Captcha string `msg:"captcha" json:"captcha,omitempty"`
}

func (AccountReverifyParams) MarshalMsg

func (z AccountReverifyParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AccountReverifyParams) Msgsize

func (z AccountReverifyParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AccountReverifyParams) UnmarshalMsg

func (z *AccountReverifyParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Attachment

type Attachment struct {
	ID string `msg:"_id" json:"_id,omitempty"`

	// Tag / bucket this file was uploaded to
	Tag string `msg:"tag" json:"tag,omitempty"`

	// Original filename
	Filename string `msg:"filename" json:"filename,omitempty"`

	// Metadata associated with file
	Metadata *AttachmentMetadata `msg:"metadata" json:"metadata,omitempty"`

	// Raw content type of this file
	ContentType string `msg:"content_type" json:"content_type,omitempty"`

	// Size of this file (in bytes)
	Size int `msg:"size" json:"size,omitempty"`

	// Whether this file was deleted
	Deleted bool `msg:"deleted" json:"deleted,omitempty"`

	// Whether this file was reported
	Reported bool `msg:"reported" json:"reported,omitempty"`

	MessageID string `msg:"message_id" json:"message_id,omitempty"`
	UserID    string `msg:"user_id" json:"user_id,omitempty"`
	ServerID  string `msg:"server_id" json:"server_id,omitempty"`
	ObjectID  string `msg:"object_id" json:"object_id,omitempty"`
}

func (*Attachment) MarshalMsg

func (z *Attachment) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Attachment) Msgsize

func (z *Attachment) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Attachment) URL

func (a Attachment) URL(size string) string

func (*Attachment) UnmarshalMsg

func (z *Attachment) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AttachmentMetadata

type AttachmentMetadata struct {
	Type AttachmentMetadataType `msg:"type" json:"type,omitempty"`

	Width  int `msg:"width" json:"width,omitempty"`
	Height int `msg:"height" json:"height,omitempty"`
}

func (AttachmentMetadata) MarshalMsg

func (z AttachmentMetadata) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AttachmentMetadata) Msgsize

func (z AttachmentMetadata) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AttachmentMetadata) UnmarshalMsg

func (z *AttachmentMetadata) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AttachmentMetadataType

type AttachmentMetadataType string
const (
	AttachmentMetadataTypeFile  AttachmentMetadataType = "File"
	AttachmentMetadataTypeText  AttachmentMetadataType = "Text"
	AttachmentMetadataTypeImage AttachmentMetadataType = "Image"
	AttachmentMetadataTypeVideo AttachmentMetadataType = "Video"
	AttachmentMetadataTypeAudio AttachmentMetadataType = "Audio"
)

func (AttachmentMetadataType) MarshalMsg

func (z AttachmentMetadataType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AttachmentMetadataType) Msgsize

func (z AttachmentMetadataType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AttachmentMetadataType) UnmarshalMsg

func (z *AttachmentMetadataType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AuthMFAMethod

type AuthMFAMethod string
const (
	AuthMFAMethodPassword AuthMFAMethod = "Password"
	AuthMFAMethodRecovery AuthMFAMethod = "Recovery"
	AuthMFAMethodTOTP     AuthMFAMethod = "Totp"
)

func (AuthMFAMethod) MarshalMsg

func (z AuthMFAMethod) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AuthMFAMethod) Msgsize

func (z AuthMFAMethod) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AuthMFAMethod) UnmarshalMsg

func (z *AuthMFAMethod) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AuthMFAParams

type AuthMFAParams struct {
	Password     string `msg:"password" json:"password,omitempty"`
	RecoveryCode string `msg:"recovery_code" json:"recovery_code,omitempty"`
	TOTPCode     string `msg:"totp_code" json:"totp_code,omitempty"`
}

AuthMFAParams should only have one of its fields set, and is used for various MFA methods

func (AuthMFAParams) MarshalMsg

func (z AuthMFAParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AuthMFAParams) Msgsize

func (z AuthMFAParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AuthMFAParams) UnmarshalMsg

func (z *AuthMFAParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AuthMFAResponse

type AuthMFAResponse struct {
	EmailOTP        bool `msg:"email_otp" json:"email_otp"`
	TrustedHandover bool `msg:"trusted_handover" json:"trusted_handover"`
	EmailMFA        bool `msg:"email_mfa" json:"email_mfa"`
	TotpMFA         bool `msg:"totp_mfa" json:"totp_mfa"`
	SecurityKeyMFA  bool `msg:"security_key_mfa" json:"security_key_mfa"`
	RecoveryActive  bool `msg:"recovery_active" json:"recovery_active"`
}

func (*AuthMFAResponse) MarshalMsg

func (z *AuthMFAResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*AuthMFAResponse) Msgsize

func (z *AuthMFAResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AuthMFAResponse) UnmarshalMsg

func (z *AuthMFAResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AuthMFATOTPSecretResponse

type AuthMFATOTPSecretResponse struct {
	Secret string `msg:"secret" json:"secret,omitempty"`
}

func (AuthMFATOTPSecretResponse) MarshalMsg

func (z AuthMFATOTPSecretResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AuthMFATOTPSecretResponse) Msgsize

func (z AuthMFATOTPSecretResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AuthMFATOTPSecretResponse) UnmarshalMsg

func (z *AuthMFATOTPSecretResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AuthMFATicketResponse

type AuthMFATicketResponse struct {
	MFATicket
}

func (*AuthMFATicketResponse) MarshalMsg

func (z *AuthMFATicketResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*AuthMFATicketResponse) Msgsize

func (z *AuthMFATicketResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AuthMFATicketResponse) UnmarshalMsg

func (z *AuthMFATicketResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type AuthType

type AuthType string
const (
	EventTypeAuthDeleteSession     AuthType = "DeleteSession"
	EventTypeAuthDeleteAllSessions AuthType = "DeleteAllSessions"
)

func (AuthType) MarshalMsg

func (z AuthType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AuthType) Msgsize

func (z AuthType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*AuthType) UnmarshalMsg

func (z *AuthType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Bot

type Bot struct {
	ID string `msg:"_id" json:"_id,omitempty"`

	// User ID of the bot owner
	Owner string `msg:"owner" json:"owner,omitempty"`

	// Token used to authenticate requests for this bot
	Token string `msg:"token" json:"token,omitempty"`

	// Whether the bot is public (may be invited by anyone)
	Public bool `msg:"public" json:"public,omitempty"`

	// Whether to enable analytics
	Analytics bool `msg:"analytics" json:"analytics,omitempty"`

	// Whether this bot should be publicly discoverable
	Discoverable bool `msg:"discoverable" json:"discoverable,omitempty"`

	// Reserved; URL for handling interactions
	InteractionsURL string `msg:"interactions_url" json:"interactions_url,omitempty"`

	// URL for terms of service
	TermsOfServiceURL string `msg:"terms_of_service_url" json:"terms_of_service_url,omitempty"`

	// URL for privacy policy
	PrivacyPolicyURL string `msg:"privacy_policy_url" json:"privacy_policy_url,omitempty"`

	// Enum of bot flags
	Flags int `msg:"flags" json:"flags,omitempty"`
}

func (*Bot) MarshalMsg

func (z *Bot) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Bot) Msgsize

func (z *Bot) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Bot) UnmarshalMsg

func (z *Bot) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BotCreateParams

type BotCreateParams struct {
	Name string `msg:"name" json:"name,omitempty"`
}

func (BotCreateParams) MarshalMsg

func (z BotCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BotCreateParams) Msgsize

func (z BotCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BotCreateParams) UnmarshalMsg

func (z *BotCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BotEditParams

type BotEditParams struct {
	Name            string   `msg:"name" json:"name,omitempty"`
	Public          bool     `msg:"public" json:"public,omitempty"`
	Analytics       bool     `msg:"analytics" json:"analytics,omitempty"`
	InteractionsURL string   `msg:"interactions_url" json:"interactions_url,omitempty"`
	Remove          []string `msg:"remove" json:"remove,omitempty"`
}

func (*BotEditParams) MarshalMsg

func (z *BotEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BotEditParams) Msgsize

func (z *BotEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BotEditParams) UnmarshalMsg

func (z *BotEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BotInformation

type BotInformation struct {
	Owner string `msg:"owner" json:"owner,omitempty"`
}

func (BotInformation) MarshalMsg

func (z BotInformation) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BotInformation) Msgsize

func (z BotInformation) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BotInformation) UnmarshalMsg

func (z *BotInformation) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BotInviteParams

type BotInviteParams struct {
	Server string `msg:"server" json:"server,omitempty"`
	Group  string `msg:"group" json:"group,omitempty"`
}

func (BotInviteParams) MarshalMsg

func (z BotInviteParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BotInviteParams) Msgsize

func (z BotInviteParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BotInviteParams) UnmarshalMsg

func (z *BotInviteParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChangeEmail

type ChangeEmail struct {
	Ticket MFATicket `msg:"ticket" json:"ticket,omitempty"` // Why is this nested (seriously, look at AuthMFATicketResponse)
}

func (*ChangeEmail) MarshalMsg

func (z *ChangeEmail) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChangeEmail) Msgsize

func (z *ChangeEmail) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChangeEmail) UnmarshalMsg

func (z *ChangeEmail) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Channel

type Channel struct {
	ID          string      `msg:"_id" json:"_id,omitempty"`
	ChannelType ChannelType `msg:"channel_type" json:"channel_type,omitempty"`

	Name        string      `msg:"name" json:"name,omitempty"`
	Description *string     `msg:"description" json:"description,omitempty"`
	Icon        *Attachment `msg:"icon" json:"icon,omitempty"`
	NSFW        bool        `msg:"nsfw" json:"nsfw,omitempty"`
	Active      bool        `msg:"active" json:"active,omitempty"`

	Server          *string                        `msg:"server" json:"server,omitempty"`                     // Server channels only
	Voice           *ChannelVoiceInformation       `msg:"voice" json:"voice,omitempty"`                       // Server channels only
	RolePermissions map[string]PermissionOverwrite `msg:"role_permissions" json:"role_permissions,omitempty"` // Server channel only

	Recipients  []string `msg:"recipients" json:"recipients,omitempty"`   // DM or Group
	Permissions *int64   `msg:"permissions" json:"permissions,omitempty"` // Group only
	Owner       string   `msg:"owner" json:"owner,omitempty"`             // Group or SavedMessages ("user" in SavedMessages)

	LastMessageID      *string              `msg:"last_message_id" json:"last_message_id,omitempty"`
	DefaultPermissions *PermissionOverwrite `msg:"default_permissions" json:"default_permissions,omitempty"`
}

Channel is derived from https://github.com/stoatchat/stoatchat/blob/main/crates/core/models/src/v0/channels.rs#L13

func (*Channel) MarshalMsg

func (z *Channel) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Channel) Msgsize

func (z *Channel) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Channel) UnmarshalMsg

func (z *Channel) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelEditParams

type ChannelEditParams struct {
	Name        string   `msg:"name" json:"name,omitempty"`
	Description string   `msg:"description" json:"description,omitempty"`
	Owner       string   `msg:"owner" json:"owner,omitempty"`
	Icon        string   `msg:"icon" json:"icon,omitempty"`
	NSFW        bool     `msg:"nsfw" json:"nsfw,omitempty"`
	Archived    bool     `msg:"archived" json:"archived,omitempty"`
	Remove      []string `msg:"remove" json:"remove,omitempty"`
}

func (*ChannelEditParams) MarshalMsg

func (z *ChannelEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelEditParams) Msgsize

func (z *ChannelEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelEditParams) UnmarshalMsg

func (z *ChannelEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelFetchedMessages

type ChannelFetchedMessages struct {
	Messages []*Message      `msg:"messages" json:"messages,omitempty"`
	Users    []*User         `msg:"users" json:"users,omitempty"`
	Members  []*ServerMember `msg:"members" json:"members,omitempty"`
}

func (*ChannelFetchedMessages) MarshalMsg

func (z *ChannelFetchedMessages) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelFetchedMessages) Msgsize

func (z *ChannelFetchedMessages) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelFetchedMessages) UnmarshalMsg

func (z *ChannelFetchedMessages) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelJoinCall

type ChannelJoinCall struct {
	// Token for authenticating with the voice server
	Token string `msg:"token" json:"token,omitempty"`

	// URL of the livekit server to connect to
	URL string `msg:"url" json:"url,omitempty"`
}

func (ChannelJoinCall) MarshalMsg

func (z ChannelJoinCall) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ChannelJoinCall) Msgsize

func (z ChannelJoinCall) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelJoinCall) UnmarshalMsg

func (z *ChannelJoinCall) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelJoinCallParams

type ChannelJoinCallParams struct {
	Node string `msg:"node" json:"node,omitempty"` // Name of the node to join

	// Whether to force disconnect any other existing voice connections
	// Useful for disconnecting on another device and joining on a new one
	ForceDisconnect bool `msg:"force_disconnect" json:"force_disconnect,omitempty"`

	// Users which should be notified of the call starting
	// Only used when the user is the first one connected.
	Recipients []string `msg:"recipients" json:"recipients,omitempty"`
}

func (*ChannelJoinCallParams) MarshalMsg

func (z *ChannelJoinCallParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelJoinCallParams) Msgsize

func (z *ChannelJoinCallParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelJoinCallParams) UnmarshalMsg

func (z *ChannelJoinCallParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelMessageBulkDeleteParams

type ChannelMessageBulkDeleteParams struct {
	IDs []string `msg:"ids" json:"ids,omitempty"`
}

func (*ChannelMessageBulkDeleteParams) MarshalMsg

func (z *ChannelMessageBulkDeleteParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelMessageBulkDeleteParams) Msgsize

func (z *ChannelMessageBulkDeleteParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelMessageBulkDeleteParams) UnmarshalMsg

func (z *ChannelMessageBulkDeleteParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelMessages

type ChannelMessages struct {
	Messages []*Message      `msg:"messages" json:"messages,omitempty"`
	Users    []*User         `msg:"users" json:"users,omitempty"`
	Members  []*ServerMember `msg:"members" json:"members,omitempty"`
}

func (*ChannelMessages) MarshalMsg

func (z *ChannelMessages) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelMessages) Msgsize

func (z *ChannelMessages) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelMessages) UnmarshalMsg

func (z *ChannelMessages) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelMessagesParams

type ChannelMessagesParams struct {
	// Maximum number of messages to fetch. For nearby messages, this is (limit + 2)
	Limit int `msg:"limit" json:"limit,omitempty"`

	// Message ID before which messages should be fetched
	Before string `msg:"before" json:"before,omitempty"`

	// Message ID after which messages should be fetched
	After string `msg:"after" json:"after,omitempty"`

	// Message sort direction
	Sort ChannelMessagesParamsSortType `msg:"sort" json:"sort,omitempty"`

	// Message ID to search around. Specifying this ignores Before, After, and Sort
	Nearby string `msg:"nearby" json:"nearby,omitempty"`

	// Whether to include user (and member, if server channel) objects
	IncludeUsers bool `msg:"include_users" json:"include_users,omitempty"`
}

ChannelMessagesParams is for /channels/{target}/messages

func (ChannelMessagesParams) Encode

func (p ChannelMessagesParams) Encode() string

func (*ChannelMessagesParams) MarshalMsg

func (z *ChannelMessagesParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelMessagesParams) Msgsize

func (z *ChannelMessagesParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelMessagesParams) UnmarshalMsg

func (z *ChannelMessagesParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelMessagesParamsSortType

type ChannelMessagesParamsSortType string
const (
	ChannelMessagesParamsSortTypeRelevance ChannelMessagesParamsSortType = "Relevance"
	ChannelMessagesParamsSortTypeOldest    ChannelMessagesParamsSortType = "Oldest"
	ChannelMessagesParamsSortTypeLatest    ChannelMessagesParamsSortType = "Latest"
)

func (ChannelMessagesParamsSortType) MarshalMsg

func (z ChannelMessagesParamsSortType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ChannelMessagesParamsSortType) Msgsize

func (z ChannelMessagesParamsSortType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelMessagesParamsSortType) UnmarshalMsg

func (z *ChannelMessagesParamsSortType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelSearchParams

type ChannelSearchParams struct {
	ChannelMessagesParams `msg:",inline"`

	// Whether to only search for pinned messages; cannot be sent with query.
	Pinned bool `msg:"pinned" json:"pinned,omitempty"`

	// Full-text search query. See https://www.mongodb.com/docs/manual/text-search/#-text-operator
	Query string `msg:"query" json:"query,omitempty"`
}

ChannelSearchParams is for /channels/{target}/search

func (*ChannelSearchParams) MarshalMsg

func (z *ChannelSearchParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelSearchParams) Msgsize

func (z *ChannelSearchParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelSearchParams) UnmarshalMsg

func (z *ChannelSearchParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelType

type ChannelType string
const (
	ChannelTypeSavedMessages ChannelType = "SavedMessages"
	ChannelTypeText          ChannelType = "TextChannel"
	ChannelTypeVoice         ChannelType = "VoiceChannel"
	ChannelTypeDM            ChannelType = "DirectMessage"
	ChannelTypeGroup         ChannelType = "Group"
)

func (ChannelType) MarshalMsg

func (z ChannelType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ChannelType) Msgsize

func (z ChannelType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelType) UnmarshalMsg

func (z *ChannelType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelUnread

type ChannelUnread struct {
	ID            ChannelUnreadCompositeID `msg:"_id" json:"_id"`
	LastMessageID *string                  `msg:"last_id" json:"last_id,omitempty"`
	MentionIDs    []string                 `msg:"mentions" json:"mentions,omitempty"`
}

func (*ChannelUnread) MarshalMsg

func (z *ChannelUnread) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelUnread) Msgsize

func (z *ChannelUnread) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelUnread) UnmarshalMsg

func (z *ChannelUnread) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelUnreadCompositeID

type ChannelUnreadCompositeID struct {
	Channel string `msg:"channel" json:"channel"`
	User    string `msg:"user" json:"user"`
}

func (ChannelUnreadCompositeID) MarshalMsg

func (z ChannelUnreadCompositeID) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ChannelUnreadCompositeID) Msgsize

func (z ChannelUnreadCompositeID) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelUnreadCompositeID) UnmarshalMsg

func (z *ChannelUnreadCompositeID) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelVoiceInformation

type ChannelVoiceInformation struct {
	MaxUsers *int `msg:"max_users" json:"max_users,omitempty"`
}

func (*ChannelVoiceInformation) MarshalMsg

func (z *ChannelVoiceInformation) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelVoiceInformation) Msgsize

func (z *ChannelVoiceInformation) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelVoiceInformation) UnmarshalMsg

func (z *ChannelVoiceInformation) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ChannelVoiceState

type ChannelVoiceState struct {
	ID           string            `msg:"id" json:"id,omitempty"`
	Participants []*UserVoiceState `msg:"participants" json:"participants,omitempty"`
}

func (*ChannelVoiceState) MarshalMsg

func (z *ChannelVoiceState) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ChannelVoiceState) Msgsize

func (z *ChannelVoiceState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ChannelVoiceState) UnmarshalMsg

func (z *ChannelVoiceState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type CompositeChannelID

type CompositeChannelID struct {
	Channel string `msg:"channel" json:"channel,omitempty"`
	User    string `msg:"user" json:"user,omitempty"`
}

func (CompositeChannelID) MarshalMsg

func (z CompositeChannelID) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (CompositeChannelID) Msgsize

func (z CompositeChannelID) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CompositeChannelID) UnmarshalMsg

func (z *CompositeChannelID) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Emoji

type Emoji struct {
	ID        string       `msg:"_id" json:"_id,omitempty"`
	Parent    *EmojiParent `msg:"parent" json:"parent,omitempty"`
	CreatorID string       `msg:"creator_id" json:"creator_id,omitempty"`
	Name      string       `msg:"name" json:"name,omitempty"`
	Animated  bool         `msg:"animated" json:"animated,omitempty"`
	NSFW      bool         `msg:"nsfw" json:"nsfw,omitempty"`
}

func (*Emoji) MarshalMsg

func (z *Emoji) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Emoji) Msgsize

func (z *Emoji) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Emoji) UnmarshalMsg

func (z *Emoji) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EmojiCreateParams

type EmojiCreateParams struct {
	Name   string       `msg:"name" json:"name,omitempty"`
	Parent *EmojiParent `msg:"parent" json:"parent,omitempty"`
	NSFW   bool         `msg:"nsfw" json:"nsfw,omitempty"`
}

func (*EmojiCreateParams) MarshalMsg

func (z *EmojiCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EmojiCreateParams) Msgsize

func (z *EmojiCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EmojiCreateParams) UnmarshalMsg

func (z *EmojiCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EmojiParent

type EmojiParent struct {
	Type string `msg:"type" json:"type,omitempty"`
	ID   string `msg:"id" json:"id,omitempty"`
}

func (EmojiParent) MarshalMsg

func (z EmojiParent) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EmojiParent) Msgsize

func (z EmojiParent) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EmojiParent) UnmarshalMsg

func (z *EmojiParent) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Event

type Event struct {
	Type string `msg:"type" json:"type,omitempty"`
}

func (Event) MarshalMsg

func (z Event) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Event) Msgsize

func (z Event) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Event) String

func (e *Event) String() string

func (*Event) UnmarshalMsg

func (z *Event) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventAuth

type EventAuth struct {
	Event
	EventType AuthType `msg:"event_type" json:"event_type,omitempty"`
	UserID    string   `msg:"user_id" json:"user_id,omitempty"`
	SessionID string   `msg:"session_id" json:"session_id,omitempty"`

	// Only present when... I forgot.
	ExcludeSessionID string `msg:"exclude_session_id" json:"exclude_session_id,omitempty"`
}

func (*EventAuth) MarshalMsg

func (z *EventAuth) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventAuth) Msgsize

func (z *EventAuth) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventAuth) UnmarshalMsg

func (z *EventAuth) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventAuthenticated

type EventAuthenticated struct {
	Event `msg:",flatten"`
}

EventAuthenticated is sent after the client has authenticated.

func (EventAuthenticated) MarshalMsg

func (z EventAuthenticated) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventAuthenticated) Msgsize

func (z EventAuthenticated) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventAuthenticated) UnmarshalMsg

func (z *EventAuthenticated) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventBulk

type EventBulk struct {
	Event
	V []msgp.Raw `msg:"v" json:"v,omitempty"`
}

func (*EventBulk) MarshalMsg

func (z *EventBulk) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventBulk) Msgsize

func (z *EventBulk) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventBulk) UnmarshalMsg

func (z *EventBulk) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventBulkMessageDelete

type EventBulkMessageDelete struct {
	Event   `msg:",flatten"`
	Channel string   `msg:"channel" json:"channel,omitempty"`
	IDs     []string `msg:"ids" json:"ids,omitempty"`
}

func (*EventBulkMessageDelete) MarshalMsg

func (z *EventBulkMessageDelete) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventBulkMessageDelete) Msgsize

func (z *EventBulkMessageDelete) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventBulkMessageDelete) UnmarshalMsg

func (z *EventBulkMessageDelete) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelAck

type EventChannelAck struct {
	Event     `msg:",flatten"`
	ID        string `msg:"id" json:"id,omitempty"`
	User      string `msg:"user" json:"user,omitempty"`
	MessageID string `msg:"message_id" json:"message_id,omitempty"`
}

func (*EventChannelAck) MarshalMsg

func (z *EventChannelAck) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventChannelAck) Msgsize

func (z *EventChannelAck) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelAck) UnmarshalMsg

func (z *EventChannelAck) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelCreate

type EventChannelCreate struct {
	Event   `msg:",flatten"`
	Channel `msg:",flatten"`
}

EventChannelCreate is sent when a channel is created. This is dispatched in conjunction with EventServerUpdate

func (*EventChannelCreate) MarshalMsg

func (z *EventChannelCreate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventChannelCreate) Msgsize

func (z *EventChannelCreate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelCreate) UnmarshalMsg

func (z *EventChannelCreate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelDelete

type EventChannelDelete struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
}

EventChannelDelete is sent when a channel is deleted.

func (EventChannelDelete) MarshalMsg

func (z EventChannelDelete) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventChannelDelete) Msgsize

func (z EventChannelDelete) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelDelete) UnmarshalMsg

func (z *EventChannelDelete) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelGroupJoin

type EventChannelGroupJoin struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
	User  string `msg:"user" json:"user,omitempty"`
}

func (EventChannelGroupJoin) MarshalMsg

func (z EventChannelGroupJoin) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventChannelGroupJoin) Msgsize

func (z EventChannelGroupJoin) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelGroupJoin) UnmarshalMsg

func (z *EventChannelGroupJoin) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelGroupLeave

type EventChannelGroupLeave struct {
	EventChannelGroupJoin `msg:",flatten"`
}

func (EventChannelGroupLeave) MarshalMsg

func (z EventChannelGroupLeave) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventChannelGroupLeave) Msgsize

func (z EventChannelGroupLeave) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelGroupLeave) UnmarshalMsg

func (z *EventChannelGroupLeave) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelStartTyping

type EventChannelStartTyping struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
	User  string `msg:"user" json:"user,omitempty"`
}

EventChannelStartTyping is sent when a user starts typing in a channel.

func (EventChannelStartTyping) MarshalMsg

func (z EventChannelStartTyping) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventChannelStartTyping) Msgsize

func (z EventChannelStartTyping) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelStartTyping) UnmarshalMsg

func (z *EventChannelStartTyping) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelStopTyping

type EventChannelStopTyping struct {
	EventChannelStartTyping `msg:",flatten"`
}

EventChannelStopTyping is sent when a user stops typing in a channel.

func (EventChannelStopTyping) MarshalMsg

func (z EventChannelStopTyping) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventChannelStopTyping) Msgsize

func (z EventChannelStopTyping) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelStopTyping) UnmarshalMsg

func (z *EventChannelStopTyping) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventChannelUpdate

type EventChannelUpdate struct {
	Event `msg:",flatten"`
	ID    string         `msg:"id" json:"id,omitempty"`
	Data  PartialChannel `msg:"data" json:"data,omitempty"`
	Clear []string       `msg:"clear" json:"clear,omitempty"`
}

EventChannelUpdate is sent when a channel is updated. Data will only contain fields that were modified.

func (*EventChannelUpdate) MarshalMsg

func (z *EventChannelUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventChannelUpdate) Msgsize

func (z *EventChannelUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventChannelUpdate) UnmarshalMsg

func (z *EventChannelUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventEmojiCreate

type EventEmojiCreate struct {
	Event `msg:",flatten"`
	Emoji `msg:",flatten"`
}

func (*EventEmojiCreate) MarshalMsg

func (z *EventEmojiCreate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventEmojiCreate) Msgsize

func (z *EventEmojiCreate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventEmojiCreate) UnmarshalMsg

func (z *EventEmojiCreate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventEmojiDelete

type EventEmojiDelete struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
}

func (EventEmojiDelete) MarshalMsg

func (z EventEmojiDelete) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventEmojiDelete) Msgsize

func (z EventEmojiDelete) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventEmojiDelete) UnmarshalMsg

func (z *EventEmojiDelete) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventError

type EventError struct {
	Event
	Data EventErrorData `msg:"data" json:"data,omitempty"`
}

func (*EventError) MarshalMsg

func (z *EventError) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventError) Msgsize

func (z *EventError) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventError) UnmarshalMsg

func (z *EventError) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventErrorData

type EventErrorData struct {
	Type     EventErrorDataType `msg:"type" json:"type,omitempty"`
	Location string             `msg:"location" json:"location,omitempty"`
}

func (EventErrorData) MarshalMsg

func (z EventErrorData) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventErrorData) Msgsize

func (z EventErrorData) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventErrorData) UnmarshalMsg

func (z *EventErrorData) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventErrorDataType

type EventErrorDataType string

EventErrorDataType is derived from https://developers.revolt.chat/developers/events/protocol.html#error

const (
	EventErrorLabelMe               EventErrorDataType = "LabelMe"
	EventErrorInternalError         EventErrorDataType = "InternalError"
	EventErrorInvalidSession        EventErrorDataType = "InvalidSession"
	EventErrorOnboardingNotFinished EventErrorDataType = "OnboardingNotFinished"
	EventErrorAlreadyAuthenticated  EventErrorDataType = "AlreadyAuthenticated"
)

func (EventErrorDataType) MarshalMsg

func (z EventErrorDataType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventErrorDataType) Msgsize

func (z EventErrorDataType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventErrorDataType) UnmarshalMsg

func (z *EventErrorDataType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventLogout

type EventLogout struct {
	Event `msg:",flatten"`
}

func (EventLogout) MarshalMsg

func (z EventLogout) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventLogout) Msgsize

func (z EventLogout) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventLogout) UnmarshalMsg

func (z *EventLogout) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventMessage

type EventMessage struct {
	Event   `msg:",flatten"`
	Message `msg:",flatten"`
}

func (*EventMessage) MarshalMsg

func (z *EventMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventMessage) Msgsize

func (z *EventMessage) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventMessage) UnmarshalMsg

func (z *EventMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventMessageAppend

type EventMessageAppend struct {
	ID      string  `msg:"id" json:"id,omitempty"`
	Channel string  `msg:"channel" json:"channel,omitempty"`
	Append  Message `msg:"append" json:"append,omitempty"`
}

func (*EventMessageAppend) MarshalMsg

func (z *EventMessageAppend) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventMessageAppend) Msgsize

func (z *EventMessageAppend) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventMessageAppend) UnmarshalMsg

func (z *EventMessageAppend) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventMessageDelete

type EventMessageDelete struct {
	Event   `msg:",flatten"`
	ID      string `msg:"id" json:"id,omitempty"`
	Channel string `msg:"channel" json:"channel,omitempty"`
}

func (EventMessageDelete) MarshalMsg

func (z EventMessageDelete) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventMessageDelete) Msgsize

func (z EventMessageDelete) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventMessageDelete) UnmarshalMsg

func (z *EventMessageDelete) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventMessageReact

type EventMessageReact struct {
	Event     `msg:",flatten"`
	ID        string `msg:"id" json:"id,omitempty"`
	ChannelID string `msg:"channel_id" json:"channel_id,omitempty"`
	UserID    string `msg:"user_id" json:"user_id,omitempty"`
	EmojiID   string `msg:"emoji_id" json:"emoji_id,omitempty"`
}

func (*EventMessageReact) MarshalMsg

func (z *EventMessageReact) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventMessageReact) Msgsize

func (z *EventMessageReact) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventMessageReact) UnmarshalMsg

func (z *EventMessageReact) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventMessageRemoveReaction

type EventMessageRemoveReaction struct {
	ID        string `msg:"id" json:"id,omitempty"`
	ChannelID string `msg:"channel_id" json:"channel_id,omitempty"`
	EmojiID   string `msg:"emoji_id" json:"emoji_id,omitempty"`
}

EventMessageRemoveReaction is sent when all the reactions are removed from a message.

func (EventMessageRemoveReaction) MarshalMsg

func (z EventMessageRemoveReaction) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventMessageRemoveReaction) Msgsize

func (z EventMessageRemoveReaction) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventMessageRemoveReaction) UnmarshalMsg

func (z *EventMessageRemoveReaction) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventMessageUnreact

type EventMessageUnreact struct {
	EventMessageReact `msg:",flatten"`
}

EventMessageUnreact is sent when a user removes a singular reaction from a message.

func (*EventMessageUnreact) MarshalMsg

func (z *EventMessageUnreact) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventMessageUnreact) Msgsize

func (z *EventMessageUnreact) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventMessageUnreact) UnmarshalMsg

func (z *EventMessageUnreact) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventMessageUpdate

type EventMessageUpdate struct {
	Event   `msg:",flatten"`
	ID      string  `msg:"id" json:"id,omitempty"`
	Channel string  `msg:"channel" json:"channel,omitempty"`
	Data    Message `msg:"data" json:"data,omitempty"`
}

func (*EventMessageUpdate) MarshalMsg

func (z *EventMessageUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventMessageUpdate) Msgsize

func (z *EventMessageUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventMessageUpdate) UnmarshalMsg

func (z *EventMessageUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventPong

type EventPong struct {
	Event
	Data int64 `msg:"data" json:"data,omitempty"`
}

func (*EventPong) MarshalMsg

func (z *EventPong) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventPong) Msgsize

func (z *EventPong) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventPong) UnmarshalMsg

func (z *EventPong) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventReady

type EventReady struct {
	Event
	Users          []*User                  `msg:"users" json:"users,omitempty"`
	Servers        []*Server                `msg:"servers" json:"servers,omitempty"`
	Channels       []*Channel               `msg:"channels" json:"channels,omitempty"`
	Members        []*ServerMember          `msg:"members" json:"members,omitempty"`
	Emojis         []*Emoji                 `msg:"emojis" json:"emojis,omitempty"`
	VoiceStates    []*ChannelVoiceState     `msg:"voice_states" json:"voice_states,omitempty"`
	UserSettings   map[string]any           `msg:"user_settings" json:"user_settings,omitempty"`
	ChannelUnreads []ChannelUnread          `msg:"channel_unreads" json:"channel_unreads,omitempty"`
	PolicyChanges  []EventReadyPolicyChange `msg:"policy_changes" json:"policy_changes,omitempty"`
}

EventReady provides information about objects relative to the user. This is used to populate the session's cache

func (*EventReady) MarshalMsg

func (z *EventReady) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventReady) Msgsize

func (z *EventReady) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventReady) UnmarshalMsg

func (z *EventReady) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventReadyPolicyChange

type EventReadyPolicyChange struct {
	// might be a Timestamp?
	CreatedTime string `msg:"created_time" json:"created_time,omitempty"`
	// might be a Timestamp?
	EffectiveTime string `msg:"effective_time" json:"effective_time,omitempty"`
	Description   string `msg:"description" json:"description,omitempty"`
	URL           string `msg:"url" json:"url,omitempty"`
}

func (*EventReadyPolicyChange) MarshalMsg

func (z *EventReadyPolicyChange) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventReadyPolicyChange) Msgsize

func (z *EventReadyPolicyChange) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventReadyPolicyChange) UnmarshalMsg

func (z *EventReadyPolicyChange) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventReportCreate

type EventReportCreate struct {
	Event `msg:",flatten"`
}

func (EventReportCreate) MarshalMsg

func (z EventReportCreate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventReportCreate) Msgsize

func (z EventReportCreate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventReportCreate) UnmarshalMsg

func (z *EventReportCreate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerCreate

type EventServerCreate struct {
	Event    `msg:",flatten"`
	ID       string     `msg:"id" json:"id,omitempty"`
	Server   *Server    `msg:"server" json:"server,omitempty"`
	Channels []*Channel `msg:"channels" json:"channels,omitempty"`
	Emojis   []*Emoji   `msg:"emojis" json:"emojis,omitempty"`
}

EventServerCreate is sent when a server is created (joined).

func (*EventServerCreate) MarshalMsg

func (z *EventServerCreate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventServerCreate) Msgsize

func (z *EventServerCreate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerCreate) UnmarshalMsg

func (z *EventServerCreate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerDelete

type EventServerDelete struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
}

func (EventServerDelete) MarshalMsg

func (z EventServerDelete) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventServerDelete) Msgsize

func (z EventServerDelete) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerDelete) UnmarshalMsg

func (z *EventServerDelete) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerMemberJoin

type EventServerMemberJoin struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
	User  string `msg:"user" json:"user,omitempty"`
}

func (EventServerMemberJoin) MarshalMsg

func (z EventServerMemberJoin) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventServerMemberJoin) Msgsize

func (z EventServerMemberJoin) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerMemberJoin) UnmarshalMsg

func (z *EventServerMemberJoin) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerMemberLeave

type EventServerMemberLeave struct {
	Event  `msg:",flatten"`
	ID     string `msg:"id" json:"id,omitempty"`     // Server ID
	User   string `msg:"user" json:"user,omitempty"` // User ID
	Reason string `msg:"reason" json:"reason,omitempty"`
}

EventServerMemberLeave is sent when a user leaves a server.

func (*EventServerMemberLeave) MarshalMsg

func (z *EventServerMemberLeave) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventServerMemberLeave) Msgsize

func (z *EventServerMemberLeave) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerMemberLeave) UnmarshalMsg

func (z *EventServerMemberLeave) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerMemberUpdate

type EventServerMemberUpdate struct {
	Event `msg:",flatten"`
	ID    MemberCompositeID   `msg:"id" json:"id,omitempty"`
	Data  PartialServerMember `msg:"data" json:"data,omitempty"`
	Clear []string            `msg:"clear" json:"clear,omitempty"`
}

EventServerMemberUpdate is sent when a member is updated. Data will only contain fields that were modified.

func (*EventServerMemberUpdate) MarshalMsg

func (z *EventServerMemberUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventServerMemberUpdate) Msgsize

func (z *EventServerMemberUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerMemberUpdate) UnmarshalMsg

func (z *EventServerMemberUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerRoleDelete

type EventServerRoleDelete struct {
	Event  `msg:",flatten"`
	ID     string `msg:"id" json:"id,omitempty"`
	RoleID string `msg:"role_id" json:"role_id,omitempty"`
}

func (EventServerRoleDelete) MarshalMsg

func (z EventServerRoleDelete) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventServerRoleDelete) Msgsize

func (z EventServerRoleDelete) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerRoleDelete) UnmarshalMsg

func (z *EventServerRoleDelete) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerRoleRanksUpdate

type EventServerRoleRanksUpdate struct {
	Event `msg:",flatten"`
	ID    string   `msg:"id" json:"id,omitempty"`
	Ranks []string `msg:"ranks" json:"ranks,omitempty"`
}

func (*EventServerRoleRanksUpdate) MarshalMsg

func (z *EventServerRoleRanksUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventServerRoleRanksUpdate) Msgsize

func (z *EventServerRoleRanksUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerRoleRanksUpdate) UnmarshalMsg

func (z *EventServerRoleRanksUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerRoleUpdate

type EventServerRoleUpdate struct {
	Event  `msg:",flatten"`
	ID     string            `msg:"id" json:"id,omitempty"`
	RoleID string            `msg:"role_id" json:"role_id,omitempty"`
	Data   PartialServerRole `msg:"data" json:"data,omitempty"`
	Clear  []string          `msg:"clear" json:"clear,omitempty"`
}

EventServerRoleUpdate is sent when a role is updated. Data will only contain fields that were modified.

func (*EventServerRoleUpdate) MarshalMsg

func (z *EventServerRoleUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventServerRoleUpdate) Msgsize

func (z *EventServerRoleUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerRoleUpdate) UnmarshalMsg

func (z *EventServerRoleUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventServerUpdate

type EventServerUpdate struct {
	Event `msg:",flatten"`
	ID    string        `msg:"id" json:"id,omitempty"`
	Data  PartialServer `msg:"data" json:"data,omitempty"`
	Clear []string      `msg:"clear" json:"clear,omitempty"`
}

EventServerUpdate is sent when a server is updated. Data will only contain fields that were modified.

func (*EventServerUpdate) MarshalMsg

func (z *EventServerUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventServerUpdate) Msgsize

func (z *EventServerUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventServerUpdate) UnmarshalMsg

func (z *EventServerUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventUserMoveVoiceChannel

type EventUserMoveVoiceChannel struct {
	Event `msg:",flatten"`
	Node  string `msg:"node" json:"node,omitempty"`
	From  string `msg:"from" json:"from,omitempty"`
	Token string `msg:"token" json:"token,omitempty"`
}

func (*EventUserMoveVoiceChannel) MarshalMsg

func (z *EventUserMoveVoiceChannel) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventUserMoveVoiceChannel) Msgsize

func (z *EventUserMoveVoiceChannel) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventUserMoveVoiceChannel) UnmarshalMsg

func (z *EventUserMoveVoiceChannel) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventUserPlatformWipe

type EventUserPlatformWipe struct {
	Event
	UserID string `msg:"user_id" json:"user_id,omitempty"`
	Flags  int    `msg:"flags" json:"flags,omitempty"`
}

func (*EventUserPlatformWipe) MarshalMsg

func (z *EventUserPlatformWipe) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventUserPlatformWipe) Msgsize

func (z *EventUserPlatformWipe) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventUserPlatformWipe) UnmarshalMsg

func (z *EventUserPlatformWipe) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventUserRelationship

type EventUserRelationship struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
	User  *User  `msg:"user" json:"user,omitempty"`
}

func (*EventUserRelationship) MarshalMsg

func (z *EventUserRelationship) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventUserRelationship) Msgsize

func (z *EventUserRelationship) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventUserRelationship) UnmarshalMsg

func (z *EventUserRelationship) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventUserSettingsUpdate

type EventUserSettingsUpdate struct {
	Event `msg:",flatten"`
	// Update is a tuple of (int, string); update time, and the data in JSON
	Update map[string]SyncSettingsParamsTuple `msg:"update" json:"update,omitempty"`
}

func (*EventUserSettingsUpdate) MarshalMsg

func (z *EventUserSettingsUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventUserSettingsUpdate) Msgsize

func (z *EventUserSettingsUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventUserSettingsUpdate) UnmarshalMsg

func (z *EventUserSettingsUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventUserUpdate

type EventUserUpdate struct {
	Event   `msg:",flatten"`
	ID      string      `msg:"id" json:"id,omitempty"`
	Data    PartialUser `msg:"data" json:"data,omitempty"`
	Clear   []string    `msg:"clear" json:"clear,omitempty"`
	EventID *string     `msg:"event_id" json:"event_id,omitempty"`
}

func (*EventUserUpdate) MarshalMsg

func (z *EventUserUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventUserUpdate) Msgsize

func (z *EventUserUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventUserUpdate) UnmarshalMsg

func (z *EventUserUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventUserVoiceStateUpdate

type EventUserVoiceStateUpdate struct {
	Event     `msg:",flatten"`
	ID        string                `msg:"id" json:"id,omitempty"`
	ChannelID string                `msg:"channel_id" json:"channel_id,omitempty"`
	Data      PartialUserVoiceState `msg:"data" json:"data,omitempty"`
}

func (*EventUserVoiceStateUpdate) MarshalMsg

func (z *EventUserVoiceStateUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventUserVoiceStateUpdate) Msgsize

func (z *EventUserVoiceStateUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventUserVoiceStateUpdate) UnmarshalMsg

func (z *EventUserVoiceStateUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventVoiceChannelJoin

type EventVoiceChannelJoin struct {
	Event `msg:",flatten"`
	ID    string         `msg:"id" json:"id,omitempty"`
	State UserVoiceState `msg:"state" json:"state,omitempty"`
}

func (*EventVoiceChannelJoin) MarshalMsg

func (z *EventVoiceChannelJoin) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventVoiceChannelJoin) Msgsize

func (z *EventVoiceChannelJoin) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventVoiceChannelJoin) UnmarshalMsg

func (z *EventVoiceChannelJoin) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventVoiceChannelLeave

type EventVoiceChannelLeave struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
	User  string `msg:"user" json:"user"`
}

func (EventVoiceChannelLeave) MarshalMsg

func (z EventVoiceChannelLeave) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventVoiceChannelLeave) Msgsize

func (z EventVoiceChannelLeave) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventVoiceChannelLeave) UnmarshalMsg

func (z *EventVoiceChannelLeave) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventVoiceChannelMove

type EventVoiceChannelMove struct {
	Event `msg:",flatten"`
	User  string         `msg:"user" json:"user,omitempty"`
	From  string         `msg:"from" json:"from,omitempty"`
	To    string         `msg:"to" json:"to,omitempty"`
	State UserVoiceState `msg:"state" json:"state,omitempty"`
}

func (*EventVoiceChannelMove) MarshalMsg

func (z *EventVoiceChannelMove) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventVoiceChannelMove) Msgsize

func (z *EventVoiceChannelMove) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventVoiceChannelMove) UnmarshalMsg

func (z *EventVoiceChannelMove) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventWebhookCreate

type EventWebhookCreate struct {
	Event   `msg:",flatten"`
	Webhook `msg:",flatten"`
}

func (*EventWebhookCreate) MarshalMsg

func (z *EventWebhookCreate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventWebhookCreate) Msgsize

func (z *EventWebhookCreate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventWebhookCreate) UnmarshalMsg

func (z *EventWebhookCreate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventWebhookDelete

type EventWebhookDelete struct {
	Event `msg:",flatten"`
	ID    string `msg:"id" json:"id,omitempty"`
}

func (EventWebhookDelete) MarshalMsg

func (z EventWebhookDelete) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (EventWebhookDelete) Msgsize

func (z EventWebhookDelete) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventWebhookDelete) UnmarshalMsg

func (z *EventWebhookDelete) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type EventWebhookUpdate

type EventWebhookUpdate struct {
	Event  `msg:",flatten"`
	ID     string         `msg:"id" json:"id,omitempty"`
	Data   PartialWebhook `msg:"data" json:"data,omitempty"`
	Remove []string       `msg:"remove" json:"remove,omitempty"` // todo: why is this "remove" and not "clear"?
}

func (*EventWebhookUpdate) MarshalMsg

func (z *EventWebhookUpdate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*EventWebhookUpdate) Msgsize

func (z *EventWebhookUpdate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*EventWebhookUpdate) UnmarshalMsg

func (z *EventWebhookUpdate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type FetchedBot

type FetchedBot struct {
	Bot  *Bot  `msg:"bot" json:"bot,omitempty"`
	User *User `msg:"user" json:"user,omitempty"`
}

func (*FetchedBot) MarshalMsg

func (z *FetchedBot) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*FetchedBot) Msgsize

func (z *FetchedBot) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*FetchedBot) UnmarshalMsg

func (z *FetchedBot) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type FetchedBots

type FetchedBots struct {
	Bots  []*Bot  `msg:"bots" json:"bots,omitempty"`
	Users []*User `msg:"users" json:"users,omitempty"`
}

func (*FetchedBots) MarshalMsg

func (z *FetchedBots) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*FetchedBots) Msgsize

func (z *FetchedBots) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*FetchedBots) UnmarshalMsg

func (z *FetchedBots) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type FetchedGroupMembers

type FetchedGroupMembers struct {
	Messages []*Message `msg:"messages" json:"messages,omitempty"`
	Users    []*User    `msg:"users" json:"users,omitempty"`
}

func (*FetchedGroupMembers) MarshalMsg

func (z *FetchedGroupMembers) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*FetchedGroupMembers) Msgsize

func (z *FetchedGroupMembers) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*FetchedGroupMembers) UnmarshalMsg

func (z *FetchedGroupMembers) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type File

type File struct {
	// The name of the file; this is completely arbitrary because the backend determines the file-type anyway
	// However, it should not be empty, otherwise the media will not load on the client
	Name string

	// The contents of the file to be read when uploading
	Reader io.Reader
}

type FileAttachment

type FileAttachment struct {
	ID string `msg:"id" json:"id,omitempty"`
}

FileAttachment is the response from the API when uploading a file. To upload a file, you must reference this ID in MessageSend.Attachments.

type GithubRepos

type GithubRepos struct {
	Sha     string            `json:"sha"`
	Commits GithubReposCommit `json:"commit"`
}

type GithubReposCommit

type GithubReposCommit struct {
	Author    GithubReposCommitUserData `json:"author"`
	Committer GithubReposCommitUserData `json:"committer"`
	Message   string                    `json:"message"`
}

type GithubReposCommitUserData

type GithubReposCommitUserData struct {
	Name string    `json:"name"`
	Date time.Time `json:"date"`
}

type Group

type Group struct {
	ID          string   `msg:"_id" json:"_id,omitempty"`
	OwnerID     string   `msg:"owner" json:"owner,omitempty"`
	Name        string   `msg:"name" json:"name,omitempty"`
	Description string   `msg:"description" json:"description,omitempty"`
	Users       []string `msg:"users" json:"users,omitempty"`
}

func (*Group) MarshalMsg

func (z *Group) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Group) Msgsize

func (z *Group) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Group) UnmarshalMsg

func (z *Group) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GroupCreateParams

type GroupCreateParams struct {
	Name        string   `msg:"name" json:"name,omitempty"`
	Description string   `msg:"description" json:"description,omitempty"`
	Users       []string `msg:"users" json:"users,omitempty"`
	NSFW        bool     `msg:"nsfw" json:"nsfw,omitempty"`
}

GroupCreateParams describes how a group should be created

func (*GroupCreateParams) MarshalMsg

func (z *GroupCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*GroupCreateParams) Msgsize

func (z *GroupCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GroupCreateParams) UnmarshalMsg

func (z *GroupCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GroupSystemMessages

type GroupSystemMessages struct {
	UserJoined string `msg:"user_joined" json:"user_joined,omitempty"`
	UserLeft   string `msg:"user_left" json:"user_left,omitempty"`
}

func (GroupSystemMessages) MarshalMsg

func (z GroupSystemMessages) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (GroupSystemMessages) Msgsize

func (z GroupSystemMessages) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GroupSystemMessages) UnmarshalMsg

func (z *GroupSystemMessages) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type HTTPClient

type HTTPClient struct {
	Debug bool
	// contains filtered or unexported fields
}

func (*HTTPClient) AddHeader

func (c *HTTPClient) AddHeader(key, value string) error

AddHeader adds a header and checks if it already exists

func (*HTTPClient) Header

func (c *HTTPClient) Header(key string) string

Header retrieves a header value

func (HTTPClient) MarshalMsg

func (z HTTPClient) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (HTTPClient) Msgsize

func (z HTTPClient) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*HTTPClient) RemoveHeader

func (c *HTTPClient) RemoveHeader(key string)

RemoveHeader removes a header

func (*HTTPClient) Request

func (c *HTTPClient) Request(method, destination string, data, result any) error

Request sends a JSON Request with "method" to a destination URL - "result" will be used to decode the response into, and - "data" is the Request body which wil be encoded as JSON

- If the "data" is a *File, it will be uploaded as a multipart form This function automatically handles rate-limiting and response status codes

func (*HTTPClient) ResolveURL

func (c *HTTPClient) ResolveURL(destination string) (string, error)

ResolveURL converts a relative URL to an absolute URL. Prefixes relative URLs with the API base URL. It also allows absolute URLs targeting the CDN. Otherwise, it rejects the URL.

func (*HTTPClient) SetHeader

func (c *HTTPClient) SetHeader(key, value string)

SetHeader overwrites a header. Use AddHeader to avoid overwriting existing headers.

func (*HTTPClient) SetTimeout

func (c *HTTPClient) SetTimeout(timeout time.Duration) error

SetTimeout sets the HTTP client timeout between 1 and 300 seconds

func (*HTTPClient) UnmarshalMsg

func (z *HTTPClient) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type InstanceConfig

type InstanceConfig struct {
	WS       string                 `msg:"ws" json:"ws,omitempty"`
	App      string                 `msg:"app" json:"app,omitempty"`
	VapID    string                 `msg:"vapid" json:"vapid,omitempty"`
	Revolt   string                 `msg:"revolt" json:"revolt,omitempty"`
	Build    InstanceConfigBuild    `msg:"build" json:"build,omitempty"`
	Features InstanceConfigFeatures `msg:"features" json:"features,omitempty"`
}

type InstanceConfigBuild

type InstanceConfigBuild struct {
	CommitSha       string `msg:"commit_sha" json:"commit_sha,omitempty"`
	CommitTimestamp string `msg:"commit_timestamp" json:"commit_timestamp,omitempty"`
	SemVer          string `msg:"semver" json:"semver,omitempty"`
	OriginURL       string `msg:"origin_url" json:"origin_url,omitempty"`
	Timestamp       string `msg:"timestamp" json:"timestamp,omitempty"`
}

type InstanceConfigFeatures

type InstanceConfigFeatures struct {
	Captcha    InstanceConfigFeaturesCaptcha `msg:"captcha" json:"captcha,omitempty"`
	Email      bool                          `msg:"email" json:"email,omitempty"`
	InviteOnly bool                          `msg:"invite_only" json:"invite_only,omitempty"`
	Autumn     InstanceConfigFeaturesAutumn  `msg:"autumn" json:"autumn,omitempty"`
	January    InstanceConfigFeaturesJanuary `msg:"january" json:"january,omitempty"`
	Voso       InstanceConfigFeaturesVoso    `msg:"voso" json:"voso,omitempty"`
}

type InstanceConfigFeaturesAutumn

type InstanceConfigFeaturesAutumn struct {
	Enabled bool   `msg:"enabled" json:"enabled,omitempty"`
	URL     string `msg:"url" json:"url,omitempty"`
}

type InstanceConfigFeaturesCaptcha

type InstanceConfigFeaturesCaptcha struct {
	Enabled bool   `msg:"enabled" json:"enabled,omitempty"`
	Key     string `msg:"key" json:"key,omitempty"`
}

type InstanceConfigFeaturesJanuary

type InstanceConfigFeaturesJanuary struct {
	Enabled bool   `msg:"enabled" json:"enabled,omitempty"`
	URL     string `msg:"url" json:"url,omitempty"`
}

type InstanceConfigFeaturesVoso

type InstanceConfigFeaturesVoso struct {
	Enabled bool   `msg:"enabled" json:"enabled,omitempty"`
	URL     string `msg:"url" json:"url,omitempty"`
	WS      string `msg:"ws" json:"ws,omitempty"`
}

type Invite

type Invite struct {
	Type               InviteType  `msg:"type" json:"type,omitempty"`
	ServerID           string      `msg:"server_id" json:"server_id,omitempty"`
	ServerName         string      `msg:"server_name" json:"server_name,omitempty"`
	ServerIcon         *Attachment `msg:"server_icon" json:"server_icon,omitempty"`
	ServerBanner       *Attachment `msg:"server_banner" json:"server_banner,omitempty"`
	ServerFlags        uint32      `msg:"server_flags" json:"server_flags,omitempty"`
	ChannelID          string      `msg:"channel_id" json:"channel_id,omitempty"`
	ChannelName        string      `msg:"channel_name" json:"channel_name,omitempty"`
	ChannelDescription string      `msg:"channel_description" json:"channel_description,omitempty"`
	UserName           string      `msg:"user_name" json:"user_name,omitempty"`
	UserAvatar         *Attachment `msg:"user_avatar" json:"user_avatar,omitempty"`
	MemberCount        uint64      `msg:"member_count" json:"member_count,omitempty"`
}

func (*Invite) MarshalMsg

func (z *Invite) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Invite) Msgsize

func (z *Invite) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Invite) UnmarshalMsg

func (z *Invite) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type InviteCreate

type InviteCreate struct {
	Type InviteType `msg:"type" json:"type,omitempty"`

	// ID is the code of the invite
	ID      string `msg:"_id" json:"_id,omitempty"`
	Server  string `msg:"server" json:"server,omitempty"`
	Creator string `msg:"creator" json:"creator,omitempty"`
	Channel string `msg:"channel" json:"channel,omitempty"`
}

InviteCreate seems deprecated/no longer documented todo: remove in the future

func (*InviteCreate) MarshalMsg

func (z *InviteCreate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*InviteCreate) Msgsize

func (z *InviteCreate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*InviteCreate) UnmarshalMsg

func (z *InviteCreate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type InviteJoin

type InviteJoin struct {
	Type     InviteType `msg:"type" json:"type,omitempty"`
	Channels []*Channel
	Server   *Server `msg:"server" json:"server,omitempty"`
}

func (*InviteJoin) MarshalMsg

func (z *InviteJoin) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*InviteJoin) Msgsize

func (z *InviteJoin) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*InviteJoin) UnmarshalMsg

func (z *InviteJoin) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type InviteType

type InviteType string
const (
	InviteTypeServer InviteType = "Server"
	InviteTypeGroup  InviteType = "Group"
)

func (InviteType) MarshalMsg

func (z InviteType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (InviteType) Msgsize

func (z InviteType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*InviteType) UnmarshalMsg

func (z *InviteType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type LoginParams

type LoginParams struct {
	Email        string `msg:"email" json:"email,omitempty"`
	Password     string `msg:"password" json:"password,omitempty"`
	FriendlyName string `msg:"friendly_name" json:"friendly_name,omitempty"`
}

func (LoginParams) MarshalMsg

func (z LoginParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (LoginParams) Msgsize

func (z LoginParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*LoginParams) UnmarshalMsg

func (z *LoginParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type LoginResponse

type LoginResponse struct {
	Result       string              `msg:"result" json:"result,omitempty"`
	ID           string              `msg:"_id" json:"_id,omitempty"`
	UserID       string              `msg:"user_id" json:"user_id,omitempty"`
	Token        string              `msg:"token" json:"token,omitempty"`
	Name         string              `msg:"name" json:"name,omitempty"`
	Subscription WebpushSubscription `msg:"subscription" json:"subscription,omitempty"`
}

func (*LoginResponse) MarshalMsg

func (z *LoginResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*LoginResponse) Msgsize

func (z *LoginResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*LoginResponse) UnmarshalMsg

func (z *LoginResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MFA

type MFA struct {
	// Unvalidated or authorised MFA ticket; used to resolve the correct account
	MfaTicket string `msg:"mfa_ticket" json:"mfa_ticket,omitempty"`

	// MFA response
	MfaResponse MFAResponse `msg:"mfa_response" json:"mfa_response,omitempty"`

	// Friendly name used for the session
	FriendlyName string `msg:"friendly_name" json:"friendly_name,omitempty"`
}

func (*MFA) MarshalMsg

func (z *MFA) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MFA) Msgsize

func (z *MFA) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MFA) UnmarshalMsg

func (z *MFA) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MFAResponse

type MFAResponse struct {
	Password string `msg:"password" json:"password,omitempty"`
}

func (MFAResponse) MarshalMsg

func (z MFAResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MFAResponse) Msgsize

func (z MFAResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MFAResponse) UnmarshalMsg

func (z *MFAResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MFATicket

type MFATicket struct {
	ID           string `msg:"_id" json:"_id,omitempty"`
	AccountID    string `msg:"account_id" json:"account_id,omitempty"`
	Token        string `msg:"token" json:"token,omitempty"`
	Validated    bool   `msg:"validated" json:"validated,omitempty"`
	Authorised   bool   `msg:"authorised" json:"authorised,omitempty"`
	LastTOTPCode string `msg:"last_totp_code" json:"last_totp_code,omitempty"`
}

func (*MFATicket) MarshalMsg

func (z *MFATicket) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MFATicket) Msgsize

func (z *MFATicket) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MFATicket) UnmarshalMsg

func (z *MFATicket) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MemberCompositeID

type MemberCompositeID struct {
	User   string `msg:"user" json:"user,omitempty"`
	Server string `msg:"server" json:"server,omitempty"`
}

func (MemberCompositeID) MarshalMsg

func (z MemberCompositeID) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MemberCompositeID) Mention

func (m MemberCompositeID) Mention() string

func (MemberCompositeID) Msgsize

func (z MemberCompositeID) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MemberCompositeID) UnmarshalMsg

func (z *MemberCompositeID) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Message

type Message struct {
	ID           string               `msg:"_id" json:"_id,omitempty"`
	Nonce        string               `msg:"nonce" json:"nonce,omitempty"`
	Channel      string               `msg:"channel" json:"channel,omitempty"`
	Author       string               `msg:"author" json:"author,omitempty"`
	Content      string               `msg:"content" json:"content,omitempty"`
	Mentions     []string             `msg:"mentions" json:"mentions,omitempty"`
	Replies      []string             `msg:"replies" json:"replies,omitempty"`
	Reactions    map[string][]string  `msg:"reactions" json:"reactions,omitempty"` // Emoji ID to array of users IDs that reacted
	Pinned       bool                 `msg:"pinned" json:"pinned,omitempty"`
	Flags        MessageFlagsType     `msg:"flags" json:"flags,omitempty"`
	Webhook      *MessageWebhook      `msg:"webhook" json:"webhook,omitempty"`
	System       *MessageSystem       `msg:"system" json:"system,omitempty"`
	Embeds       []*MessageEmbed      `msg:"embeds" json:"embeds,omitempty"`
	Attachments  []*Attachment        `msg:"attachments" json:"attachments,omitempty"`
	Edited       *time.Time           `msg:"edited" json:"edited,omitempty"`
	Interactions *MessageInteractions `msg:"interactions" json:"interactions,omitempty"`
	Masquerade   *MessageMasquerade   `msg:"masquerade" json:"masquerade,omitempty"`
}

Message contains information about a message.

func (*Message) MarshalMsg

func (z *Message) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Message) Msgsize

func (z *Message) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Message) UnmarshalMsg

func (z *Message) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEditParams

type MessageEditParams struct {
	Content string          `msg:"content" json:"content,omitempty"`
	Embeds  []*MessageEmbed `msg:"embeds" json:"embeds,omitempty"`
}

func (*MessageEditParams) MarshalMsg

func (z *MessageEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MessageEditParams) Msgsize

func (z *MessageEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEditParams) UnmarshalMsg

func (z *MessageEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEdited

type MessageEdited struct {
	Date int `msg:"$date" json:"$date,omitempty"`
}

func (MessageEdited) MarshalMsg

func (z MessageEdited) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageEdited) Msgsize

func (z MessageEdited) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEdited) UnmarshalMsg

func (z *MessageEdited) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEmbed

type MessageEmbed struct {
	Type        string               `msg:"type" json:"type,omitempty"`
	URL         string               `msg:"url" json:"url,omitempty"`
	OriginalURL string               `msg:"original_url" json:"original_url,omitempty"`
	Special     *MessageEmbedSpecial `msg:"special" json:"special,omitempty"`
	Title       string               `msg:"title" json:"title,omitempty"`
	Description string               `msg:"description" json:"description,omitempty"`
	Image       *MessageEmbedImage   `msg:"image" json:"image,omitempty"`
	Video       *MessageEmbedVideo   `msg:"video" json:"video,omitempty"`
	SiteName    string               `msg:"site_name" json:"site_name,omitempty"`
	IconURL     string               `msg:"icon_url" json:"icon_url,omitempty"`
	Colour      string               `msg:"colour" json:"colour,omitempty"`
	Media       *Attachment          `msg:"media" json:"media,omitempty"`
}

MessageEmbed is derived from: https://github.com/stoatchat/stoatchat/blob/main/crates/core/models/src/v0/embeds.rs#L158

func (*MessageEmbed) MarshalMsg

func (z *MessageEmbed) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MessageEmbed) Msgsize

func (z *MessageEmbed) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEmbed) UnmarshalMsg

func (z *MessageEmbed) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEmbedImage

type MessageEmbedImage struct {
	Size   MessageEmbedImageSizeType `msg:"size" json:"size,omitempty"`
	URL    string                    `msg:"url" json:"url,omitempty"`
	Width  int                       `msg:"width" json:"width,omitempty"`
	Height int                       `msg:"height" json:"height,omitempty"`
}

func (*MessageEmbedImage) MarshalMsg

func (z *MessageEmbedImage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MessageEmbedImage) Msgsize

func (z *MessageEmbedImage) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEmbedImage) UnmarshalMsg

func (z *MessageEmbedImage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEmbedImageSizeType

type MessageEmbedImageSizeType string
const (
	MessageEmbedImageSizeLarge   MessageEmbedImageSizeType = "Large"
	MessageEmbedImageSizePreview MessageEmbedImageSizeType = "Preview"
)

func (MessageEmbedImageSizeType) MarshalMsg

func (z MessageEmbedImageSizeType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageEmbedImageSizeType) Msgsize

func (z MessageEmbedImageSizeType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEmbedImageSizeType) UnmarshalMsg

func (z *MessageEmbedImageSizeType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEmbedSpecial

type MessageEmbedSpecial struct {
	Type        MessageEmbedSpecialType `msg:"type" json:"type,omitempty"`
	ID          string                  `msg:"id" json:"id,omitempty"`
	Timestamp   string                  `msg:"timestamp" json:"timestamp,omitempty"`
	ContentType string                  `msg:"content_type" json:"content_type,omitempty"`
	AlbumID     string                  `msg:"album_id" json:"album_id,omitempty"`
	TrackID     string                  `msg:"track_id" json:"track_id,omitempty"`
}

func (*MessageEmbedSpecial) MarshalMsg

func (z *MessageEmbedSpecial) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MessageEmbedSpecial) Msgsize

func (z *MessageEmbedSpecial) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEmbedSpecial) UnmarshalMsg

func (z *MessageEmbedSpecial) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEmbedSpecialType

type MessageEmbedSpecialType string
const (
	MessageEmbedSpecialNone       MessageEmbedSpecialType = "None"
	MessageEmbedSpecialGIF        MessageEmbedSpecialType = "GIF"
	MessageEmbedSpecialYouTube    MessageEmbedSpecialType = "YouTube"
	MessageEmbedSpecialLightspeed MessageEmbedSpecialType = "Lightspeed"
	MessageEmbedSpecialTwitch     MessageEmbedSpecialType = "Twitch"
	MessageEmbedSpecialSpotify    MessageEmbedSpecialType = "Spotify"
	MessageEmbedSpecialSoundcloud MessageEmbedSpecialType = "Soundcloud"
	MessageEmbedSpecialBandcamp   MessageEmbedSpecialType = "Bandcamp"
	MessageEmbedSpecialAppleMusic MessageEmbedSpecialType = "AppleMusic"
	MessageEmbedSpecialStreamable MessageEmbedSpecialType = "Streamable"
)

Derived from: https://github.com/stoatchat/stoatchat/blob/main/crates/core/models/src/v0/embeds.rs#L158

func (MessageEmbedSpecialType) MarshalMsg

func (z MessageEmbedSpecialType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageEmbedSpecialType) Msgsize

func (z MessageEmbedSpecialType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEmbedSpecialType) UnmarshalMsg

func (z *MessageEmbedSpecialType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageEmbedVideo

type MessageEmbedVideo struct {
	URL    string `msg:"url" json:"url,omitempty"`
	Width  int    `msg:"width" json:"width,omitempty"`
	Height int    `msg:"height" json:"height,omitempty"`
}

func (MessageEmbedVideo) MarshalMsg

func (z MessageEmbedVideo) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageEmbedVideo) Msgsize

func (z MessageEmbedVideo) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageEmbedVideo) UnmarshalMsg

func (z *MessageEmbedVideo) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageFlagsType

type MessageFlagsType uint32
const (
	MessageFlagsSuppressNotifications MessageFlagsType = 1 // Will not send push / desktop notifications
	MessageFlagsMentionsEveryone      MessageFlagsType = 2 // will mention all users who can see the channel
	MessageFlagsMentionsOnline        MessageFlagsType = 3 // will mention all users who are online and can see the channel. This cannot be true if MentionsEveryone is true
)

func (MessageFlagsType) MarshalMsg

func (z MessageFlagsType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageFlagsType) Msgsize

func (z MessageFlagsType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageFlagsType) UnmarshalMsg

func (z *MessageFlagsType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageInteractions

type MessageInteractions struct {
	Reactions []string `msg:"reactions" json:"reactions,omitempty"`

	// Whether reactions should be restricted to the given list
	RestrictReactions bool `msg:"restrict_reactions" json:"restrict_reactions,omitempty"`
}

func (*MessageInteractions) MarshalMsg

func (z *MessageInteractions) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MessageInteractions) Msgsize

func (z *MessageInteractions) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageInteractions) UnmarshalMsg

func (z *MessageInteractions) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageMasquerade

type MessageMasquerade struct {
	Name   string `msg:"name" json:"name,omitempty"`
	Avatar string `msg:"avatar" json:"avatar,omitempty"`
	Colour string `msg:"colour" json:"colour,omitempty"`
}

func (MessageMasquerade) MarshalMsg

func (z MessageMasquerade) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageMasquerade) Msgsize

func (z MessageMasquerade) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageMasquerade) UnmarshalMsg

func (z *MessageMasquerade) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageReplies

type MessageReplies struct {
	ID      string `msg:"id" json:"id,omitempty"`
	Mention bool   `msg:"mention" json:"mention"`
}

func (MessageReplies) MarshalMsg

func (z MessageReplies) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageReplies) Msgsize

func (z MessageReplies) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageReplies) UnmarshalMsg

func (z *MessageReplies) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageSend

type MessageSend struct {
	Content      string               `msg:"content" json:"content,omitempty"`
	Attachments  []string             `msg:"attachments" json:"attachments,omitempty"`
	Replies      []*MessageReplies    `msg:"replies" json:"replies,omitempty"`
	Embeds       []*MessageEmbed      `msg:"embeds" json:"embeds,omitempty"`
	Masquerade   *MessageMasquerade   `msg:"masquerade" json:"masquerade,omitempty"`
	Interactions *MessageInteractions `msg:"interactions" json:"interactions,omitempty"`
}

MessageSend is used for sending messages to channels todo: move to http since this is a sendable request body

func (*MessageSend) MarshalMsg

func (z *MessageSend) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MessageSend) Msgsize

func (z *MessageSend) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageSend) UnmarshalMsg

func (z *MessageSend) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageSystem

type MessageSystem struct {
	Type MessageSystemType `msg:"type" json:"type,omitempty"`
	ID   string            `msg:"id" json:"id,omitempty"`
}

func (MessageSystem) MarshalMsg

func (z MessageSystem) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageSystem) Msgsize

func (z MessageSystem) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageSystem) UnmarshalMsg

func (z *MessageSystem) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageSystemType

type MessageSystemType string
const (
	MessageSystemText                      MessageSystemType = "text"
	MessageSystemUserAdded                 MessageSystemType = "user_added"
	MessageSystemUserRemove                MessageSystemType = "user_remove"
	MessageSystemUserJoined                MessageSystemType = "user_joined"
	MessageSystemUserLeft                  MessageSystemType = "user_left"
	MessageSystemUserKicked                MessageSystemType = "user_kicked"
	MessageSystemUserBanned                MessageSystemType = "user_banned"
	MessageSystemChannelRenamed            MessageSystemType = "channel_renamed"
	MessageSystemChannelDescriptionChanged MessageSystemType = "channel_description_changed"
	MessageSystemChannelIconChanged        MessageSystemType = "channel_icon_changed"
	MessageSystemChannelOwnershipChanged   MessageSystemType = "channel_ownership_changed"
	MessageSystemMessagePinned             MessageSystemType = "message_pinned"
	MessageSystemMessageUnpinned           MessageSystemType = "message_unpinned"
	MessageSystemCallStarted               MessageSystemType = "call_started"
)

func (MessageSystemType) MarshalMsg

func (z MessageSystemType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageSystemType) Msgsize

func (z MessageSystemType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageSystemType) UnmarshalMsg

func (z *MessageSystemType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageWebhook

type MessageWebhook struct {
	Name   string  `msg:"name" json:"name,omitempty"`
	Avatar *string `msg:"avatar" json:"avatar,omitempty"`
}

MessageWebhook is derived from: https://github.com/stoatchat/stoatchat/blob/main/crates/core/models/src/v0/channel_webhooks.rs#L36

func (MessageWebhook) AvatarURL

func (ms MessageWebhook) AvatarURL(size string) string

func (*MessageWebhook) MarshalMsg

func (z *MessageWebhook) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MessageWebhook) Msgsize

func (z *MessageWebhook) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MessageWebhook) UnmarshalMsg

func (z *MessageWebhook) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MutualFriendsAndServersResponse

type MutualFriendsAndServersResponse struct {
	Users   []string `msg:"users" json:"users,omitempty"`
	Servers []string `msg:"servers" json:"servers,omitempty"`
}

func (*MutualFriendsAndServersResponse) MarshalMsg

func (z *MutualFriendsAndServersResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MutualFriendsAndServersResponse) Msgsize

func (z *MutualFriendsAndServersResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MutualFriendsAndServersResponse) UnmarshalMsg

func (z *MutualFriendsAndServersResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Onboarding

type Onboarding struct {
	Onboarding bool `msg:"onboarding" json:"onboarding,omitempty"`
}

func (Onboarding) MarshalMsg

func (z Onboarding) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Onboarding) Msgsize

func (z Onboarding) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Onboarding) UnmarshalMsg

func (z *Onboarding) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type OnboardingCompleteParams

type OnboardingCompleteParams struct {
	Username string `msg:"username" json:"username,omitempty"`
}

func (OnboardingCompleteParams) MarshalMsg

func (z OnboardingCompleteParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (OnboardingCompleteParams) Msgsize

func (z OnboardingCompleteParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*OnboardingCompleteParams) UnmarshalMsg

func (z *OnboardingCompleteParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PartialChannel

type PartialChannel struct {
	Name               *string                        `msg:"name" json:"name,omitempty"`
	Owner              *string                        `msg:"owner" json:"owner,omitempty"`
	Description        *string                        `msg:"description" json:"description,omitempty"`
	Icon               *Attachment                    `msg:"icon" json:"icon,omitempty"`
	NSFW               *bool                          `msg:"nsfw" json:"nsfw,omitempty"`
	Active             *bool                          `msg:"active" json:"active,omitempty"`
	Permissions        *int64                         `msg:"permissions" json:"permissions,omitempty"`
	RolePermissions    map[string]PermissionOverwrite `msg:"role_permissions" json:"role_permissions,omitempty"`
	DefaultPermissions *PermissionOverwrite           `msg:"default_permissions" json:"default_permissions,omitempty"`
	LastMessageID      *string                        `msg:"last_message_id" json:"last_message_id,omitempty"`
	Voice              *ChannelVoiceInformation       `msg:"voice" json:"voice,omitempty"`
}

func (*PartialChannel) MarshalMsg

func (z *PartialChannel) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PartialChannel) Msgsize

func (z *PartialChannel) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PartialChannel) UnmarshalMsg

func (z *PartialChannel) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PartialServer

type PartialServer struct {
	Owner              *string                `msg:"owner" json:"owner,omitempty"`
	Name               *string                `msg:"name" json:"name,omitempty"`
	Description        *string                `msg:"description" json:"description,omitempty"`
	Channels           *[]string              `msg:"channels" json:"channels,omitempty"`
	Categories         *[]*ServerCategory     `msg:"categories" json:"categories,omitempty"`
	SystemMessages     *ServerSystemMessages  `msg:"system_messages" json:"system_messages,omitempty"`
	Roles              map[string]*ServerRole `msg:"roles" json:"roles,omitempty"`
	DefaultPermissions *int64                 `msg:"default_permissions" json:"default_permissions,omitempty"`
	Icon               *Attachment            `msg:"icon" json:"icon,omitempty"`
	Banner             *Attachment            `msg:"banner" json:"banner,omitempty"`
	Flags              *uint32                `msg:"flags" json:"flags,omitempty"`
	NSFW               *bool                  `msg:"nsfw" json:"nsfw,omitempty"`
	Analytics          *bool                  `msg:"analytics" json:"analytics,omitempty"`
	Discoverable       *bool                  `msg:"discoverable" json:"discoverable,omitempty"`
}

PartialServer is only found within EventServerUpdate and used to update the state.

func (*PartialServer) MarshalMsg

func (z *PartialServer) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PartialServer) Msgsize

func (z *PartialServer) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PartialServer) UnmarshalMsg

func (z *PartialServer) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PartialServerMember

type PartialServerMember struct {
	Nickname   *string     `msg:"nickname" json:"nickname,omitempty"`
	Avatar     *Attachment `msg:"avatar" json:"avatar,omitempty"`
	Roles      *[]string   `msg:"roles" json:"roles,omitempty"`
	Timeout    *time.Time  `msg:"timeout" json:"timeout,omitempty"`
	CanPublish *bool       `msg:"can_publish" json:"can_publish,omitempty"`
	CanReceive *bool       `msg:"can_receive" json:"can_receive,omitempty"`
}

func (*PartialServerMember) MarshalMsg

func (z *PartialServerMember) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PartialServerMember) Msgsize

func (z *PartialServerMember) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PartialServerMember) UnmarshalMsg

func (z *PartialServerMember) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PartialServerRole

type PartialServerRole struct {
	Name        *string              `msg:"name" json:"name,omitempty"`
	Permissions *PermissionOverwrite `msg:"permissions" json:"permissions,omitempty"`
	Colour      *string              `msg:"colour" json:"colour,omitempty"`
	Hoist       *bool                `msg:"hoist" json:"hoist,omitempty"`
	Rank        *int64               `msg:"rank" json:"rank,omitempty"`
}

func (*PartialServerRole) MarshalMsg

func (z *PartialServerRole) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PartialServerRole) Msgsize

func (z *PartialServerRole) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PartialServerRole) UnmarshalMsg

func (z *PartialServerRole) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PartialUser

type PartialUser struct {
	ID            *string               `msg:"_id" json:"_id,omitempty"`
	Username      *string               `msg:"username" json:"username,omitempty"`
	Discriminator *string               `msg:"discriminator" json:"discriminator,omitempty"`
	Flags         *uint32               `msg:"flags" json:"flags,omitempty"`
	Privileged    *bool                 `msg:"privileged" json:"privileged,omitempty"`
	Badges        *uint32               `msg:"badges" json:"badges,omitempty"`
	Online        *bool                 `msg:"online" json:"online,omitempty"`
	Relations     *[]UserRelationship   `msg:"relations" json:"relations,omitempty"`
	Relationship  *UserRelationshipType `msg:"relationship" json:"relationship,omitempty"`
	DisplayName   *string               `msg:"display_name" json:"display_name,omitempty"`
	Avatar        *Attachment           `msg:"avatar" json:"avatar,omitempty"`
	Status        *UserStatus           `msg:"status" json:"status,omitempty"`
	Profile       *UserProfile          `msg:"profile" json:"profile,omitempty"` // todo: deprecated? not present in src
	Bot           *Bot                  `msg:"bot" json:"bot,omitempty"`
}

func (*PartialUser) MarshalMsg

func (z *PartialUser) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PartialUser) Msgsize

func (z *PartialUser) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PartialUser) UnmarshalMsg

func (z *PartialUser) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PartialUserVoiceState

type PartialUserVoiceState struct {
	ID            *string    `msg:"_id" json:"_id,omitempty"`
	JoinedAt      *time.Time `msg:"joined_at" json:"joined_at,omitempty"`
	IsReceiving   *bool      `msg:"is_receiving" json:"is_receiving,omitempty"`
	IsPublishing  *bool      `msg:"is_publishing" json:"is_publishing,omitempty"`
	Screensharing *bool      `msg:"screensharing" json:"screensharing,omitempty"`
	Camera        *bool      `msg:"camera" json:"camera,omitempty"`
}

func (*PartialUserVoiceState) MarshalMsg

func (z *PartialUserVoiceState) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PartialUserVoiceState) Msgsize

func (z *PartialUserVoiceState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PartialUserVoiceState) UnmarshalMsg

func (z *PartialUserVoiceState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PartialWebhook

type PartialWebhook struct {
	Name        *string     `msg:"name" json:"name,omitempty"`
	Avatar      *Attachment `msg:"avatar" json:"avatar,omitempty"`
	CreatorID   *string     `msg:"creator_id" json:"creator_id,omitempty"`
	ChannelID   *string     `msg:"channel_id" json:"channel_id,omitempty"`
	Permissions *uint64     `msg:"permissions" json:"permissions,omitempty"`
	Token       *string     `msg:"token" json:"token,omitempty"`
}

func (*PartialWebhook) MarshalMsg

func (z *PartialWebhook) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PartialWebhook) Msgsize

func (z *PartialWebhook) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PartialWebhook) UnmarshalMsg

func (z *PartialWebhook) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PasswordResetConfirmParams

type PasswordResetConfirmParams struct {
	Token          string `msg:"token" json:"token,omitempty"`
	Password       string `msg:"password" json:"password,omitempty"`
	RemoveSessions bool   `msg:"remove_sessions" json:"remove_sessions,omitempty"` // Whether to log out of all sessions
}

func (PasswordResetConfirmParams) MarshalMsg

func (z PasswordResetConfirmParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PasswordResetConfirmParams) Msgsize

func (z PasswordResetConfirmParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PasswordResetConfirmParams) UnmarshalMsg

func (z *PasswordResetConfirmParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PermissionOverwrite

type PermissionOverwrite struct {
	Allow int64 `msg:"a" json:"a,omitempty"`
	Deny  int64 `msg:"d" json:"d,omitempty"`
}

PermissionOverwrite is derived from https://github.com/stoatchat/stoatchat/blob/main/crates/core/permissions/src/models/server.rs#L52.

func (PermissionOverwrite) MarshalMsg

func (z PermissionOverwrite) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PermissionOverwrite) Msgsize

func (z PermissionOverwrite) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PermissionOverwrite) UnmarshalMsg

func (z *PermissionOverwrite) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PermissionsSetDefaultParams

type PermissionsSetDefaultParams struct {
	Permissions uint `msg:"permissions" json:"permissions,omitempty"`
}

func (PermissionsSetDefaultParams) MarshalMsg

func (z PermissionsSetDefaultParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (PermissionsSetDefaultParams) Msgsize

func (z PermissionsSetDefaultParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PermissionsSetDefaultParams) UnmarshalMsg

func (z *PermissionsSetDefaultParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PublicBot

type PublicBot struct {
	ID          string      `msg:"_id" json:"_id,omitempty"`
	Username    string      `msg:"username" json:"username,omitempty"`
	Avatar      *Attachment `msg:"avatar" json:"avatar,omitempty"`
	Description string      `msg:"description" json:"description,omitempty"`
}

func (*PublicBot) MarshalMsg

func (z *PublicBot) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PublicBot) Msgsize

func (z *PublicBot) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*PublicBot) UnmarshalMsg

func (z *PublicBot) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Ratelimiter

type Ratelimiter struct {

	// Interval to clean-up stale ratelimit buckets.
	CleanInterval time.Duration
	// contains filtered or unexported fields
}

Ratelimiter manages ratelimit buckets for different API endpoints.

func (*Ratelimiter) Close

func (r *Ratelimiter) Close()

Close stops the background cleaner goroutine

type Server

type Server struct {
	ID                 string                 `msg:"_id" json:"_id,omitempty"`
	Owner              string                 `msg:"owner" json:"owner,omitempty"`
	Name               string                 `msg:"name" json:"name,omitempty"`
	Description        string                 `msg:"description" json:"description,omitempty"`
	Channels           []string               `msg:"channels" json:"channels,omitempty"`
	Categories         []*ServerCategory      `msg:"categories" json:"categories,omitempty"`
	SystemMessages     ServerSystemMessages   `msg:"system_messages" json:"system_messages,omitempty"`
	Roles              map[string]*ServerRole `msg:"roles" json:"roles,omitempty"` // Roles is a map of role ID to ServerRole structs.
	DefaultPermissions int64                  `msg:"default_permissions" json:"default_permissions,omitempty"`
	Flags              uint32                 `msg:"flags" json:"flags,omitempty"`
	NSFW               bool                   `msg:"nsfw" json:"nsfw,omitempty"`
	Analytics          bool                   `msg:"analytics" json:"analytics,omitempty"`
	Discoverable       bool                   `msg:"discoverable" json:"discoverable,omitempty"`
	Icon               *Attachment            `msg:"icon" json:"icon,omitempty"`
	Banner             *Attachment            `msg:"banner" json:"banner,omitempty"`
}

Server is derived from https://github.com/stoatchat/stoatchat/blob/main/crates/core/models/src/v0/servers.rs#L14

func (*Server) MarshalMsg

func (z *Server) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Server) Msgsize

func (z *Server) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Server) UnmarshalMsg

func (z *Server) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerBan

type ServerBan struct {
	ID     MemberCompositeID `msg:"_id" json:"_id,omitempty"`
	Reason string            `msg:"reason" json:"reason,omitempty"`
}

func (*ServerBan) MarshalMsg

func (z *ServerBan) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerBan) Msgsize

func (z *ServerBan) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerBan) UnmarshalMsg

func (z *ServerBan) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerBans

type ServerBans struct {
	Users []*User      `msg:"users" json:"users,omitempty"`
	Bans  []*ServerBan `msg:"bans" json:"bans,omitempty"`
}

func (*ServerBans) MarshalMsg

func (z *ServerBans) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerBans) Msgsize

func (z *ServerBans) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerBans) UnmarshalMsg

func (z *ServerBans) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerCategory

type ServerCategory struct {
	ID       string   `msg:"id" json:"id,omitempty"`
	Title    string   `msg:"title" json:"title,omitempty"`
	Channels []string `msg:"channels" json:"channels,omitempty"`
}

ServerCategory Server categories struct.

func (*ServerCategory) MarshalMsg

func (z *ServerCategory) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerCategory) Msgsize

func (z *ServerCategory) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerCategory) UnmarshalMsg

func (z *ServerCategory) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerChannelCreateParams

type ServerChannelCreateParams struct {
	Type        ServerChannelCreateParamsType `msg:"type" json:"type,omitempty"`
	Name        string                        `msg:"name" json:"name,omitempty"`
	Description string                        `msg:"description" json:"description,omitempty"`
	NSFW        bool                          `msg:"nsfw" json:"nsfw,omitempty"`
}

func (*ServerChannelCreateParams) MarshalMsg

func (z *ServerChannelCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerChannelCreateParams) Msgsize

func (z *ServerChannelCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerChannelCreateParams) UnmarshalMsg

func (z *ServerChannelCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerChannelCreateParamsType

type ServerChannelCreateParamsType string
const (
	ServerChannelCreateDataTypeText  ServerChannelCreateParamsType = "Text"
	ServerChannelCreateDataTypeVoice ServerChannelCreateParamsType = "Voice"
)

func (ServerChannelCreateParamsType) MarshalMsg

func (z ServerChannelCreateParamsType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ServerChannelCreateParamsType) Msgsize

func (z ServerChannelCreateParamsType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerChannelCreateParamsType) UnmarshalMsg

func (z *ServerChannelCreateParamsType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerCreateParams

type ServerCreateParams struct {
	Name        string `msg:"name" json:"name,omitempty"`
	Description string `msg:"description" json:"description,omitempty"`
}

func (ServerCreateParams) MarshalMsg

func (z ServerCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ServerCreateParams) Msgsize

func (z ServerCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerCreateParams) UnmarshalMsg

func (z *ServerCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerEditParams

type ServerEditParams struct {
	Name           string                   `msg:"name" json:"name,omitempty"`
	Description    string                   `msg:"description" json:"description,omitempty"`
	Icon           string                   `msg:"icon" json:"icon,omitempty"`
	Banner         string                   `msg:"banner" json:"banner,omitempty"`
	Categories     []*ServerCategory        `msg:"categories" json:"categories,omitempty"`
	SystemMessages *ServerSystemMessages    `msg:"system_messages" json:"system_messages,omitempty"`
	Flags          int                      `msg:"flags" json:"flags,omitempty"`
	Discoverable   *bool                    `msg:"discoverable" json:"discoverable,omitempty"`
	Analytics      *bool                    `msg:"analytics" json:"analytics,omitempty"`
	Remove         []ServerEditParamsRemove `msg:"remove" json:"remove,omitempty"`
}

func (*ServerEditParams) MarshalMsg

func (z *ServerEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerEditParams) Msgsize

func (z *ServerEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerEditParams) UnmarshalMsg

func (z *ServerEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerEditParamsRemove

type ServerEditParamsRemove string
const (
	ServerEditDataRemoveIcon           ServerEditParamsRemove = "Icon"
	ServerEditDataRemoveBanner         ServerEditParamsRemove = "Banner"
	ServerEditDataRemoveCategories     ServerEditParamsRemove = "Categories"
	ServerEditDataRemoveDescription    ServerEditParamsRemove = "Description"
	ServerEditDataRemoveSystemMessages ServerEditParamsRemove = "SystemMessages"
)

func (ServerEditParamsRemove) MarshalMsg

func (z ServerEditParamsRemove) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ServerEditParamsRemove) Msgsize

func (z ServerEditParamsRemove) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerEditParamsRemove) UnmarshalMsg

func (z *ServerEditParamsRemove) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerMember

type ServerMember struct {
	ID       MemberCompositeID `msg:"_id" json:"_id,omitempty"`
	JoinedAt time.Time         `msg:"joined_at" json:"joined_at,omitempty"`

	Nickname *string     `msg:"nickname" json:"nickname,omitempty"`
	Avatar   *Attachment `msg:"avatar" json:"avatar,omitempty"`
	Timeout  *time.Time  `msg:"timeout" json:"timeout,omitempty"`

	Roles      []string `msg:"roles" json:"roles,omitempty"`
	CanPublish bool     `msg:"can_publish" json:"can_publish,omitempty"`
	CanReceive bool     `msg:"can_receive" json:"can_receive,omitempty"`
}

ServerMember is derived from https://github.com/stoatchat/stoatchat/blob/main/crates/core/models/src/v0/server_members.rs#L44

func (*ServerMember) MarshalMsg

func (z *ServerMember) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerMember) Mention

func (m *ServerMember) Mention() string

Mention is a proxy function that calls ServerMember.ID.Mention().

func (*ServerMember) Msgsize

func (z *ServerMember) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerMember) UnmarshalMsg

func (z *ServerMember) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerMemberEditParams

type ServerMemberEditParams struct {
	Nickname string    `msg:"nickname" json:"nickname,omitempty"`
	Avatar   string    `msg:"avatar" json:"avatar,omitempty"`
	Roles    []string  `msg:"roles" json:"roles,omitempty"`
	Timeout  time.Time `msg:"timeout" json:"timeout,omitempty"`
	Remove   []string  `msg:"remove" json:"remove,omitempty"`
}

func (*ServerMemberEditParams) MarshalMsg

func (z *ServerMemberEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerMemberEditParams) Msgsize

func (z *ServerMemberEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerMemberEditParams) UnmarshalMsg

func (z *ServerMemberEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerMembers

type ServerMembers struct {
	Members []*ServerMember `msg:"members" json:"members,omitempty"`
	Users   []*User         `msg:"users" json:"users,omitempty"`
}

func (*ServerMembers) MarshalMsg

func (z *ServerMembers) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerMembers) Msgsize

func (z *ServerMembers) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerMembers) UnmarshalMsg

func (z *ServerMembers) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerRole

type ServerRole struct {
	Name        string              `msg:"name" json:"name,omitempty"`
	Permissions PermissionOverwrite `msg:"permissions" json:"permissions,omitempty"`
	Colour      *string             `msg:"colour" json:"colour,omitempty"`
	Hoist       bool                `msg:"hoist" json:"hoist,omitempty"`
	Rank        int64               `msg:"rank" json:"rank,omitempty"`
}

ServerRole is derived from https://github.com/stoatchat/stoatchat/blob/main/crates/core/database/src/models/servers/model.rs#L70

func (*ServerRole) MarshalMsg

func (z *ServerRole) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerRole) Msgsize

func (z *ServerRole) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerRole) UnmarshalMsg

func (z *ServerRole) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerRoleCreateParams

type ServerRoleCreateParams struct {
	Name string `msg:"name" json:"name,omitempty"`
	Rank int    `msg:"rank" json:"rank,omitempty"`
}

func (ServerRoleCreateParams) MarshalMsg

func (z ServerRoleCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ServerRoleCreateParams) Msgsize

func (z ServerRoleCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerRoleCreateParams) UnmarshalMsg

func (z *ServerRoleCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerRoleEditParams

type ServerRoleEditParams struct {
	Name   string   `msg:"name" json:"name,omitempty"`
	Colour string   `msg:"colour" json:"colour,omitempty"`
	Hoist  *bool    `msg:"hoist" json:"hoist,omitempty"`
	Rank   *int     `msg:"rank" json:"rank,omitempty"`
	Remove []string `msg:"remove" json:"remove,omitempty"`
}

func (*ServerRoleEditParams) MarshalMsg

func (z *ServerRoleEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerRoleEditParams) Msgsize

func (z *ServerRoleEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerRoleEditParams) UnmarshalMsg

func (z *ServerRoleEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ServerSystemMessages

type ServerSystemMessages struct {
	UserJoined string `msg:"user_joined" json:"user_joined,omitempty"`
	UserLeft   string `msg:"user_left" json:"user_left,omitempty"`
	UserKicked string `msg:"user_kicked" json:"user_kicked,omitempty"`
	UserBanned string `msg:"user_banned" json:"user_banned,omitempty"`
}

ServerSystemMessages System messages struct.

func (*ServerSystemMessages) MarshalMsg

func (z *ServerSystemMessages) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ServerSystemMessages) Msgsize

func (z *ServerSystemMessages) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ServerSystemMessages) UnmarshalMsg

func (z *ServerSystemMessages) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Session

type Session struct {
	Token           string      // Authorisation token
	WS              *Websocket  // Websocket handler for bidirectional events
	HTTP            *HTTPClient // HTTP handler for the REST API
	State           *State      // State is a central store for all data received from the API
	CheckForUpdates bool        // Whether to check for updates in the default EventReady handler
	// contains filtered or unexported fields
}

Session represents a connection to the Revolt API.

func New

func New(token string) *Session

func NewWithExpressLogin

func NewWithExpressLogin(data LoginParams) (*Session, error)

NewWithExpressLogin exchanges an email and password for a session token, and then creates a new session. Unlike NewWithLogin, this automatically reads and writes the token to a file for you. Make sure you trust the environment where this is run, as the token is stored in plaintext.

func (*Session) Account

func (s *Session) Account() (account *Account, err error)

func (*Session) AccountChangeEmail

func (s *Session) AccountChangeEmail(data AccountChangeEmailParams) error

func (*Session) AccountChangePassword

func (s *Session) AccountChangePassword(data AccountChangePasswordParams) error

func (*Session) AccountCreate

func (s *Session) AccountCreate(data AccountCreateParams) error

func (*Session) AccountDelete

func (s *Session) AccountDelete() error

func (*Session) AccountDeleteConfirm

func (s *Session) AccountDeleteConfirm(data AccountDeleteConfirmParams) error

func (*Session) AccountDisable

func (s *Session) AccountDisable() error

func (*Session) AccountReverify

func (s *Session) AccountReverify(data AccountReverifyParams) error

func (*Session) AttachmentUpload

func (s *Session) AttachmentUpload(file *File) (attachment *FileAttachment, err error)

func (*Session) AuthMFA

func (s *Session) AuthMFA() (mfa AuthMFAResponse, err error)

func (*Session) AuthMFACreateTicket

func (s *Session) AuthMFACreateTicket(data AuthMFAParams) (ticket AuthMFATicketResponse, err error)

func (*Session) AuthMFADisable2FATOTP

func (s *Session) AuthMFADisable2FATOTP() (err error)

func (*Session) AuthMFAEnable2FATOTP

func (s *Session) AuthMFAEnable2FATOTP(data AuthMFAParams) (err error)

func (*Session) AuthMFAGenerateRecoveryCodes

func (s *Session) AuthMFAGenerateRecoveryCodes() (codes []string, err error)

func (*Session) AuthMFAGenerateTOTPSecret

func (s *Session) AuthMFAGenerateTOTPSecret() (secret AuthMFATOTPSecretResponse, err error)

func (*Session) AuthMFAMethods

func (s *Session) AuthMFAMethods() (methods []AuthMFAMethod, err error)

func (*Session) AuthMFARecoveryCodes

func (s *Session) AuthMFARecoveryCodes() (codes []string, err error)

func (*Session) Bot

func (s *Session) Bot(bID string) (bot *FetchedBot, err error)

Bot fetches details of a bot you own by its ID

func (*Session) BotCreate

func (s *Session) BotCreate(data BotCreateParams) (bot *Bot, err error)

BotCreate creates a bot based on the data provided

func (*Session) BotDelete

func (s *Session) BotDelete(bID string) error

func (*Session) BotEdit

func (s *Session) BotEdit(id string, data BotEditParams) (bot *Bot, err error)

func (*Session) BotInvite

func (s *Session) BotInvite(bID string, data BotInviteParams) (err error)

BotInvite invites a bot by its ID to a server or group

func (*Session) BotPublic

func (s *Session) BotPublic(bID string) (bot *PublicBot, err error)

BotPublic fetches a public bot by its ID

func (*Session) Bots

func (s *Session) Bots() (bots *FetchedBots, err error)

Bots returns a list of bots for the current user

func (*Session) Channel

func (s *Session) Channel(cID string) (channel *Channel, err error)

Channel fetches a channel using an API call

func (*Session) ChannelBeginTyping

func (s *Session) ChannelBeginTyping(cID string) (err error)

ChannelBeginTyping is a Websocket method to start typing in a channel

func (*Session) ChannelDelete

func (s *Session) ChannelDelete(cID string) (err error)

func (*Session) ChannelEdit

func (s *Session) ChannelEdit(cID string, data ChannelEditParams) (channel *Channel, err error)

func (*Session) ChannelEndTyping

func (s *Session) ChannelEndTyping(cID string) (err error)

ChannelEndTyping is a Websocket method to stop typing in a channel

func (*Session) ChannelInviteCreate

func (s *Session) ChannelInviteCreate(cID string) (invite *InviteCreate, err error)

func (*Session) ChannelMessage

func (s *Session) ChannelMessage(cID, mID string) (message *Message, err error)

func (*Session) ChannelMessageDelete

func (s *Session) ChannelMessageDelete(cID, mID string) error

func (*Session) ChannelMessageDeleteBulk

func (s *Session) ChannelMessageDeleteBulk(cID string, messages ChannelMessageBulkDeleteParams) error

func (*Session) ChannelMessageEdit

func (s *Session) ChannelMessageEdit(cID, mID string, data MessageEditParams) (message *Message, err error)

func (*Session) ChannelMessagePin

func (s *Session) ChannelMessagePin(cID, mID string) (err error)

func (*Session) ChannelMessageReactionClear

func (s *Session) ChannelMessageReactionClear(cID, mID string) (err error)

ChannelMessageReactionClear clears all reactions on a message

func (*Session) ChannelMessageReactionCreate

func (s *Session) ChannelMessageReactionCreate(cID, mID, eID string) (err error)

ChannelMessageReactionCreate adds a reaction (emoji ID) to a message

func (*Session) ChannelMessageReactionDelete

func (s *Session) ChannelMessageReactionDelete(cID, mID, eID string) (err error)

ChannelMessageReactionDelete deletes a singular reaction on a message

func (*Session) ChannelMessageSend

func (s *Session) ChannelMessageSend(cID string, data MessageSend) (message *Message, err error)

func (*Session) ChannelMessageUnpin

func (s *Session) ChannelMessageUnpin(cID, mID string) (err error)

func (*Session) ChannelMessages

func (s *Session) ChannelMessages(cID string, params ...ChannelMessagesParams) (data ChannelMessages, err error)

func (*Session) ChannelPermissionsSet

func (s *Session) ChannelPermissionsSet(cID, rID string, data PermissionOverwrite) (err error)

ChannelPermissionsSet sets permissions for the specified role in this channel.

func (*Session) ChannelPermissionsSetDefault

func (s *Session) ChannelPermissionsSetDefault(cID string, data PermissionOverwrite) (err error)

ChannelPermissionsSetDefault sets permissions for the default role in this channel.

func (*Session) ChannelSearch

func (s *Session) ChannelSearch(cID string, query ChannelSearchParams) (messages []*Message, err error)

func (*Session) ChannelWebhookCreate

func (s *Session) ChannelWebhookCreate(cID string, data WebhookCreateParams) (webhook *Webhook, err error)

func (*Session) ChannelWebhooks

func (s *Session) ChannelWebhooks(cID string) (webhooks []*Webhook, err error)

func (*Session) ChannelsEndRing

func (s *Session) ChannelsEndRing(cID, uID string) error

ChannelsEndRing stops ringing a user in a DM if a call exists; returns NotConnected otherwise. Only works within DMs and groups; returns NoEffect in servers. Returns NotFound if the user is not in the DM/group channel.

func (*Session) ChannelsJoinCall

func (s *Session) ChannelsJoinCall(cID string, data ChannelJoinCallParams) (call ChannelJoinCall, err error)

ChannelsJoinCall asks the voice server for a token to join the call.

func (*Session) Close

func (s *Session) Close() error

Close closes the Websocket connection.

func (*Session) DirectMessageCreate

func (s *Session) DirectMessageCreate(uID string) (channel *Channel, err error)

DirectMessageCreate opens a direct message channel with a user Will return an error "MissingPermission" "SendMessage" if you are not friends or blocked

func (*Session) DirectMessages

func (s *Session) DirectMessages() (channels []*Channel, err error)

DirectMessages returns a list of direct message channels.

func (*Session) Emoji

func (s *Session) Emoji(eID string) (emoji *Emoji, err error)

func (*Session) EmojiCreate

func (s *Session) EmojiCreate(eID string, data EmojiCreateParams) (emoji *Emoji, err error)

func (*Session) EmojiDelete

func (s *Session) EmojiDelete(eID string) error

func (*Session) FriendAdd

func (s *Session) FriendAdd(uID string) (user *User, err error)

FriendAdd sends or accepts a friend Request. todo: this might be completely wrong, check: https://developers.stoat.chat/api-reference#tag/relationships/POST/users/friend todo: this POSTS to /user/friend with body "username" (Username and discriminator combo separated by #)

func (*Session) FriendDelete

func (s *Session) FriendDelete(uID string) (user *User, err error)

FriendDelete removes a friend or declines a friend request.

func (*Session) GroupCreate

func (s *Session) GroupCreate(data GroupCreateParams) (group *Group, err error)

GroupCreate creates a group based on the data provided "Users" field is a list of user IDs that will be in the group

func (*Session) GroupMemberAdd

func (s *Session) GroupMemberAdd(cID, mID string) (err error)

func (*Session) GroupMemberDelete

func (s *Session) GroupMemberDelete(cID, mID string) (err error)

func (*Session) GroupMembers

func (s *Session) GroupMembers(cID string) (users []*User, err error)

func (*Session) Invite

func (s *Session) Invite(iID string) (invite *Invite, err error)

func (*Session) InviteDelete

func (s *Session) InviteDelete(iID string) (err error)

func (*Session) InviteJoin

func (s *Session) InviteJoin(iID string) (invite *Invite, err error)

func (*Session) IsConnected

func (s *Session) IsConnected() bool

func (*Session) Login

func (s *Session) Login(data LoginParams) (mfa LoginResponse, err error)

Login as a regular user instead of bot. Friendly name is used to identify the session via MFA

func (*Session) Logout

func (s *Session) Logout() error

func (*Session) MessageAck

func (s *Session) MessageAck(channelID, messageID string) (err error)

func (*Session) Onboarding

func (s *Session) Onboarding() (onboarding Onboarding, err error)

Onboarding returns whether the current account requires onboarding or whether you can continue to send requests as usual

func (*Session) OnboardingComplete

func (s *Session) OnboardingComplete(data OnboardingCompleteParams) error

OnboardingComplete sets a new username, completes onboarding and allows a user to start using Revolt.

func (*Session) Open

func (s *Session) Open(configuration ...StateConfig) (err error)

Open determines the Websocket URL and establishes a connection. It also detects if you are logged in as a user or a bot.

An optional StateConfig defines what the State should track; if omitted, DefaultStateConfig is used. Tracking is fixed for the lifetime of the connection.

func (*Session) PasswordReset

func (s *Session) PasswordReset(data AccountReverifyParams) error

PasswordReset requests a password reset, which is sent to the email provided

func (*Session) PasswordResetConfirm

func (s *Session) PasswordResetConfirm(data PasswordResetConfirmParams) error

PasswordResetConfirm confirms a password reset

func (*Session) PermissionsSet

func (s *Session) PermissionsSet(sID, rID string, data PermissionOverwrite) (err error)

func (*Session) PermissionsSetDefault

func (s *Session) PermissionsSetDefault(sID string, data PermissionsSetDefaultParams) (err error)

PermissionsSetDefault sets the permissions of a role in a server

func (*Session) PolicyAck

func (s *Session) PolicyAck() (err error)

func (*Session) PushSubscribe

func (s *Session) PushSubscribe(data WebpushSubscription) error

func (*Session) PushUnsubscribe

func (s *Session) PushUnsubscribe(data WebpushSubscription) error

func (*Session) Relationships

func (s *Session) Relationships() (relationships []*UserRelationship, err error)

Relationships returns a list of relationships for the current user

func (*Session) Selfbot

func (s *Session) Selfbot() bool

Selfbot returns whether the session is a selfbot

func (*Session) Server

func (s *Session) Server(id string) (server *Server, err error)

Server fetches a server by its ID

func (*Session) ServerAck

func (s *Session) ServerAck(serverID string) (err error)

func (*Session) ServerBans

func (s *Session) ServerBans(sID string) (bans []*ServerBans, err error)

func (*Session) ServerChannelCreate

func (s *Session) ServerChannelCreate(sID string, data ServerChannelCreateParams) (channel *Channel, err error)

func (*Session) ServerCreate

func (s *Session) ServerCreate(data ServerCreateParams) (server *Server, err error)

ServerCreate creates a server based on the data provided

func (*Session) ServerDelete

func (s *Session) ServerDelete(sID string) error

func (*Session) ServerEdit

func (s *Session) ServerEdit(id string, data ServerEditParams) (server *Server, err error)

func (*Session) ServerEmojis

func (s *Session) ServerEmojis(sID string) (emojis []*Emoji, err error)

func (*Session) ServerInvites

func (s *Session) ServerInvites(sID string) (invites []*Invite, err error)

func (*Session) ServerMember

func (s *Session) ServerMember(sID, mID string) (member *ServerMember, err error)

func (*Session) ServerMemberBan

func (s *Session) ServerMemberBan(sID, mID string) (err error)

func (*Session) ServerMemberDelete

func (s *Session) ServerMemberDelete(sID, mID string) (err error)

func (*Session) ServerMemberEdit

func (s *Session) ServerMemberEdit(sID, mID string, data ServerMemberEditParams) (member *ServerMember, err error)

func (*Session) ServerMemberUnban

func (s *Session) ServerMemberUnban(sID, mID string) (err error)

func (*Session) ServerMembers

func (s *Session) ServerMembers(sID string, excludeOffline bool) (data *ServerMembers, err error)

func (*Session) ServerRoleDelete

func (s *Session) ServerRoleDelete(sID, rID string) (err error)

func (*Session) ServerRoleEdit

func (s *Session) ServerRoleEdit(sID, rID string, data ServerRoleEditParams) (role *ServerRole, err error)

func (*Session) ServersRole

func (s *Session) ServersRole(sID, rID string) (role *ServerRole, err error)

func (*Session) ServersRoleCreate

func (s *Session) ServersRoleCreate(sID string, data ServerRoleCreateParams) (role *ServerRole, err error)

func (*Session) ServersRoleRanksEdit

func (s *Session) ServersRoleRanksEdit(sID string, ranks []string) (err error)

func (*Session) SessionEdit

func (s *Session) SessionEdit(id string, data SessionEditParams) (session SessionEditParams, err error)

func (*Session) Sessions

func (s *Session) Sessions() (sessions []*Sessions, err error)

func (*Session) SessionsDelete

func (s *Session) SessionsDelete(id string) error

SessionsDelete invalidates a session with the provided ID

func (*Session) SessionsDeleteAll

func (s *Session) SessionsDeleteAll(revokeSelf bool) error

SessionsDeleteAll invalidates all sessions, including this one if revokeSelf is true

func (*Session) SetUsername

func (s *Session) SetUsername(data UsernameParams) (user *User, err error)

func (*Session) SyncSettingsFetch

func (s *Session) SyncSettingsFetch(payload SyncSettingsFetchParams) (data *SyncSettingsParams, err error)

func (*Session) SyncSettingsSet

func (s *Session) SyncSettingsSet(payload SyncSettingsParams) error

func (*Session) SyncUnreads

func (s *Session) SyncUnreads() (data []ChannelUnread, err error)

func (*Session) User

func (s *Session) User(uID string) (user *User, err error)

User fetches a user by their ID To fetch self, supply "@me" as the ID

func (*Session) UserBlock

func (s *Session) UserBlock(uID string) (user *User, err error)

func (*Session) UserDefaultAvatar

func (s *Session) UserDefaultAvatar(uID string) (binary []byte, err error)

func (*Session) UserEdit

func (s *Session) UserEdit(uID string, data UserEditParams) (user *User, err error)

func (*Session) UserFlags

func (s *Session) UserFlags(uID string) (flags int, err error)

func (*Session) UserMutual

func (s *Session) UserMutual(uID string) (mutual []*MutualFriendsAndServersResponse, err error)

func (*Session) UserProfile

func (s *Session) UserProfile(uID string) (profile *UserProfile, err error)

func (*Session) UserUnblock

func (s *Session) UserUnblock(uID string) (user *User, err error)

func (*Session) VerifyEmail

func (s *Session) VerifyEmail(code string) (ticket ChangeEmail, err error)

func (*Session) Webhook

func (s *Session) Webhook(wID string) (webhook *Webhook, err error)

Webhook fetches a webhook using its ID

func (*Session) WebhookDelete

func (s *Session) WebhookDelete(wID string) (err error)

func (*Session) WebhookEdit

func (s *Session) WebhookEdit(wID string, data WebhookEditParams) (webhook *Webhook, err error)

func (*Session) WebhookToken

func (s *Session) WebhookToken(wID, wToken string) (webhook *Webhook, err error)

WebhookToken fetches a webhook using its ID and token

func (*Session) WebhookTokenDelete

func (s *Session) WebhookTokenDelete(wID, wToken string) (err error)

func (*Session) WebhookTokenEdit

func (s *Session) WebhookTokenEdit(wID, wToken string, data WebhookEditParams) (webhook *Webhook, err error)

func (*Session) WebhookTokenExecute

func (s *Session) WebhookTokenExecute(wID, wToken string, data WebhookExecuteParams) (message *Message, err error)

func (*Session) WebhookTokenExecuteGitHub

func (s *Session) WebhookTokenExecuteGitHub(wID, wToken, githubEventName string, data []byte) (err error)

WebhookTokenExecuteGitHub is not implemented yet.

func (*Session) WriteSocketJSON

func (s *Session) WriteSocketJSON(data any) error

WriteSocketJSON writes data to the websocket in JSON

func (*Session) WriteSocketMSGP

func (s *Session) WriteSocketMSGP(data any) error

WriteSocketMSGP writes data to the Websocket in MessagePack

type SessionEditParams

type SessionEditParams struct {
	FriendlyName string `msg:"friendly_name" json:"friendly_name,omitempty"`
}

func (SessionEditParams) MarshalMsg

func (z SessionEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (SessionEditParams) Msgsize

func (z SessionEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SessionEditParams) UnmarshalMsg

func (z *SessionEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Sessions

type Sessions struct {
	ID   string `msg:"_id" json:"_id,omitempty"`
	Name string `msg:"name" json:"name,omitempty"`
}

func (Sessions) MarshalMsg

func (z Sessions) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Sessions) Msgsize

func (z Sessions) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Sessions) UnmarshalMsg

func (z *Sessions) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type State

type State struct {
	// contains filtered or unexported fields
}

func (*State) Channel

func (s *State) Channel(id string) *Channel

func (*State) ChannelCount

func (s *State) ChannelCount() int

func (*State) ChannelPermissions

func (s *State) ChannelPermissions(user *User, channel *Channel) (int64, error)

ChannelPermissions is a utility function to calculate permissions for a user in a Channel

func (*State) ChannelSeq

func (s *State) ChannelSeq() iter.Seq[*Channel]

ChannelSeq iterates all channels without allocating a slice. The same loop-body rules as MembersSeq apply: keep it quick and don't call other State methods from inside it. Use Channels if you need a snapshot.

func (*State) Channels

func (s *State) Channels() []*Channel

Channels returns a slice of all channels in state. For general use, Channel(id) is more common

func (*State) Emoji

func (s *State) Emoji(id string) *Emoji

func (*State) EmojiCount

func (s *State) EmojiCount() int

func (*State) EmojiSeq

func (s *State) EmojiSeq() iter.Seq[*Emoji]

EmojiSeq iterates all emojis without allocating a slice. The same loop-body rules as MembersSeq apply: keep it quick and don't call other State methods from inside it. Use Emojis if you need a snapshot.

func (*State) Emojis

func (s *State) Emojis() []*Emoji

Emojis returns a slice of all emojis in state. For general use, Emoji(id) is more common

func (*State) Member

func (s *State) Member(sID, uID string) *ServerMember

func (*State) MemberCount

func (s *State) MemberCount(sID string) int

MemberCount is a helper function to avoid costly len(s.Members(sID)) calls; avoid allocating a whole slice just to count

func (*State) Members

func (s *State) Members(sID string) []*ServerMember

Members returns a snapshot slice of a server's members. The members are copied into a fresh slice while locked, then the lock is released, so you are free to do anything inside your loop afterwards, including calling other State methods. The trade-off is one slice allocation per call. If your loop only needs a quick, read-only pass, prefer MembersSeq to skip that allocation.

func (*State) MembersSeq

func (s *State) MembersSeq(sID string) iter.Seq[*ServerMember]

MembersSeq iterates a server's members without allocating a slice:

for member := range session.State.MembersSeq(serverID) {
	// ...
}

The read lock is held for the whole loop, so keep the body quick and don't call other State methods from inside it — the lock is already held, so doing so can deadlock. Break/return is fine. If you need either, use Members.

func (*State) Role

func (s *State) Role(sID, rID string) *ServerRole

func (*State) Self

func (s *State) Self() *User

func (*State) Server

func (s *State) Server(id string) *Server

func (*State) ServerCount

func (s *State) ServerCount() int

func (*State) ServerPermissions

func (s *State) ServerPermissions(user *User, server *Server) (int64, error)

ServerPermissions is a utility function to calculate permissions for a user in a Server

func (*State) ServerSeq

func (s *State) ServerSeq() iter.Seq[*Server]

ServerSeq iterates all servers without allocating a slice. The same loop-body rules as MembersSeq apply: keep it quick and don't call other State methods from inside it. Use Servers if you need a snapshot.

func (*State) Servers

func (s *State) Servers() []*Server

Servers returns a slice of all servers in state. For general use, Server(id) is more common

func (*State) TrackAPICalls

func (s *State) TrackAPICalls() bool

func (*State) TrackBulkAPICalls

func (s *State) TrackBulkAPICalls() bool

func (*State) TrackChannels

func (s *State) TrackChannels() bool

func (*State) TrackEmojis

func (s *State) TrackEmojis() bool

func (*State) TrackMembers

func (s *State) TrackMembers() bool

func (*State) TrackServers

func (s *State) TrackServers() bool

func (*State) TrackUsers

func (s *State) TrackUsers() bool

func (*State) User

func (s *State) User(id string) *User

func (*State) UserCount

func (s *State) UserCount() int

func (*State) UserSeq

func (s *State) UserSeq() iter.Seq[*User]

UserSeq iterates all users without allocating a slice. The same loop-body rules as MembersSeq apply: keep it quick and don't call other State methods from inside it. Use Users if you need a snapshot.

func (*State) Users

func (s *State) Users() []*User

Users returns a slice of all users in state. For general use, User(id) is more common

type StateConfig

type StateConfig struct {
	TrackUsers    bool
	TrackServers  bool
	TrackChannels bool
	TrackMembers  bool
	TrackEmojis   bool

	// TrackAPICalls additionally updates the state from single API calls
	TrackAPICalls bool

	// TrackBulkAPICalls additionally updates the state from bulk API calls
	TrackBulkAPICalls bool
}

StateConfig controls which entity caches the State maintains. Pass it to Session.Open. The zero value tracks nothing. Tracking is immutable once Session.Open() has connected.

func DefaultStateConfig

func DefaultStateConfig() StateConfig

DefaultStateConfig returns a StateConfig that tracks everything.

type SyncSettingsFetchParams

type SyncSettingsFetchParams struct {
	Keys []string `msg:"keys" json:"keys,omitempty"`
}

func (*SyncSettingsFetchParams) MarshalMsg

func (z *SyncSettingsFetchParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*SyncSettingsFetchParams) Msgsize

func (z *SyncSettingsFetchParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SyncSettingsFetchParams) UnmarshalMsg

func (z *SyncSettingsFetchParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SyncSettingsParams

type SyncSettingsParams map[string]SyncSettingsParamsTuple

func (SyncSettingsParams) MarshalMsg

func (z SyncSettingsParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (SyncSettingsParams) Msgsize

func (z SyncSettingsParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SyncSettingsParams) UnmarshalMsg

func (z *SyncSettingsParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SyncSettingsParamsTuple

type SyncSettingsParamsTuple struct {
	Timestamp time.Time `msg:"0" json:"0,omitempty"`
	Value     msgp.Raw  `msg:"1" json:"1,omitempty"` // Enjoy using this.
}

func (*SyncSettingsParamsTuple) MarshalMsg

func (z *SyncSettingsParamsTuple) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*SyncSettingsParamsTuple) Msgsize

func (z *SyncSettingsParamsTuple) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SyncSettingsParamsTuple) UnmarshalMsg

func (z *SyncSettingsParamsTuple) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type User

type User struct {
	ID            string               `msg:"_id" json:"_id,omitempty"`
	Username      string               `msg:"username" json:"username,omitempty"`
	Discriminator string               `msg:"discriminator" json:"discriminator,omitempty"`
	Flags         uint32               `msg:"flags" json:"flags,omitempty"`
	Privileged    bool                 `msg:"privileged" json:"privileged,omitempty"`
	Badges        uint32               `msg:"badges" json:"badges,omitempty"`
	Online        bool                 `msg:"online" json:"online,omitempty"`
	Relations     []UserRelationship   `msg:"relations" json:"relations,omitempty"`
	Relationship  UserRelationshipType `msg:"relationship" json:"relationship,omitempty"`
	DisplayName   *string              `msg:"display_name" json:"display_name,omitempty"`
	Avatar        *Attachment          `msg:"avatar" json:"avatar,omitempty"`
	Status        *UserStatus          `msg:"status" json:"status,omitempty"`
	Profile       *UserProfile         `msg:"profile" json:"profile,omitempty"` // todo: deprecated? not present in src
	Bot           *Bot                 `msg:"bot" json:"bot,omitempty"`
}

User is derived from https://github.com/stoatchat/stoatchat/blob/main/crates/core/models/src/v0/users.rs#L24

func (*User) AvatarURL

func (u *User) AvatarURL(size string) string

func (*User) MarshalMsg

func (z *User) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*User) Mention

func (u *User) Mention() string

func (*User) Msgsize

func (z *User) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*User) UnmarshalMsg

func (z *User) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserEditParams

type UserEditParams struct {
	DisplayName string       `msg:"display_name" json:"display_name,omitempty"`
	Avatar      string       `msg:"avatar" json:"avatar,omitempty"`
	Status      *UserStatus  `msg:"status" json:"status,omitempty"`
	Profile     *UserProfile `msg:"profile" json:"profile,omitempty"`
	Badges      *int         `msg:"badges" json:"badges,omitempty"`
	Flags       *int         `msg:"flags" json:"flags,omitempty"`
	Remove      []string     `msg:"remove" json:"remove,omitempty"`
}

func (*UserEditParams) MarshalMsg

func (z *UserEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UserEditParams) Msgsize

func (z *UserEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserEditParams) UnmarshalMsg

func (z *UserEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserProfile

type UserProfile struct {
	Content    string      `msg:"content" json:"content,omitempty"`
	Background *Attachment `msg:"background" json:"background,omitempty"`
}

func (*UserProfile) MarshalMsg

func (z *UserProfile) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UserProfile) Msgsize

func (z *UserProfile) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserProfile) UnmarshalMsg

func (z *UserProfile) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserRelationship

type UserRelationship struct {
	ID     string               `msg:"_id" json:"_id,omitempty"`
	Status UserRelationshipType `msg:"status" json:"status,omitempty"`
}

func (UserRelationship) MarshalMsg

func (z UserRelationship) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UserRelationship) Msgsize

func (z UserRelationship) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserRelationship) UnmarshalMsg

func (z *UserRelationship) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserRelationshipType

type UserRelationshipType string

func (UserRelationshipType) MarshalMsg

func (z UserRelationshipType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UserRelationshipType) Msgsize

func (z UserRelationshipType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserRelationshipType) UnmarshalMsg

func (z *UserRelationshipType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserSettings

type UserSettings struct {
	Updated int
	Data    msgp.Raw
}

UserSettings TODO: This does not get decoded due to API sending tuples for some god-forsaken reason

func (*UserSettings) MarshalMsg

func (z *UserSettings) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UserSettings) Msgsize

func (z *UserSettings) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserSettings) UnmarshalMsg

func (z *UserSettings) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserStatus

type UserStatus struct {
	Text     string             `msg:"text" json:"text,omitempty"`
	Presence UserStatusPresence `msg:"presence" json:"presence,omitempty"`
}

func (UserStatus) MarshalMsg

func (z UserStatus) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UserStatus) Msgsize

func (z UserStatus) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserStatus) UnmarshalMsg

func (z *UserStatus) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserStatusPresence

type UserStatusPresence string
const (
	UserStatusPresenceOnline    UserStatusPresence = "Online"
	UserStatusPresenceIdle      UserStatusPresence = "Idle"
	UserStatusPresenceFocus     UserStatusPresence = "Focus"
	UserStatusPresenceBusy      UserStatusPresence = "Busy"
	UserStatusPresenceInvisible UserStatusPresence = "Invisible"
)

func (UserStatusPresence) MarshalMsg

func (z UserStatusPresence) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UserStatusPresence) Msgsize

func (z UserStatusPresence) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserStatusPresence) UnmarshalMsg

func (z *UserStatusPresence) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UserVoiceState

type UserVoiceState struct {
	ID            string     `msg:"_id" json:"_id,omitempty"`
	JoinedAt      *time.Time `msg:"joined_at" json:"joined_at,omitempty"`
	IsReceiving   bool       `msg:"is_receiving" json:"is_receiving,omitempty"`
	IsPublishing  bool       `msg:"is_publishing" json:"is_publishing,omitempty"`
	Screensharing bool       `msg:"screensharing" json:"screensharing,omitempty"`
	Camera        bool       `msg:"camera" json:"camera,omitempty"`
}

func (*UserVoiceState) MarshalMsg

func (z *UserVoiceState) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*UserVoiceState) Msgsize

func (z *UserVoiceState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UserVoiceState) UnmarshalMsg

func (z *UserVoiceState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UsernameParams

type UsernameParams struct {
	Username string `msg:"username" json:"username,omitempty"`
	Password string `msg:"password" json:"password,omitempty"`
}

func (UsernameParams) MarshalMsg

func (z UsernameParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UsernameParams) Msgsize

func (z UsernameParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UsernameParams) UnmarshalMsg

func (z *UsernameParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Webhook

type Webhook struct {
	ID          string      `msg:"_id" json:"_id,omitempty"`
	Name        string      `msg:"name" json:"name,omitempty"`
	Avatar      *Attachment `msg:"avatar" json:"avatar,omitempty"`
	CreatorID   string      `msg:"creator_id" json:"creator_id,omitempty"`
	ChannelID   string      `msg:"channel_id" json:"channel_id,omitempty"`
	Permissions uint64      `msg:"permissions" json:"permissions,omitempty"`
	Token       *string     `msg:"token" json:"token,omitempty"`
}

Webhook is derived from https://github.com/stoatchat/stoatchat/blob/main/crates/core/database/src/models/channel_webhooks/model.rs#L8

func (*Webhook) MarshalMsg

func (z *Webhook) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Webhook) Msgsize

func (z *Webhook) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Webhook) UnmarshalMsg

func (z *Webhook) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebhookCreateParams

type WebhookCreateParams struct {
	Name   string `msg:"name" json:"name,omitempty"`
	Avatar string `msg:"avatar" json:"avatar,omitempty"`
}

func (WebhookCreateParams) MarshalMsg

func (z WebhookCreateParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (WebhookCreateParams) Msgsize

func (z WebhookCreateParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebhookCreateParams) UnmarshalMsg

func (z *WebhookCreateParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebhookEditParams

type WebhookEditParams struct {
	Name        string               `msg:"name" json:"name,omitempty"`
	Avatar      string               `msg:"avatar" json:"avatar,omitempty"`
	Permissions string               `msg:"permissions" json:"permissions,omitempty"`
	Remove      []WebhookRemoveField `msg:"remove" json:"remove,omitempty"`
}

func (*WebhookEditParams) MarshalMsg

func (z *WebhookEditParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*WebhookEditParams) Msgsize

func (z *WebhookEditParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebhookEditParams) UnmarshalMsg

func (z *WebhookEditParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebhookExecuteParams

type WebhookExecuteParams Message

func (*WebhookExecuteParams) MarshalMsg

func (z *WebhookExecuteParams) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*WebhookExecuteParams) Msgsize

func (z *WebhookExecuteParams) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebhookExecuteParams) UnmarshalMsg

func (z *WebhookExecuteParams) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebhookRemoveField

type WebhookRemoveField string
const (
	WebhookRemoveNickname WebhookRemoveField = "Nickname"
	WebhookRemoveAvatar   WebhookRemoveField = "Avatar"
)

func (WebhookRemoveField) MarshalMsg

func (z WebhookRemoveField) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (WebhookRemoveField) Msgsize

func (z WebhookRemoveField) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebhookRemoveField) UnmarshalMsg

func (z *WebhookRemoveField) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebpushSubscription

type WebpushSubscription struct {

	// The URL to send the notification to
	Endpoint string `msg:"endpoint" json:"endpoint,omitempty"`

	// P-256 Diffie-Hellman public key
	P256DH string `msg:"p256dh" json:"p256dh,omitempty"`

	// Auth secret; used to authenticate the origin of the notification
	Auth string `msg:"auth" json:"auth,omitempty"`
}

func (WebpushSubscription) MarshalMsg

func (z WebpushSubscription) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (WebpushSubscription) Msgsize

func (z WebpushSubscription) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebpushSubscription) UnmarshalMsg

func (z *WebpushSubscription) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Websocket

type Websocket struct {

	// Interval between sending heartbeats. Lower values update the latency faster.
	// Values too high (>=100 seconds) may cause Cloudflare to drop the connection
	HeartbeatInterval time.Duration

	Debug             bool                   // Prints sending (not a typo) and received websocket messages
	ShouldReconnect   bool                   // Whether the websocket should attempt to reconnect on disconnection
	ReconnectInterval time.Duration          // Interval between reconnecting, if connection fails
	CustomCompression *gws.PermessageDeflate // Defines a custom compression algorithm for the Websocket.
	// contains filtered or unexported fields
}

func (*Websocket) IsConnected

func (ws *Websocket) IsConnected() bool

func (*Websocket) Latency

func (ws *Websocket) Latency() time.Duration

Latency returns the Websocket latency

func (*Websocket) OnClose

func (ws *Websocket) OnClose(_ *gws.Conn, err error)

func (*Websocket) OnMessage

func (ws *Websocket) OnMessage(_ *gws.Conn, message *gws.Message)

func (*Websocket) OnOpen

func (ws *Websocket) OnOpen(socket *gws.Conn)

func (*Websocket) OnPing

func (ws *Websocket) OnPing(_ *gws.Conn, payload []byte)

func (*Websocket) OnPong

func (ws *Websocket) OnPong(socket *gws.Conn, payload []byte)

func (*Websocket) Uptime

func (ws *Websocket) Uptime() time.Duration

Uptime approximates the duration the Websocket has been connected for

func (*Websocket) WriteClose

func (ws *Websocket) WriteClose() error

func (*Websocket) WriteMessage

func (ws *Websocket) WriteMessage(opcode gws.Opcode, payload []byte) error

type WebsocketChannelTyping

type WebsocketChannelTyping struct {
	Type    WebsocketMessageType `msg:"type" json:"type,omitempty"`
	Channel string               `msg:"channel" json:"channel,omitempty"`
}

func (WebsocketChannelTyping) MarshalMsg

func (z WebsocketChannelTyping) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (WebsocketChannelTyping) Msgsize

func (z WebsocketChannelTyping) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebsocketChannelTyping) UnmarshalMsg

func (z *WebsocketChannelTyping) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebsocketMessageAuthenticate

type WebsocketMessageAuthenticate struct {
	Type  WebsocketMessageType `msg:"type" json:"type,omitempty"`
	Token string               `msg:"token" json:"token,omitempty"`
}

func (WebsocketMessageAuthenticate) MarshalMsg

func (z WebsocketMessageAuthenticate) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (WebsocketMessageAuthenticate) Msgsize

func (z WebsocketMessageAuthenticate) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebsocketMessageAuthenticate) UnmarshalMsg

func (z *WebsocketMessageAuthenticate) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebsocketMessagePing

type WebsocketMessagePing struct {
	Type WebsocketMessageType `msg:"type" json:"type,omitempty"`
	Data int64                `msg:"data" json:"data,omitempty"`
}

func (WebsocketMessagePing) MarshalMsg

func (z WebsocketMessagePing) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (WebsocketMessagePing) Msgsize

func (z WebsocketMessagePing) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebsocketMessagePing) UnmarshalMsg

func (z *WebsocketMessagePing) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type WebsocketMessageType

type WebsocketMessageType string
const (
	WebsocketKeepAlivePeriod = 60 * time.Second

	WebsocketMessageTypeAuthenticate WebsocketMessageType = "Authenticate"
	WebsocketMessageTypeHeartbeat    WebsocketMessageType = "Ping"
	WebsocketMessageTypeBeginTyping  WebsocketMessageType = "BeginTyping"
	WebsocketMessageTypeEndTyping    WebsocketMessageType = "EndTyping"
)

func (WebsocketMessageType) MarshalMsg

func (z WebsocketMessageType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (WebsocketMessageType) Msgsize

func (z WebsocketMessageType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WebsocketMessageType) UnmarshalMsg

func (z *WebsocketMessageType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL