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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use crate::errors::*;
use crate::types::*;
use uuid::Uuid;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct StorageStatistics {
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
#[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
client_id: Option<i32>,
size: i64,
count: i32,
by_chat: Vec<StorageStatisticsByChat>,
}
impl RObject for StorageStatistics {
#[doc(hidden)]
fn extra(&self) -> Option<&str> {
self.extra.as_deref()
}
#[doc(hidden)]
fn client_id(&self) -> Option<i32> {
self.client_id
}
}
impl StorageStatistics {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDStorageStatisticsBuilder {
let mut inner = StorageStatistics::default();
inner.extra = Some(Uuid::new_v4().to_string());
RTDStorageStatisticsBuilder { inner }
}
pub fn size(&self) -> i64 {
self.size
}
pub fn count(&self) -> i32 {
self.count
}
pub fn by_chat(&self) -> &Vec<StorageStatisticsByChat> {
&self.by_chat
}
}
#[doc(hidden)]
pub struct RTDStorageStatisticsBuilder {
inner: StorageStatistics,
}
impl RTDStorageStatisticsBuilder {
pub fn build(&self) -> StorageStatistics {
self.inner.clone()
}
pub fn size(&mut self, size: i64) -> &mut Self {
self.inner.size = size;
self
}
pub fn count(&mut self, count: i32) -> &mut Self {
self.inner.count = count;
self
}
pub fn by_chat(&mut self, by_chat: Vec<StorageStatisticsByChat>) -> &mut Self {
self.inner.by_chat = by_chat;
self
}
}
impl AsRef<StorageStatistics> for StorageStatistics {
fn as_ref(&self) -> &StorageStatistics {
self
}
}
impl AsRef<StorageStatistics> for RTDStorageStatisticsBuilder {
fn as_ref(&self) -> &StorageStatistics {
&self.inner
}
}