Add blank lines to make type definitions easier to read.

This commit is contained in:
Jimmy Cuadra 2019-06-14 14:02:03 -07:00
parent 8b6aeddcd6
commit add7ef0d8b
18 changed files with 233 additions and 22 deletions

View File

@ -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,

View File

@ -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,
}

View File

@ -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<Candidate>,
/// 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,

View File

@ -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<Reason>,
}

View File

@ -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,
}

View File

@ -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),
}

View File

@ -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),
}

View File

@ -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),
}

View File

@ -31,22 +31,28 @@ pub struct ImageInfo {
#[serde(rename = "h")]
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<u64>,
/// The width of the image in pixels.
#[serde(rename = "w")]
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<u64>,
/// The MIME type of the image, e.g. "image/png."
#[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>,
/// The file size of the image in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>,
/// Metadata about the image referred to in `thumbnail_url`.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_info: Option<ThumbnailInfo>,
/// 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<String>,
/// Information on the encrypted thumbnail image. Only present if the thumbnail is encrypted.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_file: Option<EncryptedFile>,
@ -59,16 +65,19 @@ pub struct ThumbnailInfo {
#[serde(rename = "h")]
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<u64>,
/// The MIME type of the thumbnail, e.g. "image/png."
#[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>,
/// The file size of the thumbnail in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>,
/// The width of the thumbnail in pixels.
#[serde(rename = "w")]
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<u64>,
/// The MIME type of the thumbnail, e.g. "image/png."
#[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>,
/// The file size of the thumbnail in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>,
}
/// 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<String, String>,
/// 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<String>,
/// 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,

View File

@ -17,6 +17,7 @@ pub struct AvatarEventContent {
/// Information about the avatar image.
#[serde(skip_serializing_if = "Option::is_none")]
pub info: Option<ImageInfo>,
/// Information about the avatar thumbnail image.
/// URL of the avatar image.
pub url: String,

View File

@ -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<PreviousRoom>,
}
@ -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,
}

View File

@ -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,
}

View File

@ -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<AudioInfo>,
/// 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<String>,
/// Required if the audio clip is encrypted. Information on the encrypted audio clip.
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>,
@ -110,9 +114,11 @@ pub struct AudioInfo {
/// The duration of the audio in milliseconds.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<u64>,
/// The mimetype of the audio, e.g. "audio/aac."
#[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>,
/// The size of the audio clip in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>,
@ -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<String>,
/// The formatted version of the `body`. This is required if `format` is specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub formatted_body: Option<String>,
@ -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<String>,
/// Metadata about the file referred to in `url`.
#[serde(skip_serializing_if = "Option::is_none")]
pub info: Option<FileInfo>,
/// 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<String>,
/// Required if file is encrypted. Information on the encrypted file.
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>,
@ -162,14 +176,18 @@ pub struct FileMessageEventContent {
pub struct FileInfo {
/// The mimetype of the file, e.g. "application/msword."
pub mimetype: Option<String>,
/// The size of the file in bytes.
pub size: Option<u64>,
/// Metadata about the image referred to in `thumbnail_url`.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_info: Option<ThumbnailInfo>,
/// 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<String>,
/// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_file: Option<EncryptedFile>,
@ -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<ImageInfo>,
/// 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<String>,
/// Required if image is encrypted. Information on the encrypted image.
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>,
@ -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<LocationInfo>,
@ -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<ThumbnailInfo>,
/// 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<String>,
/// 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<String>,
/// 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<String>,
/// The formatted version of the `body`. This is required if `format` is specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub formatted_body: Option<String>,
/// 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<VideoInfo>,
/// 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<String>,
/// Required if video clip is encrypted. Information on the encrypted video clip.
#[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>,
@ -323,30 +364,37 @@ pub struct VideoInfo {
/// The duration of the video in milliseconds.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<u64>,
/// The height of the video in pixels.
#[serde(rename = "h")]
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<u64>,
/// The mimetype of the video, e.g. "video/mp4."
#[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>,
/// The size of the video in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>,
/// Metadata about an image.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_info: Option<ThumbnailInfo>,
/// 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<String>,
/// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_file: Option<EncryptedFile>,
/// The width of the video in pixels.
#[serde(rename = "w")]
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<u64>,
/// The mimetype of the video, e.g. "video/mp4."
#[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>,
/// The size of the video in bytes.
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>,
/// Metadata about an image.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_info: Option<ThumbnailInfo>,
/// 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<String>,
/// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted.
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_file: Option<EncryptedFile>,
}
/// Information about related messages for

View File

@ -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,

View File

@ -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<String>,
/// 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.

View File

@ -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,
}

View File

@ -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,
}

View File

@ -67,11 +67,14 @@ pub enum StrippedState {
pub struct StrippedStateContent<C> {
/// 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,
}