Documentation ¶
Index ¶
- Constants
- Variables
- func IsUnsupportedContentType(err error) bool
- func TrimReplyFallbackHTML(html string) string
- func TrimReplyFallbackText(text string) string
- type AnnotationChunk
- type BaseCallEventContent
- type BeeperMessageStatusEventContent
- type BeeperRetryMetadata
- type BridgeEventContent
- type BridgeInfoSection
- type CallAnswerEventContent
- type CallCandidate
- type CallCandidatesEventContent
- type CallData
- type CallDataType
- type CallHangupEventContent
- type CallHangupReason
- type CallInviteEventContent
- type CallNegotiateEventContent
- type CallRejectEventContent
- type CallSelectAnswerEventContent
- type CallVersion
- type CanonicalAliasEventContent
- type Content
- func (content *Content) AsBridge() *BridgeEventContent
- func (content *Content) AsCallAnswer() *CallAnswerEventContent
- func (content *Content) AsCallCandidates() *CallCandidatesEventContent
- func (content *Content) AsCallHangup() *CallHangupEventContent
- func (content *Content) AsCallInvite() *CallInviteEventContent
- func (content *Content) AsCallNegotiate() *CallNegotiateEventContent
- func (content *Content) AsCallReject() *CallRejectEventContent
- func (content *Content) AsCallSelectAnswer() *CallSelectAnswerEventContent
- func (content *Content) AsCanonicalAlias() *CanonicalAliasEventContent
- func (content *Content) AsCreate() *CreateEventContent
- func (content *Content) AsDirectChats() *DirectChatsEventContent
- func (content *Content) AsEncrypted() *EncryptedEventContent
- func (content *Content) AsEncryption() *EncryptionEventContent
- 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) AsModPolicy() *ModPolicyContent
- 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) AsRoomKeyWithheld() *RoomKeyWithheldEventContent
- func (content *Content) AsRoomName() *RoomNameEventContent
- func (content *Content) AsSpaceChild() *SpaceChildEventContent
- func (content *Content) AsSpaceParent() *SpaceParentEventContent
- 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) ParseRaw(evtType Type) error
- func (content *Content) UnmarshalJSON(data []byte) error
- type CreateEventContent
- type DirectChatsEventContent
- type DummyEventContent
- 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 InReplyTo
- type InsertionMarkerContent
- type JoinRule
- type JoinRuleAllow
- type JoinRuleAllowType
- type JoinRulesEventContent
- type KeyAgreementProtocol
- type KeyRequestAction
- type MACMethod
- type MautrixInfo
- type MemberEventContent
- type Membership
- type MessageEventContent
- func (content *MessageEventContent) EnsureHasHTML()
- 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) SetEdit(original id.EventID)
- func (content *MessageEventContent) SetRelatesTo(rel *RelatesTo)
- func (content *MessageEventContent) SetReply(inReplyTo *Event)
- type MessageStatus
- type MessageStatusReason
- type MessageType
- type ModPolicyContent
- 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) Historical() 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 Predecessor
- type Presence
- type PresenceEventContent
- type ReactionEventContent
- type ReadReceipt
- type ReceiptEventContent
- type ReceiptType
- type Receipts
- type RedactionEventContent
- type Relatable
- type RelatesTo
- func (rel *RelatesTo) Copy() *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) GetReplyTo() id.EventID
- func (rel *RelatesTo) GetThreadParent() id.EventID
- func (rel *RelatesTo) SetAnnotation(mxid id.EventID, key string) *RelatesTo
- func (rel *RelatesTo) SetReplace(mxid id.EventID) *RelatesTo
- func (rel *RelatesTo) SetReplyTo(mxid id.EventID) *RelatesTo
- func (rel *RelatesTo) SetThread(mxid, fallback id.EventID) *RelatesTo
- type RelationChunk
- type RelationChunkItem
- type RelationType
- type Relations
- type RequestedKeyInfo
- type RoomAvatarEventContent
- type RoomKeyEventContent
- type RoomKeyRequestEventContent
- type RoomKeyWithheldCode
- type RoomKeyWithheldEventContent
- type RoomNameEventContent
- type RoomType
- type SASMethod
- type ServerACLEventContent
- type SpaceChildEventContent
- type SpaceParentEventContent
- 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) IsCall() bool
- func (et *Type) IsCustom() bool
- func (et *Type) IsEphemeral() bool
- func (et *Type) IsInRoomVerification() bool
- func (et *Type) IsState() bool
- func (et *Type) IsToDevice() bool
- func (et *Type) MarshalJSON() ([]byte, error)
- func (et Type) MarshalText() ([]byte, error)
- func (et *Type) Repr() string
- func (et *Type) String() string
- func (et *Type) UnmarshalJSON(data []byte) error
- func (et Type) UnmarshalText(data []byte) error
- type TypeClass
- type TypingEventContent
- type Unsigned
- type UserReceipts
- type VerificationAcceptEventContent
- type VerificationCancelCode
- type VerificationCancelEventContent
- type VerificationHashMethod
- type VerificationKeyEventContent
- type VerificationMacEventContent
- type VerificationMethod
- type VerificationReadyEventContent
- type VerificationRequestEventContent
- type VerificationStartEventContent
- func (vsec *VerificationStartEventContent) GetRelatesTo() *RelatesTo
- func (vsec *VerificationStartEventContent) OptionalGetRelatesTo() *RelatesTo
- func (vsec *VerificationStartEventContent) SetRelatesTo(rel *RelatesTo)
- func (vsec *VerificationStartEventContent) SupportsHashMethod(alg VerificationHashMethod) bool
- func (vsec *VerificationStartEventContent) SupportsKeyAgreementProtocol(proto KeyAgreementProtocol) bool
- func (vsec *VerificationStartEventContent) SupportsMACMethod(meth MACMethod) bool
- func (vsec *VerificationStartEventContent) SupportsSASMethod(meth SASMethod) bool
Constants ¶
const ( KeyRequestActionRequest = "request" KeyRequestActionCancel = "request_cancellation" )
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} StateServerACL = Type{"m.room.server_acl", StateEventType} StateTombstone = Type{"m.room.tombstone", StateEventType} StatePolicyRoom = Type{"m.policy.rule.room", StateEventType} StatePolicyServer = Type{"m.policy.rule.server", StateEventType} StatePolicyUser = Type{"m.policy.rule.user", StateEventType} StateEncryption = Type{"m.room.encryption", StateEventType} StateBridge = Type{"m.bridge", StateEventType} StateHalfShotBridge = Type{"uk.half-shot.bridge", StateEventType} StateSpaceChild = Type{"m.space.child", StateEventType} StateSpaceParent = Type{"m.space.parent", StateEventType} StateInsertionMarker = Type{"org.matrix.msc2716.marker", 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} InRoomVerificationStart = Type{"m.key.verification.start", MessageEventType} InRoomVerificationReady = Type{"m.key.verification.ready", MessageEventType} InRoomVerificationAccept = Type{"m.key.verification.accept", MessageEventType} InRoomVerificationKey = Type{"m.key.verification.key", MessageEventType} InRoomVerificationMAC = Type{"m.key.verification.mac", MessageEventType} InRoomVerificationCancel = Type{"m.key.verification.cancel", MessageEventType} CallInvite = Type{"m.call.invite", MessageEventType} CallCandidates = Type{"m.call.candidates", MessageEventType} CallAnswer = Type{"m.call.answer", MessageEventType} CallReject = Type{"m.call.reject", MessageEventType} CallSelectAnswer = Type{"m.call.select_answer", MessageEventType} CallNegotiate = Type{"m.call.negotiate", MessageEventType} CallHangup = Type{"m.call.hangup", MessageEventType} BeeperMessageStatus = Type{"com.beeper.message_send_status", 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} AccountDataSecretStorageDefaultKey = Type{"m.secret_storage.default_key", AccountDataEventType} AccountDataSecretStorageKey = Type{"m.secret_storage.key", AccountDataEventType} AccountDataCrossSigningMaster = Type{"m.cross_signing.master", AccountDataEventType} AccountDataCrossSigningUser = Type{"m.cross_signing.user_signing", AccountDataEventType} AccountDataCrossSigningSelf = Type{"m.cross_signing.self_signing", 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} ToDeviceRoomKeyWithheld = Type{"m.room_key.withheld", ToDeviceEventType} ToDeviceDummy = Type{"m.dummy", ToDeviceEventType} ToDeviceVerificationRequest = Type{"m.key.verification.request", ToDeviceEventType} ToDeviceVerificationStart = Type{"m.key.verification.start", ToDeviceEventType} ToDeviceVerificationAccept = Type{"m.key.verification.accept", ToDeviceEventType} ToDeviceVerificationKey = Type{"m.key.verification.key", ToDeviceEventType} ToDeviceVerificationMAC = Type{"m.key.verification.mac", ToDeviceEventType} ToDeviceVerificationCancel = Type{"m.key.verification.cancel", ToDeviceEventType} ToDeviceOrgMatrixRoomKeyWithheld = Type{"org.matrix.room_key.withheld", ToDeviceEventType} )
Device-to-device events
var ErrContentAlreadyParsed = errors.New("content is already parsed")
var ErrUnsupportedContentType = errors.New("unsupported event type")
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{}), StateServerACL: reflect.TypeOf(ServerACLEventContent{}), 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{}), StatePolicyRoom: reflect.TypeOf(ModPolicyContent{}), StatePolicyServer: reflect.TypeOf(ModPolicyContent{}), StatePolicyUser: reflect.TypeOf(ModPolicyContent{}), StateEncryption: reflect.TypeOf(EncryptionEventContent{}), StateBridge: reflect.TypeOf(BridgeEventContent{}), StateHalfShotBridge: reflect.TypeOf(BridgeEventContent{}), StateSpaceParent: reflect.TypeOf(SpaceParentEventContent{}), StateSpaceChild: reflect.TypeOf(SpaceChildEventContent{}), StateInsertionMarker: reflect.TypeOf(InsertionMarkerContent{}), EventMessage: reflect.TypeOf(MessageEventContent{}), EventSticker: reflect.TypeOf(MessageEventContent{}), EventEncrypted: reflect.TypeOf(EncryptedEventContent{}), EventRedaction: reflect.TypeOf(RedactionEventContent{}), EventReaction: reflect.TypeOf(ReactionEventContent{}), BeeperMessageStatus: reflect.TypeOf(BeeperMessageStatusEventContent{}), 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{}), InRoomVerificationStart: reflect.TypeOf(VerificationStartEventContent{}), InRoomVerificationReady: reflect.TypeOf(VerificationReadyEventContent{}), InRoomVerificationAccept: reflect.TypeOf(VerificationAcceptEventContent{}), InRoomVerificationKey: reflect.TypeOf(VerificationKeyEventContent{}), InRoomVerificationMAC: reflect.TypeOf(VerificationMacEventContent{}), InRoomVerificationCancel: reflect.TypeOf(VerificationCancelEventContent{}), ToDeviceRoomKey: reflect.TypeOf(RoomKeyEventContent{}), ToDeviceForwardedRoomKey: reflect.TypeOf(ForwardedRoomKeyEventContent{}), ToDeviceRoomKeyRequest: reflect.TypeOf(RoomKeyRequestEventContent{}), ToDeviceEncrypted: reflect.TypeOf(EncryptedEventContent{}), ToDeviceRoomKeyWithheld: reflect.TypeOf(RoomKeyWithheldEventContent{}), ToDeviceDummy: reflect.TypeOf(DummyEventContent{}), ToDeviceVerificationStart: reflect.TypeOf(VerificationStartEventContent{}), ToDeviceVerificationAccept: reflect.TypeOf(VerificationAcceptEventContent{}), ToDeviceVerificationKey: reflect.TypeOf(VerificationKeyEventContent{}), ToDeviceVerificationMAC: reflect.TypeOf(VerificationMacEventContent{}), ToDeviceVerificationCancel: reflect.TypeOf(VerificationCancelEventContent{}), ToDeviceVerificationRequest: reflect.TypeOf(VerificationRequestEventContent{}), ToDeviceOrgMatrixRoomKeyWithheld: reflect.TypeOf(RoomKeyWithheldEventContent{}), CallInvite: reflect.TypeOf(CallInviteEventContent{}), CallCandidates: reflect.TypeOf(CallCandidatesEventContent{}), CallAnswer: reflect.TypeOf(CallAnswerEventContent{}), CallReject: reflect.TypeOf(CallRejectEventContent{}), CallSelectAnswer: reflect.TypeOf(CallSelectAnswerEventContent{}), CallNegotiate: reflect.TypeOf(CallNegotiateEventContent{}), CallHangup: reflect.TypeOf(CallHangupEventContent{}), }
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 BaseCallEventContent ¶ added in v0.9.7
type BaseCallEventContent struct { CallID string `json:"call_id"` PartyID string `json:"party_id"` Version CallVersion `json:"version"` }
type BeeperMessageStatusEventContent ¶ added in v0.12.0
type BeeperMessageStatusEventContent struct { Network string `json:"network"` RelatesTo RelatesTo `json:"m.relates_to"` Status MessageStatus `json:"status"` Reason MessageStatusReason `json:"reason,omitempty"` Error string `json:"error,omitempty"` Message string `json:"message,omitempty"` Success bool `json:"success"` CanRetry *bool `json:"can_retry,omitempty"` StillWorking bool `json:"still_working,omitempty"` LastRetry id.EventID `json:"last_retry,omitempty"` }
func (*BeeperMessageStatusEventContent) FillLegacyBooleans ¶ added in v0.12.0
func (status *BeeperMessageStatusEventContent) FillLegacyBooleans()
type BeeperRetryMetadata ¶ added in v0.12.0
type BridgeEventContent ¶ added in v0.9.29
type BridgeEventContent struct { BridgeBot id.UserID `json:"bridgebot"` Creator id.UserID `json:"creator,omitempty"` Protocol BridgeInfoSection `json:"protocol"` Network *BridgeInfoSection `json:"network,omitempty"` Channel BridgeInfoSection `json:"channel"` }
BridgeEventContent represents the content of a m.bridge state event. https://github.com/matrix-org/matrix-doc/pull/2346
type BridgeInfoSection ¶ added in v0.9.29
type BridgeInfoSection struct { ID string `json:"id"` DisplayName string `json:"displayname,omitempty"` AvatarURL id.ContentURIString `json:"avatar_url,omitempty"` ExternalURL string `json:"external_url,omitempty"` }
type CallAnswerEventContent ¶ added in v0.9.7
type CallAnswerEventContent struct { BaseCallEventContent Answer CallData `json:"answer"` }
type CallCandidate ¶ added in v0.9.7
type CallCandidatesEventContent ¶ added in v0.9.7
type CallCandidatesEventContent struct { BaseCallEventContent Candidates []CallCandidate `json:"candidates"` }
type CallData ¶ added in v0.9.7
type CallData struct { SDP string `json:"sdp"` Type CallDataType `json:"type"` }
type CallDataType ¶ added in v0.9.7
type CallDataType string
const ( CallDataTypeOffer CallDataType = "offer" CallDataTypeAnswer CallDataType = "answer" )
type CallHangupEventContent ¶ added in v0.9.7
type CallHangupEventContent struct { BaseCallEventContent Reason CallHangupReason `json:"reason"` }
type CallHangupReason ¶ added in v0.9.7
type CallHangupReason string
const ( CallHangupICEFailed CallHangupReason = "ice_failed" CallHangupInviteTimeout CallHangupReason = "invite_timeout" CallHangupUserHangup CallHangupReason = "user_hangup" CallHangupUserMediaFailed CallHangupReason = "user_media_failed" CallHangupUnknownError CallHangupReason = "unknown_error" )
type CallInviteEventContent ¶ added in v0.9.7
type CallInviteEventContent struct { BaseCallEventContent Lifetime int `json:"lifetime"` Offer CallData `json:"offer"` }
type CallNegotiateEventContent ¶ added in v0.9.7
type CallNegotiateEventContent struct { BaseCallEventContent Lifetime int `json:"lifetime"` Description CallData `json:"description"` }
type CallRejectEventContent ¶ added in v0.9.7
type CallRejectEventContent struct {
BaseCallEventContent
}
type CallSelectAnswerEventContent ¶ added in v0.9.7
type CallSelectAnswerEventContent struct { BaseCallEventContent SelectedPartyID string `json:"selected_party_id"` }
type CallVersion ¶ added in v0.9.11
type CallVersion string
func (*CallVersion) Int ¶ added in v0.9.11
func (cv *CallVersion) Int() (int, error)
func (*CallVersion) MarshalJSON ¶ added in v0.9.11
func (cv *CallVersion) MarshalJSON() ([]byte, error)
func (*CallVersion) UnmarshalJSON ¶ added in v0.9.11
func (cv *CallVersion) UnmarshalJSON(raw []byte) error
type CanonicalAliasEventContent ¶
type CanonicalAliasEventContent struct { Alias id.RoomAlias `json:"alias"` AltAliases []id.RoomAlias `json:"alt_aliases,omitempty"` }
CanonicalAliasEventContent represents the content of a m.room.canonical_alias state event. https://spec.matrix.org/v1.2/client-server-api/#mroomcanonical_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 raw JSON bytes are stored in VeryRaw and parsed into a map[string]interface{} in the Raw field. Additionally, you can call ParseRaw with the correct event type to parse the (VeryRaw) content into a nicer struct, which you can then access from Parsed or via the helper functions.
When being marshaled into JSON, the data in Parsed will be marshaled first and then recursively merged with the data in Raw. Values in Raw are preferred, but nested objects will be recursed into before merging, rather than overriding the whole object with the one in Raw). If one of them is nil, the only the other is used. If both (Parsed and Raw) are nil, VeryRaw is used instead.
func (*Content) AsBridge ¶ added in v0.9.29
func (content *Content) AsBridge() *BridgeEventContent
func (*Content) AsCallAnswer ¶ added in v0.9.7
func (content *Content) AsCallAnswer() *CallAnswerEventContent
func (*Content) AsCallCandidates ¶ added in v0.9.7
func (content *Content) AsCallCandidates() *CallCandidatesEventContent
func (*Content) AsCallHangup ¶ added in v0.9.7
func (content *Content) AsCallHangup() *CallHangupEventContent
func (*Content) AsCallInvite ¶ added in v0.9.7
func (content *Content) AsCallInvite() *CallInviteEventContent
func (*Content) AsCallNegotiate ¶ added in v0.9.7
func (content *Content) AsCallNegotiate() *CallNegotiateEventContent
func (*Content) AsCallReject ¶ added in v0.9.7
func (content *Content) AsCallReject() *CallRejectEventContent
func (*Content) AsCallSelectAnswer ¶ added in v0.9.7
func (content *Content) AsCallSelectAnswer() *CallSelectAnswerEventContent
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) AsEncryption ¶ added in v0.3.7
func (content *Content) AsEncryption() *EncryptionEventContent
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) AsModPolicy ¶ added in v0.10.12
func (content *Content) AsModPolicy() *ModPolicyContent
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) AsRoomKeyWithheld ¶ added in v0.5.3
func (content *Content) AsRoomKeyWithheld() *RoomKeyWithheldEventContent
func (*Content) AsRoomName ¶
func (content *Content) AsRoomName() *RoomNameEventContent
func (*Content) AsSpaceChild ¶ added in v0.10.8
func (content *Content) AsSpaceChild() *SpaceChildEventContent
func (*Content) AsSpaceParent ¶ added in v0.10.8
func (content *Content) AsSpaceParent() *SpaceParentEventContent
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) UnmarshalJSON ¶
type CreateEventContent ¶
type CreateEventContent struct { Type RoomType `json:"type,omitempty"` Creator id.UserID `json:"creator,omitempty"` Federate bool `json:"m.federate,omitempty"` RoomVersion string `json:"room_version,omitempty"` Predecessor *Predecessor `json:"predecessor,omitempty"` }
CreateEventContent represents the content of a m.room.create state event. https://spec.matrix.org/v1.2/client-server-api/#mroomcreate
type DirectChatsEventContent ¶
DirectChatsEventContent represents the content of a m.direct account data event. https://spec.matrix.org/v1.2/client-server-api/#mdirect
type DummyEventContent ¶ added in v0.10.5
type DummyEventContent struct{}
type EncryptedEventContent ¶
type EncryptedEventContent struct { Algorithm id.Algorithm `json:"algorithm"` SenderKey id.SenderKey `json:"sender_key,omitempty"` // Deprecated: Matrix v1.3 DeviceID id.DeviceID `json:"device_id,omitempty"` // Only present for Megolm events 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://spec.matrix.org/v1.2/client-server-api/#mroomencrypted
Note that sender_key and device_id are deprecated in Megolm events as of https://github.com/matrix-org/matrix-spec-proposals/pull/3700
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_msgs,omitempty"` }
EncryptionEventContent represents the content of a m.room.encryption state event. https://spec.matrix.org/v1.2/client-server-api/#mroomencryption
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,omitempty"` // The user ID of the sender of the event Type Type `json:"type"` // The event type Timestamp int64 `json:"origin_server_ts,omitempty"` // The unix timestamp when this message was sent by the origin server ID id.EventID `json:"event_id,omitempty"` // The unique ID of this event RoomID id.RoomID `json:"room_id,omitempty"` // 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. Mautrix MautrixInfo `json:"-"` ToUserID id.UserID `json:"to_user_id,omitempty"` // The user ID that the to-device event was sent to. Only present in MSC2409 appservice transactions. ToDeviceID id.DeviceID `json:"to_device_id,omitempty"` // The device ID that the to-device event was sent to. Only present in MSC2409 appservice transactions. }
Event represents a single Matrix event.
func (*Event) GenerateReplyFallbackHTML ¶
func (*Event) GenerateReplyFallbackText ¶
func (*Event) GetStateKey ¶
func (*Event) MarshalJSON ¶ added in v0.9.30
MarshalJSON marshals the event, including omitting the unsigned field if it's empty.
This is necessary because Unsigned is not a pointer (for convenience reasons), and encoding/json doesn't know how to check if a non-pointer struct is empty.
TODO(tulir): maybe it makes more sense to make Unsigned a pointer and make an easy and safe way to access it?
func (*Event) UnmarshalJSON ¶ added in v0.10.0
UnmarshalJSON unmarshals the event, including moving prev_content from the top level to inside unsigned.
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://spec.matrix.org/v1.2/client-server-api/#mroommessage-msgtypes
const (
FormatHTML Format = "org.matrix.custom.html"
)
Message formats
type ForwardedRoomKeyEventContent ¶
type ForwardedRoomKeyEventContent struct { RoomKeyEventContent SenderKey id.SenderKey `json:"sender_key"` SenderClaimedKey id.Ed25519 `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://spec.matrix.org/v1.2/client-server-api/#mforwarded_room_key
type FullyReadEventContent ¶
FullyReadEventContent represents the content of a m.fully_read account data event. https://spec.matrix.org/v1.2/client-server-api/#mfully_read
type GuestAccess ¶
type GuestAccess string
GuestAccess specifies whether or not guest accounts can join. https://spec.matrix.org/v1.2/client-server-api/#mroomguest_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://spec.matrix.org/v1.2/client-server-api/#mroomguest_access
type HistoryVisibility ¶
type HistoryVisibility string
HistoryVisibility specifies who can see new messages. https://spec.matrix.org/v1.2/client-server-api/#mroomhistory_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://spec.matrix.org/v1.2/client-server-api/#mroomhistory_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://spec.matrix.org/v1.2/client-server-api/#mignored_user_list
type InsertionMarkerContent ¶ added in v0.12.0
type JoinRule ¶
type JoinRule string
JoinRule specifies how open a room is to new members. https://spec.matrix.org/v1.2/client-server-api/#mroomjoin_rules
type JoinRuleAllow ¶ added in v0.11.0
type JoinRuleAllow struct { RoomID id.RoomID `json:"room_id"` Type JoinRuleAllowType `json:"type"` }
type JoinRuleAllowType ¶ added in v0.11.0
type JoinRuleAllowType string
const (
JoinRuleAllowRoomMembership JoinRuleAllowType = "m.room_membership"
)
type JoinRulesEventContent ¶
type JoinRulesEventContent struct { JoinRule JoinRule `json:"join_rule"` Allow []JoinRuleAllow `json:"allow,omitempty"` }
JoinRulesEventContent represents the content of a m.room.join_rules state event. https://spec.matrix.org/v1.2/client-server-api/#mroomjoin_rules
type KeyAgreementProtocol ¶ added in v0.7.0
type KeyAgreementProtocol string
const ( KeyAgreementCurve25519 KeyAgreementProtocol = "curve25519" KeyAgreementCurve25519HKDFSHA256 KeyAgreementProtocol = "curve25519-hkdf-sha256" )
type KeyRequestAction ¶
type KeyRequestAction string
type MACMethod ¶ added in v0.7.0
type MACMethod string
const HKDFHMACSHA256 MACMethod = "hkdf-hmac-sha256"
type MautrixInfo ¶ added in v0.4.7
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://spec.matrix.org/v1.2/client-server-api/#mroommember
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,omitempty"` Body string `json:"body"` // Extra fields for text types Format Format `json:"format,omitempty"` FormattedBody string `json:"formatted_body,omitempty"` // Extra field for m.location GeoURI string `json:"geo_uri,omitempty"` // Extra fields for media types URL id.ContentURIString `json:"url,omitempty"` Info *FileInfo `json:"info,omitempty"` File *EncryptedFileInfo `json:"file,omitempty"` FileName string `json:"filename,omitempty"` // Edits and relations NewContent *MessageEventContent `json:"m.new_content,omitempty"` RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` // In-room verification To id.UserID `json:"to,omitempty"` FromDevice id.DeviceID `json:"from_device,omitempty"` Methods []VerificationMethod `json:"methods,omitempty"` MessageSendRetry *BeeperRetryMetadata `json:"com.beeper.message_send_retry,omitempty"` // contains filtered or unexported fields }
MessageEventContent 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://spec.matrix.org/v1.2/client-server-api/#mroommessage
func (*MessageEventContent) EnsureHasHTML ¶ added in v0.11.0
func (content *MessageEventContent) EnsureHasHTML()
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) SetEdit ¶ added in v0.9.31
func (content *MessageEventContent) SetEdit(original id.EventID)
func (*MessageEventContent) SetRelatesTo ¶
func (content *MessageEventContent) SetRelatesTo(rel *RelatesTo)
func (*MessageEventContent) SetReply ¶
func (content *MessageEventContent) SetReply(inReplyTo *Event)
type MessageStatus ¶ added in v0.12.0
type MessageStatus string
const ( MessageStatusSuccess MessageStatus = "SUCCESS" MessageStatusPending MessageStatus = "PENDING" MessageStatusRetriable MessageStatus = "FAIL_RETRIABLE" MessageStatusFail MessageStatus = "FAIL_PERMANENT" )
type MessageStatusReason ¶ added in v0.12.0
type MessageStatusReason string
const ( MessageStatusGenericError MessageStatusReason = "m.event_not_handled" MessageStatusUnsupported MessageStatusReason = "com.beeper.unsupported_event" MessageStatusUndecryptable MessageStatusReason = "com.beeper.undecryptable_event" MessageStatusTooOld MessageStatusReason = "m.event_too_old" MessageStatusNetworkError MessageStatusReason = "m.foreign_network_error" MessageStatusNoPermission MessageStatusReason = "m.no_permission" )
type MessageType ¶
type MessageType string
MessageType is the sub-type of a m.room.message event. https://spec.matrix.org/v1.2/client-server-api/#mroommessage-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" MsgVerificationRequest MessageType = "m.key.verification.request" )
Msgtypes
type ModPolicyContent ¶ added in v0.10.10
type ModPolicyContent struct { Entity string `json:"entity"` Reason string `json:"reason"` Recommendation string `json:"recommendation"` }
ModPolicyContent represents the content of a m.room.rule.user, m.room.rule.room, and m.room.rule.server state event. https://spec.matrix.org/v1.2/client-server-api/#moderation-policy-lists
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://spec.matrix.org/v1.2/client-server-api/#mroompinned_events
type PowerLevelsEventContent ¶
type PowerLevelsEventContent struct { Users map[id.UserID]int `json:"users,omitempty"` UsersDefault int `json:"users_default,omitempty"` Events map[string]int `json:"events,omitempty"` EventsDefault int `json:"events_default,omitempty"` 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"` HistoricalPtr *int `json:"historical,omitempty"` // contains filtered or unexported fields }
PowerLevelsEventContent represents the content of a m.room.power_levels state event content. https://spec.matrix.org/v1.2/client-server-api/#mroompower_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) Historical ¶ added in v0.10.8
func (pl *PowerLevelsEventContent) Historical() 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 Predecessor ¶ added in v0.12.0
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://spec.matrix.org/v1.2/client-server-api/#mpresence
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"` // Extra contains any unknown fields in the read receipt event. // Most servers don't allow clients to set them, so this will be empty in most cases. Extra map[string]interface{} `json:"-"` }
func (*ReadReceipt) UnmarshalJSON ¶
func (rr *ReadReceipt) UnmarshalJSON(data []byte) error
type ReceiptEventContent ¶
ReceiptEventContent represents the content of a m.receipt ephemeral event. https://spec.matrix.org/v1.2/client-server-api/#mreceipt
func (ReceiptEventContent) GetOrCreate ¶ added in v0.12.0
func (rec ReceiptEventContent) GetOrCreate(evt id.EventID) Receipts
func (ReceiptEventContent) Set ¶ added in v0.12.0
func (rec ReceiptEventContent) Set(evtID id.EventID, receiptType ReceiptType, userID id.UserID, receipt ReadReceipt)
type ReceiptType ¶ added in v0.12.0
type ReceiptType string
const ( ReceiptTypeRead ReceiptType = "m.read" ReceiptTypeReadPrivate ReceiptType = "m.read.private" )
type Receipts ¶
type Receipts map[ReceiptType]UserReceipts
func (Receipts) GetOrCreate ¶ added in v0.12.0
func (rps Receipts) GetOrCreate(receiptType ReceiptType) UserReceipts
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://spec.matrix.org/v1.2/client-server-api/#mroomredaction
type RelatesTo ¶
type RelatesTo struct { Type RelationType `json:"rel_type,omitempty"` EventID id.EventID `json:"event_id,omitempty"` Key string `json:"key,omitempty"` InReplyTo *InReplyTo `json:"m.in_reply_to,omitempty"` IsFallingBack bool `json:"is_falling_back,omitempty"` }
func (*RelatesTo) GetAnnotationID ¶
func (*RelatesTo) GetAnnotationKey ¶
func (*RelatesTo) GetReferenceID ¶
func (*RelatesTo) GetReplaceID ¶
func (*RelatesTo) GetReplyTo ¶ added in v0.12.0
func (*RelatesTo) GetThreadParent ¶ added in v0.12.0
func (*RelatesTo) SetAnnotation ¶ added in v0.12.0
func (*RelatesTo) SetReplace ¶ added in v0.12.0
func (*RelatesTo) SetReplyTo ¶ added in v0.12.0
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" RelThread RelationType = "m.thread" )
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"` Info *FileInfo `json:"info,omitempty"` }
RoomAvatarEventContent represents the content of a m.room.avatar state event. https://spec.matrix.org/v1.2/client-server-api/#mroomavatar
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://spec.matrix.org/v1.2/client-server-api/#mroom_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://spec.matrix.org/v1.2/client-server-api/#mroom_key_request
type RoomKeyWithheldCode ¶ added in v0.5.3
type RoomKeyWithheldCode string
const ( RoomKeyWithheldBlacklisted RoomKeyWithheldCode = "m.blacklisted" RoomKeyWithheldUnverified RoomKeyWithheldCode = "m.unverified" RoomKeyWithheldNoOlmSession RoomKeyWithheldCode = "m.no_olm" )
type RoomKeyWithheldEventContent ¶ added in v0.5.3
type RoomKeyWithheldEventContent struct { RoomID id.RoomID `json:"room_id,omitempty"` Algorithm id.Algorithm `json:"algorithm"` SessionID id.SessionID `json:"session_id,omitempty"` SenderKey id.SenderKey `json:"sender_key"` Code RoomKeyWithheldCode `json:"code"` Reason string `json:"reason,omitempty"` }
type RoomNameEventContent ¶
type RoomNameEventContent struct {
Name string `json:"name"`
}
RoomNameEventContent represents the content of a m.room.name state event. https://spec.matrix.org/v1.2/client-server-api/#mroomname
type ServerACLEventContent ¶ added in v0.10.10
type ServerACLEventContent struct { Allow []string `json:"allow,omitempty"` AllowIPLiterals bool `json:"allow_ip_literals"` Deny []string `json:"deny,omitempty"` }
ServerACLEventContent represents the content of a m.room.server_acl state event. https://spec.matrix.org/v1.2/client-server-api/#server-access-control-lists-acls-for-rooms
type SpaceChildEventContent ¶ added in v0.10.8
type SpaceParentEventContent ¶ added in v0.10.8
type StrippedState ¶
type TagEventContent ¶
type TagEventContent struct {
Tags Tags `json:"tags"`
}
TagEventContent represents the content of a m.tag room account data event. https://spec.matrix.org/v1.2/client-server-api/#mtag
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://spec.matrix.org/v1.2/client-server-api/#mroomtombstone
type TopicEventContent ¶
type TopicEventContent struct {
Topic string `json:"topic"`
}
TopicEventContent represents the content of a m.room.topic state event. https://spec.matrix.org/v1.2/client-server-api/#mroomtopic
type Type ¶
func NewEventType ¶
func (*Type) GuessClass ¶
func (*Type) IsAccountData ¶
func (*Type) IsEphemeral ¶
func (*Type) IsInRoomVerification ¶ added in v0.8.0
func (*Type) IsToDevice ¶
func (*Type) MarshalJSON ¶
func (Type) MarshalText ¶ added in v0.3.2
func (*Type) UnmarshalJSON ¶
func (Type) UnmarshalText ¶ added in v0.3.2
type TypingEventContent ¶
TypingEventContent represents the content of a m.typing ephemeral event. https://spec.matrix.org/v1.2/client-server-api/#mtyping
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,omitempty"` }
type UserReceipts ¶ added in v0.12.0
type UserReceipts map[id.UserID]ReadReceipt
func (UserReceipts) Set ¶ added in v0.12.0
func (ur UserReceipts) Set(userID id.UserID, receipt ReadReceipt)
type VerificationAcceptEventContent ¶ added in v0.7.0
type VerificationAcceptEventContent struct { // An opaque identifier for the verification process. Must be the same as the one used for the m.key.verification.start message. TransactionID string `json:"transaction_id,omitempty"` // The verification method to use. Method VerificationMethod `json:"method"` // The key agreement protocol the device is choosing to use, out of the options in the m.key.verification.start message. KeyAgreementProtocol KeyAgreementProtocol `json:"key_agreement_protocol"` // The hash method the device is choosing to use, out of the options in the m.key.verification.start message. Hash VerificationHashMethod `json:"hash"` // The message authentication code the device is choosing to use, out of the options in the m.key.verification.start message. MessageAuthenticationCode MACMethod `json:"message_authentication_code"` // The SAS methods both devices involved in the verification process understand. Must be a subset of the options in the m.key.verification.start message. ShortAuthenticationString []SASMethod `json:"short_authentication_string"` // The hash (encoded as unpadded base64) of the concatenation of the device's ephemeral public key (encoded as unpadded base64) and the canonical JSON representation of the m.key.verification.start message. Commitment string `json:"commitment"` // The user that the event is sent to for in-room verification. To id.UserID `json:"to,omitempty"` // Original event ID for in-room verification. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
VerificationAcceptEventContent represents the content of a m.key.verification.accept to_device event. https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationaccept
func (*VerificationAcceptEventContent) GetRelatesTo ¶ added in v0.8.0
func (vaec *VerificationAcceptEventContent) GetRelatesTo() *RelatesTo
func (*VerificationAcceptEventContent) OptionalGetRelatesTo ¶ added in v0.8.0
func (vaec *VerificationAcceptEventContent) OptionalGetRelatesTo() *RelatesTo
func (*VerificationAcceptEventContent) SetRelatesTo ¶ added in v0.8.0
func (vaec *VerificationAcceptEventContent) SetRelatesTo(rel *RelatesTo)
type VerificationCancelCode ¶ added in v0.7.0
type VerificationCancelCode string
const ( VerificationCancelByUser VerificationCancelCode = "m.user" VerificationCancelByTimeout VerificationCancelCode = "m.timeout" VerificationCancelUnknownTransaction VerificationCancelCode = "m.unknown_transaction" VerificationCancelUnknownMethod VerificationCancelCode = "m.unknown_method" VerificationCancelUnexpectedMessage VerificationCancelCode = "m.unexpected_message" VerificationCancelKeyMismatch VerificationCancelCode = "m.key_mismatch" VerificationCancelUserMismatch VerificationCancelCode = "m.user_mismatch" VerificationCancelInvalidMessage VerificationCancelCode = "m.invalid_message" VerificationCancelAccepted VerificationCancelCode = "m.accepted" VerificationCancelSASMismatch VerificationCancelCode = "m.mismatched_sas" VerificationCancelCommitmentMismatch VerificationCancelCode = "m.mismatched_commitment" )
type VerificationCancelEventContent ¶ added in v0.7.0
type VerificationCancelEventContent struct { // The opaque identifier for the verification process/request. TransactionID string `json:"transaction_id,omitempty"` // A human readable description of the code. The client should only rely on this string if it does not understand the code. Reason string `json:"reason"` // The error code for why the process/request was cancelled by the user. Code VerificationCancelCode `json:"code"` // The user that the event is sent to for in-room verification. To id.UserID `json:"to,omitempty"` // Original event ID for in-room verification. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
VerificationCancelEventContent represents the content of a m.key.verification.cancel to_device event. https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationcancel
func (*VerificationCancelEventContent) GetRelatesTo ¶ added in v0.8.0
func (vcec *VerificationCancelEventContent) GetRelatesTo() *RelatesTo
func (*VerificationCancelEventContent) OptionalGetRelatesTo ¶ added in v0.8.0
func (vcec *VerificationCancelEventContent) OptionalGetRelatesTo() *RelatesTo
func (*VerificationCancelEventContent) SetRelatesTo ¶ added in v0.8.0
func (vcec *VerificationCancelEventContent) SetRelatesTo(rel *RelatesTo)
type VerificationHashMethod ¶ added in v0.7.0
type VerificationHashMethod string
const VerificationHashSHA256 VerificationHashMethod = "sha256"
type VerificationKeyEventContent ¶ added in v0.7.0
type VerificationKeyEventContent struct { // An opaque identifier for the verification process. Must be the same as the one used for the m.key.verification.start message. TransactionID string `json:"transaction_id,omitempty"` // The device's ephemeral public key, encoded as unpadded base64. Key string `json:"key"` // The user that the event is sent to for in-room verification. To id.UserID `json:"to,omitempty"` // Original event ID for in-room verification. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
VerificationKeyEventContent represents the content of a m.key.verification.key to_device event. https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationkey
func (*VerificationKeyEventContent) GetRelatesTo ¶ added in v0.8.0
func (vkec *VerificationKeyEventContent) GetRelatesTo() *RelatesTo
func (*VerificationKeyEventContent) OptionalGetRelatesTo ¶ added in v0.8.0
func (vkec *VerificationKeyEventContent) OptionalGetRelatesTo() *RelatesTo
func (*VerificationKeyEventContent) SetRelatesTo ¶ added in v0.8.0
func (vkec *VerificationKeyEventContent) SetRelatesTo(rel *RelatesTo)
type VerificationMacEventContent ¶ added in v0.7.0
type VerificationMacEventContent struct { // An opaque identifier for the verification process. Must be the same as the one used for the m.key.verification.start message. TransactionID string `json:"transaction_id,omitempty"` // A map of the key ID to the MAC of the key, using the algorithm in the verification process. The MAC is encoded as unpadded base64. Mac map[id.KeyID]string `json:"mac"` // The MAC of the comma-separated, sorted, list of key IDs given in the mac property, encoded as unpadded base64. Keys string `json:"keys"` // The user that the event is sent to for in-room verification. To id.UserID `json:"to,omitempty"` // Original event ID for in-room verification. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
VerificationMacEventContent represents the content of a m.key.verification.mac to_device event. https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationmac
func (*VerificationMacEventContent) GetRelatesTo ¶ added in v0.8.0
func (vmec *VerificationMacEventContent) GetRelatesTo() *RelatesTo
func (*VerificationMacEventContent) OptionalGetRelatesTo ¶ added in v0.8.0
func (vmec *VerificationMacEventContent) OptionalGetRelatesTo() *RelatesTo
func (*VerificationMacEventContent) SetRelatesTo ¶ added in v0.8.0
func (vmec *VerificationMacEventContent) SetRelatesTo(rel *RelatesTo)
type VerificationMethod ¶ added in v0.7.0
type VerificationMethod string
const VerificationMethodSAS VerificationMethod = "m.sas.v1"
type VerificationReadyEventContent ¶ added in v0.8.0
type VerificationReadyEventContent struct { // The device ID which accepted the process. FromDevice id.DeviceID `json:"from_device"` // The verification methods supported by the sender. Methods []VerificationMethod `json:"methods"` // Original event ID for in-room verification. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
VerificationReadyEventContent represents the content of a m.key.verification.ready event. https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationready
func (*VerificationReadyEventContent) GetRelatesTo ¶ added in v0.8.0
func (vrec *VerificationReadyEventContent) GetRelatesTo() *RelatesTo
func (*VerificationReadyEventContent) OptionalGetRelatesTo ¶ added in v0.8.0
func (vrec *VerificationReadyEventContent) OptionalGetRelatesTo() *RelatesTo
func (*VerificationReadyEventContent) SetRelatesTo ¶ added in v0.8.0
func (vrec *VerificationReadyEventContent) SetRelatesTo(rel *RelatesTo)
type VerificationRequestEventContent ¶ added in v0.7.0
type VerificationRequestEventContent struct { // The device ID which is initiating the request. FromDevice id.DeviceID `json:"from_device"` // An opaque identifier for the verification request. Must be unique with respect to the devices involved. TransactionID string `json:"transaction_id,omitempty"` // The verification methods supported by the sender. Methods []VerificationMethod `json:"methods"` // The POSIX timestamp in milliseconds for when the request was made. Timestamp int64 `json:"timestamp,omitempty"` // The user that the event is sent to for in-room verification. To id.UserID `json:"to,omitempty"` // Original event ID for in-room verification. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
VerificationRequestEventContent represents the content of a m.key.verification.request to_device event. https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationrequest
func (*VerificationRequestEventContent) SupportsVerificationMethod ¶ added in v0.7.0
func (vrec *VerificationRequestEventContent) SupportsVerificationMethod(meth VerificationMethod) bool
type VerificationStartEventContent ¶ added in v0.7.0
type VerificationStartEventContent struct { // The device ID which is initiating the process. FromDevice id.DeviceID `json:"from_device"` // An opaque identifier for the verification process. Must be unique with respect to the devices involved. TransactionID string `json:"transaction_id,omitempty"` // The verification method to use. Method VerificationMethod `json:"method"` // The key agreement protocols the sending device understands. KeyAgreementProtocols []KeyAgreementProtocol `json:"key_agreement_protocols"` // The hash methods the sending device understands. Hashes []VerificationHashMethod `json:"hashes"` // The message authentication codes that the sending device understands. MessageAuthenticationCodes []MACMethod `json:"message_authentication_codes"` // The SAS methods the sending device (and the sending device's user) understands. ShortAuthenticationString []SASMethod `json:"short_authentication_string"` // The user that the event is sent to for in-room verification. To id.UserID `json:"to,omitempty"` // Original event ID for in-room verification. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
VerificationStartEventContent represents the content of a m.key.verification.start to_device event. https://spec.matrix.org/v1.2/client-server-api/#mkeyverificationstartmsasv1
func (*VerificationStartEventContent) GetRelatesTo ¶ added in v0.8.0
func (vsec *VerificationStartEventContent) GetRelatesTo() *RelatesTo
func (*VerificationStartEventContent) OptionalGetRelatesTo ¶ added in v0.8.0
func (vsec *VerificationStartEventContent) OptionalGetRelatesTo() *RelatesTo
func (*VerificationStartEventContent) SetRelatesTo ¶ added in v0.8.0
func (vsec *VerificationStartEventContent) SetRelatesTo(rel *RelatesTo)
func (*VerificationStartEventContent) SupportsHashMethod ¶ added in v0.7.0
func (vsec *VerificationStartEventContent) SupportsHashMethod(alg VerificationHashMethod) bool
func (*VerificationStartEventContent) SupportsKeyAgreementProtocol ¶ added in v0.7.0
func (vsec *VerificationStartEventContent) SupportsKeyAgreementProtocol(proto KeyAgreementProtocol) bool
func (*VerificationStartEventContent) SupportsMACMethod ¶ added in v0.7.0
func (vsec *VerificationStartEventContent) SupportsMACMethod(meth MACMethod) bool
func (*VerificationStartEventContent) SupportsSASMethod ¶ added in v0.7.0
func (vsec *VerificationStartEventContent) SupportsSASMethod(meth SASMethod) bool