Documentation
¶
Index ¶
- Constants
- Variables
- func CastOrDefault[T any](content *Content) *T
- func IsUnsupportedContentType(err error) booldeprecated
- func ReverseTextToHTML(input string) string
- func TextToHTML(text string) string
- func TrimReplyFallbackHTML(html string) string
- func TrimReplyFallbackText(text string) string
- type Action
- type ActionsRow
- type AnnotationChunk
- type BaseCallEventContent
- type BeeperLinkPreview
- type BeeperMessageStatusEventContent
- type BeeperMuteEventContent
- type BeeperPerMessageProfile
- type BeeperProfileExtra
- type BeeperRetryMetadata
- type BeeperRoomKeyAckEventContent
- type BotCommand
- type BotCommandScope
- type BridgeEventContent
- type BridgeInfoSection
- type Button
- type ButtonList
- type ButtonStyle
- 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 CallbackGame
- type CanonicalAliasEventContent
- type Card
- type CardBody
- type CardButton
- type CardHeader
- type CardIcon
- type CardTitle
- type CardV2
- type ChannelType
- type CommandOption
- type ComponentEmoji
- type ComponentType
- 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) AsElementFunctionalMembers() *ElementFunctionalMembersContent
- 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) AsMarkedUnread() *MarkedUnreadEventContent
- 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) AsVerificationAccept() *VerificationAcceptEventContent
- func (content *Content) AsVerificationCancel() *VerificationCancelEventContent
- func (content *Content) AsVerificationDone() *VerificationDoneEventContent
- func (content *Content) AsVerificationKey() *VerificationKeyEventContent
- func (content *Content) AsVerificationMAC() *VerificationMACEventContent
- func (content *Content) AsVerificationReady() *VerificationReadyEventContent
- func (content *Content) AsVerificationRequest() *VerificationRequestEventContent
- func (content *Content) AsVerificationStart() *VerificationStartEventContent
- func (content *Content) MarshalJSON() ([]byte, error)
- func (content *Content) ParseRaw(evtType Type) error
- func (content *Content) UnmarshalJSON(data []byte) error
- type CreateEventContent
- type DecoratedText
- type DirectChatsEventContent
- type DummyEventContent
- type ElementFunctionalMembersContent
- 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 InRoomVerificationEvent
- type InsertionMarkerContentdeprecated
- type JoinRule
- type JoinRuleAllow
- type JoinRuleAllowType
- type JoinRulesEventContent
- type KeyAgreementProtocol
- type KeyRequestAction
- type LinkPreview
- type LoginURL
- type MACMethod
- type MSC1767Audio
- type MSC1767Message
- type MSC3245Voice
- type MarkedUnreadEventContent
- type MautrixInfo
- type MemberEventContent
- type Membership
- type Mentions
- type MessageComponent
- type MessageEventContent
- func (content *MessageEventContent) EnsureHasHTML()
- func (content *MessageEventContent) GetCaption() string
- func (content *MessageEventContent) GetFile() *EncryptedFileInfo
- func (content *MessageEventContent) GetFileName() string
- func (content *MessageEventContent) GetFormattedCaption() string
- func (content *MessageEventContent) GetInfo() *FileInfo
- func (content *MessageEventContent) GetRelatesTo() *RelatesTo
- func (content *MessageEventContent) GetReplyTo() id.EventIDdeprecated
- 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 MessageFlags
- type MessageStatus
- type MessageStatusReason
- type MessageType
- type ModPolicyContent
- type MsgCardV2
- type NotificationPowerLevels
- type OlmCiphertexts
- type OnClick
- type OpenLink
- type Parameter
- type PinnedEventsEventContent
- type PolicyRecommendation
- type PollResponseEventContent
- type PollStartEventContent
- type PowerLevelsEventContent
- func (pl *PowerLevelsEventContent) Ban() int
- func (pl *PowerLevelsEventContent) Clone() *PowerLevelsEventContent
- func (pl *PowerLevelsEventContent) EnsureEventLevel(eventType Type, level int) bool
- func (pl *PowerLevelsEventContent) EnsureEventLevelAs(actor id.UserID, eventType Type, level int) bool
- func (pl *PowerLevelsEventContent) EnsureUserLevel(target id.UserID, level int) bool
- func (pl *PowerLevelsEventContent) EnsureUserLevelAs(actor, target 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 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) GetNonFallbackReplyTo() id.EventID
- 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 RoomTag
- type RoomType
- type RoomVersion
- type SASMethod
- type SecretRequestAction
- type SecretRequestEventContent
- type SecretSendEventContent
- type Section
- type SelectMenu
- type SelectMenuDefaultValue
- type SelectMenuDefaultValueType
- type SelectMenuOption
- type SelectMenuType
- type ServerACLEventContent
- type Source
- type SpaceChildEventContent
- type SpaceParentEventContent
- type StrippedState
- type Tagdeprecated
- type TagEventContent
- type TagMetadata
- type Tags
- type TextInput
- type TextInputStyle
- type ThirdPartyInvite
- type ThreadID
- type ToDeviceVerificationEvent
- 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 VerificationDoneEventContent
- type VerificationHashMethod
- type VerificationKeyEventContent
- type VerificationMACEventContent
- type VerificationMethod
- type VerificationReadyEventContent
- type VerificationRequestEventContent
- type VerificationStartEventContent
- type VerificationTransactionable
- type WebAppInfo
- type Widget
Constants ¶
const ( CardTypeApp = "APP" CardTypeTrading = "TRADING" )
const ( CardHeaderTypeDefault = "DEFAULT" CardHeaderTypeCard = "CARD" )
const ( CardSectionTypeTable = "TABLE" CardSectionTypeDEFAULT = "DEFAULT" )
const ( StringSelectMenu = SelectMenuType(SelectMenuComponent) UserSelectMenu = SelectMenuType(UserSelectMenuComponent) RoleSelectMenu = SelectMenuType(RoleSelectMenuComponent) MentionableSelectMenu = SelectMenuType(MentionableSelectMenuComponent) ChannelSelectMenu = SelectMenuType(ChannelSelectMenuComponent) )
SelectMenu types.
const ( KeyRequestActionRequest = "request" KeyRequestActionCancel = "request_cancellation" )
const ( SecretRequestRequest = "request" SecretRequestCancellation = "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} StateLegacyPolicyRoom = Type{"m.room.rule.room", StateEventType} StateLegacyPolicyServer = Type{"m.room.rule.server", StateEventType} StateLegacyPolicyUser = Type{"m.room.rule.user", StateEventType} StateUnstablePolicyRoom = Type{"org.matrix.mjolnir.rule.room", StateEventType} StateUnstablePolicyServer = Type{"org.matrix.mjolnir.rule.server", StateEventType} StateUnstablePolicyUser = Type{"org.matrix.mjolnir.rule.user", StateEventType} // Deprecated: MSC2716 has been abandoned StateInsertionMarker = Type{"org.matrix.msc2716.marker", StateEventType} StateElementFunctionalMembers = Type{"io.element.functional_members", 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} InRoomVerificationReady = Type{"m.key.verification.ready", MessageEventType} InRoomVerificationStart = Type{"m.key.verification.start", MessageEventType} InRoomVerificationDone = Type{"m.key.verification.done", MessageEventType} InRoomVerificationCancel = Type{"m.key.verification.cancel", MessageEventType} // SAS Verification Events InRoomVerificationAccept = Type{"m.key.verification.accept", MessageEventType} InRoomVerificationKey = Type{"m.key.verification.key", MessageEventType} InRoomVerificationMAC = Type{"m.key.verification.mac", 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} EventUnstablePollStart = Type{Type: "org.matrix.msc3381.poll.start", Class: MessageEventType} EventUnstablePollResponse = Type{Type: "org.matrix.msc3381.poll.response", Class: 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} AccountDataMarkedUnread = Type{"m.marked_unread", AccountDataEventType} AccountDataBeeperMute = Type{"com.beeper.mute", AccountDataEventType} AccountDataSecretStorageDefaultKey = Type{"m.secret_storage.default_key", AccountDataEventType} AccountDataSecretStorageKey = Type{"m.secret_storage.key", AccountDataEventType} AccountDataCrossSigningMaster = Type{string(id.SecretXSMaster), AccountDataEventType} AccountDataCrossSigningUser = Type{string(id.SecretXSUserSigning), AccountDataEventType} AccountDataCrossSigningSelf = Type{string(id.SecretXSSelfSigning), AccountDataEventType} AccountDataMegolmBackupKey = Type{string(id.SecretMegolmBackupV1), 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} ToDeviceSecretRequest = Type{"m.secret.request", ToDeviceEventType} ToDeviceSecretSend = Type{"m.secret.send", ToDeviceEventType} ToDeviceDummy = Type{"m.dummy", ToDeviceEventType} ToDeviceCommandReply = Type{"m.room.command", ToDeviceEventType} ToDeviceVerificationRequest = Type{"m.key.verification.request", ToDeviceEventType} ToDeviceVerificationReady = Type{"m.key.verification.ready", ToDeviceEventType} ToDeviceVerificationStart = Type{"m.key.verification.start", ToDeviceEventType} ToDeviceVerificationDone = Type{"m.key.verification.done", ToDeviceEventType} ToDeviceVerificationCancel = Type{"m.key.verification.cancel", ToDeviceEventType} // SAS Verification Events ToDeviceVerificationAccept = Type{"m.key.verification.accept", ToDeviceEventType} ToDeviceVerificationKey = Type{"m.key.verification.key", ToDeviceEventType} ToDeviceVerificationMAC = Type{"m.key.verification.mac", ToDeviceEventType} ToDeviceOrgMatrixRoomKeyWithheld = Type{"org.matrix.room_key.withheld", ToDeviceEventType} ToDeviceBeeperRoomKeyAck = Type{"com.beeper.room_key.ack", ToDeviceEventType} )
Device-to-device events
var ( ErrJSONUnmarshal = errors.New("json unmarshal") ErrStatusOffline = errors.New("You can't set your Status to offline") ErrVerificationLevelBounds = errors.New("VerificationLevel out of bounds, should be between 0 and 3") ErrPruneDaysBounds = errors.New("the number of days should be more than or equal to 1") ErrGuildNoIcon = errors.New("guild does not have an icon set") ErrGuildNoSplash = errors.New("guild does not have a splash set") )
All error constants
var ( // Marshal defines function used to encode JSON payloads Marshal func(v interface{}) ([]byte, error) = json.Marshal // Unmarshal defines function used to decode JSON payloads Unmarshal func(src []byte, v interface{}) error = json.Unmarshal )
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 MutedForever = time.Date(9999, 12, 31, 23, 59, 59, 999999999, time.UTC)
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{}), StateLegacyPolicyRoom: reflect.TypeOf(ModPolicyContent{}), StateLegacyPolicyServer: reflect.TypeOf(ModPolicyContent{}), StateLegacyPolicyUser: reflect.TypeOf(ModPolicyContent{}), StateUnstablePolicyRoom: reflect.TypeOf(ModPolicyContent{}), StateUnstablePolicyServer: reflect.TypeOf(ModPolicyContent{}), StateUnstablePolicyUser: reflect.TypeOf(ModPolicyContent{}), StateElementFunctionalMembers: reflect.TypeOf(ElementFunctionalMembersContent{}), EventMessage: reflect.TypeOf(MessageEventContent{}), EventSticker: reflect.TypeOf(MessageEventContent{}), EventEncrypted: reflect.TypeOf(EncryptedEventContent{}), EventRedaction: reflect.TypeOf(RedactionEventContent{}), EventReaction: reflect.TypeOf(ReactionEventContent{}), EventUnstablePollStart: reflect.TypeOf(PollStartEventContent{}), EventUnstablePollResponse: reflect.TypeOf(PollResponseEventContent{}), BeeperMessageStatus: reflect.TypeOf(BeeperMessageStatusEventContent{}), AccountDataRoomTags: reflect.TypeOf(TagEventContent{}), AccountDataDirectChats: reflect.TypeOf(DirectChatsEventContent{}), AccountDataFullyRead: reflect.TypeOf(FullyReadEventContent{}), AccountDataIgnoredUserList: reflect.TypeOf(IgnoredUserListEventContent{}), AccountDataMarkedUnread: reflect.TypeOf(MarkedUnreadEventContent{}), AccountDataBeeperMute: reflect.TypeOf(BeeperMuteEventContent{}), EphemeralEventTyping: reflect.TypeOf(TypingEventContent{}), EphemeralEventReceipt: reflect.TypeOf(ReceiptEventContent{}), EphemeralEventPresence: reflect.TypeOf(PresenceEventContent{}), InRoomVerificationReady: reflect.TypeOf(VerificationReadyEventContent{}), InRoomVerificationStart: reflect.TypeOf(VerificationStartEventContent{}), InRoomVerificationDone: reflect.TypeOf(VerificationDoneEventContent{}), InRoomVerificationCancel: reflect.TypeOf(VerificationCancelEventContent{}), InRoomVerificationAccept: reflect.TypeOf(VerificationAcceptEventContent{}), InRoomVerificationKey: reflect.TypeOf(VerificationKeyEventContent{}), InRoomVerificationMAC: reflect.TypeOf(VerificationMACEventContent{}), ToDeviceRoomKey: reflect.TypeOf(RoomKeyEventContent{}), ToDeviceForwardedRoomKey: reflect.TypeOf(ForwardedRoomKeyEventContent{}), ToDeviceRoomKeyRequest: reflect.TypeOf(RoomKeyRequestEventContent{}), ToDeviceEncrypted: reflect.TypeOf(EncryptedEventContent{}), ToDeviceRoomKeyWithheld: reflect.TypeOf(RoomKeyWithheldEventContent{}), ToDeviceSecretRequest: reflect.TypeOf(SecretRequestEventContent{}), ToDeviceSecretSend: reflect.TypeOf(SecretSendEventContent{}), ToDeviceDummy: reflect.TypeOf(DummyEventContent{}), ToDeviceCommandReply: reflect.TypeOf(MessageEventContent{}), ToDeviceVerificationRequest: reflect.TypeOf(VerificationRequestEventContent{}), ToDeviceVerificationReady: reflect.TypeOf(VerificationReadyEventContent{}), ToDeviceVerificationStart: reflect.TypeOf(VerificationStartEventContent{}), ToDeviceVerificationDone: reflect.TypeOf(VerificationDoneEventContent{}), ToDeviceVerificationCancel: reflect.TypeOf(VerificationCancelEventContent{}), ToDeviceVerificationAccept: reflect.TypeOf(VerificationAcceptEventContent{}), ToDeviceVerificationKey: reflect.TypeOf(VerificationKeyEventContent{}), ToDeviceVerificationMAC: reflect.TypeOf(VerificationMACEventContent{}), ToDeviceOrgMatrixRoomKeyWithheld: reflect.TypeOf(RoomKeyWithheldEventContent{}), ToDeviceBeeperRoomKeyAck: reflect.TypeOf(BeeperRoomKeyAckEventContent{}), 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 CastOrDefault ¶
func IsUnsupportedContentType
deprecated
func ReverseTextToHTML ¶
ReverseTextToHTML reverses the modifications made by TextToHTML, i.e. replaces <br/> tags with newlines and unescapes HTML escape codes. For actually parsing HTML, use the format package instead.
func TextToHTML ¶
TextToHTML converts the given text to a HTML-safe representation by escaping HTML characters and replacing newlines with <br/> tags.
func TrimReplyFallbackHTML ¶
func TrimReplyFallbackText ¶
Types ¶
type ActionsRow ¶
type ActionsRow struct {
Components []MessageComponent `json:"components"`
}
ActionsRow is a container for components within one row.
func (ActionsRow) MarshalJSON ¶
func (r ActionsRow) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling ActionsRow to a JSON object.
func (ActionsRow) Type ¶
func (r ActionsRow) Type() ComponentType
Type is a method to get the type of a component.
func (*ActionsRow) UnmarshalJSON ¶
func (r *ActionsRow) UnmarshalJSON(data []byte) error
UnmarshalJSON is a helper function to unmarshal Actions Row.
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 ¶
type BaseCallEventContent struct { CallID string `json:"call_id"` PartyID string `json:"party_id"` Version CallVersion `json:"version"` }
type BeeperLinkPreview ¶
type BeeperLinkPreview struct { LinkPreview MatchedURL string `json:"matched_url,omitempty"` ImageEncryption *EncryptedFileInfo `json:"beeper:image:encryption,omitempty"` }
BeeperLinkPreview contains the data for a bundled URL preview as specified in MSC4095
https://github.com/matrix-org/matrix-spec-proposals/pull/4095
type BeeperMessageStatusEventContent ¶
type BeeperMessageStatusEventContent struct { Network string `json:"network,omitempty"` RelatesTo RelatesTo `json:"m.relates_to"` Status MessageStatus `json:"status"` Reason MessageStatusReason `json:"reason,omitempty"` // Deprecated: clients were showing this to users even though they aren't supposed to. // Use InternalError for error messages that should be included in bug reports, but not shown in the UI. Error string `json:"error,omitempty"` InternalError string `json:"internal_error,omitempty"` Message string `json:"message,omitempty"` LastRetry id.EventID `json:"last_retry,omitempty"` MutateEventKey string `json:"mutate_event_key,omitempty"` // Indicates the set of users to whom the event was delivered. If nil, then // the client should not expect delivered status at any later point. If not // nil (even if empty), this field indicates which users the event was // delivered to. DeliveredToUsers *[]id.UserID `json:"delivered_to_users,omitempty"` }
type BeeperMuteEventContent ¶
type BeeperMuteEventContent struct {
MutedUntil int64 `json:"muted_until,omitempty"`
}
func (*BeeperMuteEventContent) GetMutedUntilTime ¶
func (bmec *BeeperMuteEventContent) GetMutedUntilTime() time.Time
func (*BeeperMuteEventContent) IsMuted ¶
func (bmec *BeeperMuteEventContent) IsMuted() bool
type BeeperPerMessageProfile ¶
type BeeperPerMessageProfile struct { ID string `json:"id"` Displayname string `json:"displayname,omitempty"` AvatarURL *id.ContentURIString `json:"avatar_url,omitempty"` AvatarFile *EncryptedFileInfo `json:"avatar_file,omitempty"` }
type BeeperProfileExtra ¶
type BeeperProfileExtra struct { RemoteID string `json:"com.beeper.bridge.remote_id,omitempty"` Identifiers []string `json:"com.beeper.bridge.identifiers,omitempty"` Service string `json:"com.beeper.bridge.service,omitempty"` Network string `json:"com.beeper.bridge.network,omitempty"` IsBridgeBot bool `json:"com.beeper.bridge.is_bridge_bot,omitempty"` IsNetworkBot bool `json:"com.beeper.bridge.is_network_bot,omitempty"` }
type BeeperRetryMetadata ¶
type BotCommand ¶
type BotCommand struct { BotId string `json:"bot_id"` Command string `json:"command"` Description string `json:"description"` Type string `json:"type"` // 命令类型,值可为: chat、user、message。 Options []CommandOption `json:"options"` Scope BotCommandScope `json:"scope"` // default、all_private_chats、all_group_chats、all_chat_administrators、chat、chat_administrators、chat_member LanguageCode string `json:"language_code"` }
type BotCommandScope ¶
type BridgeEventContent ¶
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"` BeeperRoomType string `json:"com.beeper.room_type,omitempty"` BeeperRoomTypeV2 string `json:"com.beeper.room_type.v2,omitempty"` }
BridgeEventContent represents the content of a m.bridge state event. https://github.com/matrix-org/matrix-doc/pull/2346
type BridgeInfoSection ¶
type Button ¶
type Button struct { // Text label text on the button Text string `json:"text"` // LoginURL is an HTTP URL used to automatically authorize the user. Can be // used as a replacement for the Telegram Login Widget // // optional LoginURL *LoginURL `json:"login_url,omitempty"` // CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes. // // optional CallbackData *string `json:"callback_data,omitempty"` // WebApp if specified, the described Web App will be launched when the button // is pressed. The Web App will be able to send a “web_app_data” service // message. Available in private chats only. // // optional WebApp *WebAppInfo `json:"web_app,omitempty"` // SwitchInlineQuery if set, pressing the button will prompt the user to select one of their chats, // open that chat and insert the bot's username and the specified inline query in the input field. // Can be empty, in which case just the bot's username will be inserted. // // This offers an easy way for users to start using your bot // in inline mode when they are currently in a private chat with it. // Especially useful when combined with switch_pm… actions – in this case // the user will be automatically returned to the chat they switched from, // skipping the chat selection screen. // // optional SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username // and the specified inline query in the current chat's input field. // Can be empty, in which case only the bot's username will be inserted. // // This offers a quick way for the user to open your bot in inline mode // in the same chat – good for selecting something from multiple options. // // optional SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // CallbackGame description of the game that will be launched when the user presses the button. // // optional CallbackGame *CallbackGame `json:"callback_game,omitempty"` // Pay specify True, to send a Pay button. // // NOTE: This type of button must always be the first button in the first row. // // optional Pay bool `json:"pay,omitempty"` Style ButtonStyle `json:"style"` Emoji *ComponentEmoji `json:"emoji,omitempty"` // NOTE: Only button with LinkButton style can have link. Also, URL is mutually exclusive with CustomID. URL string `json:"url,omitempty"` }
Button represents button component.
func (Button) MarshalJSON ¶
MarshalJSON is a method for marshaling Button to a JSON object.
func (Button) Type ¶
func (Button) Type() ComponentType
Type is a method to get the type of a component.
type ButtonList ¶ added in v1.0.2
type ButtonList struct {
Buttons []*CardButton `json:"buttons,omitempty"`
}
type ButtonStyle ¶
type ButtonStyle uint
ButtonStyle is style of button.
const ( // PrimaryButton is a button with blurple color. PrimaryButton ButtonStyle = 1 // SecondaryButton is a button with grey color. SecondaryButton ButtonStyle = 2 // SuccessButton is a button with green color. SuccessButton ButtonStyle = 3 // DangerButton is a button with red color. DangerButton ButtonStyle = 4 // LinkButton is a special type of button which navigates to a URL. Has grey color. LinkButton ButtonStyle = 5 )
Button styles.
type CallAnswerEventContent ¶
type CallAnswerEventContent struct { BaseCallEventContent Answer CallData `json:"answer"` }
type CallCandidate ¶
type CallCandidatesEventContent ¶
type CallCandidatesEventContent struct { BaseCallEventContent Candidates []CallCandidate `json:"candidates"` }
type CallData ¶
type CallData struct { SDP string `json:"sdp"` Type CallDataType `json:"type"` }
type CallDataType ¶
type CallDataType string
const ( CallDataTypeOffer CallDataType = "offer" CallDataTypeAnswer CallDataType = "answer" )
type CallHangupEventContent ¶
type CallHangupEventContent struct { BaseCallEventContent Reason CallHangupReason `json:"reason"` }
type CallHangupReason ¶
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 ¶
type CallInviteEventContent struct { BaseCallEventContent Lifetime int `json:"lifetime"` Offer CallData `json:"offer"` }
type CallNegotiateEventContent ¶
type CallNegotiateEventContent struct { BaseCallEventContent Lifetime int `json:"lifetime"` Description CallData `json:"description"` }
type CallRejectEventContent ¶
type CallRejectEventContent struct {
BaseCallEventContent
}
type CallSelectAnswerEventContent ¶
type CallSelectAnswerEventContent struct { BaseCallEventContent SelectedPartyID string `json:"selected_party_id"` }
type CallVersion ¶
type CallVersion string
func (*CallVersion) Int ¶
func (cv *CallVersion) Int() (int, error)
func (*CallVersion) MarshalJSON ¶
func (cv *CallVersion) MarshalJSON() ([]byte, error)
func (*CallVersion) UnmarshalJSON ¶
func (cv *CallVersion) UnmarshalJSON(raw []byte) error
type CallbackGame ¶ added in v0.0.8
type CallbackGame struct{}
CallbackGame is for starting a game in an inline keyboard button.
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 CardButton ¶ added in v1.0.2
type CardHeader ¶ added in v1.0.2
type ChannelType ¶
type ChannelType int
ChannelType is the type of a Channel
const ( ChannelTypeGuildText ChannelType = 0 ChannelTypeDM ChannelType = 1 ChannelTypeGuildVoice ChannelType = 2 ChannelTypeGroupDM ChannelType = 3 ChannelTypeGuildCategory ChannelType = 4 ChannelTypeGuildNews ChannelType = 5 ChannelTypeGuildStore ChannelType = 6 ChannelTypeGuildNewsThread ChannelType = 10 ChannelTypeGuildPublicThread ChannelType = 11 ChannelTypeGuildPrivateThread ChannelType = 12 ChannelTypeGuildStageVoice ChannelType = 13 ChannelTypeGuildDirectory ChannelType = 14 ChannelTypeGuildForum ChannelType = 15 ChannelTypeGuildMedia ChannelType = 16 )
Block contains known ChannelType values
type CommandOption ¶
type ComponentEmoji ¶
type ComponentEmoji struct { Name string `json:"name,omitempty"` ID string `json:"id,omitempty"` Animated bool `json:"animated,omitempty"` }
ComponentEmoji represents button emoji, if it does have one.
type ComponentType ¶
type ComponentType uint
ComponentType is type of component.
const ( ActionsRowComponent ComponentType = 1 ButtonComponent ComponentType = 2 SelectMenuComponent ComponentType = 3 TextInputComponent ComponentType = 4 UserSelectMenuComponent ComponentType = 5 RoleSelectMenuComponent ComponentType = 6 MentionableSelectMenuComponent ComponentType = 7 ChannelSelectMenuComponent ComponentType = 8 )
MessageComponent types.
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 ¶
func (content *Content) AsBridge() *BridgeEventContent
func (*Content) AsCallAnswer ¶
func (content *Content) AsCallAnswer() *CallAnswerEventContent
func (*Content) AsCallCandidates ¶
func (content *Content) AsCallCandidates() *CallCandidatesEventContent
func (*Content) AsCallHangup ¶
func (content *Content) AsCallHangup() *CallHangupEventContent
func (*Content) AsCallInvite ¶
func (content *Content) AsCallInvite() *CallInviteEventContent
func (*Content) AsCallNegotiate ¶
func (content *Content) AsCallNegotiate() *CallNegotiateEventContent
func (*Content) AsCallReject ¶
func (content *Content) AsCallReject() *CallRejectEventContent
func (*Content) AsCallSelectAnswer ¶
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) AsElementFunctionalMembers ¶
func (content *Content) AsElementFunctionalMembers() *ElementFunctionalMembersContent
func (*Content) AsEncrypted ¶
func (content *Content) AsEncrypted() *EncryptedEventContent
func (*Content) AsEncryption ¶
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) AsMarkedUnread ¶
func (content *Content) AsMarkedUnread() *MarkedUnreadEventContent
func (*Content) AsMember ¶
func (content *Content) AsMember() *MemberEventContent
func (*Content) AsMessage ¶
func (content *Content) AsMessage() *MessageEventContent
func (*Content) AsModPolicy ¶
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 ¶
func (content *Content) AsRoomKeyWithheld() *RoomKeyWithheldEventContent
func (*Content) AsRoomName ¶
func (content *Content) AsRoomName() *RoomNameEventContent
func (*Content) AsSpaceChild ¶
func (content *Content) AsSpaceChild() *SpaceChildEventContent
func (*Content) AsSpaceParent ¶
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) AsVerificationAccept ¶
func (content *Content) AsVerificationAccept() *VerificationAcceptEventContent
func (*Content) AsVerificationCancel ¶
func (content *Content) AsVerificationCancel() *VerificationCancelEventContent
func (*Content) AsVerificationDone ¶
func (content *Content) AsVerificationDone() *VerificationDoneEventContent
func (*Content) AsVerificationKey ¶
func (content *Content) AsVerificationKey() *VerificationKeyEventContent
func (*Content) AsVerificationMAC ¶
func (content *Content) AsVerificationMAC() *VerificationMACEventContent
func (*Content) AsVerificationReady ¶
func (content *Content) AsVerificationReady() *VerificationReadyEventContent
func (*Content) AsVerificationRequest ¶
func (content *Content) AsVerificationRequest() *VerificationRequestEventContent
func (*Content) AsVerificationStart ¶
func (content *Content) AsVerificationStart() *VerificationStartEventContent
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 RoomVersion `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 DecoratedText ¶ added in v1.0.2
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 ¶
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"` Mentions *Mentions `json:"m.mentions,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 ¶
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 ¶
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"` Blurhash string `json:"blurhash,omitempty"` AnoaBlurhash string `json:"xyz.amorgan.blurhash,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"` MaxAge int64 `json:"com.beeper.max_age_ms"` MaxMessages int `json:"com.beeper.max_messages"` IsScheduled bool `json:"com.beeper.is_scheduled"` }
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 InRoomVerificationEvent ¶
type InRoomVerificationEvent struct { // RelatesTo indicates the m.key.verification.request that this message is // related to. Note that for encrypted messages, this property should be in // the unencrypted portion of the event. RelatesTo *RelatesTo `json:"m.relates_to,omitempty"` }
InRoomVerificationEvent contains the fields common to all in-room verification events.
func (*InRoomVerificationEvent) GetRelatesTo ¶
func (ve *InRoomVerificationEvent) GetRelatesTo() *RelatesTo
func (*InRoomVerificationEvent) OptionalGetRelatesTo ¶
func (ve *InRoomVerificationEvent) OptionalGetRelatesTo() *RelatesTo
func (*InRoomVerificationEvent) SetRelatesTo ¶
func (ve *InRoomVerificationEvent) SetRelatesTo(rel *RelatesTo)
type InsertionMarkerContent
deprecated
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 ¶
type JoinRuleAllow struct { RoomID id.RoomID `json:"room_id"` Type JoinRuleAllowType `json:"type"` }
type JoinRuleAllowType ¶
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 ¶
type KeyAgreementProtocol string
const ( KeyAgreementProtocolCurve25519 KeyAgreementProtocol = "curve25519" KeyAgreementProtocolCurve25519HKDFSHA256 KeyAgreementProtocol = "curve25519-hkdf-sha256" )
type KeyRequestAction ¶
type KeyRequestAction string
type LinkPreview ¶
type LinkPreview struct { CanonicalURL string `json:"og:url,omitempty"` Title string `json:"og:title,omitempty"` Type string `json:"og:type,omitempty"` Description string `json:"og:description,omitempty"` ImageURL id.ContentURIString `json:"og:image,omitempty"` ImageSize int `json:"matrix:image:size,omitempty"` ImageWidth int `json:"og:image:width,omitempty"` ImageHeight int `json:"og:image:height,omitempty"` ImageType string `json:"og:image:type,omitempty"` }
type LoginURL ¶ added in v0.0.8
type LoginURL struct { // URL is an HTTP URL to be opened with user authorization data added to the // query string when the button is pressed. If the user refuses to provide // authorization data, the original URL without information about the user // will be opened. The data added is the same as described in Receiving // authorization data. // // NOTE: You must always check the hash of the received data to verify the // authentication and the integrity of the data as described in Checking // authorization. URL string `json:"url"` // ForwardText is the new text of the button in forwarded messages // // optional ForwardText string `json:"forward_text,omitempty"` // BotUsername is the username of a bot, which will be used for user // authorization. See Setting up a bot for more details. If not specified, // the current bot's username will be assumed. The url's domain must be the // same as the domain linked with the bot. See Linking your domain to the // bot for more details. // // optional BotUsername string `json:"bot_username,omitempty"` // RequestWriteAccess if true requests permission for your bot to send // messages to the user // // optional RequestWriteAccess bool `json:"request_write_access,omitempty"` }
LoginURL represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
type MSC1767Audio ¶
func (*MSC1767Audio) MarshalJSON ¶
func (ma *MSC1767Audio) MarshalJSON() ([]byte, error)
type MSC1767Message ¶
type MSC3245Voice ¶
type MSC3245Voice struct{}
type MarkedUnreadEventContent ¶
type MarkedUnreadEventContent struct {
Unread bool `json:"unread"`
}
type MautrixInfo ¶
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 Mentions ¶
type MessageComponent ¶
type MessageComponent interface { json.Marshaler Type() ComponentType }
MessageComponent is a base interface for all message components.
func MessageComponentFromJSON ¶
func MessageComponentFromJSON(b []byte) (MessageComponent, error)
MessageComponentFromJSON is a helper function for unmarshaling message components
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"` Mentions *Mentions `json:"m.mentions,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"` BeeperGalleryImages []*MessageEventContent `json:"com.beeper.gallery.images,omitempty"` BeeperGalleryCaption string `json:"com.beeper.gallery.caption,omitempty"` BeeperGalleryCaptionHTML string `json:"com.beeper.gallery.caption_html,omitempty"` BeeperPerMessageProfile *BeeperPerMessageProfile `json:"com.beeper.per_message_profile,omitempty"` BeeperLinkPreviews []*BeeperLinkPreview `json:"com.beeper.linkpreviews,omitempty"` MSC1767Audio *MSC1767Audio `json:"org.matrix.msc1767.audio,omitempty"` MSC3245Voice *MSC3245Voice `json:"org.matrix.msc3245.voice,omitempty"` Components [][]MessageComponent `json:"components"` BotCommand *BotCommand `json:"bot_command,omitempty"` MsgCardV2 *MsgCardV2 `json:"cards,omitempty"` // The flags of the message, which describe extra features of a message. // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the flag. Flags MessageFlags `json:"flags"` // 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 ¶
func (content *MessageEventContent) EnsureHasHTML()
func (*MessageEventContent) GetCaption ¶
func (content *MessageEventContent) GetCaption() string
func (*MessageEventContent) GetFile ¶
func (content *MessageEventContent) GetFile() *EncryptedFileInfo
func (*MessageEventContent) GetFileName ¶
func (content *MessageEventContent) GetFileName() string
func (*MessageEventContent) GetFormattedCaption ¶
func (content *MessageEventContent) GetFormattedCaption() string
func (*MessageEventContent) GetInfo ¶
func (content *MessageEventContent) GetInfo() *FileInfo
func (*MessageEventContent) GetRelatesTo ¶
func (content *MessageEventContent) GetRelatesTo() *RelatesTo
func (*MessageEventContent) GetReplyTo
deprecated
func (content *MessageEventContent) GetReplyTo() id.EventID
Deprecated: RelatesTo methods are nil-safe, so RelatesTo.GetReplyTo can be used directly
func (*MessageEventContent) OptionalGetRelatesTo ¶
func (content *MessageEventContent) OptionalGetRelatesTo() *RelatesTo
func (*MessageEventContent) RemoveReplyFallback ¶
func (content *MessageEventContent) RemoveReplyFallback()
func (*MessageEventContent) SetEdit ¶
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 MessageFlags ¶
type MessageFlags int
MessageFlags is the flags of "message" (see MessageFlags* consts) https://discord.com/developers/docs/resources/channel#message-object-message-flags
const ( // MessageFlagsCrossPosted This message has been published to subscribed channels (via Channel Following). MessageFlagsCrossPosted MessageFlags = 1 << 0 // MessageFlagsIsCrossPosted this message originated from a message in another channel (via Channel Following). MessageFlagsIsCrossPosted MessageFlags = 1 << 1 // MessageFlagsSuppressEmbeds do not include any embeds when serializing this message. MessageFlagsSuppressEmbeds MessageFlags = 1 << 2 // TODO: deprecated, remove when compatibility is not needed MessageFlagsSupressEmbeds MessageFlags = 1 << 2 // MessageFlagsSourceMessageDeleted the source message for this crosspost has been deleted (via Channel Following). MessageFlagsSourceMessageDeleted MessageFlags = 1 << 3 // MessageFlagsUrgent this message came from the urgent message system. MessageFlagsUrgent MessageFlags = 1 << 4 // MessageFlagsHasThread this message has an associated thread, with the same id as the message. MessageFlagsHasThread MessageFlags = 1 << 5 // MessageFlagsEphemeral this message is only visible to the user who invoked the Interaction. MessageFlagsEphemeral MessageFlags = 1 << 6 // MessageFlagsLoading this message is an Interaction Response and the bot is "thinking". MessageFlagsLoading MessageFlags = 1 << 7 // MessageFlagsFailedToMentionSomeRolesInThread this message failed to mention some roles and add their members to the thread. MessageFlagsFailedToMentionSomeRolesInThread MessageFlags = 1 << 8 // MessageFlagsSuppressNotifications this message will not trigger push and desktop notifications. MessageFlagsSuppressNotifications MessageFlags = 1 << 12 // MessageFlagsIsVoiceMessage this message is a voice message. MessageFlagsIsVoiceMessage MessageFlags = 1 << 13 )
Valid MessageFlags values
type MessageStatus ¶
type MessageStatus string
const ( MessageStatusSuccess MessageStatus = "SUCCESS" MessageStatusPending MessageStatus = "PENDING" MessageStatusRetriable MessageStatus = "FAIL_RETRIABLE" MessageStatusFail MessageStatus = "FAIL_PERMANENT" )
type MessageStatusReason ¶
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" MsgCommand MessageType = "m.command" MsgCard MessageType = "m.card" MsgVerificationRequest MessageType = "m.key.verification.request" MsgBeeperGallery MessageType = "com.beeper.gallery" )
Msgtypes
func (MessageType) IsMedia ¶
func (mt MessageType) IsMedia() bool
func (MessageType) IsText ¶
func (mt MessageType) IsText() bool
type ModPolicyContent ¶
type ModPolicyContent struct { Entity string `json:"entity"` Reason string `json:"reason"` Recommendation PolicyRecommendation `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 MsgCardV2 ¶ added in v1.0.6
type MsgCardV2 struct {
CardsV2 []*CardV2 `json:"cardsV2,omitempty"`
}
type NotificationPowerLevels ¶
type NotificationPowerLevels struct {
RoomPtr *int `json:"room,omitempty"`
}
func (*NotificationPowerLevels) Clone ¶
func (npl *NotificationPowerLevels) Clone() *NotificationPowerLevels
func (*NotificationPowerLevels) Room ¶
func (npl *NotificationPowerLevels) Room() int
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 PolicyRecommendation ¶
type PolicyRecommendation string
const ( PolicyRecommendationBan PolicyRecommendation = "m.ban" PolicyRecommendationUnstableBan PolicyRecommendation = "org.matrix.mjolnir.ban" PolicyRecommendationUnban PolicyRecommendation = "fi.mau.meowlnir.unban" )
type PollResponseEventContent ¶
type PollResponseEventContent struct { RelatesTo RelatesTo `json:"m.relates_to"` Response struct { Answers []string `json:"answers"` } `json:"org.matrix.msc3381.poll.response"` }
func (*PollResponseEventContent) GetRelatesTo ¶
func (content *PollResponseEventContent) GetRelatesTo() *RelatesTo
func (*PollResponseEventContent) OptionalGetRelatesTo ¶
func (content *PollResponseEventContent) OptionalGetRelatesTo() *RelatesTo
func (*PollResponseEventContent) SetRelatesTo ¶
func (content *PollResponseEventContent) SetRelatesTo(rel *RelatesTo)
type PollStartEventContent ¶
type PollStartEventContent struct { RelatesTo *RelatesTo `json:"m.relates_to"` Mentions *Mentions `json:"m.mentions,omitempty"` PollStart struct { Kind string `json:"kind"` MaxSelections int `json:"max_selections"` Question MSC1767Message `json:"question"` Answers []struct { ID string `json:"id"` MSC1767Message } `json:"answers"` } `json:"org.matrix.msc3381.poll.start"` }
func (*PollStartEventContent) GetRelatesTo ¶
func (content *PollStartEventContent) GetRelatesTo() *RelatesTo
func (*PollStartEventContent) OptionalGetRelatesTo ¶
func (content *PollStartEventContent) OptionalGetRelatesTo() *RelatesTo
func (*PollStartEventContent) SetRelatesTo ¶
func (content *PollStartEventContent) SetRelatesTo(rel *RelatesTo)
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"` Notifications *NotificationPowerLevels `json:"notifications,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"` // contains filtered or unexported fields }
PowerLevelsEventContent represents the content of a m.room.power_levels state event content. https://spec.matrix.org/v1.5/client-server-api/#mroompower_levels
func (*PowerLevelsEventContent) Ban ¶
func (pl *PowerLevelsEventContent) Ban() int
func (*PowerLevelsEventContent) Clone ¶
func (pl *PowerLevelsEventContent) Clone() *PowerLevelsEventContent
func (*PowerLevelsEventContent) EnsureEventLevel ¶
func (pl *PowerLevelsEventContent) EnsureEventLevel(eventType Type, level int) bool
func (*PowerLevelsEventContent) EnsureEventLevelAs ¶
func (*PowerLevelsEventContent) EnsureUserLevel ¶
func (pl *PowerLevelsEventContent) EnsureUserLevel(target id.UserID, level int) bool
func (*PowerLevelsEventContent) EnsureUserLevelAs ¶
func (pl *PowerLevelsEventContent) EnsureUserLevelAs(actor, target 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 Predecessor ¶
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 time.Time // Thread ID for thread-specific read receipts from MSC3771 ThreadID ThreadID // 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{} }
func (ReadReceipt) MarshalJSON ¶
func (rr ReadReceipt) MarshalJSON() ([]byte, error)
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 ¶
func (rec ReceiptEventContent) GetOrCreate(evt id.EventID) Receipts
func (ReceiptEventContent) Set ¶
func (rec ReceiptEventContent) Set(evtID id.EventID, receiptType ReceiptType, userID id.UserID, receipt ReadReceipt)
type ReceiptType ¶
type ReceiptType string
const ( ReceiptTypeRead ReceiptType = "m.read" ReceiptTypeReadPrivate ReceiptType = "m.read.private" )
type Receipts ¶
type Receipts map[ReceiptType]UserReceipts
func (Receipts) GetOrCreate ¶
func (rps Receipts) GetOrCreate(receiptType ReceiptType) UserReceipts
type RedactionEventContent ¶
type RedactionEventContent struct { Reason string `json:"reason,omitempty"` // The event ID is here as of room v11. In old servers it may only be at the top level. Redacts id.EventID `json:"redacts,omitempty"` }
RedactionEventContent represents the content of a m.room.redaction message event.
https://spec.matrix.org/v1.8/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) GetNonFallbackReplyTo ¶
func (*RelatesTo) GetReferenceID ¶
func (*RelatesTo) GetReplaceID ¶
func (*RelatesTo) GetReplyTo ¶
func (*RelatesTo) GetThreadParent ¶
func (*RelatesTo) SetAnnotation ¶
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.ContentURIString `json:"url,omitempty"` Info *FileInfo `json:"info,omitempty"` MSC3414File *EncryptedFileInfo `json:"org.matrix.msc3414.file,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"` MaxAge int64 `json:"com.beeper.max_age_ms"` MaxMessages int `json:"com.beeper.max_messages"` IsScheduled bool `json:"com.beeper.is_scheduled"` }
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 ¶
type RoomKeyWithheldCode string
const ( RoomKeyWithheldBlacklisted RoomKeyWithheldCode = "m.blacklisted" RoomKeyWithheldUnverified RoomKeyWithheldCode = "m.unverified" RoomKeyWithheldNoOlmSession RoomKeyWithheldCode = "m.no_olm" RoomKeyWithheldBeeperRedacted RoomKeyWithheldCode = "com.beeper.redacted" )
type RoomKeyWithheldEventContent ¶
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"` }
func (*RoomKeyWithheldEventContent) Error ¶
func (withheld *RoomKeyWithheldEventContent) Error() string
func (*RoomKeyWithheldEventContent) Is ¶
func (withheld *RoomKeyWithheldEventContent) Is(other error) bool
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 RoomVersion ¶
type RoomVersion string
const ( RoomV1 RoomVersion = "1" RoomV2 RoomVersion = "2" RoomV3 RoomVersion = "3" RoomV4 RoomVersion = "4" RoomV5 RoomVersion = "5" RoomV6 RoomVersion = "6" RoomV7 RoomVersion = "7" RoomV8 RoomVersion = "8" RoomV9 RoomVersion = "9" RoomV10 RoomVersion = "10" RoomV11 RoomVersion = "11" )
type SecretRequestAction ¶
type SecretRequestAction string
func (SecretRequestAction) String ¶
func (a SecretRequestAction) String() string
type SecretSendEventContent ¶
type SelectMenu ¶
type SelectMenu struct { // Type of the select menu. MenuType SelectMenuType `json:"type,omitempty"` // CustomID is a developer-defined identifier for the select menu. CustomID string `json:"custom_id,omitempty"` // The text which will be shown in the menu if there's no default options or all options was deselected and component was closed. Placeholder string `json:"placeholder"` // This value determines the minimal amount of selected items in the menu. MinValues *int `json:"min_values,omitempty"` // This value determines the maximal amount of selected items in the menu. // If MaxValues or MinValues are greater than one then the user can select multiple items in the component. MaxValues int `json:"max_values,omitempty"` // List of default values for auto-populated select menus. // NOTE: Number of entries should be in the range defined by MinValues and MaxValues. DefaultValues []SelectMenuDefaultValue `json:"default_values,omitempty"` Options []SelectMenuOption `json:"options,omitempty"` Disabled bool `json:"disabled"` // NOTE: Can only be used in SelectMenu with Channel menu type. ChannelTypes []ChannelType `json:"channel_types,omitempty"` }
SelectMenu represents select menu component.
func (SelectMenu) MarshalJSON ¶
func (s SelectMenu) MarshalJSON() ([]byte, error)
MarshalJSON is a method for marshaling SelectMenu to a JSON object.
func (SelectMenu) Type ¶
func (s SelectMenu) Type() ComponentType
Type is a method to get the type of a component.
type SelectMenuDefaultValue ¶
type SelectMenuDefaultValue struct { // ID of the entity. ID string `json:"id"` // Type of the entity. Type SelectMenuDefaultValueType `json:"type"` }
SelectMenuDefaultValue represents an entity selected by default in auto-populated select menus.
type SelectMenuDefaultValueType ¶
type SelectMenuDefaultValueType string
SelectMenuDefaultValueType represents the type of an entity selected by default in auto-populated select menus.
const ( SelectMenuDefaultValueUser SelectMenuDefaultValueType = "user" SelectMenuDefaultValueRole SelectMenuDefaultValueType = "role" SelectMenuDefaultValueChannel SelectMenuDefaultValueType = "channel" )
SelectMenuDefaultValue types.
type SelectMenuOption ¶
type SelectMenuOption struct { Label string `json:"label,omitempty"` Value string `json:"value"` Description string `json:"description"` Emoji *ComponentEmoji `json:"emoji,omitempty"` // Determines whenever option is selected by default or not. Default bool `json:"default"` }
SelectMenuOption represents an option for a select menu.
type ServerACLEventContent ¶
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 Source ¶
type Source int
Source represents the part of the sync response that an event came from.
type SpaceChildEventContent ¶
type SpaceParentEventContent ¶
type StrippedState ¶
type Tag
deprecated
type Tag = TagMetadata
Deprecated: type alias
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 TagMetadata ¶
type Tags ¶
type Tags map[RoomTag]TagMetadata
type TextInput ¶
type TextInput struct { CustomID string `json:"custom_id"` Label string `json:"label"` Style TextInputStyle `json:"style"` Placeholder string `json:"placeholder,omitempty"` Value string `json:"value,omitempty"` Required bool `json:"required"` MinLength int `json:"min_length,omitempty"` MaxLength int `json:"max_length,omitempty"` }
TextInput represents text input component.
func (TextInput) MarshalJSON ¶
MarshalJSON is a method for marshaling TextInput to a JSON object.
func (TextInput) Type ¶
func (TextInput) Type() ComponentType
Type is a method to get the type of a component.
type TextInputStyle ¶
type TextInputStyle uint
TextInputStyle is style of text in TextInput component.
const ( TextInputShort TextInputStyle = 1 TextInputParagraph TextInputStyle = 2 )
Text styles
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 ToDeviceVerificationEvent ¶
type ToDeviceVerificationEvent struct { // TransactionID is an opaque identifier for the verification request. Must // be unique with respect to the devices involved. TransactionID id.VerificationTransactionID `json:"transaction_id,omitempty"` }
ToDeviceVerificationEvent contains the fields common to all to-device verification events.
func (*ToDeviceVerificationEvent) GetTransactionID ¶
func (ve *ToDeviceVerificationEvent) GetTransactionID() id.VerificationTransactionID
func (*ToDeviceVerificationEvent) SetTransactionID ¶
func (ve *ToDeviceVerificationEvent) SetTransactionID(id id.VerificationTransactionID)
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 ¶
func (*Type) IsToDevice ¶
func (*Type) MarshalJSON ¶
func (Type) MarshalText ¶
func (*Type) UnmarshalJSON ¶
func (Type) UnmarshalText ¶
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"` BeeperHSOrder int64 `json:"com.beeper.hs.order,omitempty"` BeeperHSSuborder int64 `json:"com.beeper.hs.suborder,omitempty"` BeeperFromBackup bool `json:"com.beeper.from_backup,omitempty"` }
type UserReceipts ¶
type UserReceipts map[id.UserID]ReadReceipt
func (UserReceipts) Set ¶
func (ur UserReceipts) Set(userID id.UserID, receipt ReadReceipt)
type VerificationAcceptEventContent ¶
type VerificationAcceptEventContent struct { ToDeviceVerificationEvent InRoomVerificationEvent // Commitment is the hash 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 jsonbytes.UnpaddedBytes `json:"commitment"` // Hash is the hash method the device is choosing to use, out of the // options in the m.key.verification.start message. Hash VerificationHashMethod `json:"hash"` // KeyAgreementProtocol is 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"` // MessageAuthenticationCode is 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"` // ShortAuthenticationString is a list of 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"` }
VerificationAcceptEventContent represents the content of an m.key.verification.accept event (both the to-device and the in-room version) as described in Section 11.12.2.2.2 of the Spec.
type VerificationCancelCode ¶
type VerificationCancelCode string
const ( VerificationCancelCodeUser VerificationCancelCode = "m.user" VerificationCancelCodeTimeout VerificationCancelCode = "m.timeout" VerificationCancelCodeUnknownTransaction VerificationCancelCode = "m.unknown_transaction" VerificationCancelCodeUnknownMethod VerificationCancelCode = "m.unknown_method" VerificationCancelCodeUnexpectedMessage VerificationCancelCode = "m.unexpected_message" VerificationCancelCodeKeyMismatch VerificationCancelCode = "m.key_mismatch" VerificationCancelCodeUserMismatch VerificationCancelCode = "m.user_mismatch" VerificationCancelCodeInvalidMessage VerificationCancelCode = "m.invalid_message" VerificationCancelCodeAccepted VerificationCancelCode = "m.accepted" VerificationCancelCodeSASMismatch VerificationCancelCode = "m.mismatched_sas" VerificationCancelCodeCommitmentMismatch VerificationCancelCode = "m.mismatched_commitment" // Non-spec codes VerificationCancelCodeInternalError VerificationCancelCode = "com.beeper.internal_error" VerificationCancelCodeMasterKeyNotTrusted VerificationCancelCode = "com.beeper.master_key_not_trusted" // the master key is not trusted by this device, but the QR code that was scanned was from a device that doesn't trust the master key )
type VerificationCancelEventContent ¶
type VerificationCancelEventContent struct { ToDeviceVerificationEvent InRoomVerificationEvent // Code is the error code for why the process/request was cancelled by the // user. Code VerificationCancelCode `json:"code"` // Reason is 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"` }
VerificationCancelEventContent represents the content of an m.key.verification.cancel event (both the to-device and the in-room version) as described in Section 11.12.2.1 of the Spec.
type VerificationDoneEventContent ¶
type VerificationDoneEventContent struct { ToDeviceVerificationEvent InRoomVerificationEvent }
VerificationDoneEventContent represents the content of an m.key.verification.done event (both the to-device and the in-room version) as described in Section 11.12.2.1 of the Spec.
This type is an alias for [VerificationRelatable] since there are no additional fields defined by the spec.
type VerificationHashMethod ¶
type VerificationHashMethod string
const VerificationHashMethodSHA256 VerificationHashMethod = "sha256"
type VerificationKeyEventContent ¶
type VerificationKeyEventContent struct { ToDeviceVerificationEvent InRoomVerificationEvent // Key is the device’s ephemeral public key. Key jsonbytes.UnpaddedBytes `json:"key"` }
VerificationKeyEventContent represents the content of an m.key.verification.key event (both the to-device and the in-room version) as described in Section 11.12.2.2.2 of the Spec.
type VerificationMACEventContent ¶
type VerificationMACEventContent struct { ToDeviceVerificationEvent InRoomVerificationEvent // Keys is the MAC of the comma-separated, sorted, list of key IDs given in // the MAC property. Keys jsonbytes.UnpaddedBytes `json:"keys"` // MAC is a map of the key ID to the MAC of the key, using the algorithm in // the verification process. MAC map[id.KeyID]jsonbytes.UnpaddedBytes `json:"mac"` }
VerificationMACEventContent represents the content of an m.key.verification.mac event (both the to-device and the in-room version) as described in Section 11.12.2.2.2 of the Spec.
type VerificationMethod ¶
type VerificationMethod string
const ( VerificationMethodSAS VerificationMethod = "m.sas.v1" VerificationMethodReciprocate VerificationMethod = "m.reciprocate.v1" VerificationMethodQRCodeShow VerificationMethod = "m.qr_code.show.v1" VerificationMethodQRCodeScan VerificationMethod = "m.qr_code.scan.v1" )
type VerificationReadyEventContent ¶
type VerificationReadyEventContent struct { ToDeviceVerificationEvent InRoomVerificationEvent // FromDevice is the device ID which is initiating the request. FromDevice id.DeviceID `json:"from_device"` // Methods is a list of the verification methods supported by the sender. Methods []VerificationMethod `json:"methods"` }
VerificationReadyEventContent represents the content of an m.key.verification.ready event (both the to-device and the in-room version) as described in Section 11.12.2.1 of the Spec.
type VerificationRequestEventContent ¶
type VerificationRequestEventContent struct { ToDeviceVerificationEvent // FromDevice is the device ID which is initiating the request. FromDevice id.DeviceID `json:"from_device"` // Methods is a list of the verification methods supported by the sender. Methods []VerificationMethod `json:"methods"` // Timestamp is the time at which the request was made. Timestamp jsontime.UnixMilli `json:"timestamp,omitempty"` }
VerificationRequestEventContent represents the content of an m.key.verification.request to-device event as described in Section 11.12.2.1 of the Spec.
For the in-room version, use a standard MessageEventContent struct.
func VerificationRequestEventContentFromMessage ¶
func VerificationRequestEventContentFromMessage(evt *Event) *VerificationRequestEventContent
VerificationRequestEventContentFromMessage converts an in-room verification request message event to a VerificationRequestEventContent.
type VerificationStartEventContent ¶
type VerificationStartEventContent struct { ToDeviceVerificationEvent InRoomVerificationEvent // FromDevice is the device ID which is initiating the request. FromDevice id.DeviceID `json:"from_device"` // Method is the verification method to use. Method VerificationMethod `json:"method"` // NextMethod is an optional method to use to verify the other user's key. // Applicable when the method chosen only verifies one user’s key. This // field will never be present if the method verifies keys both ways. NextMethod VerificationMethod `json:"next_method,omitempty"` // Hashes are the hash methods the sending device understands. This field // is only applicable when the method is m.sas.v1. Hashes []VerificationHashMethod `json:"hashes,omitempty"` // KeyAgreementProtocols is the list of key agreement protocols the sending // device understands. This field is only applicable when the method is // m.sas.v1. KeyAgreementProtocols []KeyAgreementProtocol `json:"key_agreement_protocols,omitempty"` // MessageAuthenticationCodes is a list of the MAC methods that the sending // device understands. This field is only applicable when the method is // m.sas.v1. MessageAuthenticationCodes []MACMethod `json:"message_authentication_codes"` // ShortAuthenticationString is a list of SAS methods the sending device // (and the sending device's user) understands. This field is only // applicable when the method is m.sas.v1. ShortAuthenticationString []SASMethod `json:"short_authentication_string"` // Secret is the shared secret from the QR code. This field is only // applicable when the method is m.reciprocate.v1. Secret jsonbytes.UnpaddedBytes `json:"secret,omitempty"` }
VerificationStartEventContent represents the content of an m.key.verification.start event (both the to-device and the in-room version) as described in Section 11.12.2.1 of the Spec.
This struct also contains the fields for an m.key.verification.start event using the VerificationMethodSAS method as described in Section 11.12.2.2.2 and an m.key.verification.start using VerificationMethodReciprocate as described in Section 11.12.2.4.2.
type VerificationTransactionable ¶
type VerificationTransactionable interface { GetTransactionID() id.VerificationTransactionID SetTransactionID(id.VerificationTransactionID) }
type WebAppInfo ¶ added in v0.0.9
type WebAppInfo struct { // URL is the HTTPS URL of a Web App to be opened with additional data as // specified in Initializing Web Apps. URL string `json:"url"` }
type Widget ¶ added in v1.0.2
type Widget struct { DecoratedText *DecoratedText `json:"decoratedText,omitempty"` ButtonList *ButtonList `json:"buttonList,omitempty"` }