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;




/// Contains information about a chat invite link
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ChatInviteLinkInfo {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  /// Chat identifier of the invite link; 0 if the user is not a member of this chat
  chat_id: i64,
  /// Contains information about the type of the chat
  #[serde(rename(serialize = "type", deserialize = "type"))] type_: ChatType,
  /// Title of the chat
  title: String,
  /// Chat photo; may be null
  photo: Option<ChatPhoto>,
  /// Number of members
  member_count: i64,
  /// User identifiers of some chat members that may be known to the current user
  member_user_ids: Vec<i64>,
  /// True, if the chat is a public supergroup or a channel with a username
  is_public: bool,
  
}

impl RObject for ChatInviteLinkInfo {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "chatInviteLinkInfo" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}



impl ChatInviteLinkInfo {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDChatInviteLinkInfoBuilder {
    let mut inner = ChatInviteLinkInfo::default();
    inner.td_name = "chatInviteLinkInfo".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDChatInviteLinkInfoBuilder { inner }
  }

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

  pub fn type_(&self) -> &ChatType { &self.type_ }

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

  pub fn photo(&self) -> &Option<ChatPhoto> { &self.photo }

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

  pub fn member_user_ids(&self) -> &Vec<i64> { &self.member_user_ids }

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

}

#[doc(hidden)]
pub struct RTDChatInviteLinkInfoBuilder {
  inner: ChatInviteLinkInfo
}

impl RTDChatInviteLinkInfoBuilder {
  pub fn build(&self) -> ChatInviteLinkInfo { self.inner.clone() }

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

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

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

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

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

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

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

}

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

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