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. /// The type of session description.
#[serde(rename = "type")] #[serde(rename = "type")]
pub session_type: SessionDescriptionType, pub session_type: SessionDescriptionType,
/// The SDP text of the session description. /// The SDP text of the session description.
pub sdp: String, pub sdp: String,
} }
@ -25,6 +26,7 @@ pub enum SessionDescriptionType {
/// An answer. /// An answer.
#[serde(rename = "answer")] #[serde(rename = "answer")]
Answer, Answer,
/// An offer. /// An offer.
#[serde(rename = "offer")] #[serde(rename = "offer")]
Offer, Offer,

View File

@ -14,8 +14,10 @@ room_event! {
pub struct AnswerEventContent { pub struct AnswerEventContent {
/// The VoIP session description object. The session description type must be *answer*. /// The VoIP session description object. The session description type must be *answer*.
pub answer: SessionDescription, pub answer: SessionDescription,
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
pub call_id: String, pub call_id: String,
/// The version of the VoIP specification this messages adheres to. /// The version of the VoIP specification this messages adheres to.
pub version: u64, pub version: u64,
} }

View File

@ -14,8 +14,10 @@ room_event! {
pub struct CandidatesEventContent { pub struct CandidatesEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
pub call_id: String, pub call_id: String,
/// A list of candidates. /// A list of candidates.
pub candidates: Vec<Candidate>, pub candidates: Vec<Candidate>,
/// The version of the VoIP specification this messages adheres to. /// The version of the VoIP specification this messages adheres to.
pub version: u64, pub version: u64,
} }
@ -25,9 +27,11 @@ pub struct CandidatesEventContent {
pub struct Candidate { pub struct Candidate {
/// The SDP "a" line of the candidate. /// The SDP "a" line of the candidate.
pub candidate: String, pub candidate: String,
/// The SDP media type this candidate is intended for. /// The SDP media type this candidate is intended for.
#[serde(rename = "sdpMid")] #[serde(rename = "sdpMid")]
pub sdp_mid: String, pub sdp_mid: String,
/// The index of the SDP "m" line this candidate is intended for. /// The index of the SDP "m" line this candidate is intended for.
#[serde(rename = "sdpMLineIndex")] #[serde(rename = "sdpMLineIndex")]
pub sdp_m_line_index: u64, pub sdp_m_line_index: u64,

View File

@ -13,8 +13,10 @@ room_event! {
pub struct HangupEventContent { pub struct HangupEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
pub call_id: String, pub call_id: String,
/// The version of the VoIP specification this messages adheres to. /// The version of the VoIP specification this messages adheres to.
pub version: u64, pub version: u64,
/// Optional error reason for the hangup. /// Optional error reason for the hangup.
pub reason: Option<Reason>, pub reason: Option<Reason>,
} }

View File

@ -14,12 +14,15 @@ room_event! {
pub struct InviteEventContent { pub struct InviteEventContent {
/// A unique identifer for the call. /// A unique identifer for the call.
pub call_id: String, pub call_id: String,
/// The time in milliseconds that the invite is valid for. Once the invite age exceeds this /// 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 /// value, clients should discard it. They should also no longer show the call as awaiting an
/// answer in the UI. /// answer in the UI.
pub lifetime: u64, pub lifetime: u64,
/// The session description object. The session description type must be *offer*. /// The session description object. The session description type must be *offer*.
pub offer: SessionDescription, pub offer: SessionDescription,
/// The version of the VoIP specification this messages adheres to. /// The version of the VoIP specification this messages adheres to.
pub version: u64, pub version: u64,
} }

View File

@ -44,68 +44,100 @@ use serde_json::{from_value, Value};
pub enum Event { pub enum Event {
/// m.call.answer /// m.call.answer
CallAnswer(AnswerEvent), CallAnswer(AnswerEvent),
/// m.call.candidates /// m.call.candidates
CallCandidates(CandidatesEvent), CallCandidates(CandidatesEvent),
/// m.call.hangup /// m.call.hangup
CallHangup(HangupEvent), CallHangup(HangupEvent),
/// m.call.invite /// m.call.invite
CallInvite(InviteEvent), CallInvite(InviteEvent),
/// m.direct /// m.direct
Direct(DirectEvent), Direct(DirectEvent),
/// m.fully_read /// m.fully_read
FullyRead(FullyReadEvent), FullyRead(FullyReadEvent),
/// m.ignored_user_list /// m.ignored_user_list
IgnoredUserList(IgnoredUserListEvent), IgnoredUserList(IgnoredUserListEvent),
/// m.presence /// m.presence
Presence(PresenceEvent), Presence(PresenceEvent),
/// m.receipt /// m.receipt
Receipt(ReceiptEvent), Receipt(ReceiptEvent),
/// m.room.aliases /// m.room.aliases
RoomAliases(AliasesEvent), RoomAliases(AliasesEvent),
/// m.room.avatar /// m.room.avatar
RoomAvatar(AvatarEvent), RoomAvatar(AvatarEvent),
/// m.room.canonical_alias /// m.room.canonical_alias
RoomCanonicalAlias(CanonicalAliasEvent), RoomCanonicalAlias(CanonicalAliasEvent),
/// m.room.create /// m.room.create
RoomCreate(CreateEvent), RoomCreate(CreateEvent),
/// m.room.guest_access /// m.room.guest_access
RoomGuestAccess(GuestAccessEvent), RoomGuestAccess(GuestAccessEvent),
/// m.room.history_visibility /// m.room.history_visibility
RoomHistoryVisibility(HistoryVisibilityEvent), RoomHistoryVisibility(HistoryVisibilityEvent),
/// m.room.join_rules /// m.room.join_rules
RoomJoinRules(JoinRulesEvent), RoomJoinRules(JoinRulesEvent),
/// m.room.member /// m.room.member
RoomMember(MemberEvent), RoomMember(MemberEvent),
/// m.room.message /// m.room.message
RoomMessage(MessageEvent), RoomMessage(MessageEvent),
/// m.room.message.feedback /// m.room.message.feedback
RoomMessageFeedback(FeedbackEvent), RoomMessageFeedback(FeedbackEvent),
/// m.room.name /// m.room.name
RoomName(NameEvent), RoomName(NameEvent),
/// m.room.pinned_events /// m.room.pinned_events
RoomPinnedEvents(PinnedEventsEvent), RoomPinnedEvents(PinnedEventsEvent),
/// m.room.power_levels /// m.room.power_levels
RoomPowerLevels(PowerLevelsEvent), RoomPowerLevels(PowerLevelsEvent),
/// m.room.redaction /// m.room.redaction
RoomRedaction(RedactionEvent), RoomRedaction(RedactionEvent),
/// m.room.server_acl, /// m.room.server_acl,
RoomServerAcl(ServerAclEvent), RoomServerAcl(ServerAclEvent),
/// m.room.third_party_invite /// m.room.third_party_invite
RoomThirdPartyInvite(ThirdPartyInviteEvent), RoomThirdPartyInvite(ThirdPartyInviteEvent),
/// m.room.tombstone /// m.room.tombstone
RoomTombstone(TombstoneEvent), RoomTombstone(TombstoneEvent),
/// m.room.topic /// m.room.topic
RoomTopic(TopicEvent), RoomTopic(TopicEvent),
/// m.sticker /// m.sticker
Sticker(StickerEvent), Sticker(StickerEvent),
/// m.tag /// m.tag
Tag(TagEvent), Tag(TagEvent),
/// m.typing /// m.typing
Typing(TypingEvent), Typing(TypingEvent),
/// Any basic event that is not part of the specification. /// Any basic event that is not part of the specification.
Custom(CustomEvent), Custom(CustomEvent),
/// Any room event that is not part of the specification. /// Any room event that is not part of the specification.
CustomRoom(CustomRoomEvent), CustomRoom(CustomRoomEvent),
/// Any state event that is not part of the specification. /// Any state event that is not part of the specification.
CustomState(CustomStateEvent), CustomState(CustomStateEvent),
} }
@ -116,52 +148,76 @@ pub enum Event {
pub enum RoomEvent { pub enum RoomEvent {
/// m.call.answer /// m.call.answer
CallAnswer(AnswerEvent), CallAnswer(AnswerEvent),
/// m.call.candidates /// m.call.candidates
CallCandidates(CandidatesEvent), CallCandidates(CandidatesEvent),
/// m.call.hangup /// m.call.hangup
CallHangup(HangupEvent), CallHangup(HangupEvent),
/// m.call.invite /// m.call.invite
CallInvite(InviteEvent), CallInvite(InviteEvent),
/// m.room.aliases /// m.room.aliases
RoomAliases(AliasesEvent), RoomAliases(AliasesEvent),
/// m.room.avatar /// m.room.avatar
RoomAvatar(AvatarEvent), RoomAvatar(AvatarEvent),
/// m.room.canonical_alias /// m.room.canonical_alias
RoomCanonicalAlias(CanonicalAliasEvent), RoomCanonicalAlias(CanonicalAliasEvent),
/// m.room.create /// m.room.create
RoomCreate(CreateEvent), RoomCreate(CreateEvent),
/// m.room.guest_access /// m.room.guest_access
RoomGuestAccess(GuestAccessEvent), RoomGuestAccess(GuestAccessEvent),
/// m.room.history_visibility /// m.room.history_visibility
RoomHistoryVisibility(HistoryVisibilityEvent), RoomHistoryVisibility(HistoryVisibilityEvent),
/// m.room.join_rules /// m.room.join_rules
RoomJoinRules(JoinRulesEvent), RoomJoinRules(JoinRulesEvent),
/// m.room.member /// m.room.member
RoomMember(MemberEvent), RoomMember(MemberEvent),
/// m.room.message /// m.room.message
RoomMessage(MessageEvent), RoomMessage(MessageEvent),
/// m.room.message.feedback /// m.room.message.feedback
RoomMessageFeedback(FeedbackEvent), RoomMessageFeedback(FeedbackEvent),
/// m.room.name /// m.room.name
RoomName(NameEvent), RoomName(NameEvent),
/// m.room.pinned_events /// m.room.pinned_events
RoomPinnedEvents(PinnedEventsEvent), RoomPinnedEvents(PinnedEventsEvent),
/// m.room.power_levels /// m.room.power_levels
RoomPowerLevels(PowerLevelsEvent), RoomPowerLevels(PowerLevelsEvent),
/// m.room.redaction /// m.room.redaction
RoomRedaction(RedactionEvent), RoomRedaction(RedactionEvent),
/// m.room.server_acl, /// m.room.server_acl,
RoomServerAcl(ServerAclEvent), RoomServerAcl(ServerAclEvent),
/// m.room.third_party_invite /// m.room.third_party_invite
RoomThirdPartyInvite(ThirdPartyInviteEvent), RoomThirdPartyInvite(ThirdPartyInviteEvent),
/// m.room.tombstone /// m.room.tombstone
RoomTombstone(TombstoneEvent), RoomTombstone(TombstoneEvent),
/// m.room.topic /// m.room.topic
RoomTopic(TopicEvent), RoomTopic(TopicEvent),
/// m.sticker /// m.sticker
Sticker(StickerEvent), Sticker(StickerEvent),
/// Any room event that is not part of the specification. /// Any room event that is not part of the specification.
CustomRoom(CustomRoomEvent), CustomRoom(CustomRoomEvent),
/// Any state event that is not part of the specification. /// Any state event that is not part of the specification.
CustomState(CustomStateEvent), CustomState(CustomStateEvent),
} }
@ -172,34 +228,49 @@ pub enum RoomEvent {
pub enum StateEvent { pub enum StateEvent {
/// m.room.aliases /// m.room.aliases
RoomAliases(AliasesEvent), RoomAliases(AliasesEvent),
/// m.room.avatar /// m.room.avatar
RoomAvatar(AvatarEvent), RoomAvatar(AvatarEvent),
/// m.room.canonical_alias /// m.room.canonical_alias
RoomCanonicalAlias(CanonicalAliasEvent), RoomCanonicalAlias(CanonicalAliasEvent),
/// m.room.create /// m.room.create
RoomCreate(CreateEvent), RoomCreate(CreateEvent),
/// m.room.guest_access /// m.room.guest_access
RoomGuestAccess(GuestAccessEvent), RoomGuestAccess(GuestAccessEvent),
/// m.room.history_visibility /// m.room.history_visibility
RoomHistoryVisibility(HistoryVisibilityEvent), RoomHistoryVisibility(HistoryVisibilityEvent),
/// m.room.join_rules /// m.room.join_rules
RoomJoinRules(JoinRulesEvent), RoomJoinRules(JoinRulesEvent),
/// m.room.member /// m.room.member
RoomMember(MemberEvent), RoomMember(MemberEvent),
/// m.room.name /// m.room.name
RoomName(NameEvent), RoomName(NameEvent),
/// m.room.pinned_events /// m.room.pinned_events
RoomPinnedEvents(PinnedEventsEvent), RoomPinnedEvents(PinnedEventsEvent),
/// m.room.power_levels /// m.room.power_levels
RoomPowerLevels(PowerLevelsEvent), RoomPowerLevels(PowerLevelsEvent),
/// m.room.server_acl, /// m.room.server_acl,
RoomServerAcl(ServerAclEvent), RoomServerAcl(ServerAclEvent),
/// m.room.third_party_invite /// m.room.third_party_invite
RoomThirdPartyInvite(ThirdPartyInviteEvent), RoomThirdPartyInvite(ThirdPartyInviteEvent),
/// m.room.tombstone /// m.room.tombstone
RoomTombstone(TombstoneEvent), RoomTombstone(TombstoneEvent),
/// m.room.topic /// m.room.topic
RoomTopic(TopicEvent), RoomTopic(TopicEvent),
/// Any state event that is not part of the specification. /// Any state event that is not part of the specification.
CustomState(CustomStateEvent), CustomState(CustomStateEvent),
} }

View File

@ -29,18 +29,25 @@ use crate::{
pub enum Event { pub enum Event {
/// m.direct /// m.direct
Direct(DirectEvent), Direct(DirectEvent),
/// m.fully_read /// m.fully_read
FullyRead(FullyReadEvent), FullyRead(FullyReadEvent),
/// m.ignored_user_list /// m.ignored_user_list
IgnoredUserList(IgnoredUserListEvent), IgnoredUserList(IgnoredUserListEvent),
/// m.presence /// m.presence
Presence(PresenceEvent), Presence(PresenceEvent),
/// m.receipt /// m.receipt
Receipt(ReceiptEvent), Receipt(ReceiptEvent),
/// m.tag /// m.tag
Tag(TagEvent), Tag(TagEvent),
/// m.typing /// m.typing
Typing(TypingEvent), Typing(TypingEvent),
/// Any basic event that is not part of the specification. /// Any basic event that is not part of the specification.
Custom(CustomEvent), Custom(CustomEvent),
} }
@ -51,20 +58,28 @@ pub enum Event {
pub enum RoomEvent { pub enum RoomEvent {
/// m.call.answer /// m.call.answer
CallAnswer(AnswerEvent), CallAnswer(AnswerEvent),
/// m.call.candidates /// m.call.candidates
CallCandidates(CandidatesEvent), CallCandidates(CandidatesEvent),
/// m.call.hangup /// m.call.hangup
CallHangup(HangupEvent), CallHangup(HangupEvent),
/// m.call.invite /// m.call.invite
CallInvite(InviteEvent), CallInvite(InviteEvent),
/// m.room.message /// m.room.message
RoomMessage(MessageEvent), RoomMessage(MessageEvent),
/// m.room.message.feedback /// m.room.message.feedback
RoomMessageFeedback(FeedbackEvent), RoomMessageFeedback(FeedbackEvent),
/// m.room.redaction /// m.room.redaction
RoomRedaction(RedactionEvent), RoomRedaction(RedactionEvent),
/// m.sticker /// m.sticker
Sticker(StickerEvent), Sticker(StickerEvent),
/// Any room event that is not part of the specification. /// Any room event that is not part of the specification.
CustomRoom(CustomRoomEvent), CustomRoom(CustomRoomEvent),
} }

View File

@ -137,64 +137,94 @@ pub struct ParseError;
pub enum EventType { pub enum EventType {
/// m.call.answer /// m.call.answer
CallAnswer, CallAnswer,
/// m.call.candidates /// m.call.candidates
CallCandidates, CallCandidates,
/// m.call.hangup /// m.call.hangup
CallHangup, CallHangup,
/// m.call.invite /// m.call.invite
CallInvite, CallInvite,
/// m.direct /// m.direct
Direct, Direct,
/// m.fully_read /// m.fully_read
FullyRead, FullyRead,
/// m.ignored_user_list /// m.ignored_user_list
IgnoredUserList, IgnoredUserList,
/// m.presence /// m.presence
Presence, Presence,
/// m.receipt /// m.receipt
Receipt, Receipt,
/// m.room.aliases /// m.room.aliases
RoomAliases, RoomAliases,
/// m.room.avatar /// m.room.avatar
RoomAvatar, RoomAvatar,
/// m.room.canonical_alias /// m.room.canonical_alias
RoomCanonicalAlias, RoomCanonicalAlias,
/// m.room.create /// m.room.create
RoomCreate, RoomCreate,
/// m.room.guest_access /// m.room.guest_access
RoomGuestAccess, RoomGuestAccess,
/// m.room.history_visibility /// m.room.history_visibility
RoomHistoryVisibility, RoomHistoryVisibility,
/// m.room.join_rules /// m.room.join_rules
RoomJoinRules, RoomJoinRules,
/// m.room.member /// m.room.member
RoomMember, RoomMember,
/// m.room.message /// m.room.message
RoomMessage, RoomMessage,
/// m.room.message.feedback /// m.room.message.feedback
RoomMessageFeedback, RoomMessageFeedback,
/// m.room.name /// m.room.name
RoomName, RoomName,
/// m.room.pinned_events /// m.room.pinned_events
RoomPinnedEvents, RoomPinnedEvents,
/// m.room.power_levels /// m.room.power_levels
RoomPowerLevels, RoomPowerLevels,
/// m.room.redaction /// m.room.redaction
RoomRedaction, RoomRedaction,
/// m.room.server_acl /// m.room.server_acl
RoomServerAcl, RoomServerAcl,
/// m.room.third_party_invite /// m.room.third_party_invite
RoomThirdPartyInvite, RoomThirdPartyInvite,
/// m.room.tombstone /// m.room.tombstone
RoomTombstone, RoomTombstone,
/// m.room.topic /// m.room.topic
RoomTopic, RoomTopic,
/// m.sticker /// m.sticker
Sticker, Sticker,
/// m.tag /// m.tag
Tag, Tag,
/// m.typing /// m.typing
Typing, Typing,
/// Any event that is not part of the specification. /// Any event that is not part of the specification.
Custom(String), Custom(String),
} }

View File

@ -31,22 +31,28 @@ pub struct ImageInfo {
#[serde(rename = "h")] #[serde(rename = "h")]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<u64>, pub height: Option<u64>,
/// The width of the image in pixels. /// The width of the image in pixels.
#[serde(rename = "w")] #[serde(rename = "w")]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<u64>, pub width: Option<u64>,
/// The MIME type of the image, e.g. "image/png." /// The MIME type of the image, e.g. "image/png."
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>, pub mimetype: Option<String>,
/// The file size of the image in bytes. /// The file size of the image in bytes.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>, pub size: Option<u64>,
/// Metadata about the image referred to in `thumbnail_url`. /// Metadata about the image referred to in `thumbnail_url`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_info: Option<ThumbnailInfo>, pub thumbnail_info: Option<ThumbnailInfo>,
/// The URL to the thumbnail of the image. Only present if the thumbnail is unencrypted. /// The URL to the thumbnail of the image. Only present if the thumbnail is unencrypted.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>, pub thumbnail_url: Option<String>,
/// Information on the encrypted thumbnail image. Only present if the thumbnail is encrypted. /// Information on the encrypted thumbnail image. Only present if the thumbnail is encrypted.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_file: Option<EncryptedFile>, pub thumbnail_file: Option<EncryptedFile>,
@ -59,16 +65,19 @@ pub struct ThumbnailInfo {
#[serde(rename = "h")] #[serde(rename = "h")]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<u64>, 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. /// The width of the thumbnail in pixels.
#[serde(rename = "w")] #[serde(rename = "w")]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<u64>, 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. /// A file sent to a room with end-to-end encryption enabled.
@ -76,13 +85,17 @@ pub struct ThumbnailInfo {
pub struct EncryptedFile { pub struct EncryptedFile {
/// The URL to the file. /// The URL to the file.
pub url: String, pub url: String,
/// A [JSON Web Key](https://tools.ietf.org/html/rfc7517#appendix-A.3) object. /// A [JSON Web Key](https://tools.ietf.org/html/rfc7517#appendix-A.3) object.
pub key: JsonWebKey, pub key: JsonWebKey,
/// The initialization vector used by AES-CTR, encoded as unpadded base64. /// The initialization vector used by AES-CTR, encoded as unpadded base64.
pub iv: String, pub iv: String,
/// A map from an algorithm name to a hash of the ciphertext, encoded as unpadded base64. /// 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. /// Clients should support the SHA-256 hash, which uses the key sha256.
pub hashes: HashMap<String, String>, pub hashes: HashMap<String, String>,
/// Version of the encrypted attachments protocol. Must be `v2`. /// Version of the encrypted attachments protocol. Must be `v2`.
pub v: String, pub v: String,
} }
@ -92,12 +105,16 @@ pub struct EncryptedFile {
pub struct JsonWebKey { pub struct JsonWebKey {
/// Key type. Must be `oct`. /// Key type. Must be `oct`.
pub kty: String, pub kty: String,
/// Key operations. Must at least contain `encrypt` and `decrypt`. /// Key operations. Must at least contain `encrypt` and `decrypt`.
pub key_ops: Vec<String>, pub key_ops: Vec<String>,
/// Required. Algorithm. Must be `A256CTR`. /// Required. Algorithm. Must be `A256CTR`.
pub alg: String, pub alg: String,
/// The key, encoded as urlsafe unpadded base64. /// The key, encoded as urlsafe unpadded base64.
pub k: String, pub k: String,
/// Extractable. Must be `true`. This is a /// Extractable. Must be `true`. This is a
/// [W3C extension](https://w3c.github.io/webcrypto/#iana-section-jwk). /// [W3C extension](https://w3c.github.io/webcrypto/#iana-section-jwk).
pub ext: bool, pub ext: bool,

View File

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

View File

@ -18,13 +18,16 @@ state_event! {
pub struct CreateEventContent { pub struct CreateEventContent {
/// The `user_id` of the room creator. This is set by the homeserver. /// The `user_id` of the room creator. This is set by the homeserver.
pub creator: UserId, pub creator: UserId,
/// Whether or not this room's data should be transferred to other homeservers. /// Whether or not this room's data should be transferred to other homeservers.
#[serde(rename = "m.federate")] #[serde(rename = "m.federate")]
#[serde(default = "default_true")] #[serde(default = "default_true")]
pub federate: bool, pub federate: bool,
/// The version of the room. Defaults to "1" if the key does not exist. /// The version of the room. Defaults to "1" if the key does not exist.
#[serde(default = "default_room_version_id")] #[serde(default = "default_room_version_id")]
pub room_version: RoomVersionId, pub room_version: RoomVersionId,
/// A reference to the room this room replaces, if the previous room was upgraded. /// A reference to the room this room replaces, if the previous room was upgraded.
pub predecessor: Option<PreviousRoom>, pub predecessor: Option<PreviousRoom>,
} }
@ -34,6 +37,7 @@ pub struct CreateEventContent {
pub struct PreviousRoom { pub struct PreviousRoom {
/// The ID of the old room. /// The ID of the old room.
pub room_id: RoomId, pub room_id: RoomId,
/// The event ID of the last known event in the old room. /// The event ID of the last known event in the old room.
pub event_id: EventId, 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 /// A name which can be displayed to represent the user instead of their third party
/// identifier. /// identifier.
pub display_name: String, pub display_name: String,
/// A block of content which has been signed, which servers can use to verify the event. /// A block of content which has been signed, which servers can use to verify the event.
/// Clients should ignore this. /// Clients should ignore this.
pub signed: SignedContent, pub signed: SignedContent,
@ -111,9 +112,11 @@ pub struct SignedContent {
/// ///
/// Must be equal to the user_id property of the event. /// Must be equal to the user_id property of the event.
pub mxid: UserId, pub mxid: UserId,
/// A single signature from the verifying server, in the format specified by the Signing Events /// A single signature from the verifying server, in the format specified by the Signing Events
/// section of the server-server API. /// section of the server-server API.
pub signatures: Signatures, pub signatures: Signatures,
/// The token property of the containing third_party_invite object. /// The token property of the containing third_party_invite object.
pub token: String, pub token: String,
} }

View File

@ -90,15 +90,19 @@ pub enum MessageEventContent {
pub struct AudioMessageEventContent { pub struct AudioMessageEventContent {
/// The textual representation of this message. /// The textual representation of this message.
pub body: String, pub body: String,
/// Metadata for the audio clip referred to in `url`. /// Metadata for the audio clip referred to in `url`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub info: Option<AudioInfo>, pub info: Option<AudioInfo>,
/// The message type. Always *m.audio*. /// The message type. Always *m.audio*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// The URL to the audio clip. Required if the file is unencrypted. The URL (typically /// 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. /// [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")] #[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>, pub url: Option<String>,
/// Required if the audio clip is encrypted. Information on the encrypted audio clip. /// Required if the audio clip is encrypted. Information on the encrypted audio clip.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>, pub file: Option<EncryptedFile>,
@ -110,9 +114,11 @@ pub struct AudioInfo {
/// The duration of the audio in milliseconds. /// The duration of the audio in milliseconds.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<u64>, pub duration: Option<u64>,
/// The mimetype of the audio, e.g. "audio/aac." /// The mimetype of the audio, e.g. "audio/aac."
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub mimetype: Option<String>, pub mimetype: Option<String>,
/// The size of the audio clip in bytes. /// The size of the audio clip in bytes.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u64>, pub size: Option<u64>,
@ -123,12 +129,15 @@ pub struct AudioInfo {
pub struct EmoteMessageEventContent { pub struct EmoteMessageEventContent {
/// The emote action to perform. /// The emote action to perform.
pub body: String, pub body: String,
/// The message type. Always *m.emote*. /// The message type. Always *m.emote*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// The format used in the `formatted_body`. Currently only `org.matrix.custom.html` is /// The format used in the `formatted_body`. Currently only `org.matrix.custom.html` is
/// supported. /// supported.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>, pub format: Option<String>,
/// The formatted version of the `body`. This is required if `format` is specified. /// The formatted version of the `body`. This is required if `format` is specified.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub formatted_body: Option<String>, 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 /// A human-readable description of the file. This is recommended to be the filename of the
/// original upload. /// original upload.
pub body: String, pub body: String,
/// The original filename of the uploaded file. /// The original filename of the uploaded file.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub filename: Option<String>, pub filename: Option<String>,
/// Metadata about the file referred to in `url`. /// Metadata about the file referred to in `url`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub info: Option<FileInfo>, pub info: Option<FileInfo>,
/// The message type. Always *m.file*. /// The message type. Always *m.file*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// The URL to the file. Required if the file is unencrypted. The URL (typically /// 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. /// [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to the file.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>, pub url: Option<String>,
/// Required if file is encrypted. Information on the encrypted file. /// Required if file is encrypted. Information on the encrypted file.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>, pub file: Option<EncryptedFile>,
@ -162,14 +176,18 @@ pub struct FileMessageEventContent {
pub struct FileInfo { pub struct FileInfo {
/// The mimetype of the file, e.g. "application/msword." /// The mimetype of the file, e.g. "application/msword."
pub mimetype: Option<String>, pub mimetype: Option<String>,
/// The size of the file in bytes. /// The size of the file in bytes.
pub size: Option<u64>, pub size: Option<u64>,
/// Metadata about the image referred to in `thumbnail_url`. /// Metadata about the image referred to in `thumbnail_url`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_info: Option<ThumbnailInfo>, pub thumbnail_info: Option<ThumbnailInfo>,
/// The URL to the thumbnail of the file. Only present if the thumbnail is unencrypted. /// The URL to the thumbnail of the file. Only present if the thumbnail is unencrypted.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>, pub thumbnail_url: Option<String>,
/// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted. /// Information on the encrypted thumbnail file. Only present if the thumbnail is encrypted.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_file: Option<EncryptedFile>, 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 /// 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." /// of the image, or some kind of content description for accessibility e.g. "image attachment."
pub body: String, pub body: String,
/// Metadata about the image referred to in `url`. /// Metadata about the image referred to in `url`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub info: Option<ImageInfo>, pub info: Option<ImageInfo>,
/// The message type. Always *m.image*. /// The message type. Always *m.image*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// The URL to the image. Required if the file is unencrypted. The URL (typically /// 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. /// [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to the image.
pub url: Option<String>, pub url: Option<String>,
/// Required if image is encrypted. Information on the encrypted image. /// Required if image is encrypted. Information on the encrypted image.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>, 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 /// A description of the location e.g. "Big Ben, London, UK,"or some kind of content description
/// for accessibility, e.g. "location attachment." /// for accessibility, e.g. "location attachment."
pub body: String, pub body: String,
/// A geo URI representing the location. /// A geo URI representing the location.
pub geo_uri: String, pub geo_uri: String,
/// The message type. Always *m.location*. /// The message type. Always *m.location*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// Info about the location being represented. /// Info about the location being represented.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub info: Option<LocationInfo>, pub info: Option<LocationInfo>,
@ -215,10 +240,12 @@ pub struct LocationInfo {
/// Metadata about the image referred to in `thumbnail_url` or `thumbnail_file`. /// Metadata about the image referred to in `thumbnail_url` or `thumbnail_file`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_info: Option<ThumbnailInfo>, pub thumbnail_info: Option<ThumbnailInfo>,
/// The URL to a thumbnail of the location being represented. Only present if the thumbnail is /// The URL to a thumbnail of the location being represented. Only present if the thumbnail is
/// unencrypted. /// unencrypted.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>, pub thumbnail_url: Option<String>,
/// Information on an encrypted thumbnail of the location being represented. Only present if the /// Information on an encrypted thumbnail of the location being represented. Only present if the
/// thumbnail is encrypted. /// thumbnail is encrypted.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -230,8 +257,10 @@ pub struct LocationInfo {
pub struct NoticeMessageEventContent { pub struct NoticeMessageEventContent {
/// The notice text to send. /// The notice text to send.
pub body: String, pub body: String,
/// The message type. Always *m.notice*. /// The message type. Always *m.notice*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// Information about related messages for /// Information about related messages for
/// [rich replies](https://matrix.org/docs/spec/client_server/r0.5.0#rich-replies). /// [rich replies](https://matrix.org/docs/spec/client_server/r0.5.0#rich-replies).
#[serde(rename = "m.relates_to")] #[serde(rename = "m.relates_to")]
@ -244,14 +273,18 @@ pub struct NoticeMessageEventContent {
pub struct ServerNoticeMessageEventContent { pub struct ServerNoticeMessageEventContent {
/// A human-readable description of the notice. /// A human-readable description of the notice.
pub body: String, pub body: String,
/// The message type. Always *m.server_notice*. /// The message type. Always *m.server_notice*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// The type of notice being represented. /// The type of notice being represented.
pub server_notice_type: ServerNoticeType, pub server_notice_type: ServerNoticeType,
/// A URI giving a contact method for the server administrator. /// A URI giving a contact method for the server administrator.
/// ///
/// Required if the notice type is `m.server_notice.usage_limit_reached`. /// Required if the notice type is `m.server_notice.usage_limit_reached`.
pub admin_contact: Option<String>, pub admin_contact: Option<String>,
/// The kind of usage limit the server has exceeded. /// The kind of usage limit the server has exceeded.
/// ///
/// Required if the notice type is `m.server_notice.usage_limit_reached`. /// Required if the notice type is `m.server_notice.usage_limit_reached`.
@ -282,15 +315,19 @@ pub enum LimitType {
pub struct TextMessageEventContent { pub struct TextMessageEventContent {
/// The body of the message. /// The body of the message.
pub body: String, pub body: String,
/// The message type. Always *m.text*. /// The message type. Always *m.text*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// The format used in the `formatted_body`. Currently only `org.matrix.custom.html` is /// The format used in the `formatted_body`. Currently only `org.matrix.custom.html` is
/// supported. /// supported.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>, pub format: Option<String>,
/// The formatted version of the `body`. This is required if `format` is specified. /// The formatted version of the `body`. This is required if `format` is specified.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub formatted_body: Option<String>, pub formatted_body: Option<String>,
/// Information about related messages for /// Information about related messages for
/// [rich replies](https://matrix.org/docs/spec/client_server/r0.5.0#rich-replies). /// [rich replies](https://matrix.org/docs/spec/client_server/r0.5.0#rich-replies).
#[serde(rename = "m.relates_to")] #[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 /// A description of the video, e.g. "Gangnam Style," or some kind of content description for
/// accessibility, e.g. "video attachment." /// accessibility, e.g. "video attachment."
pub body: String, pub body: String,
/// Metadata about the video clip referred to in `url`. /// Metadata about the video clip referred to in `url`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub info: Option<VideoInfo>, pub info: Option<VideoInfo>,
/// The message type. Always *m.video*. /// The message type. Always *m.video*.
pub msgtype: MessageType, pub msgtype: MessageType,
/// The URL to the video clip. Required if the file is unencrypted. The URL (typically /// 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. /// [MXC URI](https://matrix.org/docs/spec/client_server/r0.5.0#mxc-uri)) to the video clip.
pub url: Option<String>, pub url: Option<String>,
/// Required if video clip is encrypted. Information on the encrypted video clip. /// Required if video clip is encrypted. Information on the encrypted video clip.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub file: Option<EncryptedFile>, pub file: Option<EncryptedFile>,
@ -323,30 +364,37 @@ pub struct VideoInfo {
/// The duration of the video in milliseconds. /// The duration of the video in milliseconds.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<u64>, pub duration: Option<u64>,
/// The height of the video in pixels. /// The height of the video in pixels.
#[serde(rename = "h")] #[serde(rename = "h")]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<u64>, 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. /// The width of the video in pixels.
#[serde(rename = "w")] #[serde(rename = "w")]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<u64>, 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 /// Information about related messages for

View File

@ -16,6 +16,7 @@ room_event! {
pub struct FeedbackEventContent { pub struct FeedbackEventContent {
/// The event that this feedback is related to. /// The event that this feedback is related to.
pub target_event_id: EventId, pub target_event_id: EventId,
/// The type of feedback. /// The type of feedback.
#[serde(rename = "type")] #[serde(rename = "type")]
pub feedback_type: FeedbackType, pub feedback_type: FeedbackType,

View File

@ -20,6 +20,7 @@ pub struct ServerAclEventContent {
/// registered domain name. /// registered domain name.
#[serde(default = "default_true")] #[serde(default = "default_true")]
pub allow_ip_literals: bool, pub allow_ip_literals: bool,
/// The server names to allow in the room, excluding any port information. Wildcards may be used /// 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 /// to cover a wider range of hosts, where * matches zero or more characters and ? matches
/// exactly one character. /// exactly one character.
@ -27,6 +28,7 @@ pub struct ServerAclEventContent {
/// **This defaults to an empty list when not provided, effectively disallowing every server.** /// **This defaults to an empty list when not provided, effectively disallowing every server.**
#[serde(default)] #[serde(default)]
pub allow: Vec<String>, pub allow: Vec<String>,
/// The server names to disallow in the room, excluding any port information. Wildcards may be /// 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 /// used to cover a wider range of hosts, where * matches zero or more characters and ? matches
/// exactly one character. /// exactly one character.

View File

@ -14,6 +14,7 @@ state_event! {
pub struct TombstoneEventContent { pub struct TombstoneEventContent {
/// A server-defined message. /// A server-defined message.
pub body: String, pub body: String,
/// The new room the client should be visiting. /// The new room the client should be visiting.
pub replacement_room: RoomId, 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 /// 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. /// alt text of the original image, or a message to accompany and further describe the sticker.
pub body: String, pub body: String,
/// Metadata about the image referred to in `url` including a thumbnail representation. /// Metadata about the image referred to in `url` including a thumbnail representation.
pub info: ImageInfo, pub info: ImageInfo,
/// The URL to the sticker image. This must be a valid `mxc://` URI. /// The URL to the sticker image. This must be a valid `mxc://` URI.
pub url: String, pub url: String,
} }

View File

@ -67,11 +67,14 @@ pub enum StrippedState {
pub struct StrippedStateContent<C> { pub struct StrippedStateContent<C> {
/// Data specific to the event type. /// Data specific to the event type.
pub content: C, pub content: C,
/// The type of the event. /// The type of the event.
#[serde(rename = "type")] #[serde(rename = "type")]
pub event_type: EventType, pub event_type: EventType,
/// A key that determines which piece of room state the event represents. /// A key that determines which piece of room state the event represents.
pub state_key: String, pub state_key: String,
/// The unique identifier for the user who sent this event. /// The unique identifier for the user who sent this event.
pub sender: UserId, pub sender: UserId,
} }