Documentation ¶
Index ¶
- Constants
- Variables
- type AliasesEventContent
- type BaseEvent
- type CreateEventContent
- type Error
- func BadJsonError(message string) Error
- func BadParamError(message string) Error
- func BadQueryError(message string) Error
- func ForbiddenError(message string) Error
- func InternalError(err ct.Error) Error
- func MissingTokenError(message string) Error
- func NotFoundError(message string) Error
- func NotJsonError(message string) Error
- func RoomInUseError(message string) Error
- func ServerError(message string) Error
- func UnknownTokenError(message string) Error
- func UnkownError(message string) Error
- func UnrecognizedError(message string) Error
- func UserInUseError(message string) Error
- type EventStreamRange
- type GenericContent
- type InitialSync
- type JoinRule
- type JoinRulesEventContent
- type LastActive
- type Membership
- type MembershipEventContent
- type Message
- type NameEventContent
- type OldState
- type PowerLevelsEventContent
- type Presence
- type PresenceEvent
- type RoomDescription
- type RoomInitialSync
- type RoomSummary
- type State
- type StreamToken
- type TestContent
- type TokenParseError
- type TopicEventContent
- type TypingEvent
- type TypingUsers
- type User
- type UserPowerLevelMap
- type UserProfile
- type UserStatus
- type Visibility
Constants ¶
View Source
const ( EventTypeCreate = "m.room.create" EventTypeName = "m.room.name" EventTypeTopic = "m.room.topic" EventTypeAliases = "m.room.aliases" EventTypeJoinRules = "m.room.join_rules" EventTypeMembership = "m.room.member" EventTypePowerLevels = "m.room.power_levels" EventTypeTyping = "m.typing" EventTypePresence = "m.presence" )
Variables ¶
View Source
var DefaultMissingTokenError = MissingTokenError("Missing access token")
View Source
var DefaultUnknownTokenError = UnknownTokenError("Unrecognised access token")
View Source
var DefaultUnrecognizedError = UnrecognizedError("unrecognized request")
Functions ¶
This section is empty.
Types ¶
type AliasesEventContent ¶
func (*AliasesEventContent) GetEventType ¶
func (c *AliasesEventContent) GetEventType() string
type BaseEvent ¶
type BaseEvent struct {
EventType string `json:"type"`
}
func (*BaseEvent) GetEventType ¶
type CreateEventContent ¶
func (*CreateEventContent) GetEventType ¶
func (c *CreateEventContent) GetEventType() string
type Error ¶
func BadJsonError ¶
func BadParamError ¶
func BadQueryError ¶
func ForbiddenError ¶
func InternalError ¶
func MissingTokenError ¶
func NotFoundError ¶
func NotJsonError ¶
func RoomInUseError ¶
func ServerError ¶
func UnknownTokenError ¶
func UnkownError ¶
func UnrecognizedError ¶
func UserInUseError ¶
type EventStreamRange ¶
type EventStreamRange struct { Events []ct.Event `json:"chunk"` Start StreamToken `json:"start"` End StreamToken `json:"end"` }
func NewEventStreamRange ¶
func NewEventStreamRange(events []ct.Event, start StreamToken, end StreamToken) *EventStreamRange
type GenericContent ¶
type GenericContent struct { Content map[string]interface{} // contains filtered or unexported fields }
func NewGenericContent ¶
func NewGenericContent(content map[string]interface{}, eventType string) *GenericContent
func (*GenericContent) GetEventType ¶
func (c *GenericContent) GetEventType() string
func (*GenericContent) MarshalJSON ¶
func (c *GenericContent) MarshalJSON() ([]byte, error)
type InitialSync ¶
type InitialSync struct { End StreamToken `json:"end"` Presence []ct.Event `json:"presence"` Rooms []RoomSummary `json:"rooms"` }
type JoinRule ¶
type JoinRule int
func (JoinRule) MarshalJSON ¶
func (JoinRule) ToVisibility ¶
func (j JoinRule) ToVisibility() Visibility
func (*JoinRule) UnmarshalJSON ¶
type JoinRulesEventContent ¶
type JoinRulesEventContent struct {
JoinRule JoinRule `json:"join_rule"`
}
func (*JoinRulesEventContent) GetEventType ¶
func (c *JoinRulesEventContent) GetEventType() string
type LastActive ¶
func (LastActive) MarshalJSON ¶
func (l LastActive) MarshalJSON() ([]byte, error)
func (*LastActive) UnmarshalJSON ¶
func (l *LastActive) UnmarshalJSON(data []byte) error
type Membership ¶
type Membership int
const ( MembershipNone Membership = 0 MembershipInvited Membership = 1 MembershipMember Membership = 2 MembershipKnocking Membership = 3 MembershipLeaving Membership = 4 MembershipBanned Membership = 5 )
func (Membership) MarshalJSON ¶
func (m Membership) MarshalJSON() ([]byte, error)
func (Membership) String ¶
func (m Membership) String() string
func (*Membership) UnmarshalJSON ¶
func (m *Membership) UnmarshalJSON(bytes []byte) error
type MembershipEventContent ¶
type MembershipEventContent struct { *UserProfile Membership Membership `json:"membership"` }
func (*MembershipEventContent) GetEventType ¶
func (c *MembershipEventContent) GetEventType() string
type Message ¶
type Message struct { BaseEvent Content ct.Content `json:"content"` EventId ct.EventId `json:"event_id"` RoomId ct.RoomId `json:"room_id"` UserId ct.UserId `json:"user_id"` Timestamp ct.Timestamp `json:"origin_server_ts"` }
func (*Message) GetContent ¶
func (e *Message) GetContent() interface{}
func (*Message) GetEventId ¶
func (*Message) GetEventKey ¶
type NameEventContent ¶
type NameEventContent struct {
Name string `json:"name"`
}
func (*NameEventContent) GetEventType ¶
func (c *NameEventContent) GetEventType() string
type PowerLevelsEventContent ¶
type PowerLevelsEventContent struct { Ban int `json:"ban"` Kick int `json:"kick"` Invite int `json:"invite"` Redact int `json:"redact"` UserDefault int `json:"users_default"` CreateState int `json:"state_default"` EventDefault int `json:"events_default"` Users UserPowerLevelMap `json:"users"` Events map[string]int `json:"events"` }
func DefaultPowerLevels ¶
func DefaultPowerLevels(creator ct.UserId) *PowerLevelsEventContent
func (*PowerLevelsEventContent) GetEventType ¶
func (c *PowerLevelsEventContent) GetEventType() string
type PresenceEvent ¶
func (*PresenceEvent) GetContent ¶
func (e *PresenceEvent) GetContent() interface{}
func (*PresenceEvent) GetEventKey ¶
func (e *PresenceEvent) GetEventKey() ct.Id
func (*PresenceEvent) GetEventType ¶
func (e *PresenceEvent) GetEventType() string
func (*PresenceEvent) GetRoomId ¶
func (e *PresenceEvent) GetRoomId() *ct.RoomId
func (*PresenceEvent) GetUserId ¶
func (e *PresenceEvent) GetUserId() *ct.UserId
type RoomDescription ¶
type RoomInitialSync ¶
type RoomInitialSync struct { RoomSummary Presence []ct.Event `json:"presence"` }
type RoomSummary ¶
type RoomSummary struct { Membership Membership `json:"membership"` RoomId ct.RoomId `json:"room_id"` Messages *EventStreamRange `json:"messages"` State []*State `json:"state"` Visibility Visibility `json:"visibility"` }
type StreamToken ¶
func NewStreamToken ¶
func NewStreamToken(messageIndex, presenceIndex, typingIndex uint64) StreamToken
func ParseStreamToken ¶
func ParseStreamToken(str string) (StreamToken, error)
func (StreamToken) MarshalJSON ¶
func (t StreamToken) MarshalJSON() ([]byte, error)
func (StreamToken) String ¶
func (t StreamToken) String() string
func (*StreamToken) UnmarshalJSON ¶
func (t *StreamToken) UnmarshalJSON(bytes []byte) (err error)
type TestContent ¶
type TestContent struct {
Name string `json:"name"`
}
type TokenParseError ¶
type TokenParseError string
func (TokenParseError) Error ¶
func (e TokenParseError) Error() string
type TopicEventContent ¶
type TopicEventContent struct {
Topic string `json:"topic"`
}
func (*TopicEventContent) GetEventType ¶
func (c *TopicEventContent) GetEventType() string
type TypingEvent ¶
type TypingEvent struct { BaseEvent Content TypingUsers `json:"content"` RoomId ct.RoomId `json:"room_id"` }
func (*TypingEvent) GetContent ¶
func (e *TypingEvent) GetContent() interface{}
func (*TypingEvent) GetEventKey ¶
func (e *TypingEvent) GetEventKey() ct.Id
func (*TypingEvent) GetEventType ¶
func (e *TypingEvent) GetEventType() string
func (*TypingEvent) GetRoomId ¶
func (e *TypingEvent) GetRoomId() *ct.RoomId
func (*TypingEvent) GetUserId ¶
func (e *TypingEvent) GetUserId() *ct.UserId
type TypingUsers ¶
type User ¶
type User struct { UserProfile UserStatus UserId ct.UserId `json:"user_id"` }
type UserPowerLevelMap ¶
func (*UserPowerLevelMap) UnmarshalJSON ¶
func (m *UserPowerLevelMap) UnmarshalJSON(bytes []byte) error
type UserProfile ¶
type UserStatus ¶
type UserStatus struct { Presence Presence `json:"presence"` StatusMessage string `json:"status_msg"` LastActive LastActive `json:"last_active_ago"` }
type Visibility ¶
type Visibility int
const ( VisibilityPrivate Visibility = 0 VisibilityPublic Visibility = 1 )
func (Visibility) ToJoinRule ¶
func (v Visibility) ToJoinRule() JoinRule
func (*Visibility) UnmarshalJSON ¶
func (v *Visibility) UnmarshalJSON(bytes []byte) error
Click to show internal directories.
Click to hide internal directories.