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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560

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




use std::fmt::Debug;
use serde::de::{Deserialize, Deserializer};



/// TRAIT | Describes available user privacy settings
pub trait TDUserPrivacySetting: Debug + RObject {}

/// Describes available user privacy settings
#[derive(Debug, Clone, Serialize)]
#[serde(untagged)]
pub enum UserPrivacySetting {
  #[doc(hidden)] _Default(()),
  /// A privacy setting for managing whether the user can be called
  AllowCalls(UserPrivacySettingAllowCalls),
  /// A privacy setting for managing whether the user can be invited to chats
  AllowChatInvites(UserPrivacySettingAllowChatInvites),
  /// A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all"
  AllowFindingByPhoneNumber(UserPrivacySettingAllowFindingByPhoneNumber),
  /// A privacy setting for managing whether peer-to-peer connections can be used for calls
  AllowPeerToPeerCalls(UserPrivacySettingAllowPeerToPeerCalls),
  /// A privacy setting for managing whether a link to the user's account is included in forwarded messages
  ShowLinkInForwardedMessages(UserPrivacySettingShowLinkInForwardedMessages),
  /// A privacy setting for managing whether the user's phone number is visible
  ShowPhoneNumber(UserPrivacySettingShowPhoneNumber),
  /// A privacy setting for managing whether the user's profile photo is visible
  ShowProfilePhoto(UserPrivacySettingShowProfilePhoto),
  /// A privacy setting for managing whether the user's online status is visible
  ShowStatus(UserPrivacySettingShowStatus),

}

impl Default for UserPrivacySetting {
  fn default() -> Self { UserPrivacySetting::_Default(()) }
}

impl<'de> Deserialize<'de> for UserPrivacySetting {
  fn deserialize<D>(deserializer: D) -> Result<UserPrivacySetting, D::Error> where D: Deserializer<'de> {
    use serde::de::Error;
    rtd_enum_deserialize!(
      UserPrivacySetting,
      (userPrivacySettingAllowCalls, AllowCalls);
      (userPrivacySettingAllowChatInvites, AllowChatInvites);
      (userPrivacySettingAllowFindingByPhoneNumber, AllowFindingByPhoneNumber);
      (userPrivacySettingAllowPeerToPeerCalls, AllowPeerToPeerCalls);
      (userPrivacySettingShowLinkInForwardedMessages, ShowLinkInForwardedMessages);
      (userPrivacySettingShowPhoneNumber, ShowPhoneNumber);
      (userPrivacySettingShowProfilePhoto, ShowProfilePhoto);
      (userPrivacySettingShowStatus, ShowStatus);

    )(deserializer)
  }
}

impl RObject for UserPrivacySetting {
  #[doc(hidden)] fn td_name(&self) -> &'static str {
    match self {
      UserPrivacySetting::AllowCalls(t) => t.td_name(),
      UserPrivacySetting::AllowChatInvites(t) => t.td_name(),
      UserPrivacySetting::AllowFindingByPhoneNumber(t) => t.td_name(),
      UserPrivacySetting::AllowPeerToPeerCalls(t) => t.td_name(),
      UserPrivacySetting::ShowLinkInForwardedMessages(t) => t.td_name(),
      UserPrivacySetting::ShowPhoneNumber(t) => t.td_name(),
      UserPrivacySetting::ShowProfilePhoto(t) => t.td_name(),
      UserPrivacySetting::ShowStatus(t) => t.td_name(),

      _ => "-1",
    }
  }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}

impl UserPrivacySetting {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  #[doc(hidden)] pub fn _is_default(&self) -> bool { if let UserPrivacySetting::_Default(_) = self { true } else { false } }

  pub fn is_allow_calls(&self) -> bool { if let UserPrivacySetting::AllowCalls(_) = self { true } else { false } }
  pub fn is_allow_chat_invites(&self) -> bool { if let UserPrivacySetting::AllowChatInvites(_) = self { true } else { false } }
  pub fn is_allow_finding_by_phone_number(&self) -> bool { if let UserPrivacySetting::AllowFindingByPhoneNumber(_) = self { true } else { false } }
  pub fn is_allow_peer_to_peer_calls(&self) -> bool { if let UserPrivacySetting::AllowPeerToPeerCalls(_) = self { true } else { false } }
  pub fn is_show_link_in_forwarded_messages(&self) -> bool { if let UserPrivacySetting::ShowLinkInForwardedMessages(_) = self { true } else { false } }
  pub fn is_show_phone_number(&self) -> bool { if let UserPrivacySetting::ShowPhoneNumber(_) = self { true } else { false } }
  pub fn is_show_profile_photo(&self) -> bool { if let UserPrivacySetting::ShowProfilePhoto(_) = self { true } else { false } }
  pub fn is_show_status(&self) -> bool { if let UserPrivacySetting::ShowStatus(_) = self { true } else { false } }

  pub fn on_allow_calls<F: FnOnce(&UserPrivacySettingAllowCalls)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::AllowCalls(t) = self { fnc(t) }; self }
  pub fn on_allow_chat_invites<F: FnOnce(&UserPrivacySettingAllowChatInvites)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::AllowChatInvites(t) = self { fnc(t) }; self }
  pub fn on_allow_finding_by_phone_number<F: FnOnce(&UserPrivacySettingAllowFindingByPhoneNumber)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::AllowFindingByPhoneNumber(t) = self { fnc(t) }; self }
  pub fn on_allow_peer_to_peer_calls<F: FnOnce(&UserPrivacySettingAllowPeerToPeerCalls)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::AllowPeerToPeerCalls(t) = self { fnc(t) }; self }
  pub fn on_show_link_in_forwarded_messages<F: FnOnce(&UserPrivacySettingShowLinkInForwardedMessages)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::ShowLinkInForwardedMessages(t) = self { fnc(t) }; self }
  pub fn on_show_phone_number<F: FnOnce(&UserPrivacySettingShowPhoneNumber)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::ShowPhoneNumber(t) = self { fnc(t) }; self }
  pub fn on_show_profile_photo<F: FnOnce(&UserPrivacySettingShowProfilePhoto)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::ShowProfilePhoto(t) = self { fnc(t) }; self }
  pub fn on_show_status<F: FnOnce(&UserPrivacySettingShowStatus)>(&self, fnc: F) -> &Self { if let UserPrivacySetting::ShowStatus(t) = self { fnc(t) }; self }

  pub fn as_allow_calls(&self) -> Option<&UserPrivacySettingAllowCalls> { if let UserPrivacySetting::AllowCalls(t) = self { return Some(t) } None }
  pub fn as_allow_chat_invites(&self) -> Option<&UserPrivacySettingAllowChatInvites> { if let UserPrivacySetting::AllowChatInvites(t) = self { return Some(t) } None }
  pub fn as_allow_finding_by_phone_number(&self) -> Option<&UserPrivacySettingAllowFindingByPhoneNumber> { if let UserPrivacySetting::AllowFindingByPhoneNumber(t) = self { return Some(t) } None }
  pub fn as_allow_peer_to_peer_calls(&self) -> Option<&UserPrivacySettingAllowPeerToPeerCalls> { if let UserPrivacySetting::AllowPeerToPeerCalls(t) = self { return Some(t) } None }
  pub fn as_show_link_in_forwarded_messages(&self) -> Option<&UserPrivacySettingShowLinkInForwardedMessages> { if let UserPrivacySetting::ShowLinkInForwardedMessages(t) = self { return Some(t) } None }
  pub fn as_show_phone_number(&self) -> Option<&UserPrivacySettingShowPhoneNumber> { if let UserPrivacySetting::ShowPhoneNumber(t) = self { return Some(t) } None }
  pub fn as_show_profile_photo(&self) -> Option<&UserPrivacySettingShowProfilePhoto> { if let UserPrivacySetting::ShowProfilePhoto(t) = self { return Some(t) } None }
  pub fn as_show_status(&self) -> Option<&UserPrivacySettingShowStatus> { if let UserPrivacySetting::ShowStatus(t) = self { return Some(t) } None }



  pub fn allow_calls<T: AsRef<UserPrivacySettingAllowCalls>>(t: T) -> Self { UserPrivacySetting::AllowCalls(t.as_ref().clone()) }

  pub fn allow_chat_invites<T: AsRef<UserPrivacySettingAllowChatInvites>>(t: T) -> Self { UserPrivacySetting::AllowChatInvites(t.as_ref().clone()) }

  pub fn allow_finding_by_phone_number<T: AsRef<UserPrivacySettingAllowFindingByPhoneNumber>>(t: T) -> Self { UserPrivacySetting::AllowFindingByPhoneNumber(t.as_ref().clone()) }

  pub fn allow_peer_to_peer_calls<T: AsRef<UserPrivacySettingAllowPeerToPeerCalls>>(t: T) -> Self { UserPrivacySetting::AllowPeerToPeerCalls(t.as_ref().clone()) }

  pub fn show_link_in_forwarded_messages<T: AsRef<UserPrivacySettingShowLinkInForwardedMessages>>(t: T) -> Self { UserPrivacySetting::ShowLinkInForwardedMessages(t.as_ref().clone()) }

  pub fn show_phone_number<T: AsRef<UserPrivacySettingShowPhoneNumber>>(t: T) -> Self { UserPrivacySetting::ShowPhoneNumber(t.as_ref().clone()) }

  pub fn show_profile_photo<T: AsRef<UserPrivacySettingShowProfilePhoto>>(t: T) -> Self { UserPrivacySetting::ShowProfilePhoto(t.as_ref().clone()) }

  pub fn show_status<T: AsRef<UserPrivacySettingShowStatus>>(t: T) -> Self { UserPrivacySetting::ShowStatus(t.as_ref().clone()) }

}

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







/// A privacy setting for managing whether the user can be called
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingAllowCalls {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingAllowCalls {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingAllowCallsBuilder {
  inner: UserPrivacySettingAllowCalls
}

impl RTDUserPrivacySettingAllowCallsBuilder {
  pub fn build(&self) -> UserPrivacySettingAllowCalls { self.inner.clone() }

}

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

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







/// A privacy setting for managing whether the user can be invited to chats
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingAllowChatInvites {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingAllowChatInvites {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingAllowChatInvitesBuilder {
  inner: UserPrivacySettingAllowChatInvites
}

impl RTDUserPrivacySettingAllowChatInvitesBuilder {
  pub fn build(&self) -> UserPrivacySettingAllowChatInvites { self.inner.clone() }

}

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

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







/// A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all"
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingAllowFindingByPhoneNumber {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingAllowFindingByPhoneNumber {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingAllowFindingByPhoneNumberBuilder {
  inner: UserPrivacySettingAllowFindingByPhoneNumber
}

impl RTDUserPrivacySettingAllowFindingByPhoneNumberBuilder {
  pub fn build(&self) -> UserPrivacySettingAllowFindingByPhoneNumber { self.inner.clone() }

}

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

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







/// A privacy setting for managing whether peer-to-peer connections can be used for calls
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingAllowPeerToPeerCalls {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingAllowPeerToPeerCalls {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingAllowPeerToPeerCallsBuilder {
  inner: UserPrivacySettingAllowPeerToPeerCalls
}

impl RTDUserPrivacySettingAllowPeerToPeerCallsBuilder {
  pub fn build(&self) -> UserPrivacySettingAllowPeerToPeerCalls { self.inner.clone() }

}

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

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







/// A privacy setting for managing whether a link to the user's account is included in forwarded messages
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingShowLinkInForwardedMessages {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingShowLinkInForwardedMessages {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingShowLinkInForwardedMessagesBuilder {
  inner: UserPrivacySettingShowLinkInForwardedMessages
}

impl RTDUserPrivacySettingShowLinkInForwardedMessagesBuilder {
  pub fn build(&self) -> UserPrivacySettingShowLinkInForwardedMessages { self.inner.clone() }

}

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

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







/// A privacy setting for managing whether the user's phone number is visible
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingShowPhoneNumber {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingShowPhoneNumber {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingShowPhoneNumberBuilder {
  inner: UserPrivacySettingShowPhoneNumber
}

impl RTDUserPrivacySettingShowPhoneNumberBuilder {
  pub fn build(&self) -> UserPrivacySettingShowPhoneNumber { self.inner.clone() }

}

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

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







/// A privacy setting for managing whether the user's profile photo is visible
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingShowProfilePhoto {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingShowProfilePhoto {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingShowProfilePhotoBuilder {
  inner: UserPrivacySettingShowProfilePhoto
}

impl RTDUserPrivacySettingShowProfilePhotoBuilder {
  pub fn build(&self) -> UserPrivacySettingShowProfilePhoto { self.inner.clone() }

}

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

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







/// A privacy setting for managing whether the user's online status is visible
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserPrivacySettingShowStatus {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  
}

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


impl TDUserPrivacySetting for UserPrivacySettingShowStatus {}



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

}

#[doc(hidden)]
pub struct RTDUserPrivacySettingShowStatusBuilder {
  inner: UserPrivacySettingShowStatus
}

impl RTDUserPrivacySettingShowStatusBuilder {
  pub fn build(&self) -> UserPrivacySettingShowStatus { self.inner.clone() }

}

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

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