ruma_client_api/sync/
sync_events.rs1use js_int::UInt;
6use ruma_common::OwnedUserId;
7use serde::{self, Deserialize, Serialize};
8
9pub mod v3;
10
11#[cfg(feature = "unstable-msc4186")]
12pub mod v5;
13
14#[derive(Clone, Debug, Default, Deserialize, Serialize)]
16#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
17pub struct UnreadNotificationsCount {
18 #[serde(skip_serializing_if = "Option::is_none")]
20 pub highlight_count: Option<UInt>,
21
22 #[serde(skip_serializing_if = "Option::is_none")]
24 pub notification_count: Option<UInt>,
25}
26
27impl UnreadNotificationsCount {
28 pub fn new() -> Self {
30 Default::default()
31 }
32
33 pub fn is_empty(&self) -> bool {
35 self.highlight_count.is_none() && self.notification_count.is_none()
36 }
37}
38
39#[derive(Clone, Debug, Default, Deserialize, Serialize)]
41#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
42pub struct DeviceLists {
43 #[serde(default, skip_serializing_if = "Vec::is_empty")]
46 pub changed: Vec<OwnedUserId>,
47
48 #[serde(default, skip_serializing_if = "Vec::is_empty")]
51 pub left: Vec<OwnedUserId>,
52}
53
54impl DeviceLists {
55 pub fn new() -> Self {
57 Default::default()
58 }
59
60 pub fn is_empty(&self) -> bool {
62 self.changed.is_empty() && self.left.is_empty()
63 }
64}