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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243

use crate::types::*;
use crate::errors::*;




/// Contains full information about a supergroup or channel
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SupergroupFullInfo {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  /// Contains full information about a supergroup or channel
  description: String,
  /// Number of members in the supergroup or channel; 0 if unknown
  member_count: i64,
  /// Number of privileged users in the supergroup or channel; 0 if unknown
  administrator_count: i64,
  /// Number of restricted users in the supergroup; 0 if unknown
  restricted_count: i64,
  /// Number of users banned from chat; 0 if unknown
  banned_count: i64,
  /// Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown
  linked_chat_id: i64,
  /// Delay between consecutive sent messages for non-administrator supergroup members, in seconds
  slow_mode_delay: i64,
  /// Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero
  slow_mode_delay_expires_in: f32,
  /// True, if members of the chat can be retrieved
  can_get_members: bool,
  /// True, if the chat username can be changed
  can_set_username: bool,
  /// True, if the supergroup sticker set can be changed
  can_set_sticker_set: bool,
  /// True, if the supergroup location can be changed
  can_set_location: bool,
  /// True, if the channel statistics is available
  can_view_statistics: bool,
  /// True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators
  is_all_history_available: bool,
  /// Identifier of the supergroup sticker set; 0 if none
  sticker_set_id: String,
  /// Location to which the supergroup is connected; may be null
  location: Option<ChatLocation>,
  /// Invite link for this chat
  invite_link: String,
  /// Identifier of the basic group from which supergroup was upgraded; 0 if none
  upgraded_from_basic_group_id: i64,
  /// Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none
  upgraded_from_max_message_id: i64,
  
}

impl RObject for SupergroupFullInfo {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "supergroupFullInfo" }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}



impl SupergroupFullInfo {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDSupergroupFullInfoBuilder {
    let mut inner = SupergroupFullInfo::default();
    inner.td_name = "supergroupFullInfo".to_string();
    RTDSupergroupFullInfoBuilder { inner }
  }

  pub fn description(&self) -> &String { &self.description }

  pub fn member_count(&self) -> i64 { self.member_count }

  pub fn administrator_count(&self) -> i64 { self.administrator_count }

  pub fn restricted_count(&self) -> i64 { self.restricted_count }

  pub fn banned_count(&self) -> i64 { self.banned_count }

  pub fn linked_chat_id(&self) -> i64 { self.linked_chat_id }

  pub fn slow_mode_delay(&self) -> i64 { self.slow_mode_delay }

  pub fn slow_mode_delay_expires_in(&self) -> f32 { self.slow_mode_delay_expires_in }

  pub fn can_get_members(&self) -> bool { self.can_get_members }

  pub fn can_set_username(&self) -> bool { self.can_set_username }

  pub fn can_set_sticker_set(&self) -> bool { self.can_set_sticker_set }

  pub fn can_set_location(&self) -> bool { self.can_set_location }

  pub fn can_view_statistics(&self) -> bool { self.can_view_statistics }

  pub fn is_all_history_available(&self) -> bool { self.is_all_history_available }

  pub fn sticker_set_id(&self) -> &String { &self.sticker_set_id }

  pub fn location(&self) -> &Option<ChatLocation> { &self.location }

  pub fn invite_link(&self) -> &String { &self.invite_link }

  pub fn upgraded_from_basic_group_id(&self) -> i64 { self.upgraded_from_basic_group_id }

  pub fn upgraded_from_max_message_id(&self) -> i64 { self.upgraded_from_max_message_id }

}

#[doc(hidden)]
pub struct RTDSupergroupFullInfoBuilder {
  inner: SupergroupFullInfo
}

impl RTDSupergroupFullInfoBuilder {
  pub fn build(&self) -> SupergroupFullInfo { self.inner.clone() }

   
  pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
    self.inner.description = description.as_ref().to_string();
    self
  }

   
  pub fn member_count(&mut self, member_count: i64) -> &mut Self {
    self.inner.member_count = member_count;
    self
  }

   
  pub fn administrator_count(&mut self, administrator_count: i64) -> &mut Self {
    self.inner.administrator_count = administrator_count;
    self
  }

   
  pub fn restricted_count(&mut self, restricted_count: i64) -> &mut Self {
    self.inner.restricted_count = restricted_count;
    self
  }

   
  pub fn banned_count(&mut self, banned_count: i64) -> &mut Self {
    self.inner.banned_count = banned_count;
    self
  }

   
  pub fn linked_chat_id(&mut self, linked_chat_id: i64) -> &mut Self {
    self.inner.linked_chat_id = linked_chat_id;
    self
  }

   
  pub fn slow_mode_delay(&mut self, slow_mode_delay: i64) -> &mut Self {
    self.inner.slow_mode_delay = slow_mode_delay;
    self
  }

   
  pub fn slow_mode_delay_expires_in(&mut self, slow_mode_delay_expires_in: f32) -> &mut Self {
    self.inner.slow_mode_delay_expires_in = slow_mode_delay_expires_in;
    self
  }

   
  pub fn can_get_members(&mut self, can_get_members: bool) -> &mut Self {
    self.inner.can_get_members = can_get_members;
    self
  }

   
  pub fn can_set_username(&mut self, can_set_username: bool) -> &mut Self {
    self.inner.can_set_username = can_set_username;
    self
  }

   
  pub fn can_set_sticker_set(&mut self, can_set_sticker_set: bool) -> &mut Self {
    self.inner.can_set_sticker_set = can_set_sticker_set;
    self
  }

   
  pub fn can_set_location(&mut self, can_set_location: bool) -> &mut Self {
    self.inner.can_set_location = can_set_location;
    self
  }

   
  pub fn can_view_statistics(&mut self, can_view_statistics: bool) -> &mut Self {
    self.inner.can_view_statistics = can_view_statistics;
    self
  }

   
  pub fn is_all_history_available(&mut self, is_all_history_available: bool) -> &mut Self {
    self.inner.is_all_history_available = is_all_history_available;
    self
  }

   
  pub fn sticker_set_id<T: AsRef<str>>(&mut self, sticker_set_id: T) -> &mut Self {
    self.inner.sticker_set_id = sticker_set_id.as_ref().to_string();
    self
  }

   
  pub fn location<T: AsRef<ChatLocation>>(&mut self, location: T) -> &mut Self {
    self.inner.location = Some(location.as_ref().clone());
    self
  }

   
  pub fn invite_link<T: AsRef<str>>(&mut self, invite_link: T) -> &mut Self {
    self.inner.invite_link = invite_link.as_ref().to_string();
    self
  }

   
  pub fn upgraded_from_basic_group_id(&mut self, upgraded_from_basic_group_id: i64) -> &mut Self {
    self.inner.upgraded_from_basic_group_id = upgraded_from_basic_group_id;
    self
  }

   
  pub fn upgraded_from_max_message_id(&mut self, upgraded_from_max_message_id: i64) -> &mut Self {
    self.inner.upgraded_from_max_message_id = upgraded_from_max_message_id;
    self
  }

}

impl AsRef<SupergroupFullInfo> for SupergroupFullInfo {
  fn as_ref(&self) -> &SupergroupFullInfo { self }
}

impl AsRef<SupergroupFullInfo> for RTDSupergroupFullInfoBuilder {
  fn as_ref(&self) -> &SupergroupFullInfo { &self.inner }
}