Documentation ¶
Index ¶
- Constants
- Variables
- type Ban
- type Categories
- type Channel
- type ChannelAck
- type ChannelCreate
- type ChannelDelete
- type ChannelGroupJoin
- type ChannelGroupLeave
- type ChannelStartTyping
- type ChannelStopTyping
- type ChannelType
- type ChannelUpdate
- type ClearType
- type DirectMessage
- type EditChannel
- type EditMember
- type EditServer
- type EditUser
- type Embed
- type Event
- type Group
- type Member
- type Message
- type MessageCreate
- type MessageDelete
- type MessageSend
- type MessageUpdate
- type MutualFriendsAndServers
- type Pong
- type Ready
- type RelationshipStatus
- func (r RelationshipStatus) IsBlocked() bool
- func (r RelationshipStatus) IsBlockedOther() bool
- func (r RelationshipStatus) IsFriend() bool
- func (r RelationshipStatus) IsIncoming() bool
- func (r RelationshipStatus) IsNone() bool
- func (r RelationshipStatus) IsOutgoing() bool
- func (r RelationshipStatus) IsUser() bool
- type RestContent
- type Role
- type RoleClearType
- type RoleCreated
- type Server
- type ServerDelete
- type ServerMemberJoin
- type ServerMemberLeave
- type ServerMemberUpdate
- type ServerRoleDelete
- type ServerRoleUpdate
- type ServerUpdate
- type Session
- func (s *Session) AddGroupMember(channelId, userId string) (err error)
- func (s *Session) AddHandler(handler interface{})
- func (s *Session) BanMember(serverId, memberId, reason string) (err error)
- func (s *Session) ChangeUsername() (err error)
- func (s *Session) ChannelMessageSend(channelId string, msg *MessageSend) (resp []byte, err error)
- func (s *Session) ChannelMessageSendString(channelId string, msg string) (resp []byte, err error)
- func (s *Session) CloseChannel(channelId string, edit *EditChannel) (err error)
- func (s *Session) CreateGroup(name, description string, users []string, nsfw bool) (group *Group, err error)
- func (s *Session) CreateInvite(channelId string) (invite string, err error)
- func (s *Session) CreateRole(serverId, name string) (role *RoleCreated, err error)
- func (s *Session) CreateServer(name, description string, nsfw bool) (server *Server, err error)
- func (s *Session) CreateServerChannel(serverId, name, description string, channelType ChannelType, nsfw bool) (err error)
- func (s *Session) DeleteInvite(invite string) (err error)
- func (s *Session) DeleteMessage(channelId, messageId string) (err error)
- func (s *Session) DeleteRole(serverId, roleId string) (err error)
- func (s *Session) DeleteServer(serverId string) (err error)
- func (s *Session) EditChannel(channelId string, edit *EditChannel) (channel *Channel, err error)
- func (s *Session) EditMember(serverId, memberId string, edit *EditMember) (err error)
- func (s *Session) EditMessage(channelId, messageId, content string, embeds []*Embed) (err error)
- func (s *Session) EditRole(serverId, roleId, name, colour string, hoist bool, rank int, ...) (err error)
- func (s *Session) EditServer(serverId string, edit *EditServer) (err error)
- func (s *Session) EditUser(edit *EditUser) (err error)
- func (s *Session) FetchBans(serverId string) (users []*User, bans []*Ban, err error)
- func (s *Session) FetchChannel(channelId string) (channel *Channel, err error)
- func (s *Session) FetchDMs() (dms []*DirectMessage, err error)
- func (s *Session) FetchDefaultAvatar(id string) (img []byte, err error)
- func (s *Session) FetchGroupMembers(channelId, messageId string) (members []*Member, err error)
- func (s *Session) FetchInvite(invite string) (server *Server, err error)
- func (s *Session) FetchInvites(serverId string) (invites []string, err error)
- func (s *Session) FetchMember(serverId, memberId string) (member *Member, err error)
- func (s *Session) FetchMembers(serverId, memberId string) (members []*Member, users []*User, err error)
- func (s *Session) FetchMessage(channelId, messageId string) (message *Message, err error)
- func (s *Session) FetchMessages(channelId string, limit int, before string, after string, sort string, ...) (messages []*Message, users []*User, members []*Member, err error)
- func (s *Session) FetchMutualFriendsAndServers(id string) (mutuals *MutualFriendsAndServers, err error)
- func (s *Session) FetchMutuals(id string) (mutuals *MutualFriendsAndServers, err error)
- func (s *Session) FetchSelf() (user *User, err error)
- func (s *Session) FetchServer(serverId string) (server *Server, err error)
- func (s *Session) FetchUser(id string) (user *User, err error)
- func (s *Session) FetchUserProfile(id string) (profile *UserProfile, err error)
- func (s *Session) JoinInvite(invite string) (server *Server, err error)
- func (s *Session) JoinVoiceChannel(channelId string) (token string, err error)
- func (s *Session) KickMember(serverId, memberId string) (err error)
- func (s *Session) MarkServerAsRead() (err error)
- func (s *Session) MessageAck(channelId, messageId string) (err error)
- func (s *Session) Open() error
- func (s *Session) OpenDM(id string) (dm *DirectMessage, err error)
- func (s *Session) PollMessageChanges(channelId string, messageIds []string) (changed []*Message, deleted []string, err error)
- func (s *Session) RemoveGroupMember(channelId, userId string) (err error)
- func (s *Session) SearchMessages(channelId string, query string, limit int, before string, after string, ...) (messages []*Message, users []*User, members []*Member, err error)
- func (s *Session) SetDefaultPermission(id string, permissions int) (err error)
- func (s *Session) SetRolePermission(channelId string, roleId string, permissions int) (err error)
- func (s *Session) UnbanMember(serverId, memberId, reason string) (err error)
- type SystemMessages
- type User
- type UserProfile
- type UserRelationship
- type UserUpdate
Constants ¶
View Source
const BASE_URL = "http://api.revolt.chat"
View Source
const VERSION = "v0.1.0"
View Source
const WS_URL = "wss://ws.revolt.chat"
Variables ¶
View Source
var ( ErrLabelMe = "LabelMe" // uncategorised error ErrInternalError = "InternalError" // the server ran into an issue ErrInvalidSession = "InvalidSession" // authentication details are incorrect ErrOnboardingNotFinished = "OnboardingNotFinished" // user has not chosen a username ErrAlreadyAuthenticated = "AlreadyAuthenticated" // this connection is already authenticated )
View Source
var ( TypeAuthenticated = "Authenticated" TypePong = "Pong" TypeReady = "Ready" TypeMessageCreate = "Message" TypeMessageUpdate = "MessageUpdate" TypeMessageDelete = "MessageDelete" TypeChannelCreate = "ChannelCreate" TypeChannelUpdate = "ChannelUpdate" TypeChannelDelete = "ChannelDelete" TypeChannelGroupJoin = "ChannelGroupJoin" TypeChannelGroupLeave = "ChannelGroupLeave" TypeChannelStartTyping = "ChannelStartTyping" TypeChannelStopTyping = "ChannelStopTyping" TypeChannelAck = "ChannelAck" TypeServerUpdate = "ServerUpdate" TypeServerDelete = "ServerDelete" TypeServerMemberUpdate = "ServerMemberUpdate" TypeServerMemberJoin = "ServerMemberJoin" TypeServerMemberLeave = "ServerMemberLeave" TypeServerRoleUpdate = "ServerRoleUpdate" TypeServerRoleDelete = "ServerRoleDelete" TypeUserUpdate = "UserUpdate" TypeUserRelationship = "UserRelationship" )
View Source
var ErrNoToken = fmt.Errorf("no token found")
Functions ¶
This section is empty.
Types ¶
type Categories ¶
type Channel ¶
type Channel struct { ID string `json:"_id"` Server string `json:"server"` Name string `json:"name"` Description string `json:"description"` Icon struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"icon"` DefaultPermissions int `json:"default_permissions"` RolePermissions map[string]int `json:"role_permissions"` Nsfw bool `json:"nsfw"` ChannelType string `json:"channel_type"` }
Channel
type ChannelAck ¶
type ChannelCreate ¶
type ChannelDelete ¶
type ChannelGroupJoin ¶
type ChannelGroupLeave ¶
type ChannelStartTyping ¶
type ChannelStopTyping ¶
type ChannelType ¶
type ChannelType string
const ChannelTypeText ChannelType = "Text"
const ChannelTypeVoice ChannelType = "Voice"
func (ChannelType) IsText ¶
func (c ChannelType) IsText() bool
func (ChannelType) IsVoice ¶
func (c ChannelType) IsVoice() bool
type ChannelUpdate ¶
type ClearType ¶
type ClearType string
const ClearTypeBanner ClearType = "Banner"
const ClearTypeColour ClearType = "Colour"
const ClearTypeDescription ClearType = "Description"
const ClearTypeIcon ClearType = "Icon"
func (ClearType) IsDescription ¶
type DirectMessage ¶
type DirectMessage []struct { ID string `json:"_id"` ChannelType string `json:"channel_type"` Active bool `json:"active"` Recipients []string `json:"recipients"` LastMessageID string `json:"last_message_id"` }
DM
type EditChannel ¶
type EditMember ¶
type EditServer ¶
type EditServer struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Icon string `json:"icon,omitempty"` Banner string `json:"banner,omitempty"` Categories []*Categories `json:"categories,omitempty"` SystemMessages *SystemMessages `json:"system_messages,omitempty"` Nsfw bool `json:"nsfw,omitempty"` Remove string `json:"remove,omitempty"` }
type EditUser ¶
type EditUser struct { Status struct { Text string `json:"text,omitempty"` Presence string `json:"presence,omitempty"` } `json:"status,omitempty"` Profile struct { Content string `json:"content,omitempty"` Background string `json:"background,omitempty"` } `json:"profile,omitempty"` Avatar string `json:"avatar,omitempty"` Remove string `json:"remove,omitempty"` }
type Embed ¶
type Embed struct { Type string `json:"type"` URL string `json:"url"` Special struct { Type string `json:"type"` } `json:"special"` Title string `json:"title"` Description string `json:"description"` Image struct { URL string `json:"url"` Width int `json:"width"` Height int `json:"height"` Size string `json:"size"` } `json:"image"` Video struct { URL string `json:"url"` Width int `json:"width"` Height int `json:"height"` } `json:"video"` SiteName string `json:"site_name"` IconURL string `json:"icon_url"` Colour string `json:"colour"` }
type Group ¶
type Group struct { ID string `json:"_id"` ChannelType string `json:"channel_type"` Recipients []string `json:"recipients"` Name string `json:"name"` Owner string `json:"owner"` Description string `json:"description"` LastMessageID string `json:"last_message_id"` Icon struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"icon"` Permissions int `json:"permissions"` Nsfw bool `json:"nsfw"` }
Group
type Member ¶
type Member struct { ID struct { Server string `json:"server"` User string `json:"user"` } `json:"_id"` Nickname string `json:"nickname"` Avatar struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"avatar"` Roles []string `json:"roles"` }
type Message ¶
type Message struct { ID string `json:"_id"` Nonce string `json:"nonce"` Channel string `json:"channel"` Author string `json:"author"` Content interface{} `json:"content"` Attachments []struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"attachments"` Edited struct { Date string `json:"$date"` } `json:"edited"` Embeds []*Embed `json:"embeds"` Mentions []string `json:"mentions"` Replies []string `json:"replies"` Masquerade struct { Name string `json:"name"` Avatar string `json:"avatar"` } `json:"masquerade"` }
type MessageCreate ¶
type MessageDelete ¶
type MessageSend ¶
type MessageSend struct { Content string `json:"content"` Attachments []string `json:"attachments,omitempty"` Embeds []*struct { Type string `json:"type"` IconURL string `json:"icon_url"` URL string `json:"url"` Title string `json:"title"` Description string `json:"description"` Media string `json:"media"` Colour string `json:"colour"` } `json:"embeds,omitempty"` Replies []*struct { ID string `json:"id"` Mention bool `json:"mention"` } `json:"replies,omitempty"` Masquerade *struct { Name string `json:"name"` Avatar string `json:"avatar"` } `json:"masquerade,omitempty"` }
type MessageUpdate ¶
type MutualFriendsAndServers ¶
type RelationshipStatus ¶
type RelationshipStatus string
const RelationshipBlocked RelationshipStatus = "Blocked"
const RelationshipBlockedOther RelationshipStatus = "BlockedOther"
const RelationshipFriend RelationshipStatus = "Friend"
const RelationshipIncoming RelationshipStatus = "Incoming"
const RelationshipNone RelationshipStatus = "None"
const RelationshipOutgoing RelationshipStatus = "Outgoing"
const RelationshipUser RelationshipStatus = "User"
func (RelationshipStatus) IsBlocked ¶
func (r RelationshipStatus) IsBlocked() bool
func (RelationshipStatus) IsBlockedOther ¶
func (r RelationshipStatus) IsBlockedOther() bool
func (RelationshipStatus) IsFriend ¶
func (r RelationshipStatus) IsFriend() bool
func (RelationshipStatus) IsIncoming ¶
func (r RelationshipStatus) IsIncoming() bool
func (RelationshipStatus) IsNone ¶
func (r RelationshipStatus) IsNone() bool
func (RelationshipStatus) IsOutgoing ¶
func (r RelationshipStatus) IsOutgoing() bool
func (RelationshipStatus) IsUser ¶
func (r RelationshipStatus) IsUser() bool
type RestContent ¶
type RoleClearType ¶
type RoleClearType string
const RoleClearTypeColour RoleClearType = "Colour"
func (RoleClearType) IsColour ¶
func (r RoleClearType) IsColour() bool
type RoleCreated ¶
type Server ¶
type Server struct { ID string `json:"_id"` Owner string `json:"owner"` Name string `json:"name"` Description string `json:"description"` Channels []string `json:"channels"` Categories []*Categories `json:"categories"` SystemMessages *SystemMessages `json:"system_messages"` Roles []Role `json:"roles"` DefaultPermissions []int `json:"default_permissions"` Icon struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"icon"` Banner struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"banner"` Nsfw bool `json:"nsfw"` Flags int `json:"flags"` Analytics bool `json:"analytics"` Discoverable bool `json:"discoverable"` }
Server
type ServerDelete ¶
type ServerMemberJoin ¶
type ServerMemberLeave ¶
type ServerMemberUpdate ¶
type ServerRoleDelete ¶
type ServerRoleUpdate ¶
type ServerUpdate ¶
type Session ¶
func (*Session) AddGroupMember ¶
Unimplemented (Session Token) + documentation error
func (*Session) AddHandler ¶
func (s *Session) AddHandler(handler interface{})
func (*Session) ChannelMessageSend ¶
func (s *Session) ChannelMessageSend(channelId string, msg *MessageSend) (resp []byte, err error)
Messages
func (*Session) ChannelMessageSendString ¶
func (*Session) CloseChannel ¶
func (s *Session) CloseChannel(channelId string, edit *EditChannel) (err error)
func (*Session) CreateGroup ¶
func (s *Session) CreateGroup(name, description string, users []string, nsfw bool) (group *Group, err error)
Unimplemented (Session Token)
func (*Session) CreateInvite ¶
Create invite from channel ID
func (*Session) CreateRole ¶
func (s *Session) CreateRole(serverId, name string) (role *RoleCreated, err error)
func (*Session) CreateServer ¶
Unimplemented (Session Token)
func (*Session) CreateServerChannel ¶
func (s *Session) CreateServerChannel(serverId, name, description string, channelType ChannelType, nsfw bool) (err error)
func (*Session) DeleteInvite ¶
func (*Session) DeleteMessage ¶
func (*Session) DeleteRole ¶
func (*Session) DeleteServer ¶
func (*Session) EditChannel ¶
func (s *Session) EditChannel(channelId string, edit *EditChannel) (channel *Channel, err error)
func (*Session) EditMember ¶
func (s *Session) EditMember(serverId, memberId string, edit *EditMember) (err error)
func (*Session) EditMessage ¶
func (*Session) EditServer ¶
func (s *Session) EditServer(serverId string, edit *EditServer) (err error)
func (*Session) FetchChannel ¶
func (*Session) FetchDMs ¶
func (s *Session) FetchDMs() (dms []*DirectMessage, err error)
func (*Session) FetchDefaultAvatar ¶
func (*Session) FetchGroupMembers ¶
func (*Session) FetchInvite ¶
func (*Session) FetchInvites ¶
func (*Session) FetchMember ¶
Server Members
func (*Session) FetchMembers ¶
func (*Session) FetchMessage ¶
func (*Session) FetchMessages ¶
func (*Session) FetchMutualFriendsAndServers ¶
func (s *Session) FetchMutualFriendsAndServers(id string) (mutuals *MutualFriendsAndServers, err error)
func (*Session) FetchMutuals ¶
func (s *Session) FetchMutuals(id string) (mutuals *MutualFriendsAndServers, err error)
Alias for FetchMutualFriendsAndServers
func (*Session) FetchServer ¶
func (*Session) FetchUserProfile ¶
func (s *Session) FetchUserProfile(id string) (profile *UserProfile, err error)
func (*Session) JoinInvite ¶
Unimplemented (Session Token)
func (*Session) JoinVoiceChannel ¶
func (*Session) KickMember ¶
func (*Session) MarkServerAsRead ¶
Unimplemented (Session Token)
func (*Session) MessageAck ¶
Unimplemented (Session Token)
func (*Session) PollMessageChanges ¶
func (*Session) RemoveGroupMember ¶
Unimplemented (Session Token) + documentation error
func (*Session) SearchMessages ¶
func (*Session) SetDefaultPermission ¶
func (*Session) SetRolePermission ¶
func (*Session) UnbanMember ¶
type SystemMessages ¶
type User ¶
type User struct { ID string `json:"_id"` Username string `json:"username"` Avatar struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"avatar"` Relations []struct { Status string `json:"status"` ID string `json:"_id"` } `json:"relations"` Badges int `json:"badges"` Status struct { Text string `json:"text"` Presence string `json:"presence"` } `json:"status"` Relationship string `json:"relationship"` Online bool `json:"online"` Flags int `json:"flags"` Bot struct { Owner string `json:"owner"` } `json:"bot,omitempty"` }
User
type UserProfile ¶
type UserProfile struct { Content string `json:"content"` Background struct { ID string `json:"_id"` Tag string `json:"tag"` Size int `json:"size"` Filename string `json:"filename"` Metadata struct { Type string `json:"type"` } `json:"metadata"` ContentType string `json:"content_type"` } `json:"background"` }
type UserRelationship ¶
type UserRelationship struct { Type string `json:"type"` Id string `json:"id"` User string `json:"user"` Status RelationshipStatus `json:"status"` }
type UserUpdate ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.