1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use ruma_common::{MilliSecondsSinceUnixEpoch, OwnedDeviceId};
use serde::{Deserialize, Serialize};
pub mod delete_device;
pub mod delete_devices;
pub mod get_device;
pub mod get_devices;
pub mod update_device;
#[derive(Clone, Debug, Deserialize, Hash, PartialEq, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct Device {
pub device_id: OwnedDeviceId,
pub display_name: Option<String>,
pub last_seen_ip: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_seen_ts: Option<MilliSecondsSinceUnixEpoch>,
}
impl Device {
pub fn new(device_id: OwnedDeviceId) -> Self {
Self { device_id, display_name: None, last_seen_ip: None, last_seen_ts: None }
}
}