Make all fields public.

This commit is contained in:
Jimmy Cuadra 2016-06-04 02:57:24 -07:00
parent fd03a1e162
commit d525766c99
24 changed files with 184 additions and 184 deletions

View File

@ -5,19 +5,19 @@ use super::SessionDescription;
/// This event is sent by the callee when they wish to answer the call. /// This event is sent by the callee when they wish to answer the call.
pub struct AnswerEvent { pub struct AnswerEvent {
content: AnswerEventContent, pub content: AnswerEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
room_id: String, pub room_id: String,
user_id: String, pub user_id: String,
} }
/// The payload of an `AnswerEvent`. /// The payload of an `AnswerEvent`.
pub struct AnswerEventContent { pub struct AnswerEventContent {
/// The VoIP session description. /// The VoIP session description.
answer: SessionDescription, pub answer: SessionDescription,
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
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.
version: u64, pub version: u64,
} }

View File

@ -5,29 +5,29 @@ use core::EventType;
/// This event is sent by callers after sending an invite and by the callee after answering. /// This event is sent by callers after sending an invite and by the callee after answering.
/// Its purpose is to give the other party additional ICE candidates to try using to communicate. /// Its purpose is to give the other party additional ICE candidates to try using to communicate.
pub struct CandidatesEvent { pub struct CandidatesEvent {
content: CandidatesEventContent, pub content: CandidatesEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
room_id: String, pub room_id: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `CandidatesEvent`. /// The payload of a `CandidatesEvent`.
pub struct CandidatesEventContent { pub struct CandidatesEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
call_id: String, pub call_id: String,
/// A list of candidates. /// A list of candidates.
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.
version: u64, pub version: u64,
} }
/// An ICE (Interactive Connectivity Establishment) candidate. /// An ICE (Interactive Connectivity Establishment) candidate.
pub struct Candidate { pub struct Candidate {
/// The SDP "a" line of the candidate. /// The SDP "a" line of the candidate.
candidate: String, pub candidate: String,
/// The SDP media type this candidate is intended for. /// The SDP media type this candidate is intended for.
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.
sdp_m_line_index: u64, pub sdp_m_line_index: u64,
} }

View File

@ -5,17 +5,17 @@ use core::EventType;
/// Sent by either party to signal their termination of the call. This can be sent either once the /// Sent by either party to signal their termination of the call. This can be sent either once the
/// call has has been established or before to abort the call. /// call has has been established or before to abort the call.
pub struct HangupEvent { pub struct HangupEvent {
content: HangupEventContent, pub content: HangupEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
room_id: String, pub room_id: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `HangupEvent`. /// The payload of a `HangupEvent`.
pub struct HangupEventContent { pub struct HangupEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
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.
version: u64, pub version: u64,
} }

View File

@ -5,23 +5,23 @@ use super::SessionDescription;
/// This event is sent by the caller when they wish to establish a call. /// This event is sent by the caller when they wish to establish a call.
pub struct InviteEvent { pub struct InviteEvent {
content: InviteEventContent, pub content: InviteEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
room_id: String, pub room_id: String,
user_id: String, pub user_id: String,
} }
/// The payload of an `InviteEvent`. /// The payload of an `InviteEvent`.
pub struct InviteEventContent { pub struct InviteEventContent {
/// A unique identifer for the call. /// A unique identifer for the call.
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.
lifetime: u64, pub lifetime: u64,
/// The session description object. /// The session description object.
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.
version: u64, pub version: u64,
} }

View File

@ -10,9 +10,9 @@ pub mod invite;
/// A VoIP session description. /// A VoIP session description.
pub struct SessionDescription { pub struct SessionDescription {
/// The type of session description. /// The type of session description.
session_type: SessionDescriptionType, pub session_type: SessionDescriptionType,
/// The SDP text of the session description. /// The SDP text of the session description.
sdp: String, pub sdp: String,
} }
/// The type of VoIP session description. /// The type of VoIP session description.

View File

@ -42,9 +42,9 @@ pub enum StrippedState {
/// The general form of a `StrippedState`. /// The general form of a `StrippedState`.
pub struct StrippedStateContent<T> { pub struct StrippedStateContent<T> {
content: T, pub content: T,
event_type: EventType, pub event_type: EventType,
state_key: String, pub state_key: String,
} }
pub type StrippedRoomAvatar = StrippedStateContent<AvatarEventContent>; pub type StrippedRoomAvatar = StrippedStateContent<AvatarEventContent>;

View File

@ -4,21 +4,21 @@ use core::EventType;
/// Informs the client of a user's presence state change. /// Informs the client of a user's presence state change.
pub struct PresenceEvent { pub struct PresenceEvent {
content: PresenceEventContent, pub content: PresenceEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
} }
/// The payload of a `PresenceEvent`. /// The payload of a `PresenceEvent`.
pub struct PresenceEventContent { pub struct PresenceEventContent {
/// The current avatar URL for this user. /// The current avatar URL for this user.
avatar_url: Option<String>, pub avatar_url: Option<String>,
/// The current display name for this user. /// The current display name for this user.
displayname: Option<String>, pub displayname: Option<String>,
/// The last time since this used performed some action, in milliseconds. /// The last time since this used performed some action, in milliseconds.
last_active_ago: Option<u64>, pub last_active_ago: Option<u64>,
/// The presence state for this user. /// The presence state for this user.
presence: PresenceState, pub presence: PresenceState,
} }
/// A description of a user's connectivity and availability for chat. /// A description of a user's connectivity and availability for chat.

View File

@ -6,9 +6,9 @@ use core::EventType;
/// Informs the client of new receipts. /// Informs the client of new receipts.
pub struct ReceiptEvent { pub struct ReceiptEvent {
content: ReceiptEventContent, pub content: ReceiptEventContent,
event_type: EventType, pub event_type: EventType,
room_id: String, pub room_id: String,
} }
/// The payload of a `ReceiptEvent`. /// The payload of a `ReceiptEvent`.
@ -20,7 +20,7 @@ pub type ReceiptEventContent = HashMap<String, Receipts>;
/// A collection of receipts. /// A collection of receipts.
pub struct Receipts { pub struct Receipts {
/// A collection of users who have sent *m.read* receipts for this event. /// A collection of users who have sent *m.read* receipts for this event.
m_read: UserReceipts, pub m_read: UserReceipts,
} }
/// A mapping of user ID to receipt. /// A mapping of user ID to receipt.
@ -31,5 +31,5 @@ pub type UserReceipts = HashMap<String, Receipt>;
/// An acknowledgement of an event. /// An acknowledgement of an event.
pub struct Receipt { pub struct Receipt {
/// The timestamp the receipt was sent at. /// The timestamp the receipt was sent at.
ts: u64, pub ts: u64,
} }

View File

@ -4,18 +4,18 @@ use core::EventType;
/// Informs the room about what room aliases it has been given. /// Informs the room about what room aliases it has been given.
pub struct AliasesEvent { pub struct AliasesEvent {
content: AliasesEventContent, pub content: AliasesEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<AliasesEventContent>, pub prev_content: Option<AliasesEventContent>,
room_id: String, pub room_id: String,
/// The homeserver domain which owns these room aliases. /// The homeserver domain which owns these room aliases.
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of an `AliasesEvent`. /// The payload of an `AliasesEvent`.
pub struct AliasesEventContent { pub struct AliasesEventContent {
/// A list of room aliases. /// A list of room aliases.
aliases: Vec<String>, pub aliases: Vec<String>,
} }

View File

@ -7,19 +7,19 @@ use super::ImageInfo;
/// ///
/// This can be displayed alongside the room information. /// This can be displayed alongside the room information.
pub struct AvatarEvent { pub struct AvatarEvent {
content: AvatarEventContent, pub content: AvatarEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<AvatarEventContent>, pub prev_content: Option<AvatarEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of an `AvatarEvent`. /// The payload of an `AvatarEvent`.
pub struct AvatarEventContent { pub struct AvatarEventContent {
info: ImageInfo, pub info: ImageInfo,
thumbnail_info: ImageInfo, pub thumbnail_info: ImageInfo,
thumbnail_url: String, pub thumbnail_url: String,
url: String, pub url: String,
} }

View File

@ -4,17 +4,17 @@ use core::EventType;
/// Informs the room as to which alias is the canonical one. /// Informs the room as to which alias is the canonical one.
pub struct CanonicalAliasEvent { pub struct CanonicalAliasEvent {
content: CanonicalAliasEventContent, pub content: CanonicalAliasEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<CanonicalAliasEventContent>, pub prev_content: Option<CanonicalAliasEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `CanonicalAliasEvent`. /// The payload of a `CanonicalAliasEvent`.
pub struct CanonicalAliasEventContent { pub struct CanonicalAliasEventContent {
/// The canonical alias. /// The canonical alias.
alias: String, pub alias: String,
} }

View File

@ -5,17 +5,17 @@ use core::EventType;
/// This is the first event in a room and cannot be changed. It acts as the root of all other /// This is the first event in a room and cannot be changed. It acts as the root of all other
/// events. /// events.
pub struct CreateEvent { pub struct CreateEvent {
content: CreateEventContent, pub content: CreateEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<CreateEventContent>, pub prev_content: Option<CreateEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `CreateEvent`. /// The payload of a `CreateEvent`.
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.
creator: String, pub creator: String,
} }

View File

@ -7,18 +7,18 @@ use core::EventType;
/// This event controls whether guest users are allowed to join rooms. If this event is absent, /// This event controls whether guest users are allowed to join rooms. If this event is absent,
/// servers should act as if it is present and has the value `GuestAccess::Forbidden`. /// servers should act as if it is present and has the value `GuestAccess::Forbidden`.
pub struct GuestAccessEvent { pub struct GuestAccessEvent {
content: GuestAccessEventContent, pub content: GuestAccessEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<GuestAccessEventContent>, pub prev_content: Option<GuestAccessEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `GuestAccessEvent`. /// The payload of a `GuestAccessEvent`.
pub struct GuestAccessEventContent { pub struct GuestAccessEventContent {
guest_access: GuestAccess, pub guest_access: GuestAccess,
} }
/// A policy for guest user access to a room. /// A policy for guest user access to a room.

View File

@ -5,19 +5,19 @@ use core::EventType;
/// This event controls whether a member of a room can see the events that happened in a room from /// This event controls whether a member of a room can see the events that happened in a room from
/// before they joined. /// before they joined.
pub struct HistoryVisibilityEvent { pub struct HistoryVisibilityEvent {
content: HistoryVisibilityEventContent, pub content: HistoryVisibilityEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<HistoryVisibilityEventContent>, pub prev_content: Option<HistoryVisibilityEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `HistoryVisibilityEvent`. /// The payload of a `HistoryVisibilityEvent`.
pub struct HistoryVisibilityEventContent { pub struct HistoryVisibilityEventContent {
/// Who can see the room history. /// Who can see the room history.
history_visibility: HistoryVisibility, pub history_visibility: HistoryVisibility,
} }
/// Who can see a room's history. /// Who can see a room's history.

View File

@ -4,19 +4,19 @@ use core::EventType;
/// Describes how users are allowed to join the room. /// Describes how users are allowed to join the room.
pub struct JoinRulesEvent { pub struct JoinRulesEvent {
content: JoinRulesEventContent, pub content: JoinRulesEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<JoinRulesEventContent>, pub prev_content: Option<JoinRulesEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `JoinRulesEvent`. /// The payload of a `JoinRulesEvent`.
pub struct JoinRulesEventContent { pub struct JoinRulesEventContent {
/// The type of rules used for users wishing to join this room. /// The type of rules used for users wishing to join this room.
join_rule: JoinRule, pub join_rule: JoinRule,
} }
/// The rule used for users wishing to join this room. /// The rule used for users wishing to join this room.

View File

@ -1,7 +1,5 @@
//! Types for the *m.room.member* event. //! Types for the *m.room.member* event.
use std::collections::HashMap;
use core::{EventType, StrippedState}; use core::{EventType, StrippedState};
/// The current membership state of a user in the room. /// The current membership state of a user in the room.
@ -18,22 +16,23 @@ use core::{EventType, StrippedState};
/// this contains an array of `StrippedState` events. These events provide information on a few /// this contains an array of `StrippedState` events. These events provide information on a few
/// select state events such as the room name. /// select state events such as the room name.
pub struct MemberEvent { pub struct MemberEvent {
content: MemberEventContent, pub content: MemberEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
invite_room_state: Option<Vec<StrippedState>>, pub invite_room_state: Option<Vec<StrippedState>>,
prev_content: Option<MemberEventContent>, pub prev_content: Option<MemberEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `MemberEvent`. /// The payload of a `MemberEvent`.
pub struct MemberEventContent { pub struct MemberEventContent {
avatar_url: Option<String>, pub avatar_url: Option<String>,
displayname: Option<String>, pub displayname: Option<String>,
membership: MembershipState, pub membership: MembershipState,
third_party_invite: (), // TODO /// Warning: This field is not implemented yet and its type will change!
pub third_party_invite: (), // TODO
} }
/// The membership state of a user. /// The membership state of a user.

View File

@ -19,8 +19,8 @@ pub mod topic;
/// Metadata about an image. /// Metadata about an image.
pub struct ImageInfo { pub struct ImageInfo {
height: u64, pub height: u64,
mimetype: String, pub mimetype: String,
size: u64, pub size: u64,
width: u64, pub width: u64,
} }

View File

@ -4,17 +4,17 @@ use core::EventType;
/// A human-friendly room name designed to be displayed to the end-user. /// A human-friendly room name designed to be displayed to the end-user.
pub struct NameEvent { pub struct NameEvent {
content: NameEventContent, pub content: NameEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<NameEventContent>, pub prev_content: Option<NameEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `NameEvent`. /// The payload of a `NameEvent`.
pub struct NameEventContent { pub struct NameEventContent {
/// The name of the room. This MUST NOT exceed 255 bytes. /// The name of the room. This MUST NOT exceed 255 bytes.
name: String, pub name: String,
} }

View File

@ -6,23 +6,23 @@ use core::EventType;
/// Defines the power levels (privileges) of users in the room. /// Defines the power levels (privileges) of users in the room.
pub struct PowerLevelsEvent { pub struct PowerLevelsEvent {
content: PowerLevelsEventContent, pub content: PowerLevelsEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<PowerLevelsEventContent>, pub prev_content: Option<PowerLevelsEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `PowerLevelsEvent`. /// The payload of a `PowerLevelsEvent`.
pub struct PowerLevelsEventContent { pub struct PowerLevelsEventContent {
ban: u64, pub ban: u64,
events: HashMap<String, u64>, pub events: HashMap<String, u64>,
events_default: u64, pub events_default: u64,
kick: u64, pub kick: u64,
redact: u64, pub redact: u64,
state_default: u64, pub state_default: u64,
users: HashMap<String, u64>, pub users: HashMap<String, u64>,
users_default: u64, pub users_default: u64,
} }

View File

@ -4,17 +4,17 @@ use core::EventType;
/// A redaction of an event. /// A redaction of an event.
pub struct RedactionEvent { pub struct RedactionEvent {
content: RedactionEventContent, pub content: RedactionEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
/// The ID of the event that was redacted. /// The ID of the event that was redacted.
redacts: String, pub redacts: String,
room_id: String, pub room_id: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `RedactionEvent`. /// The payload of a `RedactionEvent`.
pub struct RedactionEventContent { pub struct RedactionEventContent {
/// The reason for the redaction, if any. /// The reason for the redaction, if any.
reason: Option<String>, pub reason: Option<String>,
} }

View File

@ -8,18 +8,18 @@ use core::EventType;
/// event contains a token and a public key whose private key must be used to sign the token. Any /// event contains a token and a public key whose private key must be used to sign the token. Any
/// user who can present that signature may use this invitation to join the target room. /// user who can present that signature may use this invitation to join the target room.
pub struct ThirdPartyInviteEvent { pub struct ThirdPartyInviteEvent {
content: ThirdPartyInviteEventContent, pub content: ThirdPartyInviteEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<ThirdPartyInviteEventContent>, pub prev_content: Option<ThirdPartyInviteEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `ThirdPartyInviteEvent`. /// The payload of a `ThirdPartyInviteEvent`.
pub struct ThirdPartyInviteEventContent { pub struct ThirdPartyInviteEventContent {
display_name: String, pub display_name: String,
key_validity_url: String, pub key_validity_url: String,
public_key: String, pub public_key: String,
} }

View File

@ -4,17 +4,17 @@ use core::EventType;
/// A topic is a short message detailing what is currently being discussed in the room. /// A topic is a short message detailing what is currently being discussed in the room.
pub struct TopicEvent { pub struct TopicEvent {
content: TopicEventContent, pub content: TopicEventContent,
event_id: String, pub event_id: String,
event_type: EventType, pub event_type: EventType,
prev_content: Option<TopicEventContent>, pub prev_content: Option<TopicEventContent>,
room_id: String, pub room_id: String,
state_key: String, pub state_key: String,
user_id: String, pub user_id: String,
} }
/// The payload of a `TopicEvent`. /// The payload of a `TopicEvent`.
pub struct TopicEventContent { pub struct TopicEventContent {
/// The topic text. /// The topic text.
topic: String, pub topic: String,
} }

View File

@ -7,16 +7,17 @@ use core::EventType;
/// Informs the client of tags on a room. /// Informs the client of tags on a room.
pub struct TagEvent { pub struct TagEvent {
/// The payload. /// The payload.
content: TagEventContent, pub content: TagEventContent,
pub event_type: EventType,
} }
/// The payload of a `TagEvent`. /// The payload of a `TagEvent`.
pub struct TagEventContent { pub struct TagEventContent {
/// A map of tag names to tag info. /// A map of tag names to tag info.
tags: HashMap<String, TagInfo>, pub tags: HashMap<String, TagInfo>,
} }
/// Information about a tag. /// Information about a tag.
pub struct TagInfo { pub struct TagInfo {
order: Option<u64>, pub order: Option<u64>,
} }

View File

@ -5,14 +5,14 @@ use core::EventType;
/// Informs the client of the list of users currently typing. /// Informs the client of the list of users currently typing.
pub struct TypingEvent { pub struct TypingEvent {
/// The payload. /// The payload.
content: TypingEventContent, pub content: TypingEventContent,
event_type: EventType, pub event_type: EventType,
/// The ID of the room associated with this event. /// The ID of the room associated with this event.
room_id: String, pub room_id: String,
} }
/// The payload of a `TypingEvent`. /// The payload of a `TypingEvent`.
pub struct TypingEventContent { pub struct TypingEventContent {
/// The list of user IDs typing in this room, if any. /// The list of user IDs typing in this room, if any.
user_ids: Vec<String>, pub user_ids: Vec<String>,
} }