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

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




/// Contains full information about a user (except the full list of profile photos)
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UserFullInfo {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  /// True, if the user is blacklisted by the current user
  is_blocked: bool,
  /// True, if the user can be called
  can_be_called: bool,
  /// True, if the user can't be called due to their privacy settings
  has_private_calls: bool,
  /// A short user bio
  bio: String,
  /// For bots, the text that is included with the link when users share the bot
  share_text: String,
  /// Number of group chats where both the other user and the current user are a member; 0 for the current user
  group_in_common_count: i64,
  /// If the user is a bot, information about the bot; may be null
  bot_info: Option<BotInfo>,
  
}

impl RObject for UserFullInfo {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "userFullInfo" }
  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();
    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 }
}