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

use crate::types::*;
use crate::errors::*;
use uuid::Uuid;




/// Contains full information about a user
#[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>,
  /// User profile photo; may be null
  photo: Option<ChatPhoto>,
  /// True, if the user is blocked by the current user
  is_blocked: bool,
  /// True, if the user can be called
  can_be_called: bool,
  /// True, if a video call can be created with the user
  supports_video_calls: bool,
  /// True, if the user can't be called due to their privacy settings
  has_private_calls: bool,
  /// True, if the user can't be linked in forwarded messages due to their privacy settings
  has_private_forwards: bool,
  /// True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used
  need_phone_number_privacy_exception: bool,
  /// A short user bio
  bio: String,
  /// For bots, the text that is shown on the bot's profile page and is sent together with the link when users share the bot
  share_text: String,
  /// Contains full information about a user
  description: 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,
  /// For bots, list of the bot commands
  commands: Vec<BotCommand>,
  
}

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 photo(&self) -> &Option<ChatPhoto> { &self.photo }

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

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

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

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

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

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

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

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

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

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

  pub fn commands(&self) -> &Vec<BotCommand> { &self.commands }

}

#[doc(hidden)]
pub struct RTDUserFullInfoBuilder {
  inner: UserFullInfo
}

impl RTDUserFullInfoBuilder {
  pub fn build(&self) -> UserFullInfo { self.inner.clone() }

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

   
  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 supports_video_calls(&mut self, supports_video_calls: bool) -> &mut Self {
    self.inner.supports_video_calls = supports_video_calls;
    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 has_private_forwards(&mut self, has_private_forwards: bool) -> &mut Self {
    self.inner.has_private_forwards = has_private_forwards;
    self
  }

   
  pub fn need_phone_number_privacy_exception(&mut self, need_phone_number_privacy_exception: bool) -> &mut Self {
    self.inner.need_phone_number_privacy_exception = need_phone_number_privacy_exception;
    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 description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
    self.inner.description = description.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 commands(&mut self, commands: Vec<BotCommand>) -> &mut Self {
    self.inner.commands = commands;
    self
  }

}

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

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