diff --git a/src/call.rs b/src/call.rs index da8b0272..39738c92 100644 --- a/src/call.rs +++ b/src/call.rs @@ -15,6 +15,7 @@ pub struct SessionDescription { /// The type of session description. #[serde(rename = "type")] pub session_type: SessionDescriptionType, + /// The SDP text of the session description. pub sdp: String, } @@ -25,6 +26,7 @@ pub enum SessionDescriptionType { /// An answer. #[serde(rename = "answer")] Answer, + /// An offer. #[serde(rename = "offer")] Offer, diff --git a/src/call/answer.rs b/src/call/answer.rs index e3193d91..693842c6 100644 --- a/src/call/answer.rs +++ b/src/call/answer.rs @@ -14,8 +14,10 @@ room_event! { pub struct AnswerEventContent { /// The VoIP session description object. The session description type must be *answer*. pub answer: SessionDescription, + /// The ID of the call this event relates to. pub call_id: String, + /// The version of the VoIP specification this messages adheres to. pub version: u64, } diff --git a/src/call/candidates.rs b/src/call/candidates.rs index 99543f05..0dc75ac9 100644 --- a/src/call/candidates.rs +++ b/src/call/candidates.rs @@ -14,8 +14,10 @@ room_event! { pub struct CandidatesEventContent { /// The ID of the call this event relates to. pub call_id: String, + /// A list of candidates. pub candidates: Vec, + /// The version of the VoIP specification this messages adheres to. pub version: u64, } @@ -25,9 +27,11 @@ pub struct CandidatesEventContent { pub struct Candidate { /// The SDP "a" line of the candidate. pub candidate: String, + /// The SDP media type this candidate is intended for. #[serde(rename = "sdpMid")] pub sdp_mid: String, + /// The index of the SDP "m" line this candidate is intended for. #[serde(rename = "sdpMLineIndex")] pub sdp_m_line_index: u64, diff --git a/src/call/hangup.rs b/src/call/hangup.rs index 180c1016..23dcbe1f 100644 --- a/src/call/hangup.rs +++ b/src/call/hangup.rs @@ -13,8 +13,10 @@ room_event! { pub struct HangupEventContent { /// The ID of the call this event relates to. pub call_id: String, + /// The version of the VoIP specification this messages adheres to. pub version: u64, + /// Optional error reason for the hangup. pub reason: Option, } diff --git a/src/call/invite.rs b/src/call/invite.rs index 7962b136..0929a438 100644 --- a/src/call/invite.rs +++ b/src/call/invite.rs @@ -14,12 +14,15 @@ room_event! { pub struct InviteEventContent { /// A unique identifer for the call. pub call_id: String, + /// The time in milliseconds that the invite is valid for. Once the invite age exceeds this /// value, clients should discard it. They should also no longer show the call as awaiting an /// answer in the UI. pub lifetime: u64, + /// The session description object. The session description type must be *offer*. pub offer: SessionDescription, + /// The version of the VoIP specification this messages adheres to. pub version: u64, } diff --git a/src/collections/all.rs b/src/collections/all.rs index f49cd8ff..529799ca 100644 --- a/src/collections/all.rs +++ b/src/collections/all.rs @@ -44,68 +44,100 @@ use serde_json::{from_value, Value}; pub enum Event { /// m.call.answer CallAnswer(AnswerEvent), + /// m.call.candidates CallCandidates(CandidatesEvent), + /// m.call.hangup CallHangup(HangupEvent), + /// m.call.invite CallInvite(InviteEvent), + /// m.direct Direct(DirectEvent), + /// m.fully_read FullyRead(FullyReadEvent), + /// m.ignored_user_list IgnoredUserList(IgnoredUserListEvent), + /// m.presence Presence(PresenceEvent), + /// m.receipt Receipt(ReceiptEvent), + /// m.room.aliases RoomAliases(AliasesEvent), + /// m.room.avatar RoomAvatar(AvatarEvent), + /// m.room.canonical_alias RoomCanonicalAlias(CanonicalAliasEvent), + /// m.room.create RoomCreate(CreateEvent), + /// m.room.guest_access RoomGuestAccess(GuestAccessEvent), + /// m.room.history_visibility RoomHistoryVisibility(HistoryVisibilityEvent), + /// m.room.join_rules RoomJoinRules(JoinRulesEvent), + /// m.room.member RoomMember(MemberEvent), + /// m.room.message RoomMessage(MessageEvent), + /// m.room.message.feedback RoomMessageFeedback(FeedbackEvent), + /// m.room.name RoomName(NameEvent), + /// m.room.pinned_events RoomPinnedEvents(PinnedEventsEvent), + /// m.room.power_levels RoomPowerLevels(PowerLevelsEvent), + /// m.room.redaction RoomRedaction(RedactionEvent), + /// m.room.server_acl, RoomServerAcl(ServerAclEvent), + /// m.room.third_party_invite RoomThirdPartyInvite(ThirdPartyInviteEvent), + /// m.room.tombstone RoomTombstone(TombstoneEvent), + /// m.room.topic RoomTopic(TopicEvent), + /// m.sticker Sticker(StickerEvent), + /// m.tag Tag(TagEvent), + /// m.typing Typing(TypingEvent), + /// Any basic event that is not part of the specification. Custom(CustomEvent), + /// Any room event that is not part of the specification. CustomRoom(CustomRoomEvent), + /// Any state event that is not part of the specification. CustomState(CustomStateEvent), } @@ -116,52 +148,76 @@ pub enum Event { pub enum RoomEvent { /// m.call.answer CallAnswer(AnswerEvent), + /// m.call.candidates CallCandidates(CandidatesEvent), + /// m.call.hangup CallHangup(HangupEvent), + /// m.call.invite CallInvite(InviteEvent), + /// m.room.aliases RoomAliases(AliasesEvent), + /// m.room.avatar RoomAvatar(AvatarEvent), + /// m.room.canonical_alias RoomCanonicalAlias(CanonicalAliasEvent), + /// m.room.create RoomCreate(CreateEvent), + /// m.room.guest_access RoomGuestAccess(GuestAccessEvent), + /// m.room.history_visibility RoomHistoryVisibility(HistoryVisibilityEvent), + /// m.room.join_rules RoomJoinRules(JoinRulesEvent), + /// m.room.member RoomMember(MemberEvent), + /// m.room.message RoomMessage(MessageEvent), + /// m.room.message.feedback RoomMessageFeedback(FeedbackEvent), + /// m.room.name RoomName(NameEvent), + /// m.room.pinned_events RoomPinnedEvents(PinnedEventsEvent), + /// m.room.power_levels RoomPowerLevels(PowerLevelsEvent), + /// m.room.redaction RoomRedaction(RedactionEvent), + /// m.room.server_acl, RoomServerAcl(ServerAclEvent), + /// m.room.third_party_invite RoomThirdPartyInvite(ThirdPartyInviteEvent), + /// m.room.tombstone RoomTombstone(TombstoneEvent), + /// m.room.topic RoomTopic(TopicEvent), + /// m.sticker Sticker(StickerEvent), + /// Any room event that is not part of the specification. CustomRoom(CustomRoomEvent), + /// Any state event that is not part of the specification. CustomState(CustomStateEvent), } @@ -172,34 +228,49 @@ pub enum RoomEvent { pub enum StateEvent { /// m.room.aliases RoomAliases(AliasesEvent), + /// m.room.avatar RoomAvatar(AvatarEvent), + /// m.room.canonical_alias RoomCanonicalAlias(CanonicalAliasEvent), + /// m.room.create RoomCreate(CreateEvent), + /// m.room.guest_access RoomGuestAccess(GuestAccessEvent), + /// m.room.history_visibility RoomHistoryVisibility(HistoryVisibilityEvent), + /// m.room.join_rules RoomJoinRules(JoinRulesEvent), + /// m.room.member RoomMember(MemberEvent), + /// m.room.name RoomName(NameEvent), + /// m.room.pinned_events RoomPinnedEvents(PinnedEventsEvent), + /// m.room.power_levels RoomPowerLevels(PowerLevelsEvent), + /// m.room.server_acl, RoomServerAcl(ServerAclEvent), + /// m.room.third_party_invite RoomThirdPartyInvite(ThirdPartyInviteEvent), + /// m.room.tombstone RoomTombstone(TombstoneEvent), + /// m.room.topic RoomTopic(TopicEvent), + /// Any state event that is not part of the specification. CustomState(CustomStateEvent), } diff --git a/src/collections/only.rs b/src/collections/only.rs index dae1d8f5..943de2c1 100644 --- a/src/collections/only.rs +++ b/src/collections/only.rs @@ -29,18 +29,25 @@ use crate::{ pub enum Event { /// m.direct Direct(DirectEvent), + /// m.fully_read FullyRead(FullyReadEvent), + /// m.ignored_user_list IgnoredUserList(IgnoredUserListEvent), + /// m.presence Presence(PresenceEvent), + /// m.receipt Receipt(ReceiptEvent), + /// m.tag Tag(TagEvent), + /// m.typing Typing(TypingEvent), + /// Any basic event that is not part of the specification. Custom(CustomEvent), } @@ -51,20 +58,28 @@ pub enum Event { pub enum RoomEvent { /// m.call.answer CallAnswer(AnswerEvent), + /// m.call.candidates CallCandidates(CandidatesEvent), + /// m.call.hangup CallHangup(HangupEvent), + /// m.call.invite CallInvite(InviteEvent), + /// m.room.message RoomMessage(MessageEvent), + /// m.room.message.feedback RoomMessageFeedback(FeedbackEvent), + /// m.room.redaction RoomRedaction(RedactionEvent), + /// m.sticker Sticker(StickerEvent), + /// Any room event that is not part of the specification. CustomRoom(CustomRoomEvent), } diff --git a/src/lib.rs b/src/lib.rs index e3ddc70a..e31574a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -137,64 +137,94 @@ pub struct ParseError; pub enum EventType { /// m.call.answer CallAnswer, + /// m.call.candidates CallCandidates, + /// m.call.hangup CallHangup, + /// m.call.invite CallInvite, + /// m.direct Direct, + /// m.fully_read FullyRead, + /// m.ignored_user_list IgnoredUserList, + /// m.presence Presence, + /// m.receipt Receipt, + /// m.room.aliases RoomAliases, + /// m.room.avatar RoomAvatar, + /// m.room.canonical_alias RoomCanonicalAlias, + /// m.room.create RoomCreate, + /// m.room.guest_access RoomGuestAccess, + /// m.room.history_visibility RoomHistoryVisibility, + /// m.room.join_rules RoomJoinRules, + /// m.room.member RoomMember, + /// m.room.message RoomMessage, + /// m.room.message.feedback RoomMessageFeedback, + /// m.room.name RoomName, + /// m.room.pinned_events RoomPinnedEvents, + /// m.room.power_levels RoomPowerLevels, + /// m.room.redaction RoomRedaction, + /// m.room.server_acl RoomServerAcl, + /// m.room.third_party_invite RoomThirdPartyInvite, + /// m.room.tombstone RoomTombstone, + /// m.room.topic RoomTopic, + /// m.sticker Sticker, + /// m.tag Tag, + /// m.typing Typing, + /// Any event that is not part of the specification. Custom(String), } diff --git a/src/room.rs b/src/room.rs index 68f03304..45398176 100644 --- a/src/room.rs +++ b/src/room.rs @@ -31,22 +31,28 @@ pub struct ImageInfo { #[serde(rename = "h")] #[serde(skip_serializing_if = "Option::is_none")] pub height: Option, + /// The width of the image in pixels. #[serde(rename = "w")] #[serde(skip_serializing_if = "Option::is_none")] pub width: Option, + /// The MIME type of the image, e.g. "image/png." #[serde(skip_serializing_if = "Option::is_none")] pub mimetype: Option, + /// The file size of the image in bytes. #[serde(skip_serializing_if = "Option::is_none")] pub size: Option, + /// Metadata about the image referred to in `thumbnail_url`. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_info: Option, + /// The URL to the thumbnail of the image. Only present if the thumbnail is unencrypted. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_url: Option, + /// Information on the encrypted thumbnail image. Only present if the thumbnail is encrypted. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_file: Option, @@ -59,16 +65,19 @@ pub struct ThumbnailInfo { #[serde(rename = "h")] #[serde(skip_serializing_if = "Option::is_none")] pub height: Option, - /// The MIME type of the thumbnail, e.g. "image/png." - #[serde(skip_serializing_if = "Option::is_none")] - pub mimetype: Option, - /// The file size of the thumbnail in bytes. - #[serde(skip_serializing_if = "Option::is_none")] - pub size: Option, + /// The width of the thumbnail in pixels. #[serde(rename = "w")] #[serde(skip_serializing_if = "Option::is_none")] pub width: Option, + + /// The MIME type of the thumbnail, e.g. "image/png." + #[serde(skip_serializing_if = "Option::is_none")] + pub mimetype: Option, + + /// The file size of the thumbnail in bytes. + #[serde(skip_serializing_if = "Option::is_none")] + pub size: Option, } /// A file sent to a room with end-to-end encryption enabled. @@ -76,13 +85,17 @@ pub struct ThumbnailInfo { pub struct EncryptedFile { /// The URL to the file. pub url: String, + /// A [JSON Web Key](https://tools.ietf.org/html/rfc7517#appendix-A.3) object. pub key: JsonWebKey, + /// The initialization vector used by AES-CTR, encoded as unpadded base64. pub iv: String, + /// A map from an algorithm name to a hash of the ciphertext, encoded as unpadded base64. /// Clients should support the SHA-256 hash, which uses the key sha256. pub hashes: HashMap, + /// Version of the encrypted attachments protocol. Must be `v2`. pub v: String, } @@ -92,12 +105,16 @@ pub struct EncryptedFile { pub struct JsonWebKey { /// Key type. Must be `oct`. pub kty: String, + /// Key operations. Must at least contain `encrypt` and `decrypt`. pub key_ops: Vec, + /// Required. Algorithm. Must be `A256CTR`. pub alg: String, + /// The key, encoded as urlsafe unpadded base64. pub k: String, + /// Extractable. Must be `true`. This is a /// [W3C extension](https://w3c.github.io/webcrypto/#iana-section-jwk). pub ext: bool, diff --git a/src/room/avatar.rs b/src/room/avatar.rs index ffeb6580..fbd6a736 100644 --- a/src/room/avatar.rs +++ b/src/room/avatar.rs @@ -17,6 +17,7 @@ pub struct AvatarEventContent { /// Information about the avatar image. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option, + /// Information about the avatar thumbnail image. /// URL of the avatar image. pub url: String, diff --git a/src/room/create.rs b/src/room/create.rs index 1180ce48..0e256952 100644 --- a/src/room/create.rs +++ b/src/room/create.rs @@ -18,13 +18,16 @@ state_event! { pub struct CreateEventContent { /// The `user_id` of the room creator. This is set by the homeserver. pub creator: UserId, + /// Whether or not this room's data should be transferred to other homeservers. #[serde(rename = "m.federate")] #[serde(default = "default_true")] pub federate: bool, + /// The version of the room. Defaults to "1" if the key does not exist. #[serde(default = "default_room_version_id")] pub room_version: RoomVersionId, + /// A reference to the room this room replaces, if the previous room was upgraded. pub predecessor: Option, } @@ -34,6 +37,7 @@ pub struct CreateEventContent { pub struct PreviousRoom { /// The ID of the old room. pub room_id: RoomId, + /// The event ID of the last known event in the old room. pub event_id: EventId, } diff --git a/src/room/member.rs b/src/room/member.rs index ce28a146..acaa998b 100644 --- a/src/room/member.rs +++ b/src/room/member.rs @@ -98,6 +98,7 @@ pub struct ThirdPartyInvite { /// A name which can be displayed to represent the user instead of their third party /// identifier. pub display_name: String, + /// A block of content which has been signed, which servers can use to verify the event. /// Clients should ignore this. pub signed: SignedContent, @@ -111,9 +112,11 @@ pub struct SignedContent { /// /// Must be equal to the user_id property of the event. pub mxid: UserId, + /// A single signature from the verifying server, in the format specified by the Signing Events /// section of the server-server API. pub signatures: Signatures, + /// The token property of the containing third_party_invite object. pub token: String, } diff --git a/src/room/message.rs b/src/room/message.rs index b0ac710d..09783565 100644 --- a/src/room/message.rs +++ b/src/room/message.rs @@ -90,15 +90,19 @@ pub enum MessageEventContent { pub struct AudioMessageEventContent { /// The textual representation of this message. pub body: String, + /// Metadata for the audio clip referred to in `url`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option, + /// The message type. Always *m.audio*. pub msgtype: MessageType, + /// The URL to the audio clip. Required if the file is unencrypted. The URL (typically /// [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to the audio clip. #[serde(skip_serializing_if = "Option::is_none")] pub url: Option, + /// Required if the audio clip is encrypted. Information on the encrypted audio clip. #[serde(skip_serializing_if = "Option::is_none")] pub file: Option, @@ -110,9 +114,11 @@ pub struct AudioInfo { /// The duration of the audio in milliseconds. #[serde(skip_serializing_if = "Option::is_none")] pub duration: Option, + /// The mimetype of the audio, e.g. "audio/aac." #[serde(skip_serializing_if = "Option::is_none")] pub mimetype: Option, + /// The size of the audio clip in bytes. #[serde(skip_serializing_if = "Option::is_none")] pub size: Option, @@ -123,12 +129,15 @@ pub struct AudioInfo { pub struct EmoteMessageEventContent { /// The emote action to perform. pub body: String, + /// The message type. Always *m.emote*. pub msgtype: MessageType, + /// The format used in the `formatted_body`. Currently only `org.matrix.custom.html` is /// supported. #[serde(skip_serializing_if = "Option::is_none")] pub format: Option, + /// The formatted version of the `body`. This is required if `format` is specified. #[serde(skip_serializing_if = "Option::is_none")] pub formatted_body: Option, @@ -140,18 +149,23 @@ pub struct FileMessageEventContent { /// A human-readable description of the file. This is recommended to be the filename of the /// original upload. pub body: String, + /// The original filename of the uploaded file. #[serde(skip_serializing_if = "Option::is_none")] pub filename: Option, + /// Metadata about the file referred to in `url`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option, + /// The message type. Always *m.file*. pub msgtype: MessageType, + /// The URL to the file. Required if the file is unencrypted. The URL (typically /// [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to the file. #[serde(skip_serializing_if = "Option::is_none")] pub url: Option, + /// Required if file is encrypted. Information on the encrypted file. #[serde(skip_serializing_if = "Option::is_none")] pub file: Option, @@ -162,14 +176,18 @@ pub struct FileMessageEventContent { pub struct FileInfo { /// The mimetype of the file, e.g. "application/msword." pub mimetype: Option, + /// The size of the file in bytes. pub size: Option, + /// Metadata about the image referred to in `thumbnail_url`. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_info: Option, + /// The URL to the thumbnail of the file. Only present if the thumbnail is unencrypted. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_url: Option, + /// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_file: Option, @@ -181,14 +199,18 @@ pub struct ImageMessageEventContent { /// A textual representation of the image. This could be the alt text of the image, the filename /// of the image, or some kind of content description for accessibility e.g. "image attachment." pub body: String, + /// Metadata about the image referred to in `url`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option, + /// The message type. Always *m.image*. pub msgtype: MessageType, + /// The URL to the image. Required if the file is unencrypted. The URL (typically /// [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to the image. pub url: Option, + /// Required if image is encrypted. Information on the encrypted image. #[serde(skip_serializing_if = "Option::is_none")] pub file: Option, @@ -200,10 +222,13 @@ pub struct LocationMessageEventContent { /// A description of the location e.g. "Big Ben, London, UK,"or some kind of content description /// for accessibility, e.g. "location attachment." pub body: String, + /// A geo URI representing the location. pub geo_uri: String, + /// The message type. Always *m.location*. pub msgtype: MessageType, + /// Info about the location being represented. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option, @@ -215,10 +240,12 @@ pub struct LocationInfo { /// Metadata about the image referred to in `thumbnail_url` or `thumbnail_file`. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_info: Option, + /// The URL to a thumbnail of the location being represented. Only present if the thumbnail is /// unencrypted. #[serde(skip_serializing_if = "Option::is_none")] pub thumbnail_url: Option, + /// Information on an encrypted thumbnail of the location being represented. Only present if the /// thumbnail is encrypted. #[serde(skip_serializing_if = "Option::is_none")] @@ -230,8 +257,10 @@ pub struct LocationInfo { pub struct NoticeMessageEventContent { /// The notice text to send. pub body: String, + /// The message type. Always *m.notice*. pub msgtype: MessageType, + /// Information about related messages for /// [rich replies](https://matrix.org/docs/spec/client_server/r0.5.0#rich-replies). #[serde(rename = "m.relates_to")] @@ -244,14 +273,18 @@ pub struct NoticeMessageEventContent { pub struct ServerNoticeMessageEventContent { /// A human-readable description of the notice. pub body: String, + /// The message type. Always *m.server_notice*. pub msgtype: MessageType, + /// The type of notice being represented. pub server_notice_type: ServerNoticeType, + /// A URI giving a contact method for the server administrator. /// /// Required if the notice type is `m.server_notice.usage_limit_reached`. pub admin_contact: Option, + /// The kind of usage limit the server has exceeded. /// /// Required if the notice type is `m.server_notice.usage_limit_reached`. @@ -282,15 +315,19 @@ pub enum LimitType { pub struct TextMessageEventContent { /// The body of the message. pub body: String, + /// The message type. Always *m.text*. pub msgtype: MessageType, + /// The format used in the `formatted_body`. Currently only `org.matrix.custom.html` is /// supported. #[serde(skip_serializing_if = "Option::is_none")] pub format: Option, + /// The formatted version of the `body`. This is required if `format` is specified. #[serde(skip_serializing_if = "Option::is_none")] pub formatted_body: Option, + /// Information about related messages for /// [rich replies](https://matrix.org/docs/spec/client_server/r0.5.0#rich-replies). #[serde(rename = "m.relates_to")] @@ -304,14 +341,18 @@ pub struct VideoMessageEventContent { /// A description of the video, e.g. "Gangnam Style," or some kind of content description for /// accessibility, e.g. "video attachment." pub body: String, + /// Metadata about the video clip referred to in `url`. #[serde(skip_serializing_if = "Option::is_none")] pub info: Option, + /// The message type. Always *m.video*. pub msgtype: MessageType, + /// The URL to the video clip. Required if the file is unencrypted. The URL (typically /// [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to the video clip. pub url: Option, + /// Required if video clip is encrypted. Information on the encrypted video clip. #[serde(skip_serializing_if = "Option::is_none")] pub file: Option, @@ -323,30 +364,37 @@ pub struct VideoInfo { /// The duration of the video in milliseconds. #[serde(skip_serializing_if = "Option::is_none")] pub duration: Option, + /// The height of the video in pixels. #[serde(rename = "h")] #[serde(skip_serializing_if = "Option::is_none")] pub height: Option, - /// The mimetype of the video, e.g. "video/mp4." - #[serde(skip_serializing_if = "Option::is_none")] - pub mimetype: Option, - /// The size of the video in bytes. - #[serde(skip_serializing_if = "Option::is_none")] - pub size: Option, - /// Metadata about an image. - #[serde(skip_serializing_if = "Option::is_none")] - pub thumbnail_info: Option, - /// The URL (typically [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to - /// an image thumbnail of the video clip. Only present if the thumbnail is unencrypted. - #[serde(skip_serializing_if = "Option::is_none")] - pub thumbnail_url: Option, - /// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted. - #[serde(skip_serializing_if = "Option::is_none")] - pub thumbnail_file: Option, + /// The width of the video in pixels. #[serde(rename = "w")] #[serde(skip_serializing_if = "Option::is_none")] pub width: Option, + + /// The mimetype of the video, e.g. "video/mp4." + #[serde(skip_serializing_if = "Option::is_none")] + pub mimetype: Option, + + /// The size of the video in bytes. + #[serde(skip_serializing_if = "Option::is_none")] + pub size: Option, + + /// Metadata about an image. + #[serde(skip_serializing_if = "Option::is_none")] + pub thumbnail_info: Option, + + /// The URL (typically [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to + /// an image thumbnail of the video clip. Only present if the thumbnail is unencrypted. + #[serde(skip_serializing_if = "Option::is_none")] + pub thumbnail_url: Option, + + /// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted. + #[serde(skip_serializing_if = "Option::is_none")] + pub thumbnail_file: Option, } /// Information about related messages for diff --git a/src/room/message/feedback.rs b/src/room/message/feedback.rs index 51ec0f80..726f7273 100644 --- a/src/room/message/feedback.rs +++ b/src/room/message/feedback.rs @@ -16,6 +16,7 @@ room_event! { pub struct FeedbackEventContent { /// The event that this feedback is related to. pub target_event_id: EventId, + /// The type of feedback. #[serde(rename = "type")] pub feedback_type: FeedbackType, diff --git a/src/room/server_acl.rs b/src/room/server_acl.rs index bcc999c6..f46fca96 100644 --- a/src/room/server_acl.rs +++ b/src/room/server_acl.rs @@ -20,6 +20,7 @@ pub struct ServerAclEventContent { /// registered domain name. #[serde(default = "default_true")] pub allow_ip_literals: bool, + /// The server names to allow in the room, excluding any port information. Wildcards may be used /// to cover a wider range of hosts, where * matches zero or more characters and ? matches /// exactly one character. @@ -27,6 +28,7 @@ pub struct ServerAclEventContent { /// **This defaults to an empty list when not provided, effectively disallowing every server.** #[serde(default)] pub allow: Vec, + /// The server names to disallow in the room, excluding any port information. Wildcards may be /// used to cover a wider range of hosts, where * matches zero or more characters and ? matches /// exactly one character. diff --git a/src/room/tombstone.rs b/src/room/tombstone.rs index cca37288..0ed92d1c 100644 --- a/src/room/tombstone.rs +++ b/src/room/tombstone.rs @@ -14,6 +14,7 @@ state_event! { pub struct TombstoneEventContent { /// A server-defined message. pub body: String, + /// The new room the client should be visiting. pub replacement_room: RoomId, } diff --git a/src/sticker.rs b/src/sticker.rs index b63694c3..69128e06 100644 --- a/src/sticker.rs +++ b/src/sticker.rs @@ -15,8 +15,10 @@ pub struct StickerEventContent { /// A textual representation or associated description of the sticker image. This could be the /// alt text of the original image, or a message to accompany and further describe the sticker. pub body: String, + /// Metadata about the image referred to in `url` including a thumbnail representation. pub info: ImageInfo, + /// The URL to the sticker image. This must be a valid `mxc://` URI. pub url: String, } diff --git a/src/stripped.rs b/src/stripped.rs index ac5734da..23c121fc 100644 --- a/src/stripped.rs +++ b/src/stripped.rs @@ -67,11 +67,14 @@ pub enum StrippedState { pub struct StrippedStateContent { /// Data specific to the event type. pub content: C, + /// The type of the event. #[serde(rename = "type")] pub event_type: EventType, + /// A key that determines which piece of room state the event represents. pub state_key: String, + /// The unique identifier for the user who sent this event. pub sender: UserId, }