Documentation ¶
Index ¶
- Constants
- Variables
- func IsUnsupportedContentType(err error) bool
- func TrimReplyFallbackHTML(html string) string
- func TrimReplyFallbackText(text string) string
- type AnnotationChunk
- type CanonicalAliasEventContent
- type Content
- func (content *Content) AsCanonicalAlias() *CanonicalAliasEventContent
- func (content *Content) AsCreate() *CreateEventContent
- func (content *Content) AsDirectChats() *DirectChatsEventContent
- func (content *Content) AsEncrypted() *EncryptedEventContent
- func (content *Content) AsForwardedRoomKey() *ForwardedRoomKeyEventContent
- func (content *Content) AsFullyRead() *FullyReadEventContent
- func (content *Content) AsGuestAccess() *GuestAccessEventContent
- func (content *Content) AsHistoryVisibility() *HistoryVisibilityEventContent
- func (content *Content) AsIgnoredUserList() *IgnoredUserListEventContent
- func (content *Content) AsJoinRules() *JoinRulesEventContent
- func (content *Content) AsMember() *MemberEventContent
- func (content *Content) AsMessage() *MessageEventContent
- func (content *Content) AsPinnedEvents() *PinnedEventsEventContent
- func (content *Content) AsPowerLevels() *PowerLevelsEventContent
- func (content *Content) AsPresence() *PresenceEventContent
- func (content *Content) AsReaction() *ReactionEventContent
- func (content *Content) AsReceipt() *ReceiptEventContent
- func (content *Content) AsRedaction() *RedactionEventContent
- func (content *Content) AsRoomAvatar() *RoomAvatarEventContent
- func (content *Content) AsRoomKey() *RoomKeyEventContent
- func (content *Content) AsRoomKeyRequest() *RoomKeyRequestEventContent
- func (content *Content) AsRoomName() *RoomNameEventContent
- func (content *Content) AsTag() *TagEventContent
- func (content *Content) AsTombstone() *TombstoneEventContent
- func (content *Content) AsTopic() *TopicEventContent
- func (content *Content) AsTyping() *TypingEventContent
- func (content *Content) MarshalJSON() ([]byte, error)
- func (content *Content) MergeParsedToRaw()
- func (content *Content) ParseRaw(evtType Type) error
- func (content *Content) UnmarshalJSON(data []byte) error
- type CreateEventContent
- type DirectChatsEventContent
- type EncryptedEventContent
- type EncryptedFileInfo
- type EncryptionEventContent
- type Event
- type EventIDChunk
- type FileInfo
- type Format
- type ForwardedRoomKeyEventContent
- type FullyReadEventContent
- type GuestAccess
- type GuestAccessEventContent
- type HistoryVisibility
- type HistoryVisibilityEventContent
- type IgnoredUser
- type IgnoredUserListEventContent
- type JoinRule
- type JoinRulesEventContent
- type KeyRequestAction
- type MemberEventContent
- type Membership
- type MessageEventContent
- func (content *MessageEventContent) GetFile() *EncryptedFileInfo
- func (content *MessageEventContent) GetInfo() *FileInfo
- func (content *MessageEventContent) GetRelatesTo() *RelatesTo
- func (content *MessageEventContent) GetReplyTo() id.EventID
- func (content *MessageEventContent) OptionalGetRelatesTo() *RelatesTo
- func (content *MessageEventContent) RemoveReplyFallback()
- func (content *MessageEventContent) SetRelatesTo(rel *RelatesTo)
- func (content *MessageEventContent) SetReply(inReplyTo *Event)
- type MessageType
- type OlmCiphertexts
- type PinnedEventsEventContent
- type PowerLevelsEventContent
- func (pl *PowerLevelsEventContent) Ban() int
- func (pl *PowerLevelsEventContent) EnsureEventLevel(eventType Type, level int) bool
- func (pl *PowerLevelsEventContent) EnsureUserLevel(userID id.UserID, level int) bool
- func (pl *PowerLevelsEventContent) GetEventLevel(eventType Type) int
- func (pl *PowerLevelsEventContent) GetUserLevel(userID id.UserID) int
- func (pl *PowerLevelsEventContent) Invite() int
- func (pl *PowerLevelsEventContent) Kick() int
- func (pl *PowerLevelsEventContent) Redact() int
- func (pl *PowerLevelsEventContent) SetEventLevel(eventType Type, level int)
- func (pl *PowerLevelsEventContent) SetUserLevel(userID id.UserID, level int)
- func (pl *PowerLevelsEventContent) StateDefault() int
- type Presence
- type PresenceEventContent
- type ReactionEventContent
- type ReadReceipt
- type ReceiptEventContent
- type Receipts
- type RedactionEventContent
- type Relatable
- type RelatesTo
- func (rel *RelatesTo) GetAnnotationID() id.EventID
- func (rel *RelatesTo) GetAnnotationKey() string
- func (rel *RelatesTo) GetReferenceID() id.EventID
- func (rel *RelatesTo) GetReplaceID() id.EventID
- func (rel *RelatesTo) MarshalJSON() ([]byte, error)
- func (rel *RelatesTo) UnmarshalJSON(data []byte) error
- type RelationChunk
- type RelationChunkItem
- type RelationType
- type Relations
- type RequestedKeyInfo
- type RoomAvatarEventContent
- type RoomKeyEventContent
- type RoomKeyRequestEventContent
- type RoomNameEventContent
- type StrippedState
- type Tag
- type TagEventContent
- type Tags
- type ThirdPartyInvite
- type TombstoneEventContent
- type TopicEventContent
- type Type
- func (et *Type) GuessClass() TypeClass
- func (et *Type) IsAccountData() bool
- func (et *Type) IsCustom() bool
- func (et *Type) IsEphemeral() bool
- func (et *Type) IsState() bool
- func (et *Type) IsToDevice() bool
- func (et *Type) MarshalJSON() ([]byte, error)
- func (et *Type) Repr() string
- func (et *Type) String() string
- func (et *Type) UnmarshalJSON(data []byte) error
- type TypeClass
- type TypingEventContent
- type Unsigned
Constants ¶
const ( KeyRequestActionRequest = "request" KeyRequestActionCancel = "request_cancellation" )
const ( PresenceOnline = "online" PresenceOffline = "offline" )
const ReplyFormat = `` /* 143-byte string literal not displayed */
Variables ¶
var ( StateAliases = Type{"m.room.aliases", StateEventType} StateCanonicalAlias = Type{"m.room.canonical_alias", StateEventType} StateCreate = Type{"m.room.create", StateEventType} StateJoinRules = Type{"m.room.join_rules", StateEventType} StateHistoryVisibility = Type{"m.room.history_visibility", StateEventType} StateGuestAccess = Type{"m.room.guest_access", StateEventType} StateMember = Type{"m.room.member", StateEventType} StatePowerLevels = Type{"m.room.power_levels", StateEventType} StateRoomName = Type{"m.room.name", StateEventType} StateTopic = Type{"m.room.topic", StateEventType} StateRoomAvatar = Type{"m.room.avatar", StateEventType} StatePinnedEvents = Type{"m.room.pinned_events", StateEventType} StateTombstone = Type{"m.room.tombstone", StateEventType} StateEncryption = Type{"m.room.encryption", StateEventType} )
State events
var ( EventRedaction = Type{"m.room.redaction", MessageEventType} EventMessage = Type{"m.room.message", MessageEventType} EventEncrypted = Type{"m.room.encrypted", MessageEventType} EventReaction = Type{"m.reaction", MessageEventType} EventSticker = Type{"m.sticker", MessageEventType} )
Message events
var ( EphemeralEventReceipt = Type{"m.receipt", EphemeralEventType} EphemeralEventTyping = Type{"m.typing", EphemeralEventType} EphemeralEventPresence = Type{"m.presence", EphemeralEventType} )
Ephemeral events
var ( AccountDataDirectChats = Type{"m.direct", AccountDataEventType} AccountDataPushRules = Type{"m.push_rules", AccountDataEventType} AccountDataRoomTags = Type{"m.tag", AccountDataEventType} AccountDataFullyRead = Type{"m.fully_read", AccountDataEventType} AccountDataIgnoredUserList = Type{"m.ignored_user_list", AccountDataEventType} )
Account data events
var ( ToDeviceRoomKey = Type{"m.room_key", ToDeviceEventType} ToDeviceRoomKeyRequest = Type{"m.room_key_request", ToDeviceEventType} ToDeviceForwardedRoomKey = Type{"m.forwarded_room_key", ToDeviceEventType} ToDeviceEncrypted = Type{"m.room.encrypted", ToDeviceEventType} )
Device-to-device events
var HTMLReplyFallbackRegex = regexp.MustCompile(`^<mx-reply>[\s\S]+?</mx-reply>`)
var TypeMap = map[Type]reflect.Type{ StateMember: reflect.TypeOf(MemberEventContent{}), StatePowerLevels: reflect.TypeOf(PowerLevelsEventContent{}), StateCanonicalAlias: reflect.TypeOf(CanonicalAliasEventContent{}), StateRoomName: reflect.TypeOf(RoomNameEventContent{}), StateRoomAvatar: reflect.TypeOf(RoomAvatarEventContent{}), StateTopic: reflect.TypeOf(TopicEventContent{}), StateTombstone: reflect.TypeOf(TombstoneEventContent{}), StateCreate: reflect.TypeOf(CreateEventContent{}), StateJoinRules: reflect.TypeOf(JoinRulesEventContent{}), StateHistoryVisibility: reflect.TypeOf(HistoryVisibilityEventContent{}), StateGuestAccess: reflect.TypeOf(GuestAccessEventContent{}), StatePinnedEvents: reflect.TypeOf(PinnedEventsEventContent{}), StateEncryption: reflect.TypeOf(EncryptionEventContent{}), EventMessage: reflect.TypeOf(MessageEventContent{}), EventSticker: reflect.TypeOf(MessageEventContent{}), EventEncrypted: reflect.TypeOf(EncryptedEventContent{}), EventRedaction: reflect.TypeOf(RedactionEventContent{}), EventReaction: reflect.TypeOf(ReactionEventContent{}), AccountDataRoomTags: reflect.TypeOf(TagEventContent{}), AccountDataDirectChats: reflect.TypeOf(DirectChatsEventContent{}), AccountDataFullyRead: reflect.TypeOf(FullyReadEventContent{}), AccountDataIgnoredUserList: reflect.TypeOf(IgnoredUserListEventContent{}), EphemeralEventTyping: reflect.TypeOf(TypingEventContent{}), EphemeralEventReceipt: reflect.TypeOf(ReceiptEventContent{}), EphemeralEventPresence: reflect.TypeOf(PresenceEventContent{}), ToDeviceRoomKey: reflect.TypeOf(RoomKeyEventContent{}), ToDeviceForwardedRoomKey: reflect.TypeOf(ForwardedRoomKeyEventContent{}), ToDeviceRoomKeyRequest: reflect.TypeOf(RoomKeyRequestEventContent{}), ToDeviceEncrypted: reflect.TypeOf(EncryptedEventContent{}), }
TypeMap is a mapping from event type to the content struct type. This is used by Content.ParseRaw() for creating the correct type of struct.
Functions ¶
func TrimReplyFallbackHTML ¶
func TrimReplyFallbackText ¶
Types ¶
type AnnotationChunk ¶
type AnnotationChunk struct { RelationChunk Map map[string]int `json:"-"` }
func (*AnnotationChunk) Serialize ¶
func (ac *AnnotationChunk) Serialize() RelationChunk
func (*AnnotationChunk) UnmarshalJSON ¶
func (ac *AnnotationChunk) UnmarshalJSON(data []byte) error
type CanonicalAliasEventContent ¶
type CanonicalAliasEventContent struct { Alias id.RoomAlias `json:"alias"` // This field isn't in a spec release yet. // MSC2432: https://github.com/matrix-org/matrix-doc/pull/2432 AltAliases []string `json:"alt_aliases,omitempty"` }
CanonicalAliasEventContent represents the content of a m.room.canonical_alias state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-canonical-alias
type Content ¶
type Content struct { VeryRaw json.RawMessage Raw map[string]interface{} Parsed interface{} }
Content stores the content of a Matrix event.
By default, the content is only parsed into a map[string]interface{}. However, you can call ParseRaw with the correct event type to parse the content into a nicer struct, which you can then access from Parsed or via the helper functions.
func (*Content) AsCanonicalAlias ¶
func (content *Content) AsCanonicalAlias() *CanonicalAliasEventContent
func (*Content) AsCreate ¶
func (content *Content) AsCreate() *CreateEventContent
func (*Content) AsDirectChats ¶
func (content *Content) AsDirectChats() *DirectChatsEventContent
func (*Content) AsEncrypted ¶
func (content *Content) AsEncrypted() *EncryptedEventContent
func (*Content) AsForwardedRoomKey ¶
func (content *Content) AsForwardedRoomKey() *ForwardedRoomKeyEventContent
func (*Content) AsFullyRead ¶
func (content *Content) AsFullyRead() *FullyReadEventContent
func (*Content) AsGuestAccess ¶
func (content *Content) AsGuestAccess() *GuestAccessEventContent
func (*Content) AsHistoryVisibility ¶
func (content *Content) AsHistoryVisibility() *HistoryVisibilityEventContent
func (*Content) AsIgnoredUserList ¶
func (content *Content) AsIgnoredUserList() *IgnoredUserListEventContent
func (*Content) AsJoinRules ¶
func (content *Content) AsJoinRules() *JoinRulesEventContent
func (*Content) AsMember ¶
func (content *Content) AsMember() *MemberEventContent
func (*Content) AsMessage ¶
func (content *Content) AsMessage() *MessageEventContent
func (*Content) AsPinnedEvents ¶
func (content *Content) AsPinnedEvents() *PinnedEventsEventContent
func (*Content) AsPowerLevels ¶
func (content *Content) AsPowerLevels() *PowerLevelsEventContent
func (*Content) AsPresence ¶
func (content *Content) AsPresence() *PresenceEventContent
func (*Content) AsReaction ¶
func (content *Content) AsReaction() *ReactionEventContent
func (*Content) AsReceipt ¶
func (content *Content) AsReceipt() *ReceiptEventContent
func (*Content) AsRedaction ¶
func (content *Content) AsRedaction() *RedactionEventContent
func (*Content) AsRoomAvatar ¶
func (content *Content) AsRoomAvatar() *RoomAvatarEventContent
func (*Content) AsRoomKey ¶
func (content *Content) AsRoomKey() *RoomKeyEventContent
func (*Content) AsRoomKeyRequest ¶
func (content *Content) AsRoomKeyRequest() *RoomKeyRequestEventContent
func (*Content) AsRoomName ¶
func (content *Content) AsRoomName() *RoomNameEventContent
func (*Content) AsTag ¶
func (content *Content) AsTag() *TagEventContent
func (*Content) AsTombstone ¶
func (content *Content) AsTombstone() *TombstoneEventContent
func (*Content) AsTopic ¶
func (content *Content) AsTopic() *TopicEventContent
func (*Content) AsTyping ¶
func (content *Content) AsTyping() *TypingEventContent
func (*Content) MarshalJSON ¶
func (*Content) MergeParsedToRaw ¶
func (content *Content) MergeParsedToRaw()
func (*Content) UnmarshalJSON ¶
type CreateEventContent ¶
type CreateEventContent struct { Creator id.UserID `json:"creator"` Federate bool `json:"m.federate,omitempty"` RoomVersion string `json:"version,omitempty"` Predecessor struct { RoomID id.RoomID `json:"room_id"` EventID id.EventID `json:"event_id"` } `json:"predecessor"` }
CreateEventContent represents the content of a m.room.create state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-create
type DirectChatsEventContent ¶
DirectChatsEventContent represents the content of a m.direct account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-direct
type EncryptedEventContent ¶
type EncryptedEventContent struct { Algorithm id.Algorithm `json:"algorithm"` SenderKey id.SenderKey `json:"sender_key"` DeviceID id.DeviceID `json:"device_id,omitempty"` SessionID id.SessionID `json:"session_id,omitempty"` Ciphertext json.RawMessage `json:"ciphertext"` MegolmCiphertext []byte `json:"-"` OlmCiphertext OlmCiphertexts `json:"-"` RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
EncryptedEventContent represents the content of a m.room.encrypted message event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-encrypted
func (*EncryptedEventContent) MarshalJSON ¶
func (content *EncryptedEventContent) MarshalJSON() ([]byte, error)
func (*EncryptedEventContent) UnmarshalJSON ¶
func (content *EncryptedEventContent) UnmarshalJSON(data []byte) error
type EncryptedFileInfo ¶
type EncryptedFileInfo struct { attachment.EncryptedFile URL id.ContentURIString `json:"url"` }
type EncryptionEventContent ¶
type EncryptionEventContent struct { // The encryption algorithm to be used to encrypt messages sent in this room. Must be 'm.megolm.v1.aes-sha2'. Algorithm id.Algorithm `json:"algorithm"` // How long the session should be used before changing it. 604800000 (a week) is the recommended default. RotationPeriodMillis int64 `json:"rotation_period_ms,omitempty"` // How many messages should be sent before changing the session. 100 is the recommended default. RotationPeriodMessages int `json:"rotation_period_messages,omitempty"` }
EncryptionEventContent represents the content of a m.room.encryption state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-encryption
type Event ¶
type Event struct { StateKey *string `json:"state_key,omitempty"` // The state key for the event. Only present on State Events. Sender id.UserID `json:"sender"` // The user ID of the sender of the event Type Type `json:"type"` // The event type Timestamp int64 `json:"origin_server_ts"` // The unix timestamp when this message was sent by the origin server ID id.EventID `json:"event_id"` // The unique ID of this event RoomID id.RoomID `json:"room_id"` // The room the event was sent to. May be nil (e.g. for presence) Content Content `json:"content"` // The JSON content of the event. Redacts id.EventID `json:"redacts,omitempty"` // The event ID that was redacted if a m.room.redaction event Unsigned Unsigned `json:"unsigned,omitempty"` // Unsigned content set by own homeserver. }
Event represents a single Matrix event.
func (*Event) GenerateReplyFallbackHTML ¶
func (*Event) GenerateReplyFallbackText ¶
func (*Event) GetStateKey ¶
type EventIDChunk ¶
type EventIDChunk struct { RelationChunk List []string `json:"-"` }
func (*EventIDChunk) Serialize ¶
func (ec *EventIDChunk) Serialize(typ RelationType) RelationChunk
func (*EventIDChunk) UnmarshalJSON ¶
func (ec *EventIDChunk) UnmarshalJSON(data []byte) error
type FileInfo ¶
type FileInfo struct { MimeType string `json:"mimetype,omitempty"` ThumbnailInfo *FileInfo `json:"thumbnail_info,omitempty"` ThumbnailURL id.ContentURIString `json:"thumbnail_url,omitempty"` ThumbnailFile *EncryptedFileInfo `json:"thumbnail_file,omitempty"` Width int `json:"-"` Height int `json:"-"` Duration int `json:"-"` Size int `json:"-"` }
func (*FileInfo) GetThumbnailInfo ¶
func (*FileInfo) MarshalJSON ¶
func (*FileInfo) UnmarshalJSON ¶
type Format ¶
type Format string
Format specifies the format of the formatted_body in m.room.message events. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-message-msgtypes
const (
FormatHTML Format = "org.matrix.custom.html"
)
Message formats
type ForwardedRoomKeyEventContent ¶
type ForwardedRoomKeyEventContent struct { RoomKeyEventContent SenderClaimedKey string `json:"sender_claimed_ed25519_key"` ForwardingKeyChain []string `json:"forwarding_curve25519_key_chain"` }
ForwardedRoomKeyEventContent represents the content of a m.forwarded_room_key to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-forwarded-room-key
type FullyReadEventContent ¶
FullyReadEventContent represents the content of a m.fully_read account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-fully-read
type GuestAccess ¶
type GuestAccess string
GuestAccess specifies whether or not guest accounts can join. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-guest-access
const ( GuestAccessCanJoin GuestAccess = "can_join" GuestAccessForbidden GuestAccess = "forbidden" )
type GuestAccessEventContent ¶
type GuestAccessEventContent struct {
GuestAccess GuestAccess `json:"guest_access"`
}
GuestAccessEventContent represents the content of a m.room.guest_access state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-guest-access
type HistoryVisibility ¶
type HistoryVisibility string
HistoryVisibility specifies who can see new messages. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-history-visibility
const ( HistoryVisibilityInvited HistoryVisibility = "invited" HistoryVisibilityJoined HistoryVisibility = "joined" HistoryVisibilityWorldReadable HistoryVisibility = "world_readable" )
type HistoryVisibilityEventContent ¶
type HistoryVisibilityEventContent struct {
HistoryVisibility HistoryVisibility `json:"history_visibility"`
}
HistoryVisibilityEventContent represents the content of a m.room.history_visibility state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-history-visibility
type IgnoredUser ¶
type IgnoredUser struct { }
type IgnoredUserListEventContent ¶
type IgnoredUserListEventContent struct {
IgnoredUsers map[id.UserID]IgnoredUser `json:"ignored_users"`
}
IgnoredUserListEventContent represents the content of a m.ignored_user_list account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-ignored-user-list
type JoinRule ¶
type JoinRule string
JoinRule specifies how open a room is to new members. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-join-rules
type JoinRulesEventContent ¶
type JoinRulesEventContent struct {
JoinRule JoinRule `json:"join_rule"`
}
JoinRulesEventContent represents the content of a m.room.join_rules state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-join-rules
type KeyRequestAction ¶
type KeyRequestAction string
type MemberEventContent ¶
type MemberEventContent struct { Membership Membership `json:"membership"` AvatarURL id.ContentURIString `json:"avatar_url,omitempty"` Displayname string `json:"displayname,omitempty"` IsDirect bool `json:"is_direct,omitempty"` ThirdPartyInvite *ThirdPartyInvite `json:"third_party_invite,omitempty"` Reason string `json:"reason,omitempty"` }
MemberEventContent represents the content of a m.room.member state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-member
type Membership ¶
type Membership string
Membership is an enum specifying the membership state of a room member.
const ( MembershipJoin Membership = "join" MembershipLeave Membership = "leave" MembershipInvite Membership = "invite" MembershipBan Membership = "ban" MembershipKnock Membership = "knock" )
The allowed membership states as specified in spec section 10.5.5.
func (Membership) IsInviteOrJoin ¶
func (ms Membership) IsInviteOrJoin() bool
func (Membership) IsLeaveOrBan ¶
func (ms Membership) IsLeaveOrBan() bool
type MessageEventContent ¶
type MessageEventContent struct { // Base m.room.message fields MsgType MessageType `json:"msgtype"` Body string `json:"body"` // Extra fields for text types Format Format `json:"format,omitempty"` FormattedBody string `json:"formatted_body,omitempty"` // Extra fields for media types URL id.ContentURIString `json:"url,omitempty"` Info *FileInfo `json:"info,omitempty"` File *EncryptedFileInfo `json:"file,omitempty"` // Edits and relations NewContent *MessageEventContent `json:"m.new_content,omitempty"` RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
MssageEventContent represents the content of a m.room.message event.
It is also used to represent m.sticker events, as they are equivalent to m.room.message with the exception of the msgtype field.
https://matrix.org/docs/spec/client_server/r0.6.0#m-room-message
func (*MessageEventContent) GetFile ¶
func (content *MessageEventContent) GetFile() *EncryptedFileInfo
func (*MessageEventContent) GetInfo ¶
func (content *MessageEventContent) GetInfo() *FileInfo
func (*MessageEventContent) GetRelatesTo ¶
func (content *MessageEventContent) GetRelatesTo() *RelatesTo
func (*MessageEventContent) GetReplyTo ¶
func (content *MessageEventContent) GetReplyTo() id.EventID
func (*MessageEventContent) OptionalGetRelatesTo ¶
func (content *MessageEventContent) OptionalGetRelatesTo() *RelatesTo
func (*MessageEventContent) RemoveReplyFallback ¶
func (content *MessageEventContent) RemoveReplyFallback()
func (*MessageEventContent) SetRelatesTo ¶
func (content *MessageEventContent) SetRelatesTo(rel *RelatesTo)
func (*MessageEventContent) SetReply ¶
func (content *MessageEventContent) SetReply(inReplyTo *Event)
type MessageType ¶
type MessageType string
MessageType is the sub-type of a m.room.message event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-message-msgtypes
const ( MsgText MessageType = "m.text" MsgEmote MessageType = "m.emote" MsgNotice MessageType = "m.notice" MsgImage MessageType = "m.image" MsgLocation MessageType = "m.location" MsgVideo MessageType = "m.video" MsgAudio MessageType = "m.audio" MsgFile MessageType = "m.file" )
Msgtypes
type OlmCiphertexts ¶
type OlmCiphertexts map[id.Curve25519]struct { Body string `json:"body"` Type id.OlmMsgType `json:"type"` }
type PinnedEventsEventContent ¶
PinnedEventsEventContent represents the content of a m.room.pinned_events state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-pinned-events
type PowerLevelsEventContent ¶
type PowerLevelsEventContent struct { Users map[id.UserID]int `json:"users"` UsersDefault int `json:"users_default"` Events map[string]int `json:"events"` EventsDefault int `json:"events_default"` StateDefaultPtr *int `json:"state_default,omitempty"` InvitePtr *int `json:"invite,omitempty"` KickPtr *int `json:"kick,omitempty"` BanPtr *int `json:"ban,omitempty"` RedactPtr *int `json:"redact,omitempty"` // contains filtered or unexported fields }
PowerLevelsEventContent represents the content of a m.room.power_levels state event content. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-power-levels
func (*PowerLevelsEventContent) Ban ¶
func (pl *PowerLevelsEventContent) Ban() int
func (*PowerLevelsEventContent) EnsureEventLevel ¶
func (pl *PowerLevelsEventContent) EnsureEventLevel(eventType Type, level int) bool
func (*PowerLevelsEventContent) EnsureUserLevel ¶
func (pl *PowerLevelsEventContent) EnsureUserLevel(userID id.UserID, level int) bool
func (*PowerLevelsEventContent) GetEventLevel ¶
func (pl *PowerLevelsEventContent) GetEventLevel(eventType Type) int
func (*PowerLevelsEventContent) GetUserLevel ¶
func (pl *PowerLevelsEventContent) GetUserLevel(userID id.UserID) int
func (*PowerLevelsEventContent) Invite ¶
func (pl *PowerLevelsEventContent) Invite() int
func (*PowerLevelsEventContent) Kick ¶
func (pl *PowerLevelsEventContent) Kick() int
func (*PowerLevelsEventContent) Redact ¶
func (pl *PowerLevelsEventContent) Redact() int
func (*PowerLevelsEventContent) SetEventLevel ¶
func (pl *PowerLevelsEventContent) SetEventLevel(eventType Type, level int)
func (*PowerLevelsEventContent) SetUserLevel ¶
func (pl *PowerLevelsEventContent) SetUserLevel(userID id.UserID, level int)
func (*PowerLevelsEventContent) StateDefault ¶
func (pl *PowerLevelsEventContent) StateDefault() int
type PresenceEventContent ¶
type PresenceEventContent struct { Presence Presence `json:"presence"` Displayname string `json:"displayname,omitempty"` AvatarURL id.ContentURIString `json:"avatar_url,omitempty"` LastActiveAgo int64 `json:"last_active_ago,omitempty"` CurrentlyActive bool `json:"currently_active,omitempty"` StatusMessage string `json:"status_msg,omitempty"` }
PresenceEventContent represents the content of a m.presence ephemeral event. https://matrix.org/docs/spec/client_server/r0.6.0#m-presence
type ReactionEventContent ¶
type ReactionEventContent struct {
RelatesTo RelatesTo `json:"m.relates_to"`
}
ReactionEventContent represents the content of a m.reaction message event. This is not yet in a spec release, see https://github.com/matrix-org/matrix-doc/pull/1849
func (*ReactionEventContent) GetRelatesTo ¶
func (content *ReactionEventContent) GetRelatesTo() *RelatesTo
func (*ReactionEventContent) OptionalGetRelatesTo ¶
func (content *ReactionEventContent) OptionalGetRelatesTo() *RelatesTo
func (*ReactionEventContent) SetRelatesTo ¶
func (content *ReactionEventContent) SetRelatesTo(rel *RelatesTo)
type ReadReceipt ¶
type ReadReceipt struct {
Timestamp int64 `json:"ts"`
}
func (*ReadReceipt) UnmarshalJSON ¶
func (rr *ReadReceipt) UnmarshalJSON(data []byte) error
type ReceiptEventContent ¶
ReceiptEventContent represents the content of a m.receipt ephemeral event. https://matrix.org/docs/spec/client_server/r0.6.0#m-receipt
type Receipts ¶
type Receipts struct {
Read map[id.UserID]ReadReceipt `json:"m.read"`
}
type RedactionEventContent ¶
type RedactionEventContent struct {
Reason string `json:"reason,omitempty"`
}
RedactionEventContent represents the content of a m.room.redaction message event.
The redacted event ID is still at the top level, but will move in a future room version. See https://github.com/matrix-org/matrix-doc/pull/2244 and https://github.com/matrix-org/matrix-doc/pull/2174
https://matrix.org/docs/spec/client_server/r0.6.0#m-room-redaction
type RelatesTo ¶
type RelatesTo struct { Type RelationType EventID id.EventID Key string }
func (*RelatesTo) GetAnnotationID ¶
func (*RelatesTo) GetAnnotationKey ¶
func (*RelatesTo) GetReferenceID ¶
func (*RelatesTo) GetReplaceID ¶
func (*RelatesTo) MarshalJSON ¶
func (*RelatesTo) UnmarshalJSON ¶
type RelationChunk ¶
type RelationChunk struct { Chunk []RelationChunkItem `json:"chunk"` Limited bool `json:"limited"` Count int `json:"count"` }
type RelationChunkItem ¶
type RelationChunkItem struct { Type RelationType `json:"type"` EventID string `json:"event_id,omitempty"` Key string `json:"key,omitempty"` Count int `json:"count,omitempty"` }
type RelationType ¶
type RelationType string
const ( RelReplace RelationType = "m.replace" RelReference RelationType = "m.reference" RelAnnotation RelationType = "m.annotation" )
type Relations ¶
type Relations struct { Raw map[RelationType]RelationChunk `json:"-"` Annotations AnnotationChunk `json:"m.annotation,omitempty"` References EventIDChunk `json:"m.reference,omitempty"` Replaces EventIDChunk `json:"m.replace,omitempty"` }
func (*Relations) MarshalJSON ¶
func (*Relations) UnmarshalJSON ¶
type RequestedKeyInfo ¶
type RoomAvatarEventContent ¶
type RoomAvatarEventContent struct {
URL id.ContentURI `json:"url"`
}
RoomAvatarEventContent represents the content of a m.room.avatar state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-avatar
type RoomKeyEventContent ¶
type RoomKeyEventContent struct { Algorithm id.Algorithm `json:"algorithm"` RoomID id.RoomID `json:"room_id"` SessionID id.SessionID `json:"session_id"` SessionKey string `json:"session_key"` }
RoomKeyEventContent represents the content of a m.room_key to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-key
type RoomKeyRequestEventContent ¶
type RoomKeyRequestEventContent struct { Body RequestedKeyInfo `json:"body"` Action KeyRequestAction `json:"action"` RequestingDeviceID id.DeviceID `json:"requesting_device_id"` RequestID string `json:"request_id"` }
RoomKeyRequestEventContent represents the content of a m.room_key_request to_device event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-key-request
type RoomNameEventContent ¶
type RoomNameEventContent struct {
Name string `json:"name"`
}
RoomNameEventContent represents the content of a m.room.name state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-name
type StrippedState ¶
type TagEventContent ¶
type TagEventContent struct {
Tags Tags `json:"tags"`
}
TagEventContent represents the content of a m.tag room account data event. https://matrix.org/docs/spec/client_server/r0.6.0#m-tag
type ThirdPartyInvite ¶
type ThirdPartyInvite struct { DisplayName string `json:"display_name"` Signed struct { Token string `json:"token"` Signatures json.RawMessage `json:"signatures"` MXID string `json:"mxid"` } }
type TombstoneEventContent ¶
type TombstoneEventContent struct { Body string `json:"body"` ReplacementRoom id.RoomID `json:"replacement_room"` }
TombstoneEventContent represents the content of a m.room.tombstone state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-tombstone
type TopicEventContent ¶
type TopicEventContent struct {
Topic string `json:"topic"`
}
TopicEventContent represents the content of a m.room.topic state event. https://matrix.org/docs/spec/client_server/r0.6.0#m-room-topic
type Type ¶
func NewEventType ¶
func (*Type) GuessClass ¶
func (*Type) IsAccountData ¶
func (*Type) IsEphemeral ¶
func (*Type) IsToDevice ¶
func (*Type) MarshalJSON ¶
func (*Type) UnmarshalJSON ¶
type TypingEventContent ¶
TagEventContent represents the content of a m.typing ephemeral event. https://matrix.org/docs/spec/client_server/r0.6.0#m-typing
type Unsigned ¶
type Unsigned struct { PrevContent *Content `json:"prev_content,omitempty"` PrevSender id.UserID `json:"prev_sender,omitempty"` ReplacesState id.EventID `json:"replaces_state,omitempty"` Age int64 `json:"age,omitempty"` TransactionID string `json:"transaction_id,omitempty"` Relations Relations `json:"m.relations,omitempty"` RedactedBecause *Event `json:"redacted_because,omitempty"` InviteRoomState []StrippedState `json:"invite_room_state"` }