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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
use crate::types::*;
use crate::errors::*;
use uuid::Uuid;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserFullInfo {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
is_blocked: bool,
can_be_called: bool,
has_private_calls: bool,
bio: String,
share_text: String,
group_in_common_count: i64,
bot_info: Option<BotInfo>,
}
impl RObject for UserFullInfo {
#[doc(hidden)] fn td_name(&self) -> &'static str { "userFullInfo" }
#[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}
impl UserFullInfo {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
pub fn builder() -> RTDUserFullInfoBuilder {
let mut inner = UserFullInfo::default();
inner.td_name = "userFullInfo".to_string();
inner.extra = Some(Uuid::new_v4().to_string());
RTDUserFullInfoBuilder { inner }
}
pub fn is_blocked(&self) -> bool { self.is_blocked }
pub fn can_be_called(&self) -> bool { self.can_be_called }
pub fn has_private_calls(&self) -> bool { self.has_private_calls }
pub fn bio(&self) -> &String { &self.bio }
pub fn share_text(&self) -> &String { &self.share_text }
pub fn group_in_common_count(&self) -> i64 { self.group_in_common_count }
pub fn bot_info(&self) -> &Option<BotInfo> { &self.bot_info }
}
#[doc(hidden)]
pub struct RTDUserFullInfoBuilder {
inner: UserFullInfo
}
impl RTDUserFullInfoBuilder {
pub fn build(&self) -> UserFullInfo { self.inner.clone() }
pub fn is_blocked(&mut self, is_blocked: bool) -> &mut Self {
self.inner.is_blocked = is_blocked;
self
}
pub fn can_be_called(&mut self, can_be_called: bool) -> &mut Self {
self.inner.can_be_called = can_be_called;
self
}
pub fn has_private_calls(&mut self, has_private_calls: bool) -> &mut Self {
self.inner.has_private_calls = has_private_calls;
self
}
pub fn bio<T: AsRef<str>>(&mut self, bio: T) -> &mut Self {
self.inner.bio = bio.as_ref().to_string();
self
}
pub fn share_text<T: AsRef<str>>(&mut self, share_text: T) -> &mut Self {
self.inner.share_text = share_text.as_ref().to_string();
self
}
pub fn group_in_common_count(&mut self, group_in_common_count: i64) -> &mut Self {
self.inner.group_in_common_count = group_in_common_count;
self
}
pub fn bot_info<T: AsRef<BotInfo>>(&mut self, bot_info: T) -> &mut Self {
self.inner.bot_info = Some(bot_info.as_ref().clone());
self
}
}
impl AsRef<UserFullInfo> for UserFullInfo {
fn as_ref(&self) -> &UserFullInfo { self }
}
impl AsRef<UserFullInfo> for RTDUserFullInfoBuilder {
fn as_ref(&self) -> &UserFullInfo { &self.inner }
}