Derive Debug and {De,}Serialize for all types.
This commit is contained in:
parent
d525766c99
commit
09ecdfa470
18
Cargo.toml
18
Cargo.toml
@ -1,11 +1,15 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ruma-events"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Jimmy Cuadra <jimmy@jimmycuadra.com>"]
|
authors = ["Jimmy Cuadra <jimmy@jimmycuadra.com>"]
|
||||||
description = "Serializable types for the events in the Matrix specification."
|
description = "Serializable types for the events in the Matrix specification."
|
||||||
license = "MIT"
|
|
||||||
readme = "README.md"
|
|
||||||
keywords = ["matrix", "matrix.org", "chat", "messaging", "ruma"]
|
|
||||||
repository = "https://github.com/ruma/ruma-events"
|
|
||||||
homepage = "https://github.com/ruma/ruma-events"
|
|
||||||
documentation = "http://ruma.github.io/ruma-events/ruma-events"
|
documentation = "http://ruma.github.io/ruma-events/ruma-events"
|
||||||
|
homepage = "https://github.com/ruma/ruma-events"
|
||||||
|
keywords = ["matrix", "matrix.org", "chat", "messaging", "ruma"]
|
||||||
|
license = "MIT"
|
||||||
|
name = "ruma-events"
|
||||||
|
readme = "README.md"
|
||||||
|
repository = "https://github.com/ruma/ruma-events"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde = "0.7.7"
|
||||||
|
serde_macros = "0.7.7"
|
||||||
|
@ -4,6 +4,7 @@ use core::EventType;
|
|||||||
use super::SessionDescription;
|
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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct AnswerEvent {
|
pub struct AnswerEvent {
|
||||||
pub content: AnswerEventContent,
|
pub content: AnswerEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -13,6 +14,7 @@ pub struct AnswerEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of an `AnswerEvent`.
|
/// The payload of an `AnswerEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct AnswerEventContent {
|
pub struct AnswerEventContent {
|
||||||
/// The VoIP session description.
|
/// The VoIP session description.
|
||||||
pub answer: SessionDescription,
|
pub answer: SessionDescription,
|
||||||
|
@ -4,6 +4,7 @@ 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct CandidatesEvent {
|
pub struct CandidatesEvent {
|
||||||
pub content: CandidatesEventContent,
|
pub content: CandidatesEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -13,6 +14,7 @@ pub struct CandidatesEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `CandidatesEvent`.
|
/// The payload of a `CandidatesEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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,
|
||||||
@ -23,6 +25,7 @@ pub struct CandidatesEventContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An ICE (Interactive Connectivity Establishment) candidate.
|
/// An ICE (Interactive Connectivity Establishment) candidate.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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,
|
||||||
|
@ -4,6 +4,7 @@ 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct HangupEvent {
|
pub struct HangupEvent {
|
||||||
pub content: HangupEventContent,
|
pub content: HangupEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -13,6 +14,7 @@ pub struct HangupEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `HangupEvent`.
|
/// The payload of a `HangupEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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,
|
||||||
|
@ -4,6 +4,7 @@ use core::EventType;
|
|||||||
use super::SessionDescription;
|
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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct InviteEvent {
|
pub struct InviteEvent {
|
||||||
pub content: InviteEventContent,
|
pub content: InviteEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -13,6 +14,7 @@ pub struct InviteEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of an `InviteEvent`.
|
/// The payload of an `InviteEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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,
|
||||||
|
@ -8,6 +8,7 @@ pub mod hangup;
|
|||||||
pub mod invite;
|
pub mod invite;
|
||||||
|
|
||||||
/// A VoIP session description.
|
/// A VoIP session description.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct SessionDescription {
|
pub struct SessionDescription {
|
||||||
/// The type of session description.
|
/// The type of session description.
|
||||||
pub session_type: SessionDescriptionType,
|
pub session_type: SessionDescriptionType,
|
||||||
@ -16,6 +17,7 @@ pub struct SessionDescription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The type of VoIP session description.
|
/// The type of VoIP session description.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum SessionDescriptionType {
|
pub enum SessionDescriptionType {
|
||||||
/// An answer.
|
/// An answer.
|
||||||
Answer,
|
Answer,
|
||||||
|
@ -6,6 +6,7 @@ use room::join_rules::JoinRulesEventContent;
|
|||||||
use room::name::NameEventContent;
|
use room::name::NameEventContent;
|
||||||
|
|
||||||
/// The type of an event.
|
/// The type of an event.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum EventType {
|
pub enum EventType {
|
||||||
CallAnswer,
|
CallAnswer,
|
||||||
CallCandidates,
|
CallCandidates,
|
||||||
@ -33,6 +34,7 @@ pub enum EventType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A stripped-down version of a state event that is included along with some other events.
|
/// A stripped-down version of a state event that is included along with some other events.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum StrippedState {
|
pub enum StrippedState {
|
||||||
RoomAvatar(StrippedRoomAvatar),
|
RoomAvatar(StrippedRoomAvatar),
|
||||||
RoomCanonicalAlias(StrippedRoomCanonicalAlias),
|
RoomCanonicalAlias(StrippedRoomCanonicalAlias),
|
||||||
@ -41,6 +43,7 @@ pub enum StrippedState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The general form of a `StrippedState`.
|
/// The general form of a `StrippedState`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct StrippedStateContent<T> {
|
pub struct StrippedStateContent<T> {
|
||||||
pub content: T,
|
pub content: T,
|
||||||
pub event_type: EventType,
|
pub event_type: EventType,
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
//! Crate ruma_events contains serializable types for the events in the [Matrix](https://matrix.org)
|
//! Crate ruma_events contains serializable types for the events in the [Matrix](https://matrix.org)
|
||||||
//! specification that can be shared by client and server code.
|
//! specification that can be shared by client and server code.
|
||||||
|
|
||||||
|
#![feature(custom_derive, plugin)]
|
||||||
|
#![plugin(serde_macros)]
|
||||||
|
|
||||||
pub mod call;
|
pub mod call;
|
||||||
pub mod core;
|
pub mod core;
|
||||||
pub mod presence;
|
pub mod presence;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
use core::EventType;
|
||||||
|
|
||||||
/// Informs the client of a user's presence state change.
|
/// Informs the client of a user's presence state change.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct PresenceEvent {
|
pub struct PresenceEvent {
|
||||||
pub content: PresenceEventContent,
|
pub content: PresenceEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -10,6 +11,7 @@ pub struct PresenceEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `PresenceEvent`.
|
/// The payload of a `PresenceEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct PresenceEventContent {
|
pub struct PresenceEventContent {
|
||||||
/// The current avatar URL for this user.
|
/// The current avatar URL for this user.
|
||||||
pub avatar_url: Option<String>,
|
pub avatar_url: Option<String>,
|
||||||
@ -22,6 +24,7 @@ pub struct PresenceEventContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A description of a user's connectivity and availability for chat.
|
/// A description of a user's connectivity and availability for chat.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum PresenceState {
|
pub enum PresenceState {
|
||||||
/// Connected to the service and available for chat.
|
/// Connected to the service and available for chat.
|
||||||
FreeForChat,
|
FreeForChat,
|
||||||
|
@ -5,6 +5,7 @@ use std::collections::HashMap;
|
|||||||
use core::EventType;
|
use core::EventType;
|
||||||
|
|
||||||
/// Informs the client of new receipts.
|
/// Informs the client of new receipts.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct ReceiptEvent {
|
pub struct ReceiptEvent {
|
||||||
pub content: ReceiptEventContent,
|
pub content: ReceiptEventContent,
|
||||||
pub event_type: EventType,
|
pub event_type: EventType,
|
||||||
@ -18,6 +19,7 @@ pub struct ReceiptEvent {
|
|||||||
pub type ReceiptEventContent = HashMap<String, Receipts>;
|
pub type ReceiptEventContent = HashMap<String, Receipts>;
|
||||||
|
|
||||||
/// A collection of receipts.
|
/// A collection of receipts.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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.
|
||||||
pub m_read: UserReceipts,
|
pub m_read: UserReceipts,
|
||||||
@ -29,6 +31,7 @@ pub struct Receipts {
|
|||||||
pub type UserReceipts = HashMap<String, Receipt>;
|
pub type UserReceipts = HashMap<String, Receipt>;
|
||||||
|
|
||||||
/// An acknowledgement of an event.
|
/// An acknowledgement of an event.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct Receipt {
|
pub struct Receipt {
|
||||||
/// The timestamp the receipt was sent at.
|
/// The timestamp the receipt was sent at.
|
||||||
pub ts: u64,
|
pub ts: u64,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct AliasesEvent {
|
pub struct AliasesEvent {
|
||||||
pub content: AliasesEventContent,
|
pub content: AliasesEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -15,6 +16,7 @@ pub struct AliasesEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of an `AliasesEvent`.
|
/// The payload of an `AliasesEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct AliasesEventContent {
|
pub struct AliasesEventContent {
|
||||||
/// A list of room aliases.
|
/// A list of room aliases.
|
||||||
pub aliases: Vec<String>,
|
pub aliases: Vec<String>,
|
||||||
|
@ -6,6 +6,7 @@ use super::ImageInfo;
|
|||||||
/// A picture that is associated with the room.
|
/// A picture that is associated with the room.
|
||||||
///
|
///
|
||||||
/// This can be displayed alongside the room information.
|
/// This can be displayed alongside the room information.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct AvatarEvent {
|
pub struct AvatarEvent {
|
||||||
pub content: AvatarEventContent,
|
pub content: AvatarEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -17,6 +18,7 @@ pub struct AvatarEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of an `AvatarEvent`.
|
/// The payload of an `AvatarEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct AvatarEventContent {
|
pub struct AvatarEventContent {
|
||||||
pub info: ImageInfo,
|
pub info: ImageInfo,
|
||||||
pub thumbnail_info: ImageInfo,
|
pub thumbnail_info: ImageInfo,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct CanonicalAliasEvent {
|
pub struct CanonicalAliasEvent {
|
||||||
pub content: CanonicalAliasEventContent,
|
pub content: CanonicalAliasEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -14,6 +15,7 @@ pub struct CanonicalAliasEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `CanonicalAliasEvent`.
|
/// The payload of a `CanonicalAliasEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct CanonicalAliasEventContent {
|
pub struct CanonicalAliasEventContent {
|
||||||
/// The canonical alias.
|
/// The canonical alias.
|
||||||
pub alias: String,
|
pub alias: String,
|
||||||
|
@ -4,6 +4,7 @@ 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct CreateEvent {
|
pub struct CreateEvent {
|
||||||
pub content: CreateEventContent,
|
pub content: CreateEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -15,6 +16,7 @@ pub struct CreateEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `CreateEvent`.
|
/// The payload of a `CreateEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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: String,
|
pub creator: String,
|
||||||
|
@ -6,6 +6,7 @@ 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`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct GuestAccessEvent {
|
pub struct GuestAccessEvent {
|
||||||
pub content: GuestAccessEventContent,
|
pub content: GuestAccessEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -17,11 +18,13 @@ pub struct GuestAccessEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `GuestAccessEvent`.
|
/// The payload of a `GuestAccessEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct GuestAccessEventContent {
|
pub struct GuestAccessEventContent {
|
||||||
pub 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum GuestAccess {
|
pub enum GuestAccess {
|
||||||
/// Guests are allowed to join the room.
|
/// Guests are allowed to join the room.
|
||||||
CanJoin,
|
CanJoin,
|
||||||
|
@ -4,6 +4,7 @@ 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct HistoryVisibilityEvent {
|
pub struct HistoryVisibilityEvent {
|
||||||
pub content: HistoryVisibilityEventContent,
|
pub content: HistoryVisibilityEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -15,12 +16,14 @@ pub struct HistoryVisibilityEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `HistoryVisibilityEvent`.
|
/// The payload of a `HistoryVisibilityEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct HistoryVisibilityEventContent {
|
pub struct HistoryVisibilityEventContent {
|
||||||
/// Who can see the room history.
|
/// Who can see the room history.
|
||||||
pub history_visibility: HistoryVisibility,
|
pub history_visibility: HistoryVisibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Who can see a room's history.
|
/// Who can see a room's history.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum HistoryVisibility {
|
pub enum HistoryVisibility {
|
||||||
/// Previous events are accessible to newly joined members from the point they were invited
|
/// Previous events are accessible to newly joined members from the point they were invited
|
||||||
/// onwards. Events stop being accessible when the member's state changes to something other
|
/// onwards. Events stop being accessible when the member's state changes to something other
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
use core::EventType;
|
||||||
|
|
||||||
/// Describes how users are allowed to join the room.
|
/// Describes how users are allowed to join the room.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct JoinRulesEvent {
|
pub struct JoinRulesEvent {
|
||||||
pub content: JoinRulesEventContent,
|
pub content: JoinRulesEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -14,12 +15,14 @@ pub struct JoinRulesEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `JoinRulesEvent`.
|
/// The payload of a `JoinRulesEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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.
|
||||||
pub 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum JoinRule {
|
pub enum JoinRule {
|
||||||
/// A user who wishes to join the room must first receive an invite to the room from someone
|
/// A user who wishes to join the room must first receive an invite to the room from someone
|
||||||
/// already inside of the room.
|
/// already inside of the room.
|
||||||
|
@ -15,6 +15,7 @@ use core::{EventType, StrippedState};
|
|||||||
/// This event may also include an *invite_room_state* key outside the *content* key. If present,
|
/// This event may also include an *invite_room_state* key outside the *content* key. If present,
|
||||||
/// 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct MemberEvent {
|
pub struct MemberEvent {
|
||||||
pub content: MemberEventContent,
|
pub content: MemberEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -27,6 +28,7 @@ pub struct MemberEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `MemberEvent`.
|
/// The payload of a `MemberEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct MemberEventContent {
|
pub struct MemberEventContent {
|
||||||
pub avatar_url: Option<String>,
|
pub avatar_url: Option<String>,
|
||||||
pub displayname: Option<String>,
|
pub displayname: Option<String>,
|
||||||
@ -36,6 +38,7 @@ pub struct MemberEventContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The membership state of a user.
|
/// The membership state of a user.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum MembershipState {
|
pub enum MembershipState {
|
||||||
Ban,
|
Ban,
|
||||||
Invite,
|
Invite,
|
||||||
|
@ -18,6 +18,7 @@ pub mod third_party_invite;
|
|||||||
pub mod topic;
|
pub mod topic;
|
||||||
|
|
||||||
/// Metadata about an image.
|
/// Metadata about an image.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct ImageInfo {
|
pub struct ImageInfo {
|
||||||
pub height: u64,
|
pub height: u64,
|
||||||
pub mimetype: String,
|
pub mimetype: String,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct NameEvent {
|
pub struct NameEvent {
|
||||||
pub content: NameEventContent,
|
pub content: NameEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -14,6 +15,7 @@ pub struct NameEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `NameEvent`.
|
/// The payload of a `NameEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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.
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
@ -5,6 +5,7 @@ use std::collections::HashMap;
|
|||||||
use core::EventType;
|
use core::EventType;
|
||||||
|
|
||||||
/// Defines the power levels (privileges) of users in the room.
|
/// Defines the power levels (privileges) of users in the room.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct PowerLevelsEvent {
|
pub struct PowerLevelsEvent {
|
||||||
pub content: PowerLevelsEventContent,
|
pub content: PowerLevelsEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -16,6 +17,7 @@ pub struct PowerLevelsEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `PowerLevelsEvent`.
|
/// The payload of a `PowerLevelsEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct PowerLevelsEventContent {
|
pub struct PowerLevelsEventContent {
|
||||||
pub ban: u64,
|
pub ban: u64,
|
||||||
pub events: HashMap<String, u64>,
|
pub events: HashMap<String, u64>,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
use core::EventType;
|
||||||
|
|
||||||
/// A redaction of an event.
|
/// A redaction of an event.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct RedactionEvent {
|
pub struct RedactionEvent {
|
||||||
pub content: RedactionEventContent,
|
pub content: RedactionEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -14,6 +15,7 @@ pub struct RedactionEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `RedactionEvent`.
|
/// The payload of a `RedactionEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct RedactionEventContent {
|
pub struct RedactionEventContent {
|
||||||
/// The reason for the redaction, if any.
|
/// The reason for the redaction, if any.
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
|
@ -7,6 +7,7 @@ use core::EventType;
|
|||||||
/// Acts as an *m.room.member* invite event, where there isn't a target user_id to invite. This
|
/// Acts as an *m.room.member* invite event, where there isn't a target user_id to invite. This
|
||||||
/// 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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct ThirdPartyInviteEvent {
|
pub struct ThirdPartyInviteEvent {
|
||||||
pub content: ThirdPartyInviteEventContent,
|
pub content: ThirdPartyInviteEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -18,6 +19,7 @@ pub struct ThirdPartyInviteEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `ThirdPartyInviteEvent`.
|
/// The payload of a `ThirdPartyInviteEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct ThirdPartyInviteEventContent {
|
pub struct ThirdPartyInviteEventContent {
|
||||||
pub display_name: String,
|
pub display_name: String,
|
||||||
pub key_validity_url: String,
|
pub key_validity_url: String,
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
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.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct TopicEvent {
|
pub struct TopicEvent {
|
||||||
pub content: TopicEventContent,
|
pub content: TopicEventContent,
|
||||||
pub event_id: String,
|
pub event_id: String,
|
||||||
@ -14,6 +15,7 @@ pub struct TopicEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `TopicEvent`.
|
/// The payload of a `TopicEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct TopicEventContent {
|
pub struct TopicEventContent {
|
||||||
/// The topic text.
|
/// The topic text.
|
||||||
pub topic: String,
|
pub topic: String,
|
||||||
|
@ -5,6 +5,7 @@ use std::collections::HashMap;
|
|||||||
use core::EventType;
|
use core::EventType;
|
||||||
|
|
||||||
/// Informs the client of tags on a room.
|
/// Informs the client of tags on a room.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct TagEvent {
|
pub struct TagEvent {
|
||||||
/// The payload.
|
/// The payload.
|
||||||
pub content: TagEventContent,
|
pub content: TagEventContent,
|
||||||
@ -12,12 +13,14 @@ pub struct TagEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `TagEvent`.
|
/// The payload of a `TagEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct TagEventContent {
|
pub struct TagEventContent {
|
||||||
/// A map of tag names to tag info.
|
/// A map of tag names to tag info.
|
||||||
pub tags: HashMap<String, TagInfo>,
|
pub tags: HashMap<String, TagInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information about a tag.
|
/// Information about a tag.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct TagInfo {
|
pub struct TagInfo {
|
||||||
pub order: Option<u64>,
|
pub order: Option<u64>,
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use core::EventType;
|
use core::EventType;
|
||||||
|
|
||||||
/// Informs the client of the list of users currently typing.
|
/// Informs the client of the list of users currently typing.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct TypingEvent {
|
pub struct TypingEvent {
|
||||||
/// The payload.
|
/// The payload.
|
||||||
pub content: TypingEventContent,
|
pub content: TypingEventContent,
|
||||||
@ -12,6 +13,7 @@ pub struct TypingEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The payload of a `TypingEvent`.
|
/// The payload of a `TypingEvent`.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
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.
|
||||||
pub user_ids: Vec<String>,
|
pub user_ids: Vec<String>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user