regolt

package module
v0.0.0-...-761d34b Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 17 Imported by: 0

README

regolt

Revolt library for Go

Examples

Ping pong example is located here.

Documentation

Index

Constants

View Source
const InfiniteCache int = -1
View Source
const Version = "1.1.0"

! |-- Revolt API version ! | ! | |-- Regolt major version ! | | ! | | |-- Regolt minor version

Variables

View Source
var (
	// API.QueryNode() -> GET /
	RouteQueryNode = func() Route { return Route{"GET", "/"} }
	// API.FetchSelf() -> GET /users/@me
	RouteFetchSelf = func() Route { return Route{"GET", "/users/@me"} }
	// API.FetchUser(user) -> GET /users/{user}
	RouteFetchUser = func(user ULID) Route { return Route{"GET", "/users/" + user.EncodeFP()} }
	// API.EditUser(user, params) -> PATCH /users/{user}
	RouteEditUser = func(user ULID) Route { return Route{"PATCH", "/users/" + user.EncodeFP()} }
	// API.FetchUserFlags(user) -> GET /users/{user}/flags
	RouteFetchUserFlags = func(user ULID) Route { return Route{"GET", "/users/" + user.EncodeFP() + "/flags"} }
	// API.ChangeUsername(params) -> PATCH /users/@me/username
	RouteChangeUsername = func() Route { return Route{"PATCH", "/users/@me/username"} }
	// API.FetchDefaultAvatar(user) -> GET /users/{user}/default_avatar
	RouteFetchDefaultAvatar = func(user ULID) Route {
		return Route{"GET", "/users/" + user.EncodeFP() + "/default_avatar"}
	}
	// API.FetchUserProfile(user) -> GET /users/{user}/profile
	RouteFetchUserProfile = func(user ULID) Route {
		return Route{"GET", "/users/" + user.EncodeFP() + "/profile"}
	}
	// API.FetchDirectMessageChannels() -> GET /users/dms
	RouteFetchDirectMessageChannels = func() Route {
		return Route{"GET", "/users/dms"}
	}
	// API.OpenDirectMessage(user) -> GET /users/{user}/dm
	RouteOpenDirectMessage = func(user ULID) Route {
		return Route{"GET", "/users/" + user.EncodeFP() + "/dm"}
	}
	// API.FetchMutualFriendsAndServers(user) -> GET /users/{user}/mutual
	RouteFetchMutualFriendsAndServers = func(user ULID) Route {
		return Route{"GET", "/users/" + user.EncodeFP() + "/mutual"}
	}
	// API.AcceptFriendRequest(user) -> PUT /users/{user}/friend
	RouteAcceptFriendRequest = func(user ULID) Route {
		return Route{"PUT", "/users/" + user.EncodeFP() + "/friend"}
	}
	// API.DenyFriendRequest(user) -> DELETE /users/{user}/friend
	RouteDenyFriendRequest = func(user ULID) Route {
		return Route{"DELETE", "/users/" + user.EncodeFP() + "/friend"}
	}
	// API.RemoveFriend(user) -> DELETE /users/{user}/friend
	RouteRemoveFriend = func(user ULID) Route {
		return Route{"DELETE", "/users/" + user.EncodeFP() + "/friend"}
	}
	// API.BlockUser(user) -> PUT /users/{user}/block
	RouteBlockUser = func(user ULID) Route {
		return Route{"PUT", "/users/" + user.EncodeFP() + "/block"}
	}
	// API.UnblockUser(user) -> DELETE /users/{user}/block
	RouteUnblockUser = func(user ULID) Route {
		return Route{"DELETE", "/users/" + user.EncodeFP() + "/block"}
	}
	// API.SendFriendRequest(username) -> POST /users/friend
	RouteSendFriendRequest = func() Route {
		return Route{"POST", "/users/friend"}
	}
	// API.CreateBot(name) -> POST /bots/create
	RouteCreateBot = func() Route {
		return Route{"POST", "/bots/create"}
	}
	// API.FetchPublicBot(bot) -> GET /bots/{bot}/invite
	RouteFetchPublicBot = func(bot ULID) Route {
		return Route{"GET", "/bots/" + bot.EncodeFP() + "/invite"}
	}
	// API.InviteBot(bot, params) -> POST /bots/{bot}/invite
	RouteInviteBot = func(bot ULID) Route {
		return Route{"POST", "/bots/" + bot.EncodeFP() + "/invite"}
	}
	// API.FetchBot(bot) -> GET /bots/{bot}
	RouteFetchBot = func(bot ULID) Route {
		return Route{"GET", "/bots/" + bot.EncodeFP()}
	}
	// API.FetchOwnedBots() -> GET /bots/@me
	RouteFetchOwnedBots = func() Route {
		return Route{"GET", "/bots/@me"}
	}
	// API.DeleteBot(bot) -> DELETE /bots/{bot}
	RouteDeleteBot = func(bot ULID) Route {
		return Route{"DELETE", "/bots/" + bot.EncodeFP()}
	}
	// API.EditBot(bot, params) -> PATCH /bots/{bot}
	RouteEditBot = func(bot ULID) Route {
		return Route{"PATCH", "/bots/" + bot.EncodeFP()}
	}
	// API.FetchChannel(channel) -> GET /channels/{channel}
	RouteFetchChannel = func(channel ULID) Route {
		return Route{"GET", "/channels/" + channel.EncodeFP()}
	}
	// API.CloseChannel(channel) -> DELETE /channels/{channel}
	RouteCloseChannel = func(channel ULID) Route {
		return Route{"DELETE", "/channels/" + channel.EncodeFP()}
	}
	// API.EditChannel(channel, params) -> PATCH /channels/{channel}
	RouteEditChannel = func(channel ULID) Route {
		return Route{"PATCH", "/channels/" + channel.EncodeFP()}
	}
	// API.CreateInvite(channel) -> POST /channels/{channel}/invites
	RouteCreateInvite = func(channel ULID) Route {
		return Route{"POST", "/channels/" + channel.EncodeFP() + "/invites"}
	}
	// API.SetRoleChannelPermission(channel, role, allow, deny) -> PUT /channels/{channel}/permissions/{role}
	RouteSetRoleChannelPermission = func(channel, role ULID) Route {
		return Route{"PUT", "/channels/" + channel.EncodeFP() + "/permissions/" + role.EncodeFP()}
	}
	// API.SetDefaultChannelPermission(channel, allow, deny) -> PUT /channels/{channel}/permissions/default
	RouteSetDefaultChannelPermission = func(channel ULID) Route {
		return Route{"PUT", "/channels/" + channel.EncodeFP() + "/permissions/default"}
	}
	// API.AcknowledgeMessage(channel, message) -> PUT /channels/{channel}/ack/{message}
	RouteAcknowledgeMessage = func(channel, message ULID) Route {
		return Route{"PUT", "/channels/" + channel.EncodeFP() + "/ack/" + message.EncodeFP()}
	}
	// API.FetchMessages(channel, params) -> GET /channels/{channel}/messages
	RouteFetchMessages = func(channel ULID) Route {
		return Route{"GET", "/channels/" + channel.EncodeFP() + "/messages"}
	}
	// API.SendMessage(channel, params) -> POST /channels/{channel}/messages
	RouteSendMessage = func(channel ULID) Route {
		return Route{"POST", "/channels/" + channel.EncodeFP() + "/messages"}
	}
	// API.SearchForMessages(channel) -> POST /channels/{channel}/search
	RouteSearchForMessages = func(channel ULID) Route {
		return Route{"POST", "/channels/" + channel.EncodeFP() + "/search"}
	}
	// API.FetchMessage(channel, message) -> GET /channels/{channel}/messages/{message}
	RouteFetchMessage = func(channel, message ULID) Route {
		return Route{"GET", "/channels/" + channel.EncodeFP() + "/messages/" + message.EncodeFP()}
	}
	// API.DeleteMessage(channel, message) -> DELETE /channels/{channel}/messages/{message}
	RouteDeleteMessage = func(channel, message ULID) Route {
		return Route{"DELETE", "/channels/" + channel.EncodeFP() + "/messages/" + message.EncodeFP()}
	}
	// API.EditMessage(channel, message, params) -> PATCH /channels/{channel}/messages/{message}
	RouteEditMessage = func(channel, message ULID) Route {
		return Route{"PATCH", "/channels/" + channel.EncodeFP() + "/messages/" + message.EncodeFP()}
	}
	// API.BulkDeleteMessages(channel, ids) -> DELETE /channels/{channel}/messages/bulk
	RouteBulkDeleteMessages = func(channel ULID) Route {
		return Route{"DELETE", "/channels/" + channel.EncodeFP() + "/messages/bulk"}
	}
	// API.AddReactionToMessage(channel, message, emoji) -> PUT /channels/{channel}/messages/{message}/reactions/{emoji}
	RouteAddReactionToMessage = func(channel, message ULID, emoji Emoji) Route {
		return Route{"PUT", "/channels/" + channel.EncodeFP() + "/messages/" + message.EncodeFP() + "/reactions/" + emoji.EncodeFP()}
	}
	// API.RemoveReactionsFromMessage(channel, message, emoji) -> DELETE /channels/{channel}/messages/{message}/reactions/{emoji}
	RouteRemoveReactionsFromMessage = func(channel, message ULID, emoji Emoji) Route {
		return Route{"DELETE", "/channels/" + channel.EncodeFP() + "/messages/" + message.EncodeFP() + "/reactions/" + emoji.EncodeFP()}
	}
	// API.RemoveAllReactionsFromMessage(channel, message) -> DELETE /channels/{channel}/messages/{message}/reactions
	RouteRemoveAllReactionsFromMessage = func(channel, message ULID) Route {
		return Route{"DELETE", "/channels/" + channel.EncodeFP() + "/messages/" + message.EncodeFP() + "/reactions"}
	}
	// API.FetchGroupMembers(channel) -> GET /channels/{channel}/members
	RouteFetchGroupMembers = func(channel ULID) Route {
		return Route{"GET", "/channels/" + channel.EncodeFP() + "/members"}
	}
	// API.CreateGroup(params) -> POST /channels/create
	RouteCreateGroup = func() Route {
		return Route{"POST", "/channels/create"}
	}
	// API.AddMemberToGroup(channel, member) -> PUT /channels/{channel}/recipients/{member}
	RouteAddMemberToGroup = func(channel, member ULID) Route {
		return Route{"PUT", "/channels/" + channel.EncodeFP() + "/recipients/" + member.EncodeFP()}
	}
	// API.RemoveMemberFromGroup(channel, member) -> DELETE /channels/{channel}/recipients/{member}
	RouteRemoveMemberFromGroup = func(channel, member ULID) Route {
		return Route{"DELETE", "/channels/" + channel.EncodeFP() + "/recipients/" + member.EncodeFP()}
	}
	// API.JoinCall(channel) -> POST /channels/{channel}/join_call
	RouteJoinCall = func(channel ULID) Route {
		return Route{"POST", "/channels/" + channel.EncodeFP() + "/join_call"}
	}
	// API.CreateWebhook(channel, name, avatar) -> POST /channels/{channel}/webhooks
	RouteCreateWebhook = func(channel ULID) Route {
		return Route{"POST", "/channels/" + channel.EncodeFP() + "/webhooks"}
	}
	// API.DeleteWebhook(webhook, "") -> DELETE /webhooks/{webhook}
	RouteDeleteWebhook = func(webhook ULID) Route {
		return Route{"DELETE", "/webhooks/" + webhook.EncodeFP()}
	}
	// API.DeleteWebhook(webhook, token) -> DELETE /webhooks/{webhook}/{token}
	RouteDeleteWebhookWithToken = func(webhook ULID, token string) Route {
		return Route{"DELETE", "/webhooks/" + webhook.EncodeFP() + "/" + url.PathEscape(token)}
	}
	// API.EditWebhook(webhook, "", params) -> PATCH /webhooks/{webhook}
	RouteEditWebhook = func(webhook ULID) Route {
		return Route{"PATCH", "/webhooks/" + webhook.EncodeFP()}
	}
	// API.EditWebhook(webhook, token, params) -> PATCH /webhooks/{webhook}/{token}
	RouteEditWebhookWithToken = func(webhook ULID, token string) Route {
		return Route{"PATCH", "/webhooks/" + webhook.EncodeFP() + "/" + url.PathEscape(token)}
	}
	// API.ExecuteWebhook(webhook, token, params) -> POST /webhooks/{webhook}/{token}
	RouteExecuteWebhook = func(webhook ULID, token string) Route {
		return Route{"POST", "/webhooks/" + webhook.EncodeFP() + "/" + url.PathEscape(token)}
	}
	// API.FetchWebhook(webhook, "") -> GET /webhooks/{webhook}
	RouteFetchWebhook = func(webhook ULID) Route {
		return Route{"GET", "/webhooks/" + webhook.EncodeFP()}
	}
	// API.FetchWebhook(webhook, token) -> GET /webhooks/{webhook}/{token}
	RouteFetchWebhookWithToken = func(webhook ULID, token string) Route {
		return Route{"GET", "/webhooks/" + webhook.EncodeFP() + "/" + url.PathEscape(token)}
	}
	// API.FetchChannelWebhooks(channel) -> GET /channels/{channel}/webhooks
	RouteFetchChannelWebhooks = func(channel ULID) Route {
		return Route{"GET", "/channels/" + channel.EncodeFP() + "/webhooks"}
	}
	// API.CreateServer(params) -> POST /servers/create
	RouteCreateServer = func() Route {
		return Route{"POST", "/servers/create"}
	}
	// API.FetchServer(server) -> GET /servers/{server}
	RouteFetchServer = func(server ULID) Route {
		return Route{"GET", "/servers/" + server.EncodeFP()}
	}
	// API.DeleteServer(server) -> DELETE /servers/{server}
	RouteDeleteServer = func(server ULID) Route {
		return Route{"DELETE", "/servers/" + server.EncodeFP()}
	}
	// API.LeaveServer(server) -> DELETE /servers/{server}
	RouteLeaveServer = func(server ULID) Route {
		return Route{"DELETE", "/servers/" + server.EncodeFP()}
	}
	// API.EditServer(server, params) -> PATCH /servers/{server}
	RouteEditServer = func(server ULID) Route {
		return Route{"PATCH", "/servers/" + server.EncodeFP()}
	}
	// API.MarkServerAsRead(server) -> PUT /servers/{server}/ack
	RouteMarkServerAsRead = func(server ULID) Route {
		return Route{"PUT", "/servers/" + server.EncodeFP() + "/ack"}
	}
	// API.CreateChannel(server, params) -> POST /servers/{server}/channels
	RouteCreateChannel = func(server ULID) Route {
		return Route{"POST", "/servers/" + server.EncodeFP() + "/channels"}
	}
	// API.FetchMembers(server, params) -> GET /servers/{server}/members
	RouteFetchMembers = func(server ULID) Route {
		return Route{"GET", "/servers/" + server.EncodeFP() + "/members"}
	}
	// API.FetchMember(server, member) -> GET /servers/{server}/members/{member}
	RouteFetchMember = func(server ULID, member ULID) Route {
		return Route{"GET", "/servers/" + server.EncodeFP() + "/members/" + member.EncodeFP()}
	}
	// API.KickMember(server, member) -> DELETE /servers/{server}/members/{member}
	RouteKickMember = func(server ULID, member ULID) Route {
		return Route{"DELETE", "/servers/" + server.EncodeFP() + "/members/" + member.EncodeFP()}
	}
	// API.EditMember(server, member, params) -> PATCH /servers/{server}/members/{member}
	RouteEditMember = func(server ULID, member ULID) Route {
		return Route{"PATCH", "/servers/" + server.EncodeFP() + "/members/" + member.EncodeFP()}
	}
	// API.QueryMembersByName(server, query) -> GET /servers/{server}/members_experimental_query
	RouteQueryMembersByName = func(server ULID) Route {
		return Route{"GET", "/servers/" + server.EncodeFP() + "/members_experimental_query"}
	}
	// API.BanUser(server, user, reason) -> PUT /servers/{server}/bans/{user}
	RouteBanUser = func(server ULID, user ULID) Route {
		return Route{"PUT", "/servers/" + server.EncodeFP() + "/bans/" + user.EncodeFP()}
	}
	// API.UnbanUser(server, user) -> DELETE /servers/{server}/bans/{user}
	RouteUnbanUser = func(server ULID, user ULID) Route {
		return Route{"DELETE", "/servers/" + server.EncodeFP() + "/bans/" + user.EncodeFP()}
	}
	// API.FetchBans(server) -> GET /servers/{server}/bans
	RouteFetchBans = func(server ULID) Route {
		return Route{"GET", "/servers/" + server.EncodeFP() + "/bans"}
	}
	// API.FetchInvites(server) -> GET /servers/{server}/invites
	RouteFetchInvites = func(server ULID) Route {
		return Route{"GET", "/servers/" + server.EncodeFP() + "/invites"}
	}
	// API.CreateRole(server, params) -> POST /servers/{server}/roles
	RouteCreateRole = func(server ULID) Route {
		return Route{"POST", "/servers/" + server.EncodeFP() + "/roles"}
	}
	// API.DeleteRole(server, role) -> DELETE /servers/{server}/roles/{role}
	RouteDeleteRole = func(server ULID, role ULID) Route {
		return Route{"DELETE", "/servers/" + server.EncodeFP() + "/roles/" + role.EncodeFP()}
	}
	// API.EditRole(server, role) -> PATCH /servers/{server}/roles/{role}
	RouteEditRole = func(server ULID, role ULID) Route {
		return Route{"PATCH", "/servers/" + server.EncodeFP() + "/roles/" + role.EncodeFP()}
	}
	// API.SetRoleServerPermission(server, role, allow, deny) -> PUT /servers/{server}/permissions/{role}
	RouteSetRoleServerPermission = func(server ULID, role ULID) Route {
		return Route{"PUT", "/servers/" + server.EncodeFP() + "/permissions/" + role.EncodeFP()}
	}
	// API.SetDefaultServerPermission(server,, allow, deny) -> PUT /servers/{server}/permissions/default
	RouteSetDefaultServerPermission = func(server ULID) Route {
		return Route{"PUT", "/servers/" + server.EncodeFP() + "/permissions/default"}
	}
	// API.FetchInvite(invite) -> GET /invites/{invite}
	RouteFetchInvite = func(invite string) Route {
		return Route{"GET", "/invites/" + url.PathEscape(invite)}
	}
	// API.JoinInvite(invite) -> POST /invites/{invite}
	RouteJoinInvite = func(invite string) Route {
		return Route{"POST", "/invites/" + url.PathEscape(invite)}
	}
	// API.DeleteInvite(invite) -> DELETE /invites/{invite}
	RouteDeleteInvite = func(invite string) Route {
		return Route{"DELETE", "/invites/" + url.PathEscape(invite)}
	}
	// API.FetchEmoji(emoji) -> GET /custom/emoji/{emoji}
	RouteFetchEmoji = func(emoji ULID) Route {
		return Route{"GET", "/custom/emoji/" + emoji.EncodeFP()}
	}
	// API.FetchEmoji(id) -> PUT /custom/emoji/{id}
	RouteCreateEmoji = func(id string) Route {
		return Route{"PUT", "/custom/emoji/" + url.PathEscape(id)}
	}
	// API.DeleteEmoji(emoji) -> DELETE /custom/emoji/{emoji}
	RouteDeleteEmoji = func(emoji ULID) Route {
		return Route{"DELETE", "/custom/emoji/" + emoji.EncodeFP()}
	}
	// API.FetchServerEmojis(server) -> GET /servers/{server}/emojis
	RouteFetchServerEmojis = func(server ULID) Route {
		return Route{"GET", "/servers/" + server.EncodeFP() + "/emojis"}
	}
	RouteQueryStats = func() Route {
		return Route{"GET", "/admin/stats"}
	}
	RouteGloballyFetchMessages = func() Route {
		return Route{"POST", "/admin/messages"}
	}
	// API.EditReport(report, params) -> PATCH /safety/reports/{report}
	RouteEditReport = func(report ULID) Route {
		return Route{"PATCH", "/safety/reports/" + report.EncodeFP()}
	}
	// API.FetchReport(report) -> GET /safety/reports/{report}
	RouteFetchReport = func(report ULID) Route {
		return Route{"GET", "/safety/reports/" + report.EncodeFP()}
	}
	// API.FetchReports() -> GET /safety/reports
	RouteFetchReports = func() Route {
		return Route{"GET", "/safety/reports"}
	}
	// API.ReportContent(content, additionalContext) -> POST /safety/report
	RouteReportContent = func() Route {
		return Route{"POST", "/safety/report"}
	}
	// API.FetchSnapshots(report) -> GET /safety/snapshot/{report}
	RouteFetchSnapshots = func(report ULID) Route {
		return Route{"GET", "/safety/snapshot/" + report.EncodeFP()}
	}
	// API.CreateStrike(user, reason) -> POST /safety/strikes
	RouteCreateStrike = func() Route {
		return Route{"POST", "/safety/strikes"}
	}
	// API.FetchStrikes(user) -> GET /safety/strikes/{user}
	RouteFetchStrikes = func(user ULID) Route {
		return Route{"GET", "/safety/strikes/" + user.EncodeFP()}
	}
	// API.EditStrike(strike, params) -> POST /safety/strikes/{strike}
	RouteEditStrike = func(strike ULID) Route {
		return Route{"POST", "/safety/strikes/" + strike.EncodeFP()}
	}
	// API.DeleteStrike(strike) -> DELETE /safety/strikes/{strike}
	RouteDeleteStrike = func(strike ULID) Route {
		return Route{"DELETE", "/safety/strikes/" + strike.EncodeFP()}
	}
	// API.CreateAccount(params) -> POST /auth/account/create
	RouteCreateAccount = func() Route {
		return Route{"POST", "/auth/account/create"}
	}
	// API.ResendVerification(email, captcha) -> POST /auth/account/reverify
	RouteResendVerification = func() Route {
		return Route{"POST", "/auth/account/reverify"}
	}
	// API.ConfirmAccountDeletion(token) -> PUT /auth/account/delete
	RouteConfirmAccountDeletion = func() Route {
		return Route{"PUT", "/auth/account/delete"}
	}
	// API.DeleteAccount() -> POST /auth/account/delete
	RouteDeleteAccount = func() Route {
		return Route{"POST", "/auth/account/delete"}
	}
	// API.FetchAccount() -> GET /auth/account
	RouteFetchAccount = func() Route {
		return Route{"GET", "/auth/account/"}
	}
	// API.DisableAccount() -> POST /auth/account/disable
	RouteDisableAccount = func() Route {
		return Route{"POST", "/auth/account/disable"}
	}
	// API.ChangePassword(password, currentPassword) -> PATCH /auth/account/change/password
	RouteChangePassword = func() Route {
		return Route{"PATCH", "/auth/account/change/password"}
	}
	// API.ChangeEmail(email, currentPassword) -> PATCH /auth/account/change/email
	RouteChangeEmail = func() Route {
		return Route{"PATCH", "/auth/account/change/email"}
	}
	// API.VerifyEmail(code) -> POST /auth/account/verify/{code}
	RouteVerifyEmail = func(code string) Route {
		return Route{"POST", "/auth/account/verify/" + url.PathEscape(code)}
	}
	// API.SendPasswordReset(email, captcha) -> POST /auth/account/reset_password
	RouteSendPasswordReset = func() Route {
		return Route{"POST", "/auth/account/reset_password"}
	}
	// API.PasswordReset(token, password, removeSessions) -> PATCH /auth/account/reset_password
	RoutePasswordReset = func() Route {
		return Route{"PATCH", "/auth/account/reset_password"}
	}
	// API.Login(params) -> POST /auth/session/login
	RouteLogin = func() Route {
		return Route{"POST", "/auth/session/login"}
	}
	// API.Logout() -> POST /auth/session/logout
	RouteLogout = func() Route {
		return Route{"POST", "/auth/session/logout"}
	}
	// API.FetchSessions() -> GET /auth/session/all
	RouteFetchSessions = func() Route {
		return Route{"GET", "/auth/session/all"}
	}
	// API.DeleteAllSessions(revokeSelf) -> DELETE /auth/session/all
	RouteDeleteAllSessions = func() Route {
		return Route{"DELETE", "/auth/session/all"}
	}
	// API.RevokeSession(session) -> DELETE /auth/session/{id}
	RouteRevokeSession = func(id string) Route {
		return Route{"DELETE", "/auth/session/" + url.PathEscape(id)}
	}
	// API.EditSession(session, friendlyName) -> PATCH /auth/session/{id}
	RouteEditSession = func(id string) Route {
		return Route{"PATCH", "/auth/session/" + url.PathEscape(id)}
	}
	// API.CheckOnboardingStatus() -> GET /onboard/hello
	RouteCheckOnboardingStatus = func() Route {
		return Route{"GET", "/onboard/hello"}
	}
	// API.CompleteOnboarding(username) -> POST /onboard/complete
	RouteCompleteOnboarding = func() Route {
		return Route{"POST", "/onboard/complete"}
	}
	// API.CreateMFATicket(params) -> PUT /auth/mfa/ticket
	RouteCreateMFATicket = func() Route {
		return Route{"PUT", "/auth/mfa/ticket"}
	}
	// API.FetchMFAStatus() -> GET /auth/mfa/
	RouteFetchMFAStatus = func() Route {
		return Route{"GET", "/auth/mfa/"}
	}
	// API.FetchRecoveryCodes() -> POST /auth/mfa/recovery
	RouteFetchRecoveryCodes = func() Route {
		return Route{"POST", "/auth/mfa/recovery"}
	}
	// `API.GenerateRecoveryCodes()` -> `DELETE /auth/mfa/recovery`
	RouteGenerateRecoveryCodes = func() Route {
		return Route{"PATCH", "/auth/mfa/recovery"}
	}
	// API.GetMFAMethods() -> GET /auth/mfa/methods
	RouteGetMFAMethods = func() Route {
		return Route{"GET", "/auth/mfa/methods"}
	}
	// API.EnableTOTP2FA(params) -> PUT /auth/mfa/totp
	RouteEnableTOTP2FA = func() Route {
		return Route{"PUT", "/auth/mfa/totp"}
	}
	// API.GenerateTOTPSecre() -> POST /auth/mfa/totp
	RouteGenerateTOTPSecret = func() Route {
		return Route{"POST", "/auth/mfa/totp"}
	}
	// API.DisableTOTP2FA() -> DELETE /auth/mfa/totp
	RouteDisableTOTP2FA = func() Route {
		return Route{"DELETE", "/auth/mfa/totp"}
	}
	RouteFetchSettings = func() Route {
		return Route{"POST", "/sync/settings/fetch"}
	}

	RouteSetSettings = func() Route {
		return Route{"POST", "/sync/settings/set"}
	}
	// API.FetchUnreads() -> GET /sync/unreads
	RouteFetchUnreads = func() Route {
		return Route{"GET", "/sync/unreads"}
	}
	// API.PushSubscribe() -> POST /push/subscribe
	RoutePushSubscribe = func() Route {
		return Route{"POST", "/push/subscribe"}
	}
	// API.Unsubscribe() -> POST /push/unsubscribe
	RouteUnsubscribe = func() Route {
		return Route{"POST", "/push/unsubscribe"}
	}
)
View Source
var (
	AutumnRouteFetchConfig = func() Route {
		return Route{"GET", "/"}
	}
	AutumnRouteUpload = func(tag string) Route {
		return Route{"POST", "/" + url.PathEscape(tag)}
	}
	AutumnRouteGet = func(tag, id string) Route {
		return Route{"GET", "/" + url.PathEscape(tag) + "/" + url.PathEscape(id)}
	}
)

Functions

func P

func P[T any](t T) *T

Types

type API

type API struct {
	Token      *Token
	HTTPClient HTTPClient
	URL        *url.URL
	Arshaler   JSONArshaler
}

func NewAPI

func NewAPI(token *Token, config *APIConfig) (api *API, err error)

func (*API) AcceptFriendRequest

func (api *API) AcceptFriendRequest(user ULID) (u *User, err error)

Accept another user's friend request. https://developers.revolt.chat/api/#tag/Relationships/operation/add_friend_req

func (*API) AcknowledgeMessage

func (api *API) AcknowledgeMessage(channel, message ULID) error

Lets the server and all other clients know that we've seen this message in this channel. https://developers.revolt.chat/api/#tag/Messaging/operation/channel_ack_req

func (*API) AddMemberToGroup

func (api *API) AddMemberToGroup(channel, member ULID) error

Adds another user to the group. https://developers.revolt.chat/api/#tag/Groups/operation/group_add_member_req

func (*API) AddReactionToMessage

func (api *API) AddReactionToMessage(channel, message ULID, emoji Emoji) error

React to a given message. https://developers.revolt.chat/api/#tag/Interactions/operation/message_react_react_message

func (*API) BanUser

func (api *API) BanUser(server, user ULID, reason string) (b *Ban, err error)

Ban a user by their ID. https://developers.revolt.chat/api/#tag/Server-Members/operation/ban_create_req

func (*API) BlockUser

func (api *API) BlockUser(user ULID) (u *User, err error)

Block another user by their ID. https://developers.revolt.chat/api/#tag/Relationships/operation/block_user_req

func (*API) BulkDeleteMessages

func (api *API) BulkDeleteMessages(channel ULID, ids []ULID) error

Delete multiple messages you've sent or one you have permission to delete. This will always require `ManageMessages` permission regardless of whether you own the message or not. Messages must have been sent within the past 1 week. ids [required] - Message IDs https://developers.revolt.chat/api/#tag/Messaging/operation/message_bulk_delete_req

func (*API) ChangeEmail

func (api *API) ChangeEmail(email, currentPassword string) error

Change the associated account email. email - Valid email address currentPassword - Current password https://developers.revolt.chat/api/#tag/Account/operation/change_email_change_email

func (*API) ChangePassword

func (api *API) ChangePassword(password, currentPassword string) error

Change the current account password. password - New password currentPassword - Current password https://developers.revolt.chat/api/#tag/Account/operation/change_password_change_password

func (*API) ChangeUsername

func (api *API) ChangeUsername(params *ChangeUsername) (u *User, err error)

Change your username. https://developers.revolt.chat/api/#tag/User-Information/operation/change_username_req

func (*API) CheckOnboardingStatus

func (api *API) CheckOnboardingStatus() (onboarding bool, err error)

This will tell you whether the current account requires onboarding or whether you can continue to send requests as usual. You may skip calling this if you're restoring an existing session. Return value - Whether onboarding is required https://developers.revolt.chat/api/#tag/Onboarding/operation/hello_req

func (*API) CloseChannel

func (api *API) CloseChannel(channel ULID, leaveSilently *bool) error

Deletes a server channel, leaves a group or closes a group. https://developers.revolt.chat/api/#tag/Channel-Information/operation/channel_delete_req

func (*API) CompleteOnboarding

func (api *API) CompleteOnboarding(username string) error

This sets a new username, completes onboarding and allows a user to start using Revolt. username [required] - New username which will be used to identify the user on the platform https://developers.revolt.chat/api/#tag/Onboarding/operation/complete_req

func (*API) ConfirmAccountDeletion

func (api *API) ConfirmAccountDeletion(token string) error

Schedule an account for deletion by confirming the received token. https://developers.revolt.chat/api/#tag/Account/operation/confirm_deletion_confirm_deletion

func (*API) CreateBot

func (api *API) CreateBot(name string) (b *Bot, err error)

Create a new Revolt bot. name [required] - Bot username https://developers.revolt.chat/api/#tag/Bots/operation/create_create_bot

func (*API) CreateChannel

func (api *API) CreateChannel(server ULID, params *CreateChannel) (c *Channel, err error)

Create a new Text or Voice channel. https://developers.revolt.chat/api/#tag/Server-Information/operation/channel_create_req

func (*API) CreateEmoji

func (api *API) CreateEmoji(emoji string, params *CreateEmoji) (ce *CustomEmoji, err error)

Create an emoji by its Autumn upload ID. https://developers.revolt.chat/api/#tag/Emojis/operation/emoji_create_create_emoji

func (*API) CreateGroup

func (api *API) CreateGroup(params *CreateGroup) (c *Channel, err error)

Create a new group channel. https://developers.revolt.chat/api/#tag/Groups/operation/group_create_req

func (*API) CreateInvite

func (api *API) CreateInvite(channel ULID) (i *Invite, err error)

Creates an invite to this channel. Channel must be a `TextChannel`. https://developers.revolt.chat/api/#tag/Channel-Invites/operation/invite_create_req

func (*API) CreateMFATicket

func (api *API) CreateMFATicket(params *MFAResponse) (t *MFATicket, err error)

Create a new MFA ticket or validate an existing one. https://developers.revolt.chat/api/#tag/MFA/operation/create_ticket_create_ticket

func (*API) CreateRole

func (api *API) CreateRole(server ULID, params *CreateRole) (rr *RoleResponse, err error)

Creates a new server role. https://developers.revolt.chat/api/#tag/Server-Permissions/operation/roles_create_req

func (*API) CreateStrike

func (api *API) CreateStrike(user ULID, reason string) (s *Strike, err error)

Create a new account strike user [required] - ID of reported user reason [required] - Attached reason https://developers.revolt.chat/api/#tag/User-Safety/operation/create_strike_create_strike

func (*API) CreateWebhook

func (api *API) CreateWebhook(channel ULID, name string, avatar string) (w *Webhook, err error)

Creates a webhook which 3rd party platforms can use to send messages. name [required] - The webhook name. avatar [optional, pass empty] - The webhook avatar. (Pass Autumn file ID) https://developers.revolt.chat/api/#tag/Webhooks/operation/webhook_create_req

func (*API) DeleteAccount

func (api *API) DeleteAccount() error

Request to have an account deleted. https://developers.revolt.chat/api/#tag/Account/operation/delete_account_delete_account

func (*API) DeleteAllSessions

func (api *API) DeleteAllSessions(revokeSelf bool) error

Delete all active sessions, optionally including current one. https://developers.revolt.chat/api/#tag/Session/operation/revoke_all_revoke_all

func (*API) DeleteBot

func (api *API) DeleteBot(bot ULID) error

Delete a bot by its ID. https://developers.revolt.chat/api/#tag/Bots/operation/delete_delete_bot

func (*API) DeleteEmoji

func (api *API) DeleteEmoji(emoji ULID) error

Delete an emoji by its ID. https://developers.revolt.chat/api/#tag/Emojis/operation/emoji_delete_delete_emoji

func (*API) DeleteInvite

func (api *API) DeleteInvite(invite string) error

Delete an invite by its ID. https://developers.revolt.chat/api/#tag/Invites/operation/invite_delete_req

func (*API) DeleteMessage

func (api *API) DeleteMessage(channel, message ULID) error

Delete a message you've sent or one you have permission to delete. https://developers.revolt.chat/api/#tag/Messaging/operation/message_delete_req

func (*API) DeleteRole

func (api *API) DeleteRole(server, role ULID) error

Delete a server role by its ID. https://developers.revolt.chat/api/#tag/Server-Permissions/operation/roles_delete_req

func (*API) DeleteServer

func (api *API) DeleteServer(server ULID) (err error)

Deletes a server if owner. https://developers.revolt.chat/api/#tag/Server-Information/operation/server_delete_req

func (*API) DeleteStrike

func (api *API) DeleteStrike(strike ULID) error

Delete a strike by its ID. https://developers.revolt.chat/api/#tag/User-Safety/operation/delete_strike_delete_strike

func (*API) DeleteWebhook

func (api *API) DeleteWebhook(webhookID ULID, webhookToken string) error

Deletes a webhook [with a token]. webhook [required] - The webhook ID webhookToken [optional, pass empty] - The webhook private token.

func (*API) DenyFriendRequest

func (api *API) DenyFriendRequest(user ULID) (u *User, err error)

Denies another user's friend request. https://developers.revolt.chat/api/#tag/Relationships/operation/remove_friend_req

func (*API) DisableTOTP2FA

func (api *API) DisableTOTP2FA() error

Disable TOTP 2FA for an account. https://developers.revolt.chat/api/#tag/MFA/operation/totp_disable_totp_disable

func (*API) EditBot

func (api *API) EditBot(bot ULID, params EditBot) (b *Bot, err error)

Edit bot details by its ID. https://developers.revolt.chat/api/#tag/Bots/operation/edit_edit_bot

func (*API) EditChannel

func (api *API) EditChannel(channel ULID, params *EditChannel) (c *Channel, err error)

Edit a channel object by its id. https://developers.revolt.chat/api/#tag/Channel-Information/operation/channel_edit_req

func (*API) EditMember

func (api *API) EditMember(server, member ULID, params *EditMember) (m *Member, err error)

Edit a member by their ID. https://developers.revolt.chat/api/#tag/Server-Members/operation/member_edit_req

func (*API) EditMessage

func (api *API) EditMessage(channel, message ULID, params *EditMessage) (m *Message, err error)

Edits a message that you've previously sent. https://developers.revolt.chat/api/#tag/Messaging/operation/message_edit_req

func (*API) EditReport

func (api *API) EditReport(report ULID, params *EditReport) (r *Report, err error)

Edit a report. https://developers.revolt.chat/api/#tag/User-Safety/operation/edit_report_edit_report

func (*API) EditRole

func (api *API) EditRole(server, role ULID, params *EditRole) (r *Role, err error)

Edit a role by its ID. https://developers.revolt.chat/api/#tag/Server-Permissions/operation/roles_edit_req

func (*API) EditServer

func (api *API) EditServer(server ULID, params *EditServer) (s *Server, err error)

Edit a server by its ID. https://developers.revolt.chat/api/#tag/Server-Information/operation/server_edit_req

func (*API) EditSession

func (api *API) EditSession(session, friendlyName string) (s *Session, err error)

Edit current session information. friendlyName [required] - Session friendly name https://developers.revolt.chat/api/#tag/Session/operation/edit_edit

func (*API) EditStrike

func (api *API) EditStrike(strike ULID, params *EditStrike) error

Edit a strike by its ID. https://developers.revolt.chat/api/#tag/User-Safety/operation/edit_strike_edit_strike

func (*API) EditUser

func (api *API) EditUser(user ULID, params EditUser) (u *User, err error)

Edit currently authenticated user. https://developers.revolt.chat/api/#tag/User-Information/operation/edit_user_req

func (*API) EditWebhook

func (api *API) EditWebhook(webhookID ULID, webhookToken string, params *EditWebhook) (w *Webhook, err error)

Edits a webhook [with a token]. webhook [required] - The webhook ID webhookToken [optional, pass empty] - The webhook private token. params [required] - What to change in webhook.

func (*API) EnableTOTP2FA

func (api *API) EnableTOTP2FA(params *MFAResponse) error

Generate a new secret for TOTP. https://developers.revolt.chat/api/#tag/MFA/operation/totp_enable_totp_enable

func (*API) ExecuteWebhook

func (api *API) ExecuteWebhook(webhook ULID, token string, params *SendMessage) (m *Message, err error)

Executes a webhook and sends a message. https://github.com/revoltchat/backend/blob/master/crates/delta/src/routes/webhooks/webhook_execute.rs (No OpenAPI docs)

func (*API) FetchAccount

func (api *API) FetchAccount() (a *Account, err error)

Fetch account information from the current session. https://developers.revolt.chat/api/#tag/Account/operation/fetch_account_fetch_account

func (*API) FetchBans

func (api *API) FetchBans(server ULID) (br *BansResponse, err error)

Fetch all bans on a server. https://developers.revolt.chat/api/#tag/Server-Members/operation/ban_list_req

func (*API) FetchBot

func (api *API) FetchBot(bot ULID) (b *Bot, u *User, err error)

Fetch details of a bot you own by its id. https://developers.revolt.chat/api/#tag/Bots/operation/fetch_fetch_bot

func (*API) FetchChannel

func (api *API) FetchChannel(channel ULID) (c *Channel, err error)

Fetch channel by its ID. https://developers.revolt.chat/api/#tag/Channel-Information/operation/channel_fetch_req

func (*API) FetchChannelWebhooks

func (api *API) FetchChannelWebhooks(channel ULID) (a []*Webhook, err error)

Fetches all webhooks inside the channel. https://developers.revolt.chat/api/#tag/Webhooks/operation/webhook_fetch_all_req

func (*API) FetchDefaultAvatar

func (api *API) FetchDefaultAvatar(user ULID) ([]byte, error)

This returns a default avatar based on the given id. https://developers.revolt.chat/api/#tag/User-Information/operation/get_default_avatar_req

func (*API) FetchDirectMessageChannels

func (api *API) FetchDirectMessageChannels() (a []*Channel, err error)

This fetches your direct messages, including any DM and group DM conversations. https://developers.revolt.chat/api/#tag/Direct-Messaging/operation/fetch_dms_req

func (*API) FetchEmoji

func (api *API) FetchEmoji(emoji ULID) (ce *CustomEmoji, err error)

Fetch an emoji by its ID. https://developers.revolt.chat/api/#tag/Emojis/operation/emoji_fetch_fetch_emoji

func (*API) FetchGroupMembers

func (api *API) FetchGroupMembers(channel ULID) (a []*User, err error)

Retrieves all users who are part of this group. https://developers.revolt.chat/api/#tag/Groups/operation/members_fetch_req

func (*API) FetchInvite

func (api *API) FetchInvite(invite string) (i *InviteResponse, err error)

Fetch an invite by its ID. https://developers.revolt.chat/api/#tag/Invites/operation/invite_fetch_req

func (*API) FetchInvites

func (api *API) FetchInvites(server ULID) (i []*Invite, err error)

Fetch all server invites. https://developers.revolt.chat/api/#tag/Server-Members/operation/invites_fetch_req

func (*API) FetchMFAStatus

func (api *API) FetchMFAStatus() (s *MFAStatus, err error)

Fetch MFA status of an account. https://developers.revolt.chat/api/#tag/MFA/operation/fetch_status_fetch_status

func (*API) FetchMember

func (api *API) FetchMember(server, member ULID) (m *Member, err error)

Retrieve a member. https://developers.revolt.chat/api/#tag/Server-Members/operation/member_fetch_req

func (*API) FetchMembers

func (api *API) FetchMembers(server ULID, params *FetchMembers) (fmr *FetchMembersResponse, err error)

Fetch all server members. https://developers.revolt.chat/api/#tag/Server-Members/operation/member_fetch_all_req

func (*API) FetchMessage

func (api *API) FetchMessage(channel, message ULID) (m *Message, err error)

Retrieves a message by its id. https://developers.revolt.chat/api/#tag/Messaging/operation/message_fetch_req

func (*API) FetchMessages

func (api *API) FetchMessages(channel ULID, params *FetchMessages) (m *Messages, err error)

Fetch multiple messages. https://developers.revolt.chat/api/#tag/Messaging/operation/message_query_req

func (*API) FetchMutualFriendsAndServers

func (api *API) FetchMutualFriendsAndServers(user ULID) (users []ULID, servers []ULID, err error)

Retrieve a list of mutual friends and servers with another user. https://developers.revolt.chat/api/#tag/Relationships/operation/find_mutual_req

func (*API) FetchOwnedBots

func (api *API) FetchOwnedBots() (b []*Bot, u []*User, err error)

Fetch all of the bots that you have control over. https://developers.revolt.chat/api/#tag/Bots/operation/fetch_owned_fetch_owned_bots

func (*API) FetchPublicBot

func (api *API) FetchPublicBot(bot ULID) (b *PublicBot, err error)

Fetch details of a public (or owned) bot by its id. https://developers.revolt.chat/api/#tag/Bots/operation/fetch_public_fetch_public_bot

func (*API) FetchRecoveryCodes

func (api *API) FetchRecoveryCodes() (a []string, err error)

Fetch recovery codes for an account. https://developers.revolt.chat/api/#tag/MFA/operation/fetch_recovery_fetch_recovery

func (*API) FetchReport

func (api *API) FetchReport(report ULID) (r *Report, err error)

Fetch a report by its ID. https://developers.revolt.chat/api/#tag/User-Safety/operation/fetch_report_fetch_report

func (*API) FetchReports

func (api *API) FetchReports(params *FetchReports) (a []*Report, err error)

Fetch all available reports. https://developers.revolt.chat/api/#tag/User-Safety/operation/fetch_reports_fetch_reports

func (*API) FetchSelf

func (api *API) FetchSelf() (u *User, err error)

Retrieve your user information. https://developers.revolt.chat/api/#tag/User-Information/operation/fetch_self_req

func (*API) FetchServer

func (api *API) FetchServer(server ULID) (s *Server, err error)

Fetch a server by its ID. https://developers.revolt.chat/api/#tag/Server-Information/operation/server_fetch_req

func (*API) FetchServerEmojis

func (api *API) FetchServerEmojis(server ULID) (a []*CustomEmoji, err error)

Fetch all emojis on a server.

func (*API) FetchSessions

func (api *API) FetchSessions() (s []*Session, err error)

Fetch all sessions associated with this account. https://developers.revolt.chat/api/#tag/Session/operation/fetch_all_fetch_all

func (*API) FetchSettings

func (api *API) FetchSettings(keys []string) (m map[string]*Setting, err error)

Fetch settings from server filtered by keys. This will return an object with the requested keys, each value is a `Setting` struct, the value is the previously uploaded data. keys [required] - Keys to fetch https://developers.revolt.chat/api/#tag/Sync/operation/get_settings_req

func (*API) FetchSnapshots

func (api *API) FetchSnapshots(report ULID) (a []*Snapshot, err error)

Fetch a snapshots for a given report. https://developers.revolt.chat/api/#tag/User-Safety/operation/fetch_snapshots_fetch_snapshots

func (*API) FetchStrikes

func (api *API) FetchStrikes(user ULID) (a []*Strike, err error)

Fetch strikes for a user by their ID https://developers.revolt.chat/api/#tag/User-Safety/operation/fetch_strikes_fetch_strikes

func (*API) FetchUnreads

func (api *API) FetchUnreads() (a []*UnreadMessage, err error)

Fetch information about unread state on channels. https://developers.revolt.chat/api/#tag/Sync/operation/get_unreads_req

func (*API) FetchUser

func (api *API) FetchUser(user ULID) (u *User, err error)

Retrieve a user's information. https://developers.revolt.chat/api/#tag/User-Information/operation/fetch_user_req

func (*API) FetchUserProfile

func (api *API) FetchUserProfile(user ULID) (p *UserProfile, err error)

Retrieve a user's profile data. Will fail if you do not have permission to access the other user's profile. https://developers.revolt.chat/api/#tag/User-Information/operation/fetch_profile_req

func (*API) FetchWebhook

func (api *API) FetchWebhook(webhookID ULID, webhookToken string) (w *Webhook, err error)

Fetches a webhook [with a token]. Requires valid API token if no webhook token passed. webhookID [required] - The webhook ID webhookToken [optional, pass empty] - The webhook private token.

func (*API) GenerateRecoveryCodes

func (api *API) GenerateRecoveryCodes() (a []string, err error)

Re-generate recovery codes for an account. https://developers.revolt.chat/api/#tag/MFA/operation/generate_recovery_generate_recovery

func (*API) GenerateTOTPSecret

func (api *API) GenerateTOTPSecret() (s string, err error)

Generate a new secret for TOTP. https://developers.revolt.chat/api/#tag/MFA/operation/totp_generate_secret_totp_generate_secret

func (*API) GetMFAMethods

func (api *API) GetMFAMethods() (a []MFAMethod, err error)

Fetch available MFA methods. https://developers.revolt.chat/api/#tag/MFA/operation/get_mfa_methods_get_mfa_methods

func (*API) GloballyFetchMessages

func (api *API) GloballyFetchMessages(params *GloballyFetchMessages) (m *Messages, err error)

This is a privileged route to globally fetch messages. https://developers.revolt.chat/api/#tag/Admin/operation/message_query_message_query

func (*API) InviteBot

func (api *API) InviteBot(bot ULID, params *InviteBot) error

Invite a bot to a server or group by its id. https://developers.revolt.chat/api/#tag/Bots/operation/invite_invite_bot

func (*API) JoinCall

func (api *API) JoinCall(channel ULID) (string, error)

Asks the voice server for a token to join the call. https://developers.revolt.chat/api/#tag/Voice/operation/voice_join_req

func (*API) JoinInvite

func (api *API) JoinInvite(invite string) (jir *JoinInviteResponse, err error)

Join an invite by its ID. https://developers.revolt.chat/api/#tag/Invites/operation/invite_join_req

func (*API) KickMember

func (api *API) KickMember(server, member ULID) error

Removes a member from the server. https://developers.revolt.chat/api/#tag/Server-Members/operation/member_remove_req

func (*API) LeaveServer

func (api *API) LeaveServer(server ULID, params *LeaveServer) (err error)

Leaves a server if not owner. https://developers.revolt.chat/api/#tag/Server-Information/operation/server_delete_req

func (*API) Login

func (api *API) Login(params *Login) (lr *LoginResponse, err error)

Login to an account. https://developers.revolt.chat/api/#tag/Session/operation/login_login

func (*API) Logout

func (api *API) Logout() error

Delete current session. https://developers.revolt.chat/api/#tag/Session/operation/logout_logout

func (*API) MarkServerAsRead

func (api *API) MarkServerAsRead(server ULID) (err error)

Mark all channels in a server as read. https://developers.revolt.chat/api/#tag/Server-Information/operation/server_ack_req

func (*API) OpenDirectMessage

func (api *API) OpenDirectMessage(user ULID) (c *Channel, err error)

Open a DM with another user. If the target is oneself, a saved messages channel is returned. https://developers.revolt.chat/api/#tag/Direct-Messaging/operation/open_dm_req

func (*API) PasswordReset

func (api *API) PasswordReset(token, password string, removeSessions bool) error

Confirm password reset and change the password. token [required] - Reset token password [required] - New password https://developers.revolt.chat/api/#tag/Account/operation/password_reset_password_reset

func (*API) PushSubscribe

func (api *API) PushSubscribe(params WebPushSubscription) error

Create a new Web Push subscription. If an existing subscription exists on this session, it will be removed. https://developers.revolt.chat/api/#tag/Web-Push/operation/subscribe_req

func (*API) QueryMembersByName

func (api *API) QueryMembersByName(server ULID, query string) (ma []*Member, mu []*User, err error)

Query members by a given name, this API is not stable and will be removed in the future. query [required] - String to search for https://developers.revolt.chat/api/#tag/Server-Members/operation/member_experimental_query_member_experimental_query

func (*API) QueryNode

func (api *API) QueryNode() (n *Node, err error)

Fetch the server configuration for this Revolt instance. https://developers.revolt.chat/api/#tag/Core/operation/root_root

func (*API) QueryStats

func (api *API) QueryStats() (st *InstanceStatistics, err error)

Fetch various technical statistics. https://developers.revolt.chat/api/#tag/Admin/operation/stats_stats

func (*API) RemoveAllReactionsFromMessage

func (api *API) RemoveAllReactionsFromMessage(channel, message ULID) error

Remove your own, someone else's or all of a given reaction. Requires `ManageMessages` permission. https://developers.revolt.chat/api/#tag/Interactions/operation/message_clear_reactions_clear_reactions

func (*API) RemoveFriend

func (api *API) RemoveFriend(user ULID) (u *User, err error)

Denies another user's friend request or removes an existing friend. https://developers.revolt.chat/api/#tag/Relationships/operation/remove_friend_req

func (*API) RemoveMemberFromGroup

func (api *API) RemoveMemberFromGroup(channel, member ULID) error

Removes a user from the group. https://developers.revolt.chat/api/#tag/Groups/operation/group_remove_member_req

func (*API) RemoveReactionsFromMessage

func (api *API) RemoveReactionsFromMessage(channel, message ULID, emoji Emoji) error

Remove your own, someone else's or all of a given reaction. Requires `ManageMessages` if changing others' reactions. https://developers.revolt.chat/api/#tag/Interactions/operation/message_unreact_unreact_message

func (*API) ReportContent

func (api *API) ReportContent(content *ReportContent, additionalContext string) error

Report a piece of content to the moderation team. content [required] - The content being reported. additionalContext [optional, pass empty] - Additional report description https://developers.revolt.chat/api/#tag/User-Safety/operation/report_content_report_content

func (*API) Request

func (api *API) Request(route Route, options *RequestOptions) (*http.Response, error)

func (*API) RequestJSON

func (api *API) RequestJSON(v any, route Route, options *RequestOptions) error

func (*API) RequestNone

func (api *API) RequestNone(route Route, options *RequestOptions) error

func (*API) ResendVerification

func (api *API) ResendVerification(email, captcha string) error

Resend account creation verification email. email [required] - Email associated with the account captcha [optional, pass empty] - Captcha verification code https://developers.revolt.chat/api/#tag/Account/operation/resend_verification_resend_verification

func (*API) RevokeSession

func (api *API) RevokeSession(session string) error

Delete a specific active session. https://developers.revolt.chat/api/#tag/Session/operation/revoke_revoke

func (*API) SearchForMessages

func (api *API) SearchForMessages(channel ULID, params *SearchForMessages) (m *Messages, err error)

This route searches for messages within the given parameters. https://developers.revolt.chat/api/#tag/Messaging/operation/message_search_req

func (*API) SendFriendRequest

func (api *API) SendFriendRequest(username string) (u *User, err error)

Send a friend request to another user. username [required] - Username and discriminator combo separated by # https://developers.revolt.chat/api/#tag/Relationships/operation/send_friend_request_req

func (*API) SendMessage

func (api *API) SendMessage(channel ULID, params *SendMessage) (m *Message, err error)

Sends a message to the given channel. https://developers.revolt.chat/api/#tag/Messaging/operation/message_send_message_send

func (*API) SendPasswordReset

func (api *API) SendPasswordReset(email, captcha string) error

Send an email to reset account password. email [required] - Email associated with the account captcha [optional, pass empty string] - Captcha verification code https://developers.revolt.chat/api/#tag/Account/operation/send_password_reset_send_password_reset

func (*API) SetDefaultChannelPermission

func (api *API) SetDefaultChannelPermission(channel ULID, params *SetDefaultPermission) (c *Channel, err error)

Sets permissions for the default role in this channel. Channel must be a `Group`, `TextChannel` or `VoiceChannel`. https://developers.revolt.chat/api/#tag/Channel-Permissions/operation/permissions_set_default_req

func (*API) SetDefaultServerPermission

func (api *API) SetDefaultServerPermission(server ULID, params *SetDefaultPermission) (s *Server, err error)

Sets permissions for the default role in this server. https://developers.revolt.chat/api/#tag/Server-Permissions/operation/permissions_set_default_req

func (*API) SetRoleChannelPermission

func (api *API) SetRoleChannelPermission(channel, role ULID, allow, deny Permissions) (c *Channel, err error)

Sets permissions for the specified role in this channel. Channel must be a `TextChannel` or `VoiceChannel`. https://developers.revolt.chat/api/#tag/Channel-Permissions/operation/permissions_set_req

func (*API) SetRoleServerPermission

func (api *API) SetRoleServerPermission(server, role ULID, allow, deny Permissions) (s *Server, err error)

Sets permissions for the specified role in the server. allow [required] - Allow bit flags deny [required] - Disallow bit flags https://developers.revolt.chat/api/#tag/Server-Permissions/operation/permissions_set_req

func (*API) SetSettings

func (api *API) SetSettings(timestamp int64, data map[string]string) error

Upload data to save to settings. timestamp [optional, pass zero] - Timestamp of settings change. Used to avoid feedback loops. https://developers.revolt.chat/api/#tag/Sync/operation/set_settings_req

func (*API) UnbanUser

func (api *API) UnbanUser(server, user ULID) error

Remove a user's ban. https://developers.revolt.chat/api/#tag/Server-Members/operation/ban_remove_req

func (*API) UnblockUser

func (api *API) UnblockUser(user ULID) (u *User, err error)

Unblock another user by their ID. https://developers.revolt.chat/api/#tag/Relationships/operation/unblock_user_req

func (*API) Unsubscribe

func (api *API) Unsubscribe() error

Remove the Web Push subscription associated with the current session. https://developers.revolt.chat/api/#tag/Web-Push/operation/unsubscribe_req

func (*API) VerifyEmail

func (api *API) VerifyEmail(code string) (ticket *MFATicket, err error)

Verify an email address. ticket - May be nil https://developers.revolt.chat/api/#tag/Account/operation/verify_email_verify_email

type APIConfig

type APIConfig struct {
	HTTPClient HTTPClient
	URL        *url.URL
	Arshaler   JSONArshaler
}

type APIError

type APIError struct {
	Response   *http.Response `json:"-"`
	Type       string         `json:"type"`
	RetryAfter float64        `json:"retry_after"`
	Err        string         `json:"error"`
	Max        int            `json:"max"`
	Permission string         `json:"permission"`
	Operation  string         `json:"operation"`
	Collection string         `json:"collection"`
	Location   string         `json:"location"`
	With       string         `json:"with"`
}

func (APIError) Error

func (ae APIError) Error() string

type Account

type Account struct {
	ID    ULID   `json:"_id"`
	Email string `json:"email"`
}

type ArshalNotImplemented

type ArshalNotImplemented struct{}

func (ArshalNotImplemented) Error

func (ArshalNotImplemented) Error() string

type Auth

type Auth struct {
	EventType AuthEventType `json:"event_type"`
	// [Present only on CreateAccount]
	Account *SocketAccount `json:"account,omitempty"`
	// [Present only on CreateSession]
	Session *SocketSession `json:"session,omitempty"`
	// [Present only on DeleteSession/DeleteAllSessions]
	UserID ULID `json:"user_id,omitempty"`
	// [Present only on DeleteSession]
	SessionID string `json:"session_id,omitempty"`
	// [Present only on DeleteAllSessions]
	ExcludeSessionID string `json:"exclude_session_id,omitempty"`
}

Forwarded events from rAuth, currently only session deletion events are forwarded.

type AuthEventType

type AuthEventType string
const (
	AuthEventTypeCreateAccount     AuthEventType = "CreateAccount"
	AuthEventTypeCreateSession     AuthEventType = "CreateSession"
	AuthEventTypeDeleteSession     AuthEventType = "DeleteSession"
	AuthEventTypeDeleteAllSessions AuthEventType = "DeleteAllSessions"
)

type Authenticated

type Authenticated struct{}

The server has authenticated your connection and you will shortly start receiving data.

type AutumnAPI

type AutumnAPI struct {
	Token      *Token
	HTTPClient HTTPClient
	URL        *url.URL
	Arshaler   JSONArshaler
}

Requester for Autumn API

func NewAutumnAPI

func NewAutumnAPI(token *Token, config *AutumnAPIConfig) (api *AutumnAPI, err error)

NewAutumnAPI returns an AutumnAPI which can be used to upload and get files

func (*AutumnAPI) FetchConfig

func (api *AutumnAPI) FetchConfig() (c *AutumnConfig, err error)

func (*AutumnAPI) Get

func (api *AutumnAPI) Get(tag, id string) ([]byte, error)

Get file from Autumn. tag [required] - tag, valid tags are: ["attachments", "avatars", "backgrounds", "icons", "banners", "emojis"] id [required] - file ID Example: `id, err := autumn.Get("attachments", "123")`

func (*AutumnAPI) Request

func (api *AutumnAPI) Request(route Route, options *RequestOptions) (*http.Response, error)

func (*AutumnAPI) RequestJSON

func (api *AutumnAPI) RequestJSON(v any, route Route, options *RequestOptions) error

func (*AutumnAPI) Upload

func (api *AutumnAPI) Upload(tag UploadTag, filename, contentType string, contents []byte) (s string, err error)

Upload file to Autumn. tag [required] - tag, valid tags are: ["attachments", "avatars", "backgrounds", "banners", "emojis", "icons"] filename [required] - filename that will displayed in client contentType [optional, pass empty] - content type contents [required] - the file contents Example: `id, err := autumn.Upload("attachments", "hello.txt", "", []byte("hello world"))`

type AutumnAPIConfig

type AutumnAPIConfig struct {
	HTTPClient HTTPClient
	URL        *url.URL
	Arshaler   JSONArshaler
}

Requester config

type AutumnConfig

type AutumnConfig struct {
	Version     string                `json:"autumn"`
	Tags        map[string]*AutumnTag `json:"tags"`
	JPEGQuality int                   `json:"jpeg_quality"`
}

type AutumnFile

type AutumnFile struct {
	// Unique ID
	ID string `json:"_id"`
	// Tag / bucket this file was uploaded to
	Tag string `json:"tag"`
	// Original filename
	Filename string `json:"filename"`
	// Metadata associated with file
	Metadata AutumnFileMetadata `json:"metadata"`
	// Raw content type of this file
	ContentType string `json:"content_type"`
	// Size of this file (in bytes)
	Size int `json:"size"`
	// Whether this file was deleted
	Deleted *bool `json:"deleted"`
	// Whether this file was reported
	Reported  *bool `json:"reported"`
	MessageID ULID  `json:"message_id"`
	UserID    ULID  `json:"user_id"`
	ServerID  ULID  `json:"server_id"`
	// ID of the object this file is associated with
	ObjectID ULID `json:"object_id"`
}

Representation of a File on Revolt Generated by Autumn

func (*AutumnFile) ToOptimized

func (o *AutumnFile) ToOptimized() *OptimizedAutumnFile

type AutumnFileMetadata

type AutumnFileMetadata struct {
	Type   AutumnFileMetadataType `json:"type"`
	Width  int                    `json:"width"`
	Height int                    `json:"height"`
}

func (*AutumnFileMetadata) ToOptimized

type AutumnFileMetadataType

type AutumnFileMetadataType string
const (
	AutumnFileMetadataTypeFile  AutumnFileMetadataType = "File"
	AutumnFileMetadataTypeText  AutumnFileMetadataType = "Text"
	AutumnFileMetadataTypeImage AutumnFileMetadataType = "Image"
	AutumnFileMetadataTypeVideo AutumnFileMetadataType = "Video"
	AutumnFileMetadataTypeAudio AutumnFileMetadataType = "Audio"
)

func (AutumnFileMetadataType) ToOptimized

type AutumnTag

type AutumnTag struct {
	MaxSize             int      `json:"max_size"`
	UseULID             bool     `json:"use_ulid"`
	Enabled             bool     `json:"enabled"`
	ServeIfFieldPresent []string `json:"serve_if_field_present,omitempty"`
	RestrictContentType string   `json:"restrict_content_type"`
}

type Ban

type Ban struct {
	ID MemberID `json:"_id"`
	// Reason for ban creation
	Reason string `json:"reason"`
}

type BansResponse

type BansResponse struct {
	// Users objects
	Users []User `json:"users"`
	// Ban objects
	Bans []Ban `json:"bans"`
}

type Bot

type Bot struct {
	// Bot ID. This equals the associated bot user's ID.
	ID ULID `json:"_id"`
	// User ID of the bot owner
	Owner ULID `json:"owner"`
	// Token used to authenticate requests for this bot
	Token string `json:"token"`
	// Whether the bot is public (may be invited by anyone)
	Public bool `json:"public"`
	// Whether to enable analytics
	Analytics bool `json:"analytics,omitempty"`
	// Whether this bot should be publicly discoverable
	Discoverable bool `json:"discoverable,omitempty"`
	// Reserved; URL for handling interactions
	InteractionsURL string `json:"interactions_url,omitempty"`
	// URL for terms of service
	TermsOfServiceURL string `json:"terms_of_service_url,omitempty"`
	// URL for privacy policy
	PrivacyPolicyURL string `json:"privacy_policy_url,omitempty"`
	// Enum of bot flags
	Flags BotFlags `json:"flags"`
}

type BotFlags

type BotFlags int
const (
	BotFlagsVerified BotFlags = 1 << (0 + iota)
	BotFlagsOfficial
)

type BuildInformation

type BuildInformation struct {
	CommitSHA       string `json:"commit_sha"`
	CommitTimestamp string `json:"commit_timestamp"`
	Semver          string `json:"semver"`
	OriginURL       string `json:"origin_url"`
	Timestamp       string `json:"timestamp"`
}

type BulkDeleteMessage

type BulkDeleteMessage struct {
	// Where messages were deleted.
	ChannelID ULID `json:"channel_id"`
	// Affected message IDs.
	IDs []ULID `json:"ids"`
}

Multiple messages were deleted.

type Cache1

type Cache1[T Cacheable] struct {
	Checker              Cache1Checker[T]
	DontInsertIfOverflow bool
	MaxSize              int
	Cache                map[ULID]*T
}

func (*Cache1[T]) Del

func (c *Cache1[T]) Del(id ULID)

func (*Cache1[T]) Get

func (c *Cache1[T]) Get(id ULID) *T

func (*Cache1[T]) PartiallyUpdate

func (c *Cache1[T]) PartiallyUpdate(id ULID, updater func(m *T))

func (*Cache1[T]) Set

func (c *Cache1[T]) Set(v *T)

func (*Cache1[T]) Size

func (c *Cache1[T]) Size() int

type Cache1CheckContext

type Cache1CheckContext[T Cacheable] struct {
	Cache  *Cache1[T]
	Entity *T
}

type Cache1Checker

type Cache1Checker[T Cacheable] interface {
	CanCache1(*Cache1CheckContext[T]) bool
}

type Cache2

type Cache2[T Cacheable] struct {
	Checker      Cache2Checker[T]
	MaxSize1     int
	MaxSize2     int
	TotalMaxSize int

	DontInsertIfOverflow bool
	Cache                map[ULID]map[ULID]*T
	// contains filtered or unexported fields
}

func (*Cache2[T]) Del

func (c *Cache2[T]) Del(parent, id ULID)

func (*Cache2[T]) DelGroup

func (c *Cache2[T]) DelGroup(parent ULID)

func (*Cache2[T]) Get

func (c *Cache2[T]) Get(parent, id ULID) *T

func (*Cache2[T]) GroupsCount

func (c *Cache2[T]) GroupsCount() int

func (*Cache2[T]) PartiallyUpdate

func (c *Cache2[T]) PartiallyUpdate(parent, id ULID, updater func(m *T))

func (*Cache2[T]) Set

func (c *Cache2[T]) Set(parent ULID, v *T)

func (*Cache2[T]) Size

func (c *Cache2[T]) Size() int

type Cache2CheckContext

type Cache2CheckContext[T Cacheable] struct {
	Cache  *Cache2[T]
	Parent ULID
	Entity *T
}

type Cache2Checker

type Cache2Checker[T Cacheable] interface {
	CanCache2(*Cache2CheckContext[T]) bool
}

type Cacheable

type Cacheable interface {
	GetKey() ULID
}

type Category

type Category struct {
	// Unique ID for this category
	ID ULID `json:"id"`
	// Title for this category
	Title string `json:"title"`
	// Channels in this category
	Channels []ULID `json:"channels"`
}

type ChangeUsername

type ChangeUsername struct {
	// New username
	Username string `json:"username"`
	// Current account password
	Password string `json:"password"`
}

type Channel

type Channel struct {
	Type ChannelType `json:"channel_type"`
	// Unique ID
	ID ULID `json:"_id"`
	// ID of the server this channel belongs to
	Server ULID `json:"server,omitempty"`
	// Display name of the channel
	Name string `json:"name,omitempty"`
	// Whether this direct message channel is currently open on both sides
	Active bool `json:"active"`
	// User ID of the owner of the group
	Owner ULID `json:"owner,omitempty"`
	// Channel description
	Description string      `json:"description,omitempty"`
	Icon        *AutumnFile `json:"icon,omitempty"`
	// 2-tuple of user ids participating in direct message / Array of user ids participating in channel
	Recipients []ULID `json:"recipients,omitempty"`
	// ID of the last message sent in this channel
	LastMessageID ULID `json:"last_message_id,omitempty"`
	// Permissions assigned to members of this group (does not apply to the owner of the group)
	Permissions Permissions `json:"permissions,omitempty"`
	// Representation of a single permission override as it appears on models and in the database
	DefaultPermissions *PermissionOverride `json:"default_permissions,omitempty"`
	// Permissions assigned based on role to this channel
	RolePermissions map[ULID]PermissionOverride `json:"role_permissions,omitempty"`
	// ID of the user this channel belongs to
	User ULID `json:"user,omitempty"`
	// Whether this group is marked as not safe for work
	NSFW bool `json:"nsfw,omitempty"`
}

func (Channel) GetKey

func (c Channel) GetKey() ULID

func (*Channel) ToOptimized

func (c *Channel) ToOptimized() *OptimizedChannel

type ChannelAck

type ChannelAck struct {
	ChannelID ULID `json:"id"`
	User      ULID `json:"user"`
	MessageID ULID `json:"message_id"`
}

You have acknowledged new messages in this channel up to this message ID.

type ChannelDelete

type ChannelDelete struct {
	ChannelID ULID `json:"id"`
}

Channel has been deleted.

type ChannelGroupJoin

type ChannelGroupJoin struct {
	ChannelID ULID `json:"id"`
	User      ULID `json:"user"`
}

A user has joined the group.

type ChannelGroupLeave

type ChannelGroupLeave struct {
	ChannelID ULID `json:"id"`
	User      ULID `json:"user"`
}

A user has left the group.

type ChannelStartTyping

type ChannelStartTyping struct {
	ChannelID ULID `json:"id"`
	User      ULID `json:"user"`
}

A user has started typing in this channel.

type ChannelStopTyping

type ChannelStopTyping struct {
	ChannelID ULID `json:"id"`
	User      ULID `json:"user"`
}

A user has stopped typing in this channel.

type ChannelType

type ChannelType string
const (
	ChannelTypeSavedMessages ChannelType = "SavedMessages"
	ChannelTypeDirectMessage ChannelType = "DirectMessage"
	ChannelTypeGroup         ChannelType = "Group"
	ChannelTypeTextChannel   ChannelType = "TextChannel"
	ChannelTypeVoiceChannel  ChannelType = "VoiceChannel"
)

func (ChannelType) ToOptimized

func (ct ChannelType) ToOptimized() OptimizedChannelType

type ChannelUpdate

type ChannelUpdate struct {
	ChannelID ULID            `json:"id"`
	Data      *PartialChannel `json:"data"`
	// Possible values: ["Description", "Icon", "DefaultPermissions"]
	Clear []string `json:"clear"`
}

Channel details updated.

func (*ChannelUpdate) IsDefaultPermissionsWereRemoved

func (cu *ChannelUpdate) IsDefaultPermissionsWereRemoved() bool

Whether default permissions were removed.

func (*ChannelUpdate) IsDescriptionCleared

func (cu *ChannelUpdate) IsDescriptionCleared() bool

Whether description was cleared.

func (*ChannelUpdate) IsIconRemoved

func (cu *ChannelUpdate) IsIconRemoved() bool

Whether icon was removed.

type CollectionScans

type CollectionScans struct {
	// Number of total collection scans
	Total int64 `json:"total"`
	// Number of total collection scans not using a tailable cursor
	NonTailable int64 `json:"nonTailable"`
}

type CollectionStats

type CollectionStats struct {
	// Namespace
	Namespace string `json:"ns"`
	LocalTime Time   `json:"localTime"`
	// Latency stats
	LatencyStats map[string]*LatencyStats `json:"latencyStats"`
	// Collection query execution stats
	QueryExecStats QueryExecStats `json:"queryExecStaus"`
	// Number of documents in collection
	Count uint64 `json:"count"`
}

type CreateAccount

type CreateAccount struct {
	// Valid email address
	Email string `json:"email"`
	// Password
	Password string `json:"password"`
	// Invite code
	Invite string `json:"invite,omitempty"`
	// Captcha verification code
	Captcha string `json:"captcha,omitempty"`
}

type CreateChannel

type CreateChannel struct {
	// Default: "Text"
	// Enum: "Text" "Voice"
	// Channel type
	Type ChannelType `json:"type,omitempty"`
	// Channel name
	Name string `json:"name"`
	// Channel description
	Description string `json:"description,omitempty"`
	// Whether this channel is age restricted
	NSFW bool `json:"nsfw"`
}

type CreateEmoji

type CreateEmoji struct {
	// Emoji name
	Name string `json:"name"`
	// Information about what owns this emoji
	Parent CustomEmojiParent `json:"parent"`
	// Whether the emoji is mature
	NSFW bool `json:"nsfw"`
}

type CreateGroup

type CreateGroup struct {
	// Group name
	Name string `json:"name"`
	// Group description
	Description string `json:"description,omitempty"`
	// Array of user IDs to add to the group
	// Must be friends with these users.
	Users []ULID `json:"users"`
	// Whether this group is age-restricted
	NSFW bool `json:"nsfw"`
}

type CreateRole

type CreateRole struct {
	// Role name
	Name string `json:"name"`
	// Ranking position
	// Smaller values take priority.
	Rank *int `json:"rank,omitempty"`
}

type CreateServer

type CreateServer struct {
	// Server name
	Name string `json:"name"`
	// Server description
	Description string `json:"description,omitempty"`
	// Whether this server is age-restricted
	NSFW bool `json:"nsfw"`
}

type CustomEmoji

type CustomEmoji struct {
	// Unique ID
	ID ULID `json:"_id"`
	// What owns this emoji
	Parent CustomEmojiParent `json:"parent"`
	// Uploader user ID
	CreatorID ULID `json:"creator_id"`
	// Emoji name
	Name string `json:"name"`
	// Whether the emoji is animated
	Animated bool `json:"animated,omitempty"`
	// Whether the emoji is marked as NSFW
	NSFW bool `json:"nsfw,omitempty"`
}

func (*CustomEmoji) ToOptimized

func (e *CustomEmoji) ToOptimized() *OptimizedCustomEmoji

type CustomEmojiParent

type CustomEmojiParent struct {
	Type CustomEmojiParentType `json:"type"`
	ID   ULID                  `json:"id,omitempty"`
}

Information about what owns this emoji

func (*CustomEmojiParent) ToOptimized

type CustomEmojiParentType

type CustomEmojiParentType string
const (
	CustomEmojiParentTypeServer   CustomEmojiParentType = "Server"
	CustomEmojiParentTypeDetached CustomEmojiParentType = "Detached"
)

func (CustomEmojiParentType) ToOptimized

type DefaultHTTPClient

type DefaultHTTPClient struct {
	Client http.Client
}

func NewDefaultHTTPClient

func NewDefaultHTTPClient(client http.Client) DefaultHTTPClient

func (DefaultHTTPClient) Perform

func (h DefaultHTTPClient) Perform(req *http.Request) (*http.Response, error)

type DefaultWebsocketDialer

type DefaultWebsocketDialer struct {
	Dialer *websocket.Dialer
}

func NewDefaultWebsocketDialer

func NewDefaultWebsocketDialer(dialer *websocket.Dialer) DefaultWebsocketDialer

func (DefaultWebsocketDialer) Dial

type DeletionInfo

type DeletionInfo struct {
	Token  string `json:"token,omitempty"`
	Expiry *Time  `json:"expiry,omitempty"`
	After  *Time  `json:"after,omitempty"`
}

Account deletion information

type DeletionInfoStatus

type DeletionInfoStatus string
const (
	// The user must confirm deletion by email
	DeletionInfoStatusWaitingForVerification DeletionInfoStatus = "WaitingForVerification"
	// The account is scheduled for deletion
	DeletionInfoStatusScheduled DeletionInfoStatus = "Scheduled"
	// This account was deleted
	DeletionInfoStatusDeleted DeletionInfoStatus = "Deleted"
)

type EditBot

type EditBot struct {
	// Bot username
	Name string `json:"name,omitempty"`
	// Whether the bot can be added by anyone
	Public *bool `json:"public,omitempty"`
	// Whether analytics should be gathered for this bot
	// Must be enabled in order to show up on Revolt Discover.
	Analytics *bool `json:"analytics,omitempty"`
	// Interactions URL
	InteractionsURL *string `json:"interactions_url,omitempty"`
	// Fields to remove from bot object
	// Possible values: ["Token", "InteractionsURL"]
	Remove []string `json:"remove,omitempty"`
}

func (*EditBot) RemoveInteractionsURL

func (eb *EditBot) RemoveInteractionsURL() *EditBot

Indicate that we will remove interactions URL.

func (*EditBot) RemoveToken

func (eb *EditBot) RemoveToken() *EditBot

Indicate that we will remove token.

type EditChannel

type EditChannel struct {
	// Channel name
	Name string `json:"name,omitempty"`
	// Channel description
	Description *string `json:"description,omitempty"`
	// Group owner
	Owner ULID `json:"owner,omitempty"`
	// Icon to set. Provide an Autumn attachment ID.
	Icon *string `json:"icon,omitempty"`
	// Whether this channel is age-restricted
	NSFW *bool `json:"nsfw,omitempty"`
	// Whether this channel is archived
	Archived *bool `json:"archived,omitempty"`
	// Fields to remove from channel object
	// Possible values: ["Description", "Icon", "DefaultPermissions"]
	Remove []string `json:"remove,omitempty"`
}

func (*EditChannel) RemoveDefaultPermissions

func (ec *EditChannel) RemoveDefaultPermissions() *EditChannel

Indicate that we will remove default permissions.

func (*EditChannel) RemoveDescription

func (ec *EditChannel) RemoveDescription() *EditChannel

Indicate that we will remove description.

func (*EditChannel) RemoveIcon

func (ec *EditChannel) RemoveIcon() *EditChannel

Indicate that we will remove icon.

type EditMember

type EditMember struct {
	// Member nickname
	Nickname string `json:"nickname,omitempty"`
	// Attachment ID to set for avatar
	Avatar string `json:"avatar,omitempty"`
	// Array of role IDs
	Roles *[]ULID `json:"roles,omitempty"`
	// ISO8601 formatted timestamp
	Timeout *Time `json:"timeout,omitempty"`
	// Fields to remove from member object
	// Possible values: ["Nickname", "Avatar", "Roles", "Timeout"]
	Remove []string `json:"remove,omitempty"`
}

func (*EditMember) RemoveAvatar

func (em *EditMember) RemoveAvatar() *EditMember

Indicate that we will remove avatar.

func (*EditMember) RemoveNickname

func (em *EditMember) RemoveNickname() *EditMember

Indicate that we will remove nickname.

func (*EditMember) RemoveRoles

func (em *EditMember) RemoveRoles() *EditMember

Indicate that we will remove roles.

func (*EditMember) RemoveTimeout

func (em *EditMember) RemoveTimeout() *EditMember

Indicate that we will remove timeout.

type EditMessage

type EditMessage struct {
	// New message content
	Content *string `json:"content,omitempty"`
	// Embeds to include in the message
	Embeds *[]SendableEmbed `json:"embeds,omitempty"`
}

func (*EditMessage) AddEmbeds

func (em *EditMessage) AddEmbeds(embeds ...SendableEmbed) *EditMessage

func (*EditMessage) SetContent

func (em *EditMessage) SetContent(content string) *EditMessage

func (*EditMessage) SetEmbeds

func (em *EditMessage) SetEmbeds(embeds *[]SendableEmbed) *EditMessage

func (*EditMessage) UnsetContent

func (em *EditMessage) UnsetContent() *EditMessage

func (*EditMessage) UnsetEmbeds

func (em *EditMessage) UnsetEmbeds() *EditMessage

type EditProfile

type EditProfile struct {
	// Text to set as user profile description
	Content *string `json:"content,omitempty"`
	// Attachment Id for background
	Background string `json:"background,omitempty"`
}

type EditReport

type EditReport struct {
	// Status of the report
	Status *EditReportStatus `json:"status,omitempty"`
	// Report notes
	Notes string `json:"notes,omitempty"`
}

type EditReportStatus

type EditReportStatus struct {
	Status          ReportStatus `json:"status"`
	RejectionReason string       `json:"rejection_reason,omitempty"`
	ClosedAt        *Time        `json:"closed_at,omitempty"`
}

type EditRole

type EditRole struct {
	// Role name
	Name string `json:"name,omitempty"`
	// Role colour
	Colour string `json:"colour,omitempty"`
	// Whether this role should be displayed separately
	Hoist *bool `json:"hoist,omitempty"`
	// Ranking position
	// Smaller values take priority.
	Rank *int `json:"rank,omitempty"`
	// Fields to remove from role object
	// Possible values: ["Colour"]
	Remove []string `json:"remove,omitempty"`
}

func (*EditRole) RemoveColour

func (er *EditRole) RemoveColour() *EditRole

Indicate that we will remove colour.

type EditServer

type EditServer struct {
	// Server name
	Name string `json:"name,omitempty"`
	// Server description
	Description *string `json:"description,omitempty"`
	// Attachment ID for icon
	Icon *string `json:"icon,omitempty"`
	// Attachment ID for banner
	Banner *string `json:"banner,omitempty"`
	// Category structure for server
	Categories *[]Category `json:"categories,omitempty"`
	// System message channel assignments
	SystemMessages *EditSystemMessages `json:"system_messages,omitempty"`
	// Bitfield of server flags
	Flags ServerFlags `json:"flags,omitempty"`
	// Whether this server is public and should show up on Revolt Discover
	Discoverable *bool `json:"discoverable,omitempty"`
	// Whether analytics should be collected for this server
	// Must be enabled in order to show up on Revolt Discover.
	Analytics *bool `json:"analytics,omitempty"`
	// Fields to remove from server object
	// Possible values: ["Description", "Categories", "SystemMessages", "Icon", "Banner"]
	Remove []string `json:"remove,omitempty"`
}

func (*EditServer) AddCategories

func (es *EditServer) AddCategories(categories ...Category) *EditServer

func (*EditServer) RemoveBanner

func (es *EditServer) RemoveBanner() *EditServer

Indicate that we will remove banner.

func (*EditServer) RemoveCategories

func (es *EditServer) RemoveCategories() *EditServer

Indicate that we will remove categories.

func (*EditServer) RemoveDescription

func (es *EditServer) RemoveDescription() *EditServer

Indicate that we will remove description.

func (*EditServer) RemoveIcon

func (es *EditServer) RemoveIcon() *EditServer

Indicate that we will remove icon.

func (*EditServer) RemoveSystemMessages

func (es *EditServer) RemoveSystemMessages() *EditServer

Indicate that we will remove system messages.

func (*EditServer) SetCategories

func (es *EditServer) SetCategories(categories *[]Category) *EditServer

func (*EditServer) SetDescription

func (es *EditServer) SetDescription(description string) *EditServer

func (*EditServer) SetFlags

func (es *EditServer) SetFlags(flags ServerFlags) *EditServer

func (*EditServer) SetIcon

func (es *EditServer) SetIcon(icon string) *EditServer

func (*EditServer) SetName

func (es *EditServer) SetName(name string) *EditServer

func (*EditServer) SetSystemMessages

func (es *EditServer) SetSystemMessages(systemMessages EditSystemMessages) *EditServer

func (*EditServer) UnsetCategories

func (es *EditServer) UnsetCategories() *EditServer

func (*EditServer) UnsetDescription

func (es *EditServer) UnsetDescription() *EditServer

func (*EditServer) UnsetIcon

func (es *EditServer) UnsetIcon() *EditServer

func (*EditServer) UnsetName

func (es *EditServer) UnsetName() *EditServer

func (*EditServer) UnsetSystemMessages

func (es *EditServer) UnsetSystemMessages() *EditServer

type EditStrike

type EditStrike struct {
	// New attached reason
	Reason string `json:"reason,omitempty"`
}

type EditSystemMessages

type EditSystemMessages struct {
	// ID of channel to send user join messages in
	UserJoined *ULID
	// ID of channel to send user left messages in
	UserLeft *ULID
	// ID of channel to send user kicked messages in
	UserKicked *ULID
	// ID of channel to send user banned messages in
	UserBanned *ULID
}

func (EditSystemMessages) MarshalJSON

func (esm EditSystemMessages) MarshalJSON() ([]byte, error)

type EditUser

type EditUser struct {
	// New display name
	DisplayName *string
	// Attachment ID for avatar
	Avatar *string
	// User's active status
	Status *UserStatus
	// New user profile data. This is applied as a partial.
	Profile *EditProfile
	// Bitfield of user badges
	Badges UserBadges
	// Enum of user flags
	Flags UserFlags
	// Fields to remove from user object
	// Possible values: ["Avatar", "StatusText", "StatusPresence", "ProfileContent", "ProfileBackground", "DisplayName"]
	Remove []string
}

func (EditUser) MarshalJSON

func (eu EditUser) MarshalJSON() ([]byte, error)

func (*EditUser) RemoveAvatar

func (eu *EditUser) RemoveAvatar() *EditUser

Indicate that we will remove avatar.

func (*EditUser) RemoveDisplayName

func (eu *EditUser) RemoveDisplayName() *EditUser

Indicate that we will remove display name.

func (*EditUser) RemoveProfileBackground

func (eu *EditUser) RemoveProfileBackground() *EditUser

Indicate that we will remove profile background.

func (*EditUser) RemoveProfileContent

func (eu *EditUser) RemoveProfileContent() *EditUser

Indicate that we will remove profile content.

func (*EditUser) RemoveStatusPresence

func (eu *EditUser) RemoveStatusPresence() *EditUser

Indicate that we will remove status presence.

func (*EditUser) RemoveStatusText

func (eu *EditUser) RemoveStatusText() *EditUser

Indicate that we will remove status text.

type EditWebhook

type EditWebhook struct {
	// New webhook name
	Name string `json:"name,omitempty"`
	// New avatar ID
	Avatar string `json:"avatar,omitempty"`
	// New webhook permissions
	Permissions *Permissions `json:"permissions,omitempty"`
	// Fields to remove from webhook
	// Possible values: ["Avatar"]
	Remove []string `json:"remove,omitempty"`
}

func (*EditWebhook) RemoveAvatar

func (ew *EditWebhook) RemoveAvatar() *EditWebhook

Indicate that we will remove avatar.

type EmailVerification

type EmailVerification struct {
	Status EmailVerificationStatus `json:"status"`
	// [Present only on Moving] New email
	NewEmail string `json:"new_email,omitempty"`
	// [Present only on Pending/Moving] New token
	Token string `json:"token,omitempty"`
	// [Present only on Pending/Moving] Time at which this token expires
	Expiry *Time `json:"expiry,omitempty"`
}

Email verification status

type EmailVerificationStatus

type EmailVerificationStatus string
const (
	// Account is verified
	EmailVerificationStatusVerified EmailVerificationStatus = "Verified"
	// Pending email verification
	EmailVerificationStatusPending EmailVerificationStatus = "Pending"
	// Moving to a new email
	EmailVerificationStatusMoving EmailVerificationStatus = "Moving"
)

type Embed

type Embed struct {
	Type EmbedType `json:"type"`
	// Direct URL to web page / URL to the original image / URL to the original video / URL for title
	URL string `json:"url"`
	// Original direct URL
	OriginalURL string `json:"original_url"`
	// Information about special remote content
	Special *EmbedSpecial `json:"special"`
	// Title of website / Title of text embed
	Title string `json:"title"`
	// Description of website / Description of text embed
	Description string `json:"description"`
	// Image
	Image *EmbedImage `json:"image"`
	// Video
	Video *EmbedVideo `json:"video"`
	// Site name
	SiteName string `json:"site_name"`
	// URL to site icon / URL to icon
	IconURL string      `json:"icon_url"`
	Media   *AutumnFile `json:"media"`
	// CSS Colour
	Colour string `json:"colour"`
	// Width of the image / Width of the video
	Width int `json:"width"`
	// Height of the image / Height of the video
	Height int `json:"height"`
	// Image positioning and size
	Size EmbedImageSize `json:"size"`
}

func (*Embed) ToOptimized

func (o *Embed) ToOptimized() *OptimizedEmbed

type EmbedImage

type EmbedImage struct {
	URL    string         `json:"url"`
	Width  int            `json:"width"`
	Height int            `json:"height"`
	Size   EmbedImageSize `json:"size"`
}

func (*EmbedImage) ToOptimized

func (o *EmbedImage) ToOptimized() *OptimizedEmbedImage

type EmbedImageSize

type EmbedImageSize string
const (
	EmbedImageSizeLarge   EmbedImageSize = "Large"
	EmbedImageSizePreview EmbedImageSize = "Preview"
)

func (EmbedImageSize) ToOptimized

func (s EmbedImageSize) ToOptimized() OptimizedEmbedImageSize

type EmbedSpecial

type EmbedSpecial struct {
	Type EmbedSpecialType `json:"type"`
	ID   string           `json:"id"`
	// Type of remote Lightspeed.tv content / Type of remote Twitch content / Type of remote Bandcamp content
	ContentType string `json:"content_type"`
	Timestamp   string `json:"timestamp"`
}

func (*EmbedSpecial) ToOptimized

func (o *EmbedSpecial) ToOptimized() *OptimizedEmbedSpecial

type EmbedSpecialType

type EmbedSpecialType string
const (
	EmbedSpecialTypeNone       EmbedSpecialType = "None"
	EmbedSpecialTypeGIF        EmbedSpecialType = "GIF"
	EmbedSpecialTypeYouTube    EmbedSpecialType = "YouTube"
	EmbedSpecialTypeLightspeed EmbedSpecialType = "Lightspeed"
	EmbedSpecialTypeTwitch     EmbedSpecialType = "Twitch"
	EmbedSpecialTypeSpotify    EmbedSpecialType = "Spotify"
	EmbedSpecialTypeSoundcloud EmbedSpecialType = "Soundcloud"
	EmbedSpecialTypeBandcamp   EmbedSpecialType = "Bandcamp"
	EmbedSpecialTypeStreamable EmbedSpecialType = "Streamable"
)

func (EmbedSpecialType) ToOptimized

type EmbedType

type EmbedType string
const (
	EmbedTypeWebsite EmbedType = "Website"
	EmbedTypeImage   EmbedType = "Image"
	EmbedTypeVideo   EmbedType = "Video"
	EmbedTypeText    EmbedType = "Text"
	EmbedTypeNone    EmbedType = "None"
)

func (EmbedType) ToOptimized

func (s EmbedType) ToOptimized() OptimizedEmbedType

type EmbedVideo

type EmbedVideo struct {
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

type Emoji

type Emoji struct {
	ID    ULID
	Emoji string
}

func NewCustomEmoji

func NewCustomEmoji(emoji ULID) *Emoji

func NewUnicodeEmoji

func NewUnicodeEmoji(emoji string) *Emoji

func (Emoji) EncodeFP

func (e Emoji) EncodeFP() string

func (*Emoji) UnmarshalJSON

func (e *Emoji) UnmarshalJSON(b []byte) error

type EmojiDelete

type EmojiDelete struct {
	EmojiID ULID `json:"id"`
}

Emoji has been deleted.

type EventController

type EventController[T any] struct {
	// contains filtered or unexported fields
}

func NewEventController

func NewEventController[T any]() *EventController[T]

func (*EventController[T]) Emit

func (ec *EventController[T]) Emit(t T) *EventController[T]

func (*EventController[T]) EmitAndCall

func (ec *EventController[T]) EmitAndCall(t T, f func(T)) *EventController[T]

func (*EventController[T]) EmitInGoroutines

func (ec *EventController[T]) EmitInGoroutines(t T) *EventController[T]

func (*EventController[T]) Listen

func (ec *EventController[T]) Listen(f func(T)) *Subscription[T]

func (*EventController[T]) Override

func (ec *EventController[T]) Override(f func(T)) *Subscription[T]

type Events

type Events struct {
	Error         *EventController[error]
	RevoltError   *EventController[string]
	Authenticated *EventController[*Authenticated]
	Raw           *EventController[map[string]any]
	Ready         *EventController[*Ready]
	// Message received, the event object has the same schema as the Message object in the API with the addition of an event type.
	Message               *EventController[*Message]
	MessageUpdate         *EventController[*MessageUpdate]
	MessageAppend         *EventController[*MessageAppend]
	MessageDelete         *EventController[*MessageDelete]
	MessageReact          *EventController[*MessageReact]
	MessageUnreact        *EventController[*MessageUnreact]
	MessageRemoveReaction *EventController[*MessageRemoveReaction]
	BulkDeleteMessage     *EventController[*BulkDeleteMessage]
	// Channel created, the event object has the same schema as the Channel object in the API with the addition of an event type.
	ChannelCreate      *EventController[*Channel]
	ChannelUpdate      *EventController[*ChannelUpdate]
	ChannelDelete      *EventController[*ChannelDelete]
	ChannelGroupJoin   *EventController[*ChannelGroupJoin]
	ChannelGroupLeave  *EventController[*ChannelGroupLeave]
	ChannelStartTyping *EventController[*ChannelStartTyping]
	ChannelStopTyping  *EventController[*ChannelStopTyping]
	ChannelAck         *EventController[*ChannelAck]
	ServerCreate       *EventController[*ServerCreate]
	ServerUpdate       *EventController[*ServerUpdate]
	ServerDelete       *EventController[*ServerDelete]
	ServerMemberUpdate *EventController[*ServerMemberUpdate]
	ServerMemberJoin   *EventController[*ServerMemberJoin]
	ServerMemberLeave  *EventController[*ServerMemberLeave]
	ServerRoleUpdate   *EventController[*ServerRoleUpdate]
	ServerRoleDelete   *EventController[*ServerRoleDelete]
	UserUpdate         *EventController[*UserUpdate]
	UserRelationship   *EventController[*UserRelationship]
	UserSettingsUpdate *EventController[*UserSettingsUpdate]
	UserPlatformWipe   *EventController[*UserPlatformWipe]
	// Emoji created, the event object has the same schema as the Emoji object in the API with the addition of an event type.
	EmojiCreate *EventController[*CustomEmoji]
	EmojiDelete *EventController[*EmojiDelete]
	// Webhook created, the event object has the same schema as the Webhook object in the API with the addition of an event type.
	WebhookCreate *EventController[*Webhook]
	WebhookUpdate *EventController[*WebhookUpdate]
	WebhookDelete *EventController[*WebhookDelete]
	// Report created, the event object has the same schema as the Report object in the API with the addition of an event type.
	ReportCreate *EventController[*Report]
	Auth         *EventController[*Auth]
}

type FeatureConfiguration

type FeatureConfiguration struct {
	/// hCaptcha configuration
	Captcha HCaptchaConfiguration `json:"captcha"`
	// Whether email verification is enabled
	Email bool `json:"email"`
	// Whether this server is invite only
	InviteOnly bool `json:"invite_only"`
	// File server service configuration
	Autumn GenericServiceConfiguration `json:"autumn"`
	// Proxy service configuration
	January GenericServiceConfiguration `json:"january"`
	// Voice server configuration
	Voso VoiceServerConfiguration `json:"voso"`
}

type FetchMembers

type FetchMembers struct {
	// Whether to exclude offline users
	ExcludeOffline *bool
}

type FetchMembersResponse

type FetchMembersResponse struct {
	// List of members
	Members []Member `json:"members"`
	// List of users
	Users []User `json:"users"`
}

type FetchMessages

type FetchMessages struct {
	// Maximum number of messages to fetch
	// For fetching nearby messages, this is `(limit + 1)`.
	Limit int
	// Message id before which messages should be fetched
	Before ULID
	// Message id after which messages should be fetched
	After ULID
	// Message sort direction
	Sort MessageSort
	// Message id to search around
	// Specifying 'nearby' ignores 'before', 'after' and 'sort'. It will also take half of limit rounded as the limits to each side. It also fetches the message ID specified.
	Nearby ULID
	// Whether to include user (and member, if server channel) objects
	IncludeUsers *bool
}

type FetchReports

type FetchReports struct {
	// Find reports aganist messages, servers, or users
	ContentID ULID
	// Find reports created by user
	AuthorID ULID
	// Report status to include in search
	Status ReportStatus
}

type GenericCache

type GenericCache struct {
	Channels *Cache1[OptimizedChannel]
	Emojis   *Cache1[OptimizedCustomEmoji]
	Messages *Cache2[OptimizedMessage]
	Members  *Cache2[Member]
	Roles    *Cache2[OptimizedRole]
	Servers  *Cache1[OptimizedServer]
	Users    *Cache1[OptimizedUser]
	Webhooks *Cache1[OptimizedWebhook]
}

type GenericServiceConfiguration

type GenericServiceConfiguration struct {
	// Whether the service is enabled
	Enabled bool `json:"enabled"`
	// URL pointing to the service
	URL string `json:"url"`
}

type GloballyFetchMessages

type GloballyFetchMessages struct {
	// Message ID before which messages should be fetched
	Before ULID `json:"before,omitempty"`
	// Message ID after which messages should be fetched
	After ULID `json:"after,omitempty"`
	// Sort used for retrieving messages
	Sort MessageSort `json:"sort,omitempty"`
	// Message ID to search around.
	// Specifying 'nearby' ignores 'before', 'after' and 'sort'. It will also take half of limit rounded as the limits to each side. It also fetches the message ID specified.
	Nearby ULID `json:"nearby,omitempty"`
	// Maximum number of messages to fetch
	// For fetching nearby messages, this is `(limit + 1)`.
	Limit int `json:"limit,omitempty"`
	// Parent channel ID
	Channel ULID `json:"channel,omitempty"`
	// Message author ID
	Author ULID `json:"author,omitempty"`
	// Search query
	Query string `json:"query,omitempty"`
}

type HCaptchaConfiguration

type HCaptchaConfiguration struct {
	// Whether captcha is enabled
	Enabled bool `json:"enabled"`
	// Client key used for solving captcha
	Key string `json:"key"`
}

type HTTPClient

type HTTPClient interface {
	Perform(*http.Request) (*http.Response, error)
}

type Index

type Index struct {
	// Index name
	Name string `json:"name"`
	// Index access information
	Accesses IndexAccesses `json:"accesses"`
}

type IndexAccesses

type IndexAccesses struct {
	// Operations since timestamp
	Ops int `json:"ops"`
	// ISO8601 formatted timestamp
	Since Time `json:"since"`
}

type InstanceStatistics

type InstanceStatistics struct {
	// Index usage information
	Indices map[string]*Index `json:"indices"`
	// Collection stats
	CollStats map[string]*CollectionStats `json:"coll_stats"`
}

type Invite

type Invite struct {
	Type InviteType `json:"type"`
	// Invite code
	ID string `json:"_id"`
	// ID of the server this invite points to
	Server ULID `json:"server"`
	// ID of user who created this invite
	Creator ULID `json:"creator"`
	// ID of the server channel this invite points to / ID of the group channel this invite points to
	Channel ULID `json:"channel"`
}

type InviteBot

type InviteBot struct {
	// Server ID
	Server ULID `json:"server,omitempty"`
	// Group ID
	Group ULID `json:"group,omitempty"`
}

type InviteResponse

type InviteResponse struct {
	Type InviteType `json:"type"`
	// Invite code
	Code string `json:"code"`
	// ID of the server
	ServerID ULID `json:"server_id"`
	// Name of the server
	ServerName   string      `json:"server_name"`
	ServerIcon   *AutumnFile `json:"server_icon"`
	ServerBanner *AutumnFile `json:"server_banner"`
	// Enum of server flags
	ServerFlags ServerFlags `json:"server_flags"`
	// ID of server channel
	ChannelID ULID `json:"channel_id"`
	// Name of server channel
	ChannelName string `json:"channel_name"`
	// Description of server channel
	ChannelDescription string `json:"channel_description"`
	// Name of user who created the invite
	UserName   string      `json:"user_name"`
	UserAvatar *AutumnFile `json:"user_avatar"`
	// Number of members in this server
	MemberCount int `json:"member_count"`
}

type InviteType

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

type JSONArshaler

type JSONArshaler interface {
	// if you want use default arshal, do `nil, ArshalNotImplemented{}`
	Marshal(any) ([]byte, error)
	Unmarshal([]byte, any) error
}

func NewJSONArshaler

func NewJSONArshaler(marshal Marshal, unmarshal Unmarshal) JSONArshaler

both params can be nil

type JoinInviteResponse

type JoinInviteResponse struct {
	// Channels in the server
	Channels []Channel `json:"channels"`
	// Representation of a server on Revolt
	Server Server `json:"server"`
}

type LatencyHistogramEntry

type LatencyHistogramEntry struct {
	// Time
	Micros int64 `json:"micros"`
	// Count
	Count int64 `json:"count"`
}

type LatencyStats

type LatencyStats struct {
	// Total operations
	Ops int64 `json:"ops"`
	// Timestamp at which data keeping begun
	Latency int64 `json:"latency"`
	// Histogram representation of latency data
	Histogram []*LatencyHistogramEntry `json:"histogram"`
}

type LeaveServer

type LeaveServer struct {
	// Whether to not send a leave message
	LeaveSilently *bool
}

func (*LeaveServer) SetLeaveSilently

func (ls *LeaveServer) SetLeaveSilently(b bool) *LeaveServer

func (*LeaveServer) UnsetLeaveSilently

func (ls *LeaveServer) UnsetLeaveSilently() *LeaveServer

type Lockout

type Lockout struct {
	// Attempt counter
	Attempts int `json:"attempts"`
	// Time at which this lockout expires
	Expiry *Time `json:"expiry"`
}

Lockout information

type Login

type Login struct {
	// Email
	Email string `json:"email,omitempty"`
	// Password
	Password string `json:"password,omitempty"`
	// Unvalidated or authorised MFA ticket
	// Used to resolve the correct account
	MFATicket string `json:"mfa_ticket,omitempty"`
	// MFA response
	MFAResponse *MFAResponse `json:"mfa_response,omitempty"`
	// Friendly name used for the session
	FriendlyName string `json:"friendly_name,omitempty"`
}

type LoginResponse

type LoginResponse struct {
	Result LoginResponseType `json:"result"`
	// Unique ID
	ID ULID `json:"_id"`
	// User ID
	UserID ULID   `json:"user_id"`
	Ticket string `json:"ticket"`
	// Session token
	Token string `json:"token"`
	// Display name
	Name           string               `json:"name"`
	Subscription   *WebPushSubscription `json:"subscription"`
	AllowedMethods []string             `json:"allowed_methods"`
}

type LoginResponseType

type LoginResponseType string
const (
	LoginResponseTypeSuccess  LoginResponseType = "Success"
	LoginResponseTypeMFA      LoginResponseType = "MFA"
	LoginResponseTypeDisabled LoginResponseType = "Disabled"
)

type MFAMethod

type MFAMethod string
const (
	MFAMethodPassword MFAMethod = "Password"
	MFAMethodRecovery MFAMethod = "Recovery"
	MFAMethodTOTP     MFAMethod = "Totp"
)

type MFAResponse

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

type MFAStatus

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

type MFATicket

type MFATicket struct {
	// Unique ID
	ID ULID `json:"_id"`
	// Account ID
	AccountID ULID `json:"account_id"`
	// Unique Token
	Token string `json:"token"`
	// Whether this ticket has been validated (can be used for account actions)
	Validated bool `json:"validated"`
	// Whether this ticket is authorised (can be used to log a user in)
	Authorised bool `json:"authorised"`
	// TOTP code at time of ticket creation
	LastTOTPCode string `json:"last_totp_code"`
}

type Marshal

type Marshal func(any) ([]byte, error)

type Masquerade

type Masquerade struct {
	// Replace the display name shown on this message
	Name string `json:"name,omitempty"`
	// Replace the avatar shown on this message (URL to image file)
	Avatar string `json:"avatar,omitempty"`
	// Replace the display role colour shown on this message
	// Must have ManageRole permission to use
	Colour string `json:"colour,omitempty"`
}

Name and / or avatar override information

type Member

type Member struct {
	// Unique member ID
	ID MemberID `json:"_id"`
	// Time at which this user joined the server
	JoinedAt Time `json:"joined_at"`
	// Member's nickname
	Nickname string `json:"nickname,omitempty"`
	// Avatar attachment
	Avatar *AutumnFile `json:"avatar,omitempty"`
	// Member's roles
	Roles []ULID `json:"roles,omitempty"`
	// Timestamp this member is timed out until
	Timeout *Time `json:"timeout,omitempty"`
}

func (Member) GetKey

func (o Member) GetKey() ULID

type MemberID

type MemberID struct {
	Server ULID `json:"server"`
	User   ULID `json:"user"`
}

Composite primary key consisting of server and user id

type Message

type Message struct {
	// Unique ID
	ID ULID `json:"_id"`
	// Unique value generated by client sending this message
	Nonce *string `json:"nonce,omitempty"`
	// ID of the channel this message was sent in
	Channel ULID `json:"channel"`
	// ID of the user or webhook that sent this message
	Author ULID `json:"author"`
	// The webhook that sent this message
	Webhook *MessageWebhook `json:"webhook,omitempty"`
	// Message content
	Content string              `json:"content,omitempty"`
	System  *SystemEventMessage `json:"system,omitempty"`
	// Array of attachments
	Attachments []*AutumnFile `json:"attachments,omitempty"`
	// Time at which this message was last edited
	Edited *Time `json:"edited"`
	// Attached embeds to this message
	Embeds []*Embed `json:"embeds,omitempty"`
	// Array of user IDs mentioned in this message
	Mentions []ULID `json:"mentions,omitempty"`
	// Array of message IDs this message is replying to
	Replies []ULID `json:"replies,omitempty"`
	// Hashmap of emoji IDs to array of user IDs
	Reactions    map[string][]ULID    `json:"reactions,omitempty"`
	Interactions *MessageInteractions `json:"interactions,omitempty"`
	Masquerade   *Masquerade          `json:"masquerade,omitempty"`
}

func (Message) GetKey

func (o Message) GetKey() ULID

func (*Message) ToOptimized

func (o *Message) ToOptimized() *OptimizedMessage

type MessageAppend

type MessageAppend struct {
	MessageID ULID `json:"id"`
	Channel   ULID `json:"channel"`
	// will contain only `embeds`
	Append *PartialMessage `json:"append"`
}

Message has data being appended to it.

type MessageDelete

type MessageDelete struct {
	MessageID ULID `json:"id"`
	Channel   ULID `json:"channel"`
}

Message has been deleted.

type MessageInteractions

type MessageInteractions struct {
	// Reactions which should always appear and be distinct
	Reactions []string `json:"reactions,omitempty"`
	// Whether reactions should be restricted to the given list
	// Can only be set to true if reactions list is of at least length 1
	RestrictReactions bool `json:"restrict_reactions,omitempty"`
}

Information to guide interactions on this message

type MessageReact

type MessageReact struct {
	MessageID ULID  `json:"id"`
	ChannelID ULID  `json:"channel_id"`
	UserID    ULID  `json:"user_id"`
	Emoji     Emoji `json:"emoji_id"`
}

A reaction has been added to a message.

type MessageRemoveReaction

type MessageRemoveReaction struct {
	ID        ULID  `json:"id"`
	ChannelID ULID  `json:"channel_id"`
	Emoji     Emoji `json:"emoji_id"`
}

A certain reaction has been removed from the message.

type MessageSort

type MessageSort int
const (
	MessageSortByNone MessageSort = iota
	MessageSortByRelevance
	MessageSortByLatest
	MessageSortByOldest
)

func (MessageSort) MarshalJSON

func (v MessageSort) MarshalJSON() ([]byte, error)

func (MessageSort) String

func (v MessageSort) String() string

type MessageUnreact

type MessageUnreact struct {
	MessageID ULID  `json:"id"`
	ChannelID ULID  `json:"channel_id"`
	UserID    ULID  `json:"user_id"`
	Emoji     Emoji `json:"emoji_id"`
}

A reaction has been removed from a message.

type MessageUpdate

type MessageUpdate struct {
	MessageID ULID            `json:"id"`
	Channel   ULID            `json:"channel"`
	Data      *PartialMessage `json:"data"`
}

Message edited or otherwise updated.

type MessageWebhook

type MessageWebhook struct {
	Name   string `json:"name"`
	Avatar string `json:"avatar"`
}

type Messages

type Messages struct {
	Messages []*Message `json:"messages"`
	Users    []*User    `json:"users"`
	Members  []*Member  `json:"members"`
}

type MultiFactorAuthentication

type MultiFactorAuthentication struct {
	// TOTP MFA token, enabled if present
	// (2-Factor)
	TOTPToken *TOTP `json:"totp_token,omitempty"`
	// Recovery codes
	RecoveryCodes []string `json:"recovery_codes,omitempty"`
}

MFA configuration

type Node

type Node struct {
	// Revolt API Version
	Revolt string `json:"revolt"`
	// Features enabled on this Revolt node
	Features FeatureConfiguration `json:"features"`
	// WebSocket URL
	WS string `json:"ws"`
	// URL pointing to the client serving this node
	App string `json:"app"`
	// Web Push VAPID public key
	VAPID string `json:"vapid"`
	// Build information
	Build BuildInformation `json:"build"`
}

type OptimizedAutumnFile

type OptimizedAutumnFile struct {
	ID          string
	Tag         string
	Filename    string
	Metadata    *OptimizedAutumnFileMetadata
	ContentType string
	Size        int
	Flags       OptimizedAutumnFileFlags
	MessageID   ULID
	UserID      ULID
	ServerID    ULID
	ObjectID    ULID
}

type OptimizedAutumnFileFlags

type OptimizedAutumnFileFlags int
const (
	OptimizedAutumnFileFlagsDeleted OptimizedAutumnFileFlags = 1 << (0 + iota)
	OptimizedAutumnFileFlagsIsDeletedNil
	OptimizedAutumnFileFlagsReported
	OptimizedAutumnFileFlagsIsReportedNil
)

type OptimizedAutumnFileMetadata

type OptimizedAutumnFileMetadata struct {
	Type   OptimizedAutumnFileMetadataType
	Width  int
	Height int
}

type OptimizedAutumnFileMetadataType

type OptimizedAutumnFileMetadataType int
const (
	OptimizedAutumnFileMetadataTypeUnknown OptimizedAutumnFileMetadataType = iota
	OptimizedAutumnFileMetadataTypeFile
	OptimizedAutumnFileMetadataTypeText
	OptimizedAutumnFileMetadataTypeImage
	OptimizedAutumnFileMetadataTypeVideo
	OptimizedAutumnFileMetadataTypeAudio
)

type OptimizedChannel

type OptimizedChannel struct {
	Type OptimizedChannelType
	// Unique ID
	ID ULID
	// ID of the server this channel belongs to
	Server ULID
	// Display name of the channel
	Name  string
	Flags OptimizedChannelFlags
	// User ID of the owner of the group
	Owner ULID
	// Channel description
	Description string
	Icon        *OptimizedAutumnFile
	// 2-tuple of user ids participating in direct message / Array of user ids participating in channel
	Recipients []ULID
	// ID of the last message sent in this channel
	LastMessageID ULID
	// Permissions assigned to members of this group (does not apply to the owner of the group)
	Permissions Permissions
	// Representation of a single permission override as it appears on models and in the database
	DefaultPermissions *PermissionOverride
	// Permissions assigned based on role to this channel
	RolePermissions map[ULID]PermissionOverride
	// ID of the user this channel belongs to
	User ULID
}

Same as Channel, but with flags bitfield instead of bools

func (OptimizedChannel) GetKey

func (c OptimizedChannel) GetKey() ULID

type OptimizedChannelFlags

type OptimizedChannelFlags int
const (
	OptimizedChannelFlagActive OptimizedChannelFlags = 1 << (0 + iota)
	OptimizedChannelFlagNSFW
)

type OptimizedChannelType

type OptimizedChannelType int
const (
	OptimizedChannelTypeUnknown OptimizedChannelType = iota
	OptimizedChannelTypeSavedMessages
	OptimizedChannelTypeDirectMessage
	OptimizedChannelTypeGroup
	OptimizedChannelTypeTextChannel
	OptimizedChannelTypeVoiceChannel
)

type OptimizedCustomEmoji

type OptimizedCustomEmoji struct {
	ID        ULID
	Parent    *OptimizedCustomEmojiParent
	CreatorID ULID
	Name      string
	Flags     OptimizedCustomEmojiFlags
}

func (OptimizedCustomEmoji) GetKey

func (e OptimizedCustomEmoji) GetKey() ULID

type OptimizedCustomEmojiFlags

type OptimizedCustomEmojiFlags int
const (
	OptimizedCustomEmojiFlagsAnimated OptimizedCustomEmojiFlags = 1 << (0 + iota)
	OptimizedCustomEmojiFlagsNSFW
)

type OptimizedCustomEmojiParent

type OptimizedCustomEmojiParent struct {
	Type OptimizedCustomEmojiParentType
	ID   ULID
}

type OptimizedCustomEmojiParentType

type OptimizedCustomEmojiParentType int
const (
	OptimizedCustomEmojiParentTypeUnknown OptimizedCustomEmojiParentType = iota
	OptimizedCustomEmojiParentTypeServer
	OptimizedCustomEmojiParentTypeDetached
)

type OptimizedEmbed

type OptimizedEmbed struct {
	Type        OptimizedEmbedType
	URL         string
	OriginalURL string
	Special     *OptimizedEmbedSpecial
	Title       string
	Description string
	Image       *OptimizedEmbedImage
	Video       *EmbedVideo
	SiteName    string
	IconURL     string
	Media       *OptimizedAutumnFile
	Colour      string
	Width       int
	Height      int
	Size        OptimizedEmbedImageSize
}

type OptimizedEmbedImage

type OptimizedEmbedImage struct {
	URL    string
	Width  int
	Height int
	Size   OptimizedEmbedImageSize
}

type OptimizedEmbedImageSize

type OptimizedEmbedImageSize int
const (
	OptimizedEmbedImageSizeUnknown OptimizedEmbedImageSize = iota
	OptimizedEmbedImageSizeLarge
	OptimizedEmbedImageSizePreview
)

type OptimizedEmbedSpecial

type OptimizedEmbedSpecial struct {
	Type        OptimizedEmbedSpecialType
	ID          string
	ContentType string
	Timestamp   string
}

type OptimizedEmbedSpecialType

type OptimizedEmbedSpecialType int
const (
	OptimizedEmbedSpecialTypeUnknown OptimizedEmbedSpecialType = iota
	OptimizedEmbedSpecialTypeNone
	OptimizedEmbedSpecialTypeGIF
	OptimizedEmbedSpecialTypeYouTube
	OptimizedEmbedSpecialTypeLightspeed
	OptimizedEmbedSpecialTypeTwitch
	OptimizedEmbedSpecialTypeSpotify
	OptimizedEmbedSpecialTypeSoundcloud
	OptimizedEmbedSpecialTypeBandcamp
	OptimizedEmbedSpecialTypeStreamable
)

type OptimizedEmbedType

type OptimizedEmbedType int
const (
	OptimizedEmbedTypeUnknown OptimizedEmbedType = iota
	OptimizedEmbedTypeWebsite
	OptimizedEmbedTypeImage
	OptimizedEmbedTypeVideo
	OptimizedEmbedTypeText
	OptimizedEmbedTypeNone
)

type OptimizedMessage

type OptimizedMessage struct {
	ID           ULID
	Nonce        *string
	Channel      ULID
	Author       ULID
	Webhook      *MessageWebhook
	Content      string
	System       *OptimizedSystemEventMessage
	Attachments  []*OptimizedAutumnFile
	Edited       *Time
	Embeds       []*OptimizedEmbed
	Mentions     []ULID
	Replies      []ULID
	Reactions    map[string][]ULID
	Interactions *MessageInteractions
	Masquerade   *Masquerade
}

func (OptimizedMessage) GetKey

func (o OptimizedMessage) GetKey() ULID

type OptimizedPresence

type OptimizedPresence int
const (
	OptimizedPresenceUnknown OptimizedPresence = iota
	OptimizedPresenceOnline
	OptimizedPresenceIdle
	OptimizedPresenceFocus
	OptimizedPresenceBusy
	OptimizedPresenceInvisible
)

type OptimizedRelationshipStatus

type OptimizedRelationshipStatus int
const (
	OptimizedRelationshipStatusUnknown OptimizedRelationshipStatus = iota
	OptimizedRelationshipStatusNone
	OptimizedRelationshipStatusUser
	OptimizedRelationshipStatusFriend
	OptimizedRelationshipStatusOutgoing
	OptimizedRelationshipStatusIncoming
	OptimizedRelationshipStatusBlocked
	OptimizedRelationshipStatusBlockedOther
)

type OptimizedRole

type OptimizedRole struct {
	// Unique ID
	ID ULID
	// Role name
	Name string
	// Representation of a single permission override as it appears on models and in the database
	Permissions PermissionOverride
	// Colour used for this role
	// This can be any valid CSS colour
	Colour string
	Flags  OptimizedRoleFlags
	// Default: `0`
	// Ranking of this role
	Rank int
}

func (OptimizedRole) GetKey

func (o OptimizedRole) GetKey() ULID

type OptimizedRoleFlags

type OptimizedRoleFlags int
const (
	OptimizedRoleFlagsHoist OptimizedRoleFlags = 1 << (0 + iota)
)

type OptimizedServer

type OptimizedServer struct {
	// Unique ID
	ID ULID
	// User ID of the owner
	Owner ULID
	// Name of the server
	Name string
	// Description for the server
	Description string
	// Channels within this server
	Channels []ULID
	// Categories for this server
	Categories []*Category
	// System message channel assignments
	SystemMessages *SystemMessages
	// Default set of server and channel permissions
	DefaultPermissions Permissions
	Icon               *OptimizedAutumnFile
	Banner             *OptimizedAutumnFile
	// Bitfield of server flags
	Flags OptimizedServerFlags
}

func (OptimizedServer) GetKey

func (o OptimizedServer) GetKey() ULID

type OptimizedServerFlags

type OptimizedServerFlags int
const (
	OptimizedServerFlagsVerified OptimizedServerFlags = 1 << (0 + iota)
	OptimizedServerFlagsOfficial
	OptimizedServerFlagsNSFW
	OptimizedServerFlagsAnalytics
	OptimizedServerFlagsDiscoverable
)

type OptimizedSystemEventMessage

type OptimizedSystemEventMessage struct {
	Type    OptimizedSystemEventMessageType
	Content string
	ID      ULID
	Name    string
	By      ULID
	From    ULID
	To      ULID
}

type OptimizedSystemEventMessageType

type OptimizedSystemEventMessageType int
const (
	OptimizedSystemEventMessageTypeUnknown OptimizedSystemEventMessageType = iota
	OptimizedSystemEventMessageTypeText
	OptimizedSystemEventMessageTypeUserAdded
	OptimizedSystemEventMessageTypeUserRemove
	OptimizedSystemEventMessageTypeUserJoined
	OptimizedSystemEventMessageTypeUserLeft
	OptimizedSystemEventMessageTypeUserKicked
	OptimizedSystemEventMessageTypeUserBanned
	OptimizedSystemEventMessageTypeChannelRenamed
	OptimizedSystemEventMessageTypeChannelDescriptionChanged
	OptimizedSystemEventMessageTypeChannelIconChanged
	OptimizedSystemEventMessageTypeChannelOwnershipChanged
)

type OptimizedUser

type OptimizedUser struct {
	ID            ULID
	Username      string
	Discriminator string
	DisplayName   string
	Avatar        *OptimizedAutumnFile
	Relations     []*UserRelation
	Status        *OptimizedUserStatus
	Profile       *OptimizedUserProfile
	Bot           *UserBot
	Relationship  OptimizedRelationshipStatus
	Flags         OptimizedUserFlags
}

func (OptimizedUser) GetKey

func (o OptimizedUser) GetKey() ULID

type OptimizedUserFlags

type OptimizedUserFlags int
const (
	OptimizedUserFlagsSuspended OptimizedUserFlags = 1 << (0 + iota)
	OptimizedUserFlagsDeleted
	OptimizedUserFlagsBanned
	OptimizedUserFlagsSpam
	OptimizedUserFlagsPrivileged
	OptimizedUserFlagsOnline
	OptimizedUserFlagsDeveloper
	OptimizedUserFlagsTranslator
	OptimizedUserFlagsSupporter
	OptimizedUserFlagsResponsibleDisclosure
	OptimizedUserFlagsFounder
	OptimizedUserFlagsPlatformModeration
	OptimizedUserFlagsActiveSupporter
	OptimizedUserFlagsPaw
	OptimizedUserFlagsEarlyAdopter
	OptimizedUserFlagsRelevantJokeBadge1
	OptimizedUserFlagsRelevantJokeBadge2
)

func NewOptimizedUserFlags

func NewOptimizedUserFlags(flags UserFlags, badges UserBadges, privileged, online bool) OptimizedUserFlags

type OptimizedUserProfile

type OptimizedUserProfile struct {
	Content    string
	Background *OptimizedAutumnFile
}

type OptimizedUserStatus

type OptimizedUserStatus struct {
	Text     string
	Presence OptimizedPresence
}

type OptimizedWebhook

type OptimizedWebhook struct {
	// Webhook ID
	ID ULID `json:"id"`
	// The name of the webhook
	Name   string               `json:"name"`
	Avatar *OptimizedAutumnFile `json:"avatar"`
	// The channel this webhook belongs to
	ChannelID ULID `json:"channel_id"`
	// The permissions for the webhook
	Permissions Permissions `json:"permissions"`
	// The private token for the webhook
	Token string `json:"token"`
}

func (OptimizedWebhook) GetKey

func (o OptimizedWebhook) GetKey() ULID

type PartialChannel

type PartialChannel struct {
	Type ChannelType `json:"channel_type"`
	// Unique ID
	ID ULID `json:"_id"`
	// ID of the server this channel belongs to
	Server ULID `json:"server"`
	// Display name of the channel
	Name string `json:"name"`
	// Whether this direct message channel is currently open on both sides
	Active *bool `json:"active"`
	// User ID of the owner of the group
	Owner ULID `json:"owner"`
	// Channel description
	Description *string     `json:"description"`
	Icon        *AutumnFile `json:"icon"`
	// 2-tuple of user ids participating in direct message / Array of user ids participating in channel
	Recipients []ULID `json:"recipients"`
	// ID of the last message sent in this channel
	LastMessageID ULID `json:"last_message_id"`
	// Permissions assigned to members of this group (does not apply to the owner of the group)
	Permissions *Permissions `json:"permissions"`
	// Representation of a single permission override as it appears on models and in the database
	DefaultPermissions *PermissionOverride `json:"default_permissions"`
	// Permissions assigned based on role to this channel
	RolePermissions *map[ULID]PermissionOverride `json:"role_permissions"`
	// ID of the user this channel belongs to
	User *ULID `json:"user"`
	// Whether this group is marked as not safe for work
	NSFW *bool `json:"nsfw"`
}

type PartialMember

type PartialMember struct {
	ID MemberID `json:"_id"`
	// Member's nickname
	Nickname *string     `json:"nickname,omitempty"`
	Avatar   *AutumnFile `json:"avatar,omitempty"`
	// Member's roles
	Roles *[]ULID `json:"roles,omitempty"`
	// ISO8601 formatted timestamp
	Timeout *Time `json:"timeout,omitempty"`
}

type PartialMessage

type PartialMessage struct {
	// Message content
	Content *string `json:"content"`
	// Attached embeds to this message
	Embeds *[]*Embed `json:"embeds"`
}

type PartialRole

type PartialRole struct {
	// Role name
	Name string `json:"name,omitempty"`
	// Representation of a single permission override as it appears on models and in the database
	Permissions *PermissionOverride `json:"permissions,omitempty"`
	// Colour used for this role
	// This can be any valid CSS colour
	Colour string `json:"colour,omitempty"`
	// Whether this role should be shown separately on the member sidebar
	Hoist *bool `json:"hoist,omitempty"`
	// Default: `0`
	// Ranking of this role
	Rank *int `json:"rank,omitempty"`
}

type PartialServer

type PartialServer struct {
	// Unique ID
	ID ULID `json:"_id"`
	// User ID of the owner
	Owner string `json:"owner,omitempty"`
	// Name of the server
	Name *string `json:"name,omitempty"`
	// Description for the server
	Description *string `json:"description,omitempty"`
	// Channels within this server
	Channels *[]ULID `json:"channels,omitempty"`
	// Categories for this server
	Categories *[]*Category `json:"categories,omitempty"`
	// System message channel assignments
	SystemMessages *SystemMessages `json:"system_messages,omitempty"`
	// Roles for this server
	Roles *map[ULID]*Role `json:"roles,omitempty"`
	// Default set of server and channel permissions
	DefaultPermissions *Permissions `json:"default_permissions,omitempty"`
	Icon               *AutumnFile  `json:"icon,omitempty"`
	Banner             *AutumnFile  `json:"banner,omitempty"`
	// Bitfield of server flags
	Flags *ServerFlags `json:"flags,omitempty"`
	// Whether this server is flagged as not safe for work
	NSFW *bool `json:"nsfw,omitempty"`
	// Whether to enable analytics
	Analytics *bool `json:"analytics,omitempty"`
	// Whether this server should be publicly discoverable
	Discoverable *bool `json:"discoverable,omitempty"`
}

type PartialUser

type PartialUser struct {
	// Unique ID
	ID ULID `json:"_id"`
	// Username
	Username *string `json:"username"`
	// Discriminator
	Discriminator *string `json:"discriminator"`
	// Display name
	DisplayName *string     `json:"display_name"`
	Avatar      *AutumnFile `json:"avatar"`
	// Relationships with other users
	Relations *[]*UserRelation `json:"relations"`
	// Bitfield of user badges
	Badges *UserBadges `json:"badges"`
	// User's active status
	Status *UserStatus `json:"status"`
	// User's profile
	Profile *UserProfile `json:"profile"`
	// Enum of user flags
	Flags *UserFlags `json:"flags"`
	// Bot information for if the user is a bot
	Bot *UserBot `json:"bot"`
	// User's relationship with another user (or themselves)
	Relationship *RelationshipStatus `json:"relationship"`
	// Whether this user is currently online
	Online *bool `json:"online"`
}

type PartialWebhook

type PartialWebhook struct {
	// Webhook ID
	ID ULID `json:"id"`
	// The name of the webhook
	Name   string      `json:"name,omitempty"`
	Avatar *AutumnFile `json:"avatar,omitempty"`
	// The permissions for the webhook
	Permissions *Permissions `json:"permissions,omitempty"`
}

type PasswordReset

type PasswordReset struct {
	// Token required to change password
	Token string `json:"token"`
	// Time at which this token expires
	Expiry *Time `json:"expiry,omitempty"`
}

Password reset information

type PermissionOverride

type PermissionOverride struct {
	// Allow bit flags
	Allow Permissions `json:"a"`
	// Disallow bit flags
	Disallow Permissions `json:"d"`
}

type Permissions

type Permissions int64
const (
	PermissionManageChannel Permissions = 1 << iota
	PermissionManageServer
	PermissionManagePermissions
	PermissionManageRoles
	PermissionManageCustomisation
	PermissionKickMembers Permissions = 1 << (6 + iota)
	PermissionBanMembers
	PermissionTimeoutMembers
	PermissionAssignRoles
	PermissionChangeNickname
	PermissionManageNicknames
	PermissionChangeAvatar
	PermissionRemoveAvatars
	PermissionViewChannel Permissions = 1 << (20 + iota)
	PermissionReadMessageHistory
	PermissionSendMessages
	PermissionManageMessages
	PermissionManageWebhooks
	PermissionInviteOthers
	PermissionSendEmbeds
	PermissionUploadFiles
	PermissionMasquerade
	PermissionReact
	PermissionConnect
	PermissionSpeak
	PermissionVideo
	PermissionMuteMembers
	PermissionDeafenMembers
	PermissionMoveMembers
)

type Presence

type Presence string
const (
	// User is online
	PresenceOnline Presence = "Online"
	// User is not currently available
	PresenceIdle Presence = "Idle"
	// User is focusing / will only receive mentions
	PresenceFocus Presence = "Focus"
	// User is busy / will not receive any notifications
	PresenceBusy Presence = "Busy"
	// User appears to be offline
	PresenceInvisible Presence = "Invisible"
)

func (Presence) ToOptimized

func (o Presence) ToOptimized() OptimizedPresence

type PublicBot

type PublicBot struct {
	// Bot ID
	ID ULID `json:"_id"`
	// Bot username
	Username string `json:"username"`
	// Profile Avatar
	Avatar string `json:"avatar"`
	// Profile Description
	Description string `json:"description"`
}

type QueryExecStats

type QueryExecStats struct {
	// Query collection scan stats
	CollectionScans CollectionScans `json:"collectionScans"`
}

type Ready

type Ready struct {
	Users    []*User        `json:"users"`
	Servers  []*Server      `json:"servers"`
	Channels []*Channel     `json:"channels"`
	Members  []*Member      `json:"members"`
	Emojis   *[]CustomEmoji `json:"emojis"`
}

Data for use by client, data structures match the API specification.

type RelationshipStatus

type RelationshipStatus string

User's relationship with another user (or themselves)

const (
	RelationshipStatusNone         RelationshipStatus = "None"
	RelationshipStatusUser         RelationshipStatus = "User"
	RelationshipStatusFriend       RelationshipStatus = "Friend"
	RelationshipStatusOutgoing     RelationshipStatus = "Outgoing"
	RelationshipStatusIncoming     RelationshipStatus = "Incoming"
	RelationshipStatusBlocked      RelationshipStatus = "Blocked"
	RelationshipStatusBlockedOther RelationshipStatus = "BlockedOther"
)

func (RelationshipStatus) ToOptimized

type Reply

type Reply struct {
	// Message ID
	ID ULID `json:"id"`
	// Whether this reply should mention the message's author
	Mention bool `json:"mention"`
}

type Report

type Report struct {
	Status          ReportStatus `json:"status"`
	RejectionReason string       `json:"rejection_reason,omitempty"`
	ClosedAt        *Time        `json:"closed_at,omitempty"`
	// Unique ID
	ID ULID `json:"_id"`
	// ID of the user creating this report
	AuthorID ULID `json:"author_id"`
	// The content being reported
	Content ReportContent `json:"content"`
	// Additional report context
	AdditionalContext string `json:"additional_context"`
	// Additional notes included on the report
	Notes string `json:"notes"`
}

type ReportContent

type ReportContent struct {
	Type ReportContentType `json:"type"`
	// ID of the message / ID of the server / ID of the user
	ID ULID `json:"id"`
	// Reason for reporting content (message or server)
	ReportReason ReportReason `json:"report_reason"`
	// Message context
	MessageID ULID `json:"message_id,omitempty"`
}

type ReportContentType

type ReportContentType string
const (
	ReportContentTypeMessage ReportContentType = "Message"
	ReportContentTypeServer  ReportContentType = "Server"
	ReportContentTypeUser    ReportContentType = "User"
)

type ReportReason

type ReportReason string
const (
	// No reason has been specified
	ReportReasonNoneSpecified ReportReason = "NoneSpecified"
	// Illegal content catch-all reason
	ReportReasonIllegal ReportReason = "Illegal" // Message/Server
	// Selling or facilitating use of drugs or other illegal goods
	ReportReasonIllegalGoods ReportReason = "IllegalGoods" // Message/Server
	// Extortion or blackmail
	ReportReasonIllegalExtortion ReportReason = "IllegalExtortion" // Message/Server
	// Revenge or child pornography
	ReportReasonIllegalPornography ReportReason = "IllegalPornography" // Message/Server
	// Illegal hacking activity
	ReportReasonIllegalHacking ReportReason = "IllegalHacking" // Message/Server
	// Extreme violence, gore, or animal cruelty
	// With exception to violence potrayed in media / creative arts
	ReportReasonExtremeViolence ReportReason = "ExtremeViolence" // Message/Server
	// Content that promotes harm to others / self
	ReportReasonProtesHarm ReportReason = "ProtesHarm" // Message/Server
	// Unsolicited advertisements
	ReportReasonUnsolicitedSpam ReportReason = "UnsolicitedSpam" // Message/Server/User
	// This is a raid
	ReportReasonRaid ReportReason = "Raid" // Message/Server
	// Spam or platform abuse / User is sending spam or otherwise abusing the platform
	ReportReasonSpamAbuse ReportReason = "SpamAbuse" // Message/Server/User
	// Scams or fraud
	ReportReasonScamsFraud ReportReason = "ScamsFraud" // Message/Server
	// Distribution of malware of malicious links
	ReportReasonMalware ReportReason = "Malware" // Message/Server
	// Harassment or abuse targeted at another user
	ReportReasonHarassment ReportReason = "Harassment" // Message/Server
	// User's profile contains inappropriate content for a general audience
	ReportReasonInappropriateProfile ReportReason = "InappropriateProfile" // User
	// User is impersonating another user
	ReportReasonImpersonation ReportReason = "Impersonation" // User
	// User is evading a ban
	ReportReasonBanEvasion ReportReason = "BanEvasion" // User
	// User is not of minimum age to use the platform
	ReportReasonUnderage ReportReason = "Underage" // User
)

type ReportStatus

type ReportStatus string
const (
	ReportStatusCreated  ReportStatus = "Created"
	ReportStatusRejected ReportStatus = "Rejected"
	ReportStatusResolved ReportStatus = "Resolved"
)

type RequestOptions

type RequestOptions struct {
	Body            io.ReadCloser
	JSON            any
	Header          http.Header
	Unauthenticated bool
	ManualAccept    bool
	QueryValues     url.Values
}

type Role

type Role struct {
	// Role name
	Name string `json:"name"`
	// Representation of a single permission override as it appears on models and in the database
	Permissions PermissionOverride `json:"permissions"`
	// Colour used for this role
	// This can be any valid CSS colour
	Colour string `json:"colour,omitempty"`
	// Whether this role should be shown separately on the member sidebar
	Hoist bool `json:"hoist,omitempty"`
	// Default: `0`
	// Ranking of this role
	Rank int `json:"rank"`
}

func (*Role) ToOptimized

func (r *Role) ToOptimized(id ULID) *OptimizedRole

type RoleResponse

type RoleResponse struct {
	// ID of the role
	ID ULID `json:"id"`
	// Representation of a server role
	Role Role `json:"role"`
}

type Route

type Route struct {
	Method string
	Path   string
}

type SearchForMessages

type SearchForMessages struct {
	// Full-text search query
	// See [MongoDB documentation](https://docs.mongodb.com/manual/text-search/#-text-operator) for more information.
	Query string
	// Maximum number of messages to fetch
	Limit int
	// Message id before which messages should be fetched
	Before ULID
	// Message id after which messages should be fetched
	After ULID
	// Sort used for retrieving messages
	Sort MessageSort
	// Whether to include user (and member, if server channel) objects
	IncludeUsers *bool
}

type SendMessage

type SendMessage struct {
	// Unique token to prevent duplicate message sending
	IdempotencyKey string `json:"-"`
	// Message content to send
	Content string `json:"content,omitempty"`
	// Attachments to include in message
	Attachments []string `json:"attachments,omitempty"`
	// Messages to reply to
	Replies []Reply `json:"replies,omitempty"`
	// Embeds to include in message
	// Text embed content contributes to the content length cap
	Embeds []SendableEmbed `json:"embeds,omitempty"`
	// Name and / or avatar override information
	Masquerade *Masquerade `json:"masquerade,omitempty"`
	// Information to guide interactions on this message
	Interactions *MessageInteractions `json:"interactions,omitempty"`
}

func (*SendMessage) AddAttachments

func (sm *SendMessage) AddAttachments(attachments ...string) *SendMessage

func (*SendMessage) AddEmbeds

func (sm *SendMessage) AddEmbeds(embeds ...SendableEmbed) *SendMessage

func (*SendMessage) AddReply

func (sm *SendMessage) AddReply(replies ...Reply) *SendMessage

func (*SendMessage) ReplyTo

func (sm *SendMessage) ReplyTo(messages ...ULID) *SendMessage

func (*SendMessage) SetAttachments

func (sm *SendMessage) SetAttachments(attachments []string) *SendMessage

func (*SendMessage) SetContent

func (sm *SendMessage) SetContent(content string) *SendMessage

func (*SendMessage) SetEmbeds

func (sm *SendMessage) SetEmbeds(embeds []SendableEmbed) *SendMessage

func (*SendMessage) SetInteractions

func (sm *SendMessage) SetInteractions(interactions *MessageInteractions) *SendMessage

func (*SendMessage) SetMasquerade

func (sm *SendMessage) SetMasquerade(masquerade *Masquerade) *SendMessage

func (*SendMessage) SetReplies

func (sm *SendMessage) SetReplies(replies []Reply) *SendMessage

type SendableEmbed

type SendableEmbed struct {
	IconURL string `json:"icon_url,omitempty"`
	// URL in embed title
	URL string `json:"url,omitempty"`
	// Embed title
	Title string `json:"title,omitempty"`
	// Embed description
	Description string `json:"description,omitempty"`
	// Embed media
	Media string `json:"media,omitempty"`
	// Embed colour. This can be any valid CSS colour.
	Colour string `json:"colour,omitempty"`
}

type Server

type Server struct {
	// Unique ID
	ID ULID `json:"_id"`
	// User ID of the owner
	Owner ULID `json:"owner"`
	// Name of the server
	Name string `json:"name"`
	// Description for the server
	Description string `json:"description,omitempty"`
	// Channels within this server
	Channels []ULID `json:"channels"`
	// Categories for this server
	Categories []*Category `json:"categories,omitempty"`
	// System message channel assignments
	SystemMessages *SystemMessages `json:"system_messages,omitempty"`
	// Roles for this server
	Roles map[ULID]*Role `json:"roles,omitempty"`
	// Default set of server and channel permissions
	DefaultPermissions Permissions `json:"default_permissions"`
	Icon               *AutumnFile `json:"icon,omitempty"`
	Banner             *AutumnFile `json:"banner,omitempty"`
	// Bitfield of server flags
	Flags ServerFlags `json:"flags"`
	// Whether this server is flagged as not safe for work
	NSFW bool `json:"nsfw,omitempty"`
	// Whether to enable analytics
	Analytics bool `json:"analytics,omitempty"`
	// Whether this server should be publicly discoverable
	Discoverable bool `json:"discoverable,omitempty"`
}

func (*Server) ToOptimized

func (o *Server) ToOptimized() *OptimizedServer

type ServerCreate

type ServerCreate struct {
	// Unique ID
	ID ULID `json:"id"`
	// Server
	Server *Server `json:"server"`
	// Channels within this server
	Channels []*Channel `json:"channels"`
	// Emojis within this server
	Emojis []*CustomEmoji `json:"emojis"`
}

Server has been created.

type ServerDelete

type ServerDelete struct {
	ServerID ULID `json:"id"`
}

Server has been deleted.

type ServerFlags

type ServerFlags int
const (
	ServerFlagsVerified ServerFlags = 1 << (0 + iota)
	ServerFlagsOfficial
)

func (ServerFlags) ToOptimized

func (sf ServerFlags) ToOptimized() (r OptimizedServerFlags)

type ServerMemberJoin

type ServerMemberJoin struct {
	ServerID ULID `json:"id"`
	UserID   ULID `json:"user"`
}

A user has joined the server.

type ServerMemberLeave

type ServerMemberLeave struct {
	ServerID ULID `json:"id"`
	UserID   ULID `json:"user"`
}

A user has left the server.

type ServerMemberUpdate

type ServerMemberUpdate struct {
	ID   MemberID       `json:"id"`
	Data *PartialMember `json:"data"`
	// Possible values: ["Nickname", "Avatar", "Roles", "Timeout"]
	Clear []string `json:"clear"`
}

Server member details updated.

func (*ServerMemberUpdate) IsAvatarRemoved

func (smu *ServerMemberUpdate) IsAvatarRemoved() bool

Whether avatar was removed.

func (*ServerMemberUpdate) IsNicknameRemoved

func (smu *ServerMemberUpdate) IsNicknameRemoved() bool

Whether nickname was removed.

func (*ServerMemberUpdate) IsRolesWereCleared

func (smu *ServerMemberUpdate) IsRolesWereCleared() bool

Whether roles were cleared.

func (*ServerMemberUpdate) IsTimeoutRemoved

func (smu *ServerMemberUpdate) IsTimeoutRemoved() bool

Whether timeout was removed.

type ServerResponse

type ServerResponse struct {
	Server   Server    `json:"server"`
	Channels []Channel `json:"channels"`
}

type ServerRoleDelete

type ServerRoleDelete struct {
	ServerID ULID `json:"id"`
	RoleID   ULID `json:"role_id"`
}

Server role has been deleted.

type ServerRoleUpdate

type ServerRoleUpdate struct {
	ServerID ULID         `json:"id"`
	RoleID   ULID         `json:"role_id"`
	Data     *PartialRole `json:"data"`
	// Possible values: ["Colour"]
	Clear     []string `json:"clear"`
	IsCreated bool     `json:"-"`
}

Server role has been updated or created.

func (*ServerRoleUpdate) IsColourRemoved

func (sru *ServerRoleUpdate) IsColourRemoved() bool

Whether colour was removed.

type ServerUpdate

type ServerUpdate struct {
	ServerID ULID           `json:"id"`
	Data     *PartialServer `json:"data"`
	// Possible values: ["Description", "Categories", "SystemMessages", "Icon", "Banner"]
	Clear []string `json:"clear"`
}

Server details updated.

func (*ServerUpdate) IsBannerRemoved

func (su *ServerUpdate) IsBannerRemoved() bool

Whether banner was removed.

func (*ServerUpdate) IsCategoriesWereRemoved

func (su *ServerUpdate) IsCategoriesWereRemoved() bool

Whether categories were removed.

func (*ServerUpdate) IsDescriptionCleared

func (su *ServerUpdate) IsDescriptionCleared() bool

Whether description was cleared.

func (*ServerUpdate) IsIconRemoved

func (su *ServerUpdate) IsIconRemoved() bool

Whether icon was removed.

func (*ServerUpdate) IsSystemMessagesWereRemoved

func (su *ServerUpdate) IsSystemMessagesWereRemoved() bool

Whether system messages were removed.

type Session

type Session struct {
	ID   ULID   `json:"_id"`
	Name string `json:"name"`
}

type SetDefaultPermission

type SetDefaultPermission struct {
	// Permission values to set for members in a `Group`
	Permission Permissions
	// Representation of a single permission override
	Permissions *PermissionOverride
}

func (SetDefaultPermission) MarshalJSON

func (p SetDefaultPermission) MarshalJSON() ([]byte, error)

type Setting

type Setting struct {
	Timestamp int64
	Value     string
}

func (*Setting) UnmarshalJSON

func (s *Setting) UnmarshalJSON(d []byte) (err error)

type Snapshot

type Snapshot struct {
	// Users involved in snapshot
	Users []*User `json:"_users,omitempty"`
	// Channels involved in snapshot
	Channels []*Channel `json:"_channels,omitempty"`
	// Server involved in snapshot
	Server *Server `json:"_server,omitempty"`
	// Unique ID
	ID ULID `json:"_id"`
	// Report parent ID
	ReportID ULID `json:"report_id,omitempty"`
	// Enum to map into different models that can be saved in a snapshot
	Content *SnapshotContent `json:"content"`
}

type SnapshotContent

type SnapshotContent struct {
	Type SnapshotContentType `json:"_type"`
	// [Message] Context before the message
	PriorContext []*Message `json:"_prior_context"`
	// [Message] Context after the message
	LeadingContext []*Message `json:"_leading_context"`
	// [Message,Server,User] Unique ID
	ID ULID `json:"_id"`
	// [Message] Unique value generated by client sending this message
	Nonce *string `json:"nonce"`
	// [Message] ID of the channel this message was sent in
	Channel ULID `json:"channel"`
	// [Message] ID of the user or webhook that sent this message
	Author ULID `json:"author"`
	// [Message] Information about the webhook bundled with Message
	Webhook *MessageWebhook `json:"webhook"`
	// [Message] Message content
	Content string `json:"content"`
	// [Message]
	System *SystemEventMessage `json:"system"`
	// [Message]
	Attachments []*AutumnFile `json:"attachments"`
	// [Message]
	Edited *Time `json:"edited"`
	// [Message] Attached embeds to this message
	Embeds []*Embed `json:"embeds"`
	// [Message] Array of user IDs mentioned in this message
	Mentions []ULID `json:"mentions"`
	// [Message] Array of message IDs this message is replyingto
	Replies []ULID `json:"replies"`
	// [Message] Hashmap of emoji IDs to array of user IDs
	Reactions map[string][]ULID `json:"reactions"`
	// [Message]
	Interactions *MessageInteractions `json:"interactions"`
	// [Message]
	Masquerade *Masquerade `json:"masquerade"`

	// [Server] User ID of the owner
	Owner ULID `json:"owner"`
	// [Server] Name of the server
	Name string `json:"name"`
	// [Server] Description for the server
	Description string `json:"description"`
	// [Server] Channels within this server
	Channels []ULID `json:"channels"`
	// [Server] Categories for this server
	Categories []*Category `json:"categories"`
	// [Server] System message channel assignments
	SystemMessages *SystemMessages `json:"system_messages"`
	// [Server] Roles for this server
	Roles map[ULID]*Role `json:"roles"`
	// [Server] Default set of server and channel permissions
	DefaultPermissions Permissions `json:"default_permissions"`
	// [Server]
	Icon *AutumnFile `json:"icon"`
	// [Server]
	Banner *AutumnFile `json:"banner"`
	// [Server,User] Bitfield of server flags / Enum of user flags
	Flags int `json:"flags"`
	// [Server] Whether this server is flagged as not safe for work
	NSFW bool `json:"nsfw"`
	// [Server] Whether to enable analytics
	Analytics bool `json:"analytics"`
	// [Server] Whether this server should be publicly discoverable
	Discoverable bool `json:"discoverable"`

	// [User] Username
	Username string `json:"username"`
	// [User] Discriminator
	Discriminator string `json:"discriminator"`
	// [User] Display name
	DisplayName string `json:"display_name"`
	// [User]
	Avatar *AutumnFile `json:"avatar"`
	// [User] Relationships with other users
	Relations []*UserRelation `json:"relations"`
	// [User] Bitfield of user badges
	Badges UserBadges `json:"badges"`
	// [User] User's active status
	Status *UserStatus `json:"status"`
	// [User] User's profile
	Profile *UserProfile `json:"profile"`

	// [User] Whether this user is privileged
	Privileged bool `json:"privileged"`
	// [User] Bot information for if the user is a bot
	Bot *UserBot `json:"bot"`
	// [User] User's relationship with another user (or themselves)
	Relationship RelationshipStatus `json:"relationship"`
	// [User] Whether this user is currently online
	Online bool `json:"online"`
}

func (*SnapshotContent) ToMessage

func (sc *SnapshotContent) ToMessage() *Message

func (*SnapshotContent) ToServer

func (sc *SnapshotContent) ToServer() *Server

func (*SnapshotContent) ToUser

func (sc *SnapshotContent) ToUser() *User

type SnapshotContentType

type SnapshotContentType string
const (
	SnapshotContentTypeMessage SnapshotContentType = "Message"
	SnapshotContentTypeServer  SnapshotContentType = "Server"
	SnapshotContentTypeUser    SnapshotContentType = "User"
)

type Socket

type Socket struct {
	Token      string
	Dialer     WebsocketDialer
	Connection *websocket.Conn
	URL        *url.URL
	Me         *User
	Events     Events

	Cache    *GenericCache
	Logger   *slog.Logger
	Arshaler JSONArshaler
	// contains filtered or unexported fields
}

func NewSocket

func NewSocket(token string, config *SocketConfig) (socket *Socket, err error)

func (*Socket) Authenticate

func (socket *Socket) Authenticate() error

func (*Socket) BeginTyping

func (socket *Socket) BeginTyping(channel ULID) error

func (*Socket) Close

func (socket *Socket) Close() error

func (*Socket) CloseWithCode

func (socket *Socket) CloseWithCode(closeCode int) error

func (*Socket) Connect

func (socket *Socket) Connect() error

func (*Socket) EndTyping

func (socket *Socket) EndTyping(channel ULID) error

func (*Socket) Latency

func (socket *Socket) Latency() time.Duration

func (*Socket) LatencyMs

func (socket *Socket) LatencyMs() float64

func (*Socket) Listen

func (socket *Socket) Listen()

func (*Socket) OnAuth

func (socket *Socket) OnAuth(f func(*Auth)) *Subscription[*Auth]

func (*Socket) OnAuthenticated

func (socket *Socket) OnAuthenticated(f func(*Authenticated)) *Subscription[*Authenticated]

func (*Socket) OnBulkDeleteMessage

func (socket *Socket) OnBulkDeleteMessage(f func(*BulkDeleteMessage)) *Subscription[*BulkDeleteMessage]

func (*Socket) OnChannelAck

func (socket *Socket) OnChannelAck(f func(*ChannelAck)) *Subscription[*ChannelAck]

func (*Socket) OnChannelCreate

func (socket *Socket) OnChannelCreate(f func(*Channel)) *Subscription[*Channel]

func (*Socket) OnChannelDelete

func (socket *Socket) OnChannelDelete(f func(*ChannelDelete)) *Subscription[*ChannelDelete]

func (*Socket) OnChannelGroupJoin

func (socket *Socket) OnChannelGroupJoin(f func(*ChannelGroupJoin)) *Subscription[*ChannelGroupJoin]

func (*Socket) OnChannelGroupLeave

func (socket *Socket) OnChannelGroupLeave(f func(*ChannelGroupLeave)) *Subscription[*ChannelGroupLeave]

func (*Socket) OnChannelStartTyping

func (socket *Socket) OnChannelStartTyping(f func(*ChannelStartTyping)) *Subscription[*ChannelStartTyping]

func (*Socket) OnChannelStopTyping

func (socket *Socket) OnChannelStopTyping(f func(*ChannelStopTyping)) *Subscription[*ChannelStopTyping]

func (*Socket) OnChannelUpdate

func (socket *Socket) OnChannelUpdate(f func(*ChannelUpdate)) *Subscription[*ChannelUpdate]

func (*Socket) OnEmojiCreate

func (socket *Socket) OnEmojiCreate(f func(*CustomEmoji)) *Subscription[*CustomEmoji]

func (*Socket) OnEmojiDelete

func (socket *Socket) OnEmojiDelete(f func(*EmojiDelete)) *Subscription[*EmojiDelete]

func (*Socket) OnError

func (socket *Socket) OnError(f func(error)) *Subscription[error]

func (*Socket) OnMessage

func (socket *Socket) OnMessage(f func(*Message)) *Subscription[*Message]

func (*Socket) OnMessageAppend

func (socket *Socket) OnMessageAppend(f func(*MessageAppend)) *Subscription[*MessageAppend]

func (*Socket) OnMessageDelete

func (socket *Socket) OnMessageDelete(f func(*MessageDelete)) *Subscription[*MessageDelete]

func (*Socket) OnMessageReact

func (socket *Socket) OnMessageReact(f func(*MessageReact)) *Subscription[*MessageReact]

func (*Socket) OnMessageRemoveReaction

func (socket *Socket) OnMessageRemoveReaction(f func(*MessageRemoveReaction)) *Subscription[*MessageRemoveReaction]

func (*Socket) OnMessageUnreact

func (socket *Socket) OnMessageUnreact(f func(*MessageUnreact)) *Subscription[*MessageUnreact]

func (*Socket) OnMessageUpdate

func (socket *Socket) OnMessageUpdate(f func(*MessageUpdate)) *Subscription[*MessageUpdate]

func (*Socket) OnRaw

func (socket *Socket) OnRaw(f func(map[string]any)) *Subscription[map[string]any]

func (*Socket) OnReady

func (socket *Socket) OnReady(f func(*Ready)) *Subscription[*Ready]

func (*Socket) OnReportCreate

func (socket *Socket) OnReportCreate(f func(*Report)) *Subscription[*Report]

func (*Socket) OnRevoltError

func (socket *Socket) OnRevoltError(f func(string)) *Subscription[string]

func (*Socket) OnServerCreate

func (socket *Socket) OnServerCreate(f func(*ServerCreate)) *Subscription[*ServerCreate]

func (*Socket) OnServerDelete

func (socket *Socket) OnServerDelete(f func(*ServerDelete)) *Subscription[*ServerDelete]

func (*Socket) OnServerMemberJoin

func (socket *Socket) OnServerMemberJoin(f func(*ServerMemberJoin)) *Subscription[*ServerMemberJoin]

func (*Socket) OnServerMemberLeave

func (socket *Socket) OnServerMemberLeave(f func(*ServerMemberLeave)) *Subscription[*ServerMemberLeave]

func (*Socket) OnServerMemberUpdate

func (socket *Socket) OnServerMemberUpdate(f func(*ServerMemberUpdate)) *Subscription[*ServerMemberUpdate]

func (*Socket) OnServerRoleDelete

func (socket *Socket) OnServerRoleDelete(f func(*ServerRoleDelete)) *Subscription[*ServerRoleDelete]

func (*Socket) OnServerRoleUpdate

func (socket *Socket) OnServerRoleUpdate(f func(*ServerRoleUpdate)) *Subscription[*ServerRoleUpdate]

func (*Socket) OnServerUpdate

func (socket *Socket) OnServerUpdate(f func(*ServerUpdate)) *Subscription[*ServerUpdate]

func (*Socket) OnUserPlatformWipe

func (socket *Socket) OnUserPlatformWipe(f func(*UserPlatformWipe)) *Subscription[*UserPlatformWipe]

func (*Socket) OnUserRelationship

func (socket *Socket) OnUserRelationship(f func(*UserRelationship)) *Subscription[*UserRelationship]

func (*Socket) OnUserSettingsUpdate

func (socket *Socket) OnUserSettingsUpdate(f func(*UserSettingsUpdate)) *Subscription[*UserSettingsUpdate]

func (*Socket) OnUserUpdate

func (socket *Socket) OnUserUpdate(f func(*UserUpdate)) *Subscription[*UserUpdate]

func (*Socket) OnWebhookCreate

func (socket *Socket) OnWebhookCreate(f func(*Webhook)) *Subscription[*Webhook]

func (*Socket) OnWebhookDelete

func (socket *Socket) OnWebhookDelete(f func(*WebhookDelete)) *Subscription[*WebhookDelete]

func (*Socket) OnWebhookUpdate

func (socket *Socket) OnWebhookUpdate(f func(*WebhookUpdate)) *Subscription[*WebhookUpdate]

func (*Socket) Open

func (socket *Socket) Open() (err error)

func (*Socket) Ping

func (socket *Socket) Ping() error

func (*Socket) Write

func (socket *Socket) Write(typ string, d map[string]any) error

type SocketAccount

type SocketAccount struct {
	// Unique ID
	ID string `json:"_id"`
	// User's email
	Email string `json:"email"`
	// Normalised email
	//
	// (see https://github.com/insertish/authifier/#how-does-authifier-work)
	EmailNormalised string `json:"email_normalised"`
	// Argon2 hashed password
	Password string `json:"password"`
	// Whether the account is disabled
	Disabled bool `json:"disabled"`
	// Email verification status
	Verification *EmailVerification `json:"verification"`
	// Password reset information
	PasswordReset *PasswordReset `json:"password_reset"`
	// Account deletion information
	Deletion *DeletionInfo `json:"deletion"`
	// Account lockout
	Lockout *Lockout `json:"lockout"`
	// Multi-factor authentication information
	MFA *MultiFactorAuthentication `json:"mfa"`
}

Account model

type SocketConfig

type SocketConfig struct {
	Cache          *GenericCache
	Dialer         WebsocketDialer
	URL            *url.URL
	AddLogSource   bool
	Logger         *slog.Logger
	DisableLogging bool
	LoggerLevel    slog.Leveler
	Arshaler       JSONArshaler
}

type SocketError

type SocketError struct {
	ErrorID string
}

func (SocketError) Error

func (se SocketError) Error() string

type SocketSession

type SocketSession struct {
	// Unique ID
	ID string `json:"_id"`
	// User ID
	UserID string `json:"user_id"`
	// Session token
	Token string `json:"token"`
	// Display name
	Name string `json:"name"`
	// Web Push subscription
	Subscription *WebPushSubscription `json:"subscription,omitempty"`
}

type Strike

type Strike struct {
	// Strike ID
	ID ULID `json:"_id"`
	// ID of reported user
	UserID ULID `json:"user_id"`
	// Attached reason
	Reason string `json:"reason"`
}

type Subscription

type Subscription[T any] struct {
	Controller *EventController[T]
	ID         int
}

func (*Subscription[T]) Delete

func (s *Subscription[T]) Delete()

type SystemEventMessage

type SystemEventMessage struct {
	Type    SystemEventMessageType `json:"type"`
	Content string                 `json:"content,omitempty"`
	ID      ULID                   `json:"id,omitempty"`
	Name    string                 `json:"name,omitempty"`
	By      ULID                   `json:"by,omitempty"`
	From    ULID                   `json:"from,omitempty"`
	To      ULID                   `json:"to,omitempty"`
}

Representation of a system event message

func (*SystemEventMessage) ToOptimized

type SystemEventMessageType

type SystemEventMessageType string
const (
	SystemEventMessageTypeText                      SystemEventMessageType = "text"
	SystemEventMessageTypeUserAdded                 SystemEventMessageType = "user_added"
	SystemEventMessageTypeUserRemove                SystemEventMessageType = "user_remove"
	SystemEventMessageTypeUserJoined                SystemEventMessageType = "user_joined"
	SystemEventMessageTypeUserLeft                  SystemEventMessageType = "user_left"
	SystemEventMessageTypeUserKicked                SystemEventMessageType = "user_kicked"
	SystemEventMessageTypeUserBanned                SystemEventMessageType = "user_banned"
	SystemEventMessageTypeChannelRenamed            SystemEventMessageType = "channel_renamed"
	SystemEventMessageTypeChannelDescriptionChanged SystemEventMessageType = "channel_description_changed"
	SystemEventMessageTypeChannelIconChanged        SystemEventMessageType = "channel_icon_changed"
	SystemEventMessageTypeChannelOwnershipChanged   SystemEventMessageType = "channel_ownership_changed"
)

func (SystemEventMessageType) ToOptimized

type SystemMessages

type SystemMessages struct {
	// ID of channel to send user join messages in
	UserJoined ULID `json:"user_joined,omitempty"`
	// ID of channel to send user left messages in
	UserLeft ULID `json:"user_left,omitempty"`
	// ID of channel to send user kicked messages in
	UserKicked ULID `json:"user_kicked,omitempty"`
	// ID of channel to send user banned messages in
	UserBanned ULID `json:"user_banned,omitempty"`
}

type TOTP

type TOTP struct {
	Status TOTPStatus `json:"status"`
	// [Present only on Pending/Enabled]
	Secret string `json:"secret,omitempty"`
}

Time-based one-time password configuration

type TOTPStatus

type TOTPStatus string
const (
	// Disabled
	TOTPStatusDisabled TOTPStatus = "Disabled"
	// Waiting for user activation
	TOTPStatusPending TOTPStatus = "Pending"
	// Required on account
	TOTPStatusEnabled TOTPStatus = "Enabled"
)

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(d []byte) error

type Token

type Token struct {
	Type TokenType
	// The token string
	Token string
}

func NewBotToken

func NewBotToken(token string) *Token

NewBotToken returns an Token with type "TokenTypeBot" set

func NewUserToken

func NewUserToken(token string) *Token

NewUserToken returns an Token with type "TokenTypeUser" set

type TokenType

type TokenType int

Type of Revolt token.

const (
	// User token
	TokenTypeUser TokenType = iota
	// Bot token
	TokenTypeBot
)

type ULID

type ULID string

func (ULID) EncodeFP

func (id ULID) EncodeFP() string

type Unmarshal

type Unmarshal func([]byte, any) error

type UnreadMessage

type UnreadMessage struct {
	ID UnreadMessageID `json:"_id"`
	// ID of the last message read in this channel by a user
	LastID ULID `json:"last_id,omitempty"`
	// Array of message IDs that mention the user
	Mentions []ULID `json:"mentions,omitempty"`
}

type UnreadMessageID

type UnreadMessageID struct {
	// Channel ID
	Channel ULID `json:"channel"`
	// User ID
	User ULID `json:"user"`
}

Composite primary key consisting of channel and user ID

type UploadTag

type UploadTag string
const (
	UploadTagAttachments UploadTag = "attachments"
	UploadTagAvatars     UploadTag = "avatars"
	UploadTagBackgrounds UploadTag = "backgrounds"
	UploadTagIcons       UploadTag = "icons"
	UploadTagBanners     UploadTag = "banners"
	UploadTagEmojis      UploadTag = "emojis"
)

type User

type User struct {
	// Unique ID
	ID ULID `json:"_id"`
	// Username
	Username string `json:"username"`
	// Discriminator
	Discriminator string `json:"discriminator"`
	// Display name
	DisplayName string `json:"display_name,omitempty"`
	// Avatar attachment
	Avatar *AutumnFile `json:"avatar,omitempty"`
	// Relationships with other users
	Relations []*UserRelation `json:"relations,omitempty"`
	// Bitfield of user badges
	Badges UserBadges `json:"badges"`
	// User's active status
	Status *UserStatus `json:"status,omitempty"`
	// User's profile
	Profile *UserProfile `json:"profile,omitempty"`
	// Enum of user flags
	Flags UserFlags `json:"flags"`
	// Whether this user is privileged
	Privileged bool `json:"privileged,omitempty"`
	// Bot information
	Bot *UserBot `json:"bot,omitempty"`
	// User's relationship with another user (or themselves)
	Relationship RelationshipStatus `json:"relationship,omitempty"`
	// Whether this user is currently online
	Online bool `json:"online"`
}

func (*User) ToOptimized

func (u *User) ToOptimized() *OptimizedUser

type UserBadges

type UserBadges int

User badge bitfield

const (
	// Active or significant contributor to Revolt
	UserBadgesDeveloper UserBadges = 1 << (0 + iota)
	// Helped translate Revolt
	UserBadgesTranslator
	// Monetarily supported Revolt
	UserBadgesSupporter

	// Responsibly disclosed a security issue
	UserBadgesResponsibleDisclosure
	// Revolt Founder
	UserBadgesFounder
	// Platform moderator
	UserBadgesPlatformModeration
	// Active monetary supporter
	UserBadgesActiveSupporter
	// 🦊🦝
	UserBadgesPaw
	// Joined as one of the first 1000 users in 2021
	UserBadgesEarlyAdopter
	// Amogus
	UserBadgesRelevantJokeBadge1
	// Low resolution troll face
	UserBadgesRelevantJokeBadge2
)

type UserBot

type UserBot struct {
	// ID of the owner of this bot
	Owner ULID `json:"owner"`
}

Bot information for if the user is a bot

type UserFlags

type UserFlags int

User flag enum

const (
	// User has been suspended from the platform
	UserFlagsSuspended UserFlags = 1 << (0 + iota)
	// User has deleted their account
	UserFlagsDeleted
	// User was banned off the platform
	UserFlagsBanned
	// User was marked as spam and removed from platform
	UserFlagsSpam
)

type UserPlatformWipe

type UserPlatformWipe struct {
	UserID ULID      `json:"user_id"`
	Flags  UserFlags `json:"flags"`
}

User has been platform banned or deleted their account. Clients should remove the following associated data: - Messages - DM Channels - Relationships - Server Memberships User flags are specified to explain why a wipe is occurring though not all reasons will necessarily ever appear.

type UserProfile

type UserProfile struct {
	// Text content on user's profile
	Content    string      `json:"content,omitempty"`
	Background *AutumnFile `json:"background,omitempty"`
}

func (*UserProfile) ToOptimized

func (o *UserProfile) ToOptimized() *OptimizedUserProfile

type UserRelation

type UserRelation struct {
	UserID ULID `json:"_id"`
	// User's relationship with another user (or themselves)
	Status RelationshipStatus `json:"status"`
}

type UserRelationship

type UserRelationship struct {
	ID   ULID  `json:"id"`
	User *User `json:"user"`
}

Your relationship with another user has changed.

func (*UserRelationship) Status

func (ur *UserRelationship) Status() RelationshipStatus

type UserSettingsUpdate

type UserSettingsUpdate struct {
	ID     ULID                `json:"id"`
	Update map[string]*Setting `json:"update"`
}

Settings were updated remotely

type UserStatus

type UserStatus struct {
	// Custom status text
	Text string `json:"text,omitempty"`
	// Presence status
	Presence Presence `json:"presence,omitempty"`
}

User's active status

func (*UserStatus) ToOptimized

func (o *UserStatus) ToOptimized() *OptimizedUserStatus

type UserUpdate

type UserUpdate struct {
	UserID ULID         `json:"id"`
	Data   *PartialUser `json:"data"`
	// Possible values: ["Avatar", "StatusText", "StatusPresence", "ProfileContent", "ProfileBackground", "DisplayName"]
	Clear   []string `json:"clear"`
	EventID ULID     `json:"event_id"`
}

User has been updated.

func (*UserUpdate) IsAvatarRemoved

func (uu *UserUpdate) IsAvatarRemoved() bool

Whether avatar was removed.

func (*UserUpdate) IsDisplayNameRemoved

func (uu *UserUpdate) IsDisplayNameRemoved() bool

Whether display name was removed.

func (*UserUpdate) IsProfileBackgroundRemoved

func (uu *UserUpdate) IsProfileBackgroundRemoved() bool

Whether profile background was removed.

func (*UserUpdate) IsProfileContentRemoved

func (uu *UserUpdate) IsProfileContentRemoved() bool

Whether profile content was removed.

func (*UserUpdate) IsStatusPresenceRemoved

func (uu *UserUpdate) IsStatusPresenceRemoved() bool

Whether status presence was removed.

func (*UserUpdate) IsStatusTextRemoved

func (uu *UserUpdate) IsStatusTextRemoved() bool

Whether status text was removed.

type VoiceServerConfiguration

type VoiceServerConfiguration struct {
	// Whether voice is enabled
	Enabled bool `json:"enabled"`
	// URL pointing to the voice API
	URL string `json:"url"`
	// URL pointing to the voice WebSocket server
	WS string `json:"ws"`
}

type WebPushSubscription

type WebPushSubscription struct {
	Endpoint string `json:"endpoint"`
	P256DH   string `json:"p256dh"`
	Auth     string `json:"auth"`
}

type Webhook

type Webhook struct {
	// Webhook ID
	ID ULID `json:"id"`
	// The name of the webhook
	Name string `json:"name"`
	// The avatar of the webhook
	Avatar *AutumnFile `json:"avatar,omitempty"`
	// The channel this webhook belongs to
	ChannelID ULID `json:"channel_id"`
	// The permissions for the webhook
	Permissions Permissions `json:"permissions"`
	// The private token for the webhook
	Token string `json:"token,omitempty"`
}

func (*Webhook) ToOptimized

func (w *Webhook) ToOptimized() *OptimizedWebhook

type WebhookDelete

type WebhookDelete struct {
	ID ULID `json:"id"`
}

Webhook has been deleted.

type WebhookUpdate

type WebhookUpdate struct {
	ID   ULID            `json:"id"`
	Data *PartialWebhook `json:"data"`
	// Possible values: ["Avatar"]
	Remove []string `json:"remove"`
}

Webhook details updated.

func (*WebhookUpdate) IsAvatarRemoved

func (wu *WebhookUpdate) IsAvatarRemoved() bool

Whether avatar was removed.

type WebsocketDialer

type WebsocketDialer interface {
	Dial(wsUrl string, header http.Header) (*websocket.Conn, *http.Response, error)
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL