Re-introduce dedicated event types as type alises

This commit is contained in:
Jonas Platte 2020-06-09 01:40:52 +02:00
parent d4a196f682
commit 1e365c6a2d
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
5 changed files with 24 additions and 2 deletions

View File

@ -5,8 +5,12 @@ use ruma_events_macros::MessageEventContent;
use serde::{Deserialize, Serialize};
use super::SessionDescription;
use crate::MessageEvent;
/// This event is sent by the callee when they wish to answer the call.
pub type AnswerEvent = MessageEvent<AnswerEventContent>;
/// The payload for `AnswerEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
#[ruma_event(type = "m.call.answer")]
pub struct AnswerEventContent {

View File

@ -10,6 +10,11 @@ use ruma_events_macros::EphemeralRoomEventContent;
use ruma_identifiers::{EventId, UserId};
use serde::{Deserialize, Serialize};
use crate::EphemeralRoomEvent;
/// Informs the client who has read a message specified by it's event id.
pub type ReceiptEvent = EphemeralRoomEvent<ReceiptEventContent>;
/// The payload for `ReceiptEvent`.
///
/// A mapping of event ID to a collection of receipts for this event ID. The event ID is the ID of

View File

@ -1,13 +1,18 @@
//! Types for the *m.room_key* event.
use super::Algorithm;
use ruma_events_macros::BasicEventContent;
use ruma_identifiers::RoomId;
use serde::{Deserialize, Serialize};
use super::Algorithm;
use crate::BasicEvent;
/// This event type is used to exchange keys for end-to-end encryption.
///
/// Typically it is encrypted as an *m.room.encrypted* event, then sent as a to-device event.
pub type RoomKeyEvent = BasicEvent<RoomKeyEventContent>;
/// The payload for `RoomKeyEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, BasicEventContent)]
#[ruma_event(type = "m.room_key")]
pub struct RoomKeyEventContent {

View File

@ -3,9 +3,12 @@
use ruma_events_macros::MessageEventContent;
use serde::{Deserialize, Serialize};
use crate::room::ImageInfo;
use crate::{room::ImageInfo, MessageEvent};
/// A sticker message.
pub type StickerEvent = MessageEvent<StickerEventContent>;
/// The payload for `StickerEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, MessageEventContent)]
#[ruma_event(type = "m.sticker")]
pub struct StickerEventContent {

View File

@ -4,7 +4,12 @@ use ruma_events_macros::EphemeralRoomEventContent;
use ruma_identifiers::UserId;
use serde::{Deserialize, Serialize};
use crate::EphemeralRoomEvent;
/// Informs the client who is currently typing in a given room.
pub type TypingEvent = EphemeralRoomEvent<TypingEventContent>;
/// The payload for `TypingEvent`.
#[derive(Clone, Debug, Deserialize, Serialize, EphemeralRoomEventContent)]
#[ruma_event(type = "m.typing")]
pub struct TypingEventContent {