rtdlib/types/
internal_link_type.rs

1
2use crate::types::*;
3use crate::errors::*;
4use uuid::Uuid;
5
6
7
8
9use std::fmt::Debug;
10use serde::de::{Deserialize, Deserializer};
11
12
13
14/// TRAIT | Describes an internal https://t.me or tg: link, which must be processed by the app in a special way
15pub trait TDInternalLinkType: Debug + RObject {}
16
17/// Describes an internal https://t.me or tg: link, which must be processed by the app in a special way
18#[derive(Debug, Clone, Serialize)]
19#[serde(untagged)]
20pub enum InternalLinkType {
21  #[doc(hidden)] _Default(()),
22  /// Returns information about the type of an internal link. Returns a 404 error if the link is not internal. Can be called before authorization
23  GetInternalLinkType(GetInternalLinkType),
24  /// The link is a link to the active sessions section of the app. Use getActiveSessions to handle the link
25  ActiveSessions(InternalLinkTypeActiveSessions),
26  /// The link contains an authentication code. Call checkAuthenticationCode with the code if the current authorization state is authorizationStateWaitCode
27  AuthenticationCode(InternalLinkTypeAuthenticationCode),
28  /// The link is a link to a background. Call searchBackground with the given background name to process the link
29  Background(InternalLinkTypeBackground),
30  /// The link is a link to a chat with a Telegram bot. Call searchPublicChat with the given bot username, check that the user is a bot, show START button in the chat with the bot, and then call sendBotStartMessage with the given start parameter after the button is pressed
31  BotStart(InternalLinkTypeBotStart),
32  /// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a group to add the bot to, and then call sendBotStartMessage with the given start parameter and the chosen group chat. Bots can be added to a public group only by administrators of the group
33  BotStartInGroup(InternalLinkTypeBotStartInGroup),
34  /// The link is a link to the change phone number section of the app
35  ChangePhoneNumber(InternalLinkTypeChangePhoneNumber),
36  /// The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link
37  ChatInvite(InternalLinkTypeChatInvite),
38  /// The link is a link to the filter settings section of the app
39  FilterSettings(InternalLinkTypeFilterSettings),
40  /// The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, ask the current user to select a chat to send the game, and then call sendMessage with inputMessageGame
41  Game(InternalLinkTypeGame),
42  /// The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link
43  LanguagePack(InternalLinkTypeLanguagePack),
44  /// The link is a link to a Telegram message. Call getMessageLinkInfo with the given URL to process the link
45  Message(InternalLinkTypeMessage),
46  /// The link contains a message draft text. A share screen needs to be shown to the user, then the chosen chat must be opened and the text is added to the input field
47  MessageDraft(InternalLinkTypeMessageDraft),
48  /// The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the app, otherwise ignore it
49  PassportDataRequest(InternalLinkTypePassportDataRequest),
50  /// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link
51  PhoneNumberConfirmation(InternalLinkTypePhoneNumberConfirmation),
52  /// The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy
53  Proxy(InternalLinkTypeProxy),
54  /// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link
55  PublicChat(InternalLinkTypePublicChat),
56  /// The link can be used to login the current user on another device, but it must be scanned from QR-code using in-app camera. An alert similar to "This code can be used to allow someone to log in to your Telegram account. To confirm Telegram login, please go to Settings > Devices > Scan QR and scan the code" needs to be shown
57  QrCodeAuthentication(InternalLinkTypeQrCodeAuthentication),
58  /// The link is a link to app settings
59  Settings(InternalLinkTypeSettings),
60  /// The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set
61  StickerSet(InternalLinkTypeStickerSet),
62  /// The link is a link to a theme. TDLib has no theme support yet
63  Theme(InternalLinkTypeTheme),
64  /// The link is a link to the theme settings section of the app
65  ThemeSettings(InternalLinkTypeThemeSettings),
66  /// The link is an unknown tg: link. Call getDeepLinkInfo to process the link
67  UnknownDeepLink(InternalLinkTypeUnknownDeepLink),
68  /// The link is a link to an unsupported proxy. An alert can be shown to the user
69  UnsupportedProxy(InternalLinkTypeUnsupportedProxy),
70  /// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGoupCall with the given invite hash to process the link
71  VideoChat(InternalLinkTypeVideoChat),
72
73}
74
75impl Default for InternalLinkType {
76  fn default() -> Self { InternalLinkType::_Default(()) }
77}
78
79impl<'de> Deserialize<'de> for InternalLinkType {
80  fn deserialize<D>(deserializer: D) -> Result<InternalLinkType, D::Error> where D: Deserializer<'de> {
81    use serde::de::Error;
82    rtd_enum_deserialize!(
83      InternalLinkType,
84      (getInternalLinkType, GetInternalLinkType);
85      (internalLinkTypeActiveSessions, ActiveSessions);
86      (internalLinkTypeAuthenticationCode, AuthenticationCode);
87      (internalLinkTypeBackground, Background);
88      (internalLinkTypeBotStart, BotStart);
89      (internalLinkTypeBotStartInGroup, BotStartInGroup);
90      (internalLinkTypeChangePhoneNumber, ChangePhoneNumber);
91      (internalLinkTypeChatInvite, ChatInvite);
92      (internalLinkTypeFilterSettings, FilterSettings);
93      (internalLinkTypeGame, Game);
94      (internalLinkTypeLanguagePack, LanguagePack);
95      (internalLinkTypeMessage, Message);
96      (internalLinkTypeMessageDraft, MessageDraft);
97      (internalLinkTypePassportDataRequest, PassportDataRequest);
98      (internalLinkTypePhoneNumberConfirmation, PhoneNumberConfirmation);
99      (internalLinkTypeProxy, Proxy);
100      (internalLinkTypePublicChat, PublicChat);
101      (internalLinkTypeQrCodeAuthentication, QrCodeAuthentication);
102      (internalLinkTypeSettings, Settings);
103      (internalLinkTypeStickerSet, StickerSet);
104      (internalLinkTypeTheme, Theme);
105      (internalLinkTypeThemeSettings, ThemeSettings);
106      (internalLinkTypeUnknownDeepLink, UnknownDeepLink);
107      (internalLinkTypeUnsupportedProxy, UnsupportedProxy);
108      (internalLinkTypeVideoChat, VideoChat);
109
110    )(deserializer)
111  }
112}
113
114impl RObject for InternalLinkType {
115  #[doc(hidden)] fn td_name(&self) -> &'static str {
116    match self {
117      InternalLinkType::GetInternalLinkType(t) => t.td_name(),
118      InternalLinkType::ActiveSessions(t) => t.td_name(),
119      InternalLinkType::AuthenticationCode(t) => t.td_name(),
120      InternalLinkType::Background(t) => t.td_name(),
121      InternalLinkType::BotStart(t) => t.td_name(),
122      InternalLinkType::BotStartInGroup(t) => t.td_name(),
123      InternalLinkType::ChangePhoneNumber(t) => t.td_name(),
124      InternalLinkType::ChatInvite(t) => t.td_name(),
125      InternalLinkType::FilterSettings(t) => t.td_name(),
126      InternalLinkType::Game(t) => t.td_name(),
127      InternalLinkType::LanguagePack(t) => t.td_name(),
128      InternalLinkType::Message(t) => t.td_name(),
129      InternalLinkType::MessageDraft(t) => t.td_name(),
130      InternalLinkType::PassportDataRequest(t) => t.td_name(),
131      InternalLinkType::PhoneNumberConfirmation(t) => t.td_name(),
132      InternalLinkType::Proxy(t) => t.td_name(),
133      InternalLinkType::PublicChat(t) => t.td_name(),
134      InternalLinkType::QrCodeAuthentication(t) => t.td_name(),
135      InternalLinkType::Settings(t) => t.td_name(),
136      InternalLinkType::StickerSet(t) => t.td_name(),
137      InternalLinkType::Theme(t) => t.td_name(),
138      InternalLinkType::ThemeSettings(t) => t.td_name(),
139      InternalLinkType::UnknownDeepLink(t) => t.td_name(),
140      InternalLinkType::UnsupportedProxy(t) => t.td_name(),
141      InternalLinkType::VideoChat(t) => t.td_name(),
142
143      _ => "-1",
144    }
145  }
146  #[doc(hidden)] fn extra(&self) -> Option<String> {
147    match self {
148      InternalLinkType::GetInternalLinkType(t) => t.extra(),
149      InternalLinkType::ActiveSessions(t) => t.extra(),
150      InternalLinkType::AuthenticationCode(t) => t.extra(),
151      InternalLinkType::Background(t) => t.extra(),
152      InternalLinkType::BotStart(t) => t.extra(),
153      InternalLinkType::BotStartInGroup(t) => t.extra(),
154      InternalLinkType::ChangePhoneNumber(t) => t.extra(),
155      InternalLinkType::ChatInvite(t) => t.extra(),
156      InternalLinkType::FilterSettings(t) => t.extra(),
157      InternalLinkType::Game(t) => t.extra(),
158      InternalLinkType::LanguagePack(t) => t.extra(),
159      InternalLinkType::Message(t) => t.extra(),
160      InternalLinkType::MessageDraft(t) => t.extra(),
161      InternalLinkType::PassportDataRequest(t) => t.extra(),
162      InternalLinkType::PhoneNumberConfirmation(t) => t.extra(),
163      InternalLinkType::Proxy(t) => t.extra(),
164      InternalLinkType::PublicChat(t) => t.extra(),
165      InternalLinkType::QrCodeAuthentication(t) => t.extra(),
166      InternalLinkType::Settings(t) => t.extra(),
167      InternalLinkType::StickerSet(t) => t.extra(),
168      InternalLinkType::Theme(t) => t.extra(),
169      InternalLinkType::ThemeSettings(t) => t.extra(),
170      InternalLinkType::UnknownDeepLink(t) => t.extra(),
171      InternalLinkType::UnsupportedProxy(t) => t.extra(),
172      InternalLinkType::VideoChat(t) => t.extra(),
173
174      _ => None,
175    }
176  }
177  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
178}
179
180impl InternalLinkType {
181  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
182  #[doc(hidden)] pub fn _is_default(&self) -> bool { if let InternalLinkType::_Default(_) = self { true } else { false } }
183
184  pub fn is_get_internal_link_type(&self) -> bool { if let InternalLinkType::GetInternalLinkType(_) = self { true } else { false } }
185  pub fn is_active_sessions(&self) -> bool { if let InternalLinkType::ActiveSessions(_) = self { true } else { false } }
186  pub fn is_authentication_code(&self) -> bool { if let InternalLinkType::AuthenticationCode(_) = self { true } else { false } }
187  pub fn is_background(&self) -> bool { if let InternalLinkType::Background(_) = self { true } else { false } }
188  pub fn is_bot_start(&self) -> bool { if let InternalLinkType::BotStart(_) = self { true } else { false } }
189  pub fn is_bot_start_in_group(&self) -> bool { if let InternalLinkType::BotStartInGroup(_) = self { true } else { false } }
190  pub fn is_change_phone_number(&self) -> bool { if let InternalLinkType::ChangePhoneNumber(_) = self { true } else { false } }
191  pub fn is_chat_invite(&self) -> bool { if let InternalLinkType::ChatInvite(_) = self { true } else { false } }
192  pub fn is_filter_settings(&self) -> bool { if let InternalLinkType::FilterSettings(_) = self { true } else { false } }
193  pub fn is_game(&self) -> bool { if let InternalLinkType::Game(_) = self { true } else { false } }
194  pub fn is_language_pack(&self) -> bool { if let InternalLinkType::LanguagePack(_) = self { true } else { false } }
195  pub fn is_message(&self) -> bool { if let InternalLinkType::Message(_) = self { true } else { false } }
196  pub fn is_message_draft(&self) -> bool { if let InternalLinkType::MessageDraft(_) = self { true } else { false } }
197  pub fn is_passport_data_request(&self) -> bool { if let InternalLinkType::PassportDataRequest(_) = self { true } else { false } }
198  pub fn is_phone_number_confirmation(&self) -> bool { if let InternalLinkType::PhoneNumberConfirmation(_) = self { true } else { false } }
199  pub fn is_proxy(&self) -> bool { if let InternalLinkType::Proxy(_) = self { true } else { false } }
200  pub fn is_public_chat(&self) -> bool { if let InternalLinkType::PublicChat(_) = self { true } else { false } }
201  pub fn is_qr_code_authentication(&self) -> bool { if let InternalLinkType::QrCodeAuthentication(_) = self { true } else { false } }
202  pub fn is_settings(&self) -> bool { if let InternalLinkType::Settings(_) = self { true } else { false } }
203  pub fn is_sticker_set(&self) -> bool { if let InternalLinkType::StickerSet(_) = self { true } else { false } }
204  pub fn is_theme(&self) -> bool { if let InternalLinkType::Theme(_) = self { true } else { false } }
205  pub fn is_theme_settings(&self) -> bool { if let InternalLinkType::ThemeSettings(_) = self { true } else { false } }
206  pub fn is_unknown_deep_link(&self) -> bool { if let InternalLinkType::UnknownDeepLink(_) = self { true } else { false } }
207  pub fn is_unsupported_proxy(&self) -> bool { if let InternalLinkType::UnsupportedProxy(_) = self { true } else { false } }
208  pub fn is_video_chat(&self) -> bool { if let InternalLinkType::VideoChat(_) = self { true } else { false } }
209
210  pub fn on_get_internal_link_type<F: FnOnce(&GetInternalLinkType)>(&self, fnc: F) -> &Self { if let InternalLinkType::GetInternalLinkType(t) = self { fnc(t) }; self }
211  pub fn on_active_sessions<F: FnOnce(&InternalLinkTypeActiveSessions)>(&self, fnc: F) -> &Self { if let InternalLinkType::ActiveSessions(t) = self { fnc(t) }; self }
212  pub fn on_authentication_code<F: FnOnce(&InternalLinkTypeAuthenticationCode)>(&self, fnc: F) -> &Self { if let InternalLinkType::AuthenticationCode(t) = self { fnc(t) }; self }
213  pub fn on_background<F: FnOnce(&InternalLinkTypeBackground)>(&self, fnc: F) -> &Self { if let InternalLinkType::Background(t) = self { fnc(t) }; self }
214  pub fn on_bot_start<F: FnOnce(&InternalLinkTypeBotStart)>(&self, fnc: F) -> &Self { if let InternalLinkType::BotStart(t) = self { fnc(t) }; self }
215  pub fn on_bot_start_in_group<F: FnOnce(&InternalLinkTypeBotStartInGroup)>(&self, fnc: F) -> &Self { if let InternalLinkType::BotStartInGroup(t) = self { fnc(t) }; self }
216  pub fn on_change_phone_number<F: FnOnce(&InternalLinkTypeChangePhoneNumber)>(&self, fnc: F) -> &Self { if let InternalLinkType::ChangePhoneNumber(t) = self { fnc(t) }; self }
217  pub fn on_chat_invite<F: FnOnce(&InternalLinkTypeChatInvite)>(&self, fnc: F) -> &Self { if let InternalLinkType::ChatInvite(t) = self { fnc(t) }; self }
218  pub fn on_filter_settings<F: FnOnce(&InternalLinkTypeFilterSettings)>(&self, fnc: F) -> &Self { if let InternalLinkType::FilterSettings(t) = self { fnc(t) }; self }
219  pub fn on_game<F: FnOnce(&InternalLinkTypeGame)>(&self, fnc: F) -> &Self { if let InternalLinkType::Game(t) = self { fnc(t) }; self }
220  pub fn on_language_pack<F: FnOnce(&InternalLinkTypeLanguagePack)>(&self, fnc: F) -> &Self { if let InternalLinkType::LanguagePack(t) = self { fnc(t) }; self }
221  pub fn on_message<F: FnOnce(&InternalLinkTypeMessage)>(&self, fnc: F) -> &Self { if let InternalLinkType::Message(t) = self { fnc(t) }; self }
222  pub fn on_message_draft<F: FnOnce(&InternalLinkTypeMessageDraft)>(&self, fnc: F) -> &Self { if let InternalLinkType::MessageDraft(t) = self { fnc(t) }; self }
223  pub fn on_passport_data_request<F: FnOnce(&InternalLinkTypePassportDataRequest)>(&self, fnc: F) -> &Self { if let InternalLinkType::PassportDataRequest(t) = self { fnc(t) }; self }
224  pub fn on_phone_number_confirmation<F: FnOnce(&InternalLinkTypePhoneNumberConfirmation)>(&self, fnc: F) -> &Self { if let InternalLinkType::PhoneNumberConfirmation(t) = self { fnc(t) }; self }
225  pub fn on_proxy<F: FnOnce(&InternalLinkTypeProxy)>(&self, fnc: F) -> &Self { if let InternalLinkType::Proxy(t) = self { fnc(t) }; self }
226  pub fn on_public_chat<F: FnOnce(&InternalLinkTypePublicChat)>(&self, fnc: F) -> &Self { if let InternalLinkType::PublicChat(t) = self { fnc(t) }; self }
227  pub fn on_qr_code_authentication<F: FnOnce(&InternalLinkTypeQrCodeAuthentication)>(&self, fnc: F) -> &Self { if let InternalLinkType::QrCodeAuthentication(t) = self { fnc(t) }; self }
228  pub fn on_settings<F: FnOnce(&InternalLinkTypeSettings)>(&self, fnc: F) -> &Self { if let InternalLinkType::Settings(t) = self { fnc(t) }; self }
229  pub fn on_sticker_set<F: FnOnce(&InternalLinkTypeStickerSet)>(&self, fnc: F) -> &Self { if let InternalLinkType::StickerSet(t) = self { fnc(t) }; self }
230  pub fn on_theme<F: FnOnce(&InternalLinkTypeTheme)>(&self, fnc: F) -> &Self { if let InternalLinkType::Theme(t) = self { fnc(t) }; self }
231  pub fn on_theme_settings<F: FnOnce(&InternalLinkTypeThemeSettings)>(&self, fnc: F) -> &Self { if let InternalLinkType::ThemeSettings(t) = self { fnc(t) }; self }
232  pub fn on_unknown_deep_link<F: FnOnce(&InternalLinkTypeUnknownDeepLink)>(&self, fnc: F) -> &Self { if let InternalLinkType::UnknownDeepLink(t) = self { fnc(t) }; self }
233  pub fn on_unsupported_proxy<F: FnOnce(&InternalLinkTypeUnsupportedProxy)>(&self, fnc: F) -> &Self { if let InternalLinkType::UnsupportedProxy(t) = self { fnc(t) }; self }
234  pub fn on_video_chat<F: FnOnce(&InternalLinkTypeVideoChat)>(&self, fnc: F) -> &Self { if let InternalLinkType::VideoChat(t) = self { fnc(t) }; self }
235
236  pub fn as_get_internal_link_type(&self) -> Option<&GetInternalLinkType> { if let InternalLinkType::GetInternalLinkType(t) = self { return Some(t) } None }
237  pub fn as_active_sessions(&self) -> Option<&InternalLinkTypeActiveSessions> { if let InternalLinkType::ActiveSessions(t) = self { return Some(t) } None }
238  pub fn as_authentication_code(&self) -> Option<&InternalLinkTypeAuthenticationCode> { if let InternalLinkType::AuthenticationCode(t) = self { return Some(t) } None }
239  pub fn as_background(&self) -> Option<&InternalLinkTypeBackground> { if let InternalLinkType::Background(t) = self { return Some(t) } None }
240  pub fn as_bot_start(&self) -> Option<&InternalLinkTypeBotStart> { if let InternalLinkType::BotStart(t) = self { return Some(t) } None }
241  pub fn as_bot_start_in_group(&self) -> Option<&InternalLinkTypeBotStartInGroup> { if let InternalLinkType::BotStartInGroup(t) = self { return Some(t) } None }
242  pub fn as_change_phone_number(&self) -> Option<&InternalLinkTypeChangePhoneNumber> { if let InternalLinkType::ChangePhoneNumber(t) = self { return Some(t) } None }
243  pub fn as_chat_invite(&self) -> Option<&InternalLinkTypeChatInvite> { if let InternalLinkType::ChatInvite(t) = self { return Some(t) } None }
244  pub fn as_filter_settings(&self) -> Option<&InternalLinkTypeFilterSettings> { if let InternalLinkType::FilterSettings(t) = self { return Some(t) } None }
245  pub fn as_game(&self) -> Option<&InternalLinkTypeGame> { if let InternalLinkType::Game(t) = self { return Some(t) } None }
246  pub fn as_language_pack(&self) -> Option<&InternalLinkTypeLanguagePack> { if let InternalLinkType::LanguagePack(t) = self { return Some(t) } None }
247  pub fn as_message(&self) -> Option<&InternalLinkTypeMessage> { if let InternalLinkType::Message(t) = self { return Some(t) } None }
248  pub fn as_message_draft(&self) -> Option<&InternalLinkTypeMessageDraft> { if let InternalLinkType::MessageDraft(t) = self { return Some(t) } None }
249  pub fn as_passport_data_request(&self) -> Option<&InternalLinkTypePassportDataRequest> { if let InternalLinkType::PassportDataRequest(t) = self { return Some(t) } None }
250  pub fn as_phone_number_confirmation(&self) -> Option<&InternalLinkTypePhoneNumberConfirmation> { if let InternalLinkType::PhoneNumberConfirmation(t) = self { return Some(t) } None }
251  pub fn as_proxy(&self) -> Option<&InternalLinkTypeProxy> { if let InternalLinkType::Proxy(t) = self { return Some(t) } None }
252  pub fn as_public_chat(&self) -> Option<&InternalLinkTypePublicChat> { if let InternalLinkType::PublicChat(t) = self { return Some(t) } None }
253  pub fn as_qr_code_authentication(&self) -> Option<&InternalLinkTypeQrCodeAuthentication> { if let InternalLinkType::QrCodeAuthentication(t) = self { return Some(t) } None }
254  pub fn as_settings(&self) -> Option<&InternalLinkTypeSettings> { if let InternalLinkType::Settings(t) = self { return Some(t) } None }
255  pub fn as_sticker_set(&self) -> Option<&InternalLinkTypeStickerSet> { if let InternalLinkType::StickerSet(t) = self { return Some(t) } None }
256  pub fn as_theme(&self) -> Option<&InternalLinkTypeTheme> { if let InternalLinkType::Theme(t) = self { return Some(t) } None }
257  pub fn as_theme_settings(&self) -> Option<&InternalLinkTypeThemeSettings> { if let InternalLinkType::ThemeSettings(t) = self { return Some(t) } None }
258  pub fn as_unknown_deep_link(&self) -> Option<&InternalLinkTypeUnknownDeepLink> { if let InternalLinkType::UnknownDeepLink(t) = self { return Some(t) } None }
259  pub fn as_unsupported_proxy(&self) -> Option<&InternalLinkTypeUnsupportedProxy> { if let InternalLinkType::UnsupportedProxy(t) = self { return Some(t) } None }
260  pub fn as_video_chat(&self) -> Option<&InternalLinkTypeVideoChat> { if let InternalLinkType::VideoChat(t) = self { return Some(t) } None }
261
262
263
264  pub fn get_internal_link_type<T: AsRef<GetInternalLinkType>>(t: T) -> Self { InternalLinkType::GetInternalLinkType(t.as_ref().clone()) }
265
266  pub fn active_sessions<T: AsRef<InternalLinkTypeActiveSessions>>(t: T) -> Self { InternalLinkType::ActiveSessions(t.as_ref().clone()) }
267
268  pub fn authentication_code<T: AsRef<InternalLinkTypeAuthenticationCode>>(t: T) -> Self { InternalLinkType::AuthenticationCode(t.as_ref().clone()) }
269
270  pub fn background<T: AsRef<InternalLinkTypeBackground>>(t: T) -> Self { InternalLinkType::Background(t.as_ref().clone()) }
271
272  pub fn bot_start<T: AsRef<InternalLinkTypeBotStart>>(t: T) -> Self { InternalLinkType::BotStart(t.as_ref().clone()) }
273
274  pub fn bot_start_in_group<T: AsRef<InternalLinkTypeBotStartInGroup>>(t: T) -> Self { InternalLinkType::BotStartInGroup(t.as_ref().clone()) }
275
276  pub fn change_phone_number<T: AsRef<InternalLinkTypeChangePhoneNumber>>(t: T) -> Self { InternalLinkType::ChangePhoneNumber(t.as_ref().clone()) }
277
278  pub fn chat_invite<T: AsRef<InternalLinkTypeChatInvite>>(t: T) -> Self { InternalLinkType::ChatInvite(t.as_ref().clone()) }
279
280  pub fn filter_settings<T: AsRef<InternalLinkTypeFilterSettings>>(t: T) -> Self { InternalLinkType::FilterSettings(t.as_ref().clone()) }
281
282  pub fn game<T: AsRef<InternalLinkTypeGame>>(t: T) -> Self { InternalLinkType::Game(t.as_ref().clone()) }
283
284  pub fn language_pack<T: AsRef<InternalLinkTypeLanguagePack>>(t: T) -> Self { InternalLinkType::LanguagePack(t.as_ref().clone()) }
285
286  pub fn message<T: AsRef<InternalLinkTypeMessage>>(t: T) -> Self { InternalLinkType::Message(t.as_ref().clone()) }
287
288  pub fn message_draft<T: AsRef<InternalLinkTypeMessageDraft>>(t: T) -> Self { InternalLinkType::MessageDraft(t.as_ref().clone()) }
289
290  pub fn passport_data_request<T: AsRef<InternalLinkTypePassportDataRequest>>(t: T) -> Self { InternalLinkType::PassportDataRequest(t.as_ref().clone()) }
291
292  pub fn phone_number_confirmation<T: AsRef<InternalLinkTypePhoneNumberConfirmation>>(t: T) -> Self { InternalLinkType::PhoneNumberConfirmation(t.as_ref().clone()) }
293
294  pub fn proxy<T: AsRef<InternalLinkTypeProxy>>(t: T) -> Self { InternalLinkType::Proxy(t.as_ref().clone()) }
295
296  pub fn public_chat<T: AsRef<InternalLinkTypePublicChat>>(t: T) -> Self { InternalLinkType::PublicChat(t.as_ref().clone()) }
297
298  pub fn qr_code_authentication<T: AsRef<InternalLinkTypeQrCodeAuthentication>>(t: T) -> Self { InternalLinkType::QrCodeAuthentication(t.as_ref().clone()) }
299
300  pub fn settings<T: AsRef<InternalLinkTypeSettings>>(t: T) -> Self { InternalLinkType::Settings(t.as_ref().clone()) }
301
302  pub fn sticker_set<T: AsRef<InternalLinkTypeStickerSet>>(t: T) -> Self { InternalLinkType::StickerSet(t.as_ref().clone()) }
303
304  pub fn theme<T: AsRef<InternalLinkTypeTheme>>(t: T) -> Self { InternalLinkType::Theme(t.as_ref().clone()) }
305
306  pub fn theme_settings<T: AsRef<InternalLinkTypeThemeSettings>>(t: T) -> Self { InternalLinkType::ThemeSettings(t.as_ref().clone()) }
307
308  pub fn unknown_deep_link<T: AsRef<InternalLinkTypeUnknownDeepLink>>(t: T) -> Self { InternalLinkType::UnknownDeepLink(t.as_ref().clone()) }
309
310  pub fn unsupported_proxy<T: AsRef<InternalLinkTypeUnsupportedProxy>>(t: T) -> Self { InternalLinkType::UnsupportedProxy(t.as_ref().clone()) }
311
312  pub fn video_chat<T: AsRef<InternalLinkTypeVideoChat>>(t: T) -> Self { InternalLinkType::VideoChat(t.as_ref().clone()) }
313
314}
315
316impl AsRef<InternalLinkType> for InternalLinkType {
317  fn as_ref(&self) -> &InternalLinkType { self }
318}
319
320
321
322
323
324
325
326/// The link is a link to the active sessions section of the app. Use getActiveSessions to handle the link
327#[derive(Debug, Clone, Default, Serialize, Deserialize)]
328pub struct InternalLinkTypeActiveSessions {
329  #[doc(hidden)]
330  #[serde(rename(serialize = "@type", deserialize = "@type"))]
331  td_name: String,
332  #[doc(hidden)]
333  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
334  extra: Option<String>,
335  
336}
337
338impl RObject for InternalLinkTypeActiveSessions {
339  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeActiveSessions" }
340  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
341  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
342}
343
344
345impl TDInternalLinkType for InternalLinkTypeActiveSessions {}
346
347
348
349impl InternalLinkTypeActiveSessions {
350  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
351  pub fn builder() -> RTDInternalLinkTypeActiveSessionsBuilder {
352    let mut inner = InternalLinkTypeActiveSessions::default();
353    inner.td_name = "internalLinkTypeActiveSessions".to_string();
354    inner.extra = Some(Uuid::new_v4().to_string());
355    RTDInternalLinkTypeActiveSessionsBuilder { inner }
356  }
357
358}
359
360#[doc(hidden)]
361pub struct RTDInternalLinkTypeActiveSessionsBuilder {
362  inner: InternalLinkTypeActiveSessions
363}
364
365impl RTDInternalLinkTypeActiveSessionsBuilder {
366  pub fn build(&self) -> InternalLinkTypeActiveSessions { self.inner.clone() }
367
368}
369
370impl AsRef<InternalLinkTypeActiveSessions> for InternalLinkTypeActiveSessions {
371  fn as_ref(&self) -> &InternalLinkTypeActiveSessions { self }
372}
373
374impl AsRef<InternalLinkTypeActiveSessions> for RTDInternalLinkTypeActiveSessionsBuilder {
375  fn as_ref(&self) -> &InternalLinkTypeActiveSessions { &self.inner }
376}
377
378
379
380
381
382
383
384/// The link contains an authentication code. Call checkAuthenticationCode with the code if the current authorization state is authorizationStateWaitCode
385#[derive(Debug, Clone, Default, Serialize, Deserialize)]
386pub struct InternalLinkTypeAuthenticationCode {
387  #[doc(hidden)]
388  #[serde(rename(serialize = "@type", deserialize = "@type"))]
389  td_name: String,
390  #[doc(hidden)]
391  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
392  extra: Option<String>,
393  /// The authentication code
394  code: String,
395  
396}
397
398impl RObject for InternalLinkTypeAuthenticationCode {
399  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeAuthenticationCode" }
400  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
401  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
402}
403
404
405impl TDInternalLinkType for InternalLinkTypeAuthenticationCode {}
406
407
408
409impl InternalLinkTypeAuthenticationCode {
410  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
411  pub fn builder() -> RTDInternalLinkTypeAuthenticationCodeBuilder {
412    let mut inner = InternalLinkTypeAuthenticationCode::default();
413    inner.td_name = "internalLinkTypeAuthenticationCode".to_string();
414    inner.extra = Some(Uuid::new_v4().to_string());
415    RTDInternalLinkTypeAuthenticationCodeBuilder { inner }
416  }
417
418  pub fn code(&self) -> &String { &self.code }
419
420}
421
422#[doc(hidden)]
423pub struct RTDInternalLinkTypeAuthenticationCodeBuilder {
424  inner: InternalLinkTypeAuthenticationCode
425}
426
427impl RTDInternalLinkTypeAuthenticationCodeBuilder {
428  pub fn build(&self) -> InternalLinkTypeAuthenticationCode { self.inner.clone() }
429
430   
431  pub fn code<T: AsRef<str>>(&mut self, code: T) -> &mut Self {
432    self.inner.code = code.as_ref().to_string();
433    self
434  }
435
436}
437
438impl AsRef<InternalLinkTypeAuthenticationCode> for InternalLinkTypeAuthenticationCode {
439  fn as_ref(&self) -> &InternalLinkTypeAuthenticationCode { self }
440}
441
442impl AsRef<InternalLinkTypeAuthenticationCode> for RTDInternalLinkTypeAuthenticationCodeBuilder {
443  fn as_ref(&self) -> &InternalLinkTypeAuthenticationCode { &self.inner }
444}
445
446
447
448
449
450
451
452/// The link is a link to a background. Call searchBackground with the given background name to process the link
453#[derive(Debug, Clone, Default, Serialize, Deserialize)]
454pub struct InternalLinkTypeBackground {
455  #[doc(hidden)]
456  #[serde(rename(serialize = "@type", deserialize = "@type"))]
457  td_name: String,
458  #[doc(hidden)]
459  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
460  extra: Option<String>,
461  /// Name of the background
462  background_name: String,
463  
464}
465
466impl RObject for InternalLinkTypeBackground {
467  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeBackground" }
468  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
469  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
470}
471
472
473impl TDInternalLinkType for InternalLinkTypeBackground {}
474
475
476
477impl InternalLinkTypeBackground {
478  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
479  pub fn builder() -> RTDInternalLinkTypeBackgroundBuilder {
480    let mut inner = InternalLinkTypeBackground::default();
481    inner.td_name = "internalLinkTypeBackground".to_string();
482    inner.extra = Some(Uuid::new_v4().to_string());
483    RTDInternalLinkTypeBackgroundBuilder { inner }
484  }
485
486  pub fn background_name(&self) -> &String { &self.background_name }
487
488}
489
490#[doc(hidden)]
491pub struct RTDInternalLinkTypeBackgroundBuilder {
492  inner: InternalLinkTypeBackground
493}
494
495impl RTDInternalLinkTypeBackgroundBuilder {
496  pub fn build(&self) -> InternalLinkTypeBackground { self.inner.clone() }
497
498   
499  pub fn background_name<T: AsRef<str>>(&mut self, background_name: T) -> &mut Self {
500    self.inner.background_name = background_name.as_ref().to_string();
501    self
502  }
503
504}
505
506impl AsRef<InternalLinkTypeBackground> for InternalLinkTypeBackground {
507  fn as_ref(&self) -> &InternalLinkTypeBackground { self }
508}
509
510impl AsRef<InternalLinkTypeBackground> for RTDInternalLinkTypeBackgroundBuilder {
511  fn as_ref(&self) -> &InternalLinkTypeBackground { &self.inner }
512}
513
514
515
516
517
518
519
520/// The link is a link to a chat with a Telegram bot. Call searchPublicChat with the given bot username, check that the user is a bot, show START button in the chat with the bot, and then call sendBotStartMessage with the given start parameter after the button is pressed
521#[derive(Debug, Clone, Default, Serialize, Deserialize)]
522pub struct InternalLinkTypeBotStart {
523  #[doc(hidden)]
524  #[serde(rename(serialize = "@type", deserialize = "@type"))]
525  td_name: String,
526  #[doc(hidden)]
527  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
528  extra: Option<String>,
529  /// Username of the bot
530  bot_username: String,
531  /// The parameter to be passed to sendBotStartMessage
532  start_parameter: String,
533  
534}
535
536impl RObject for InternalLinkTypeBotStart {
537  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeBotStart" }
538  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
539  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
540}
541
542
543impl TDInternalLinkType for InternalLinkTypeBotStart {}
544
545
546
547impl InternalLinkTypeBotStart {
548  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
549  pub fn builder() -> RTDInternalLinkTypeBotStartBuilder {
550    let mut inner = InternalLinkTypeBotStart::default();
551    inner.td_name = "internalLinkTypeBotStart".to_string();
552    inner.extra = Some(Uuid::new_v4().to_string());
553    RTDInternalLinkTypeBotStartBuilder { inner }
554  }
555
556  pub fn bot_username(&self) -> &String { &self.bot_username }
557
558  pub fn start_parameter(&self) -> &String { &self.start_parameter }
559
560}
561
562#[doc(hidden)]
563pub struct RTDInternalLinkTypeBotStartBuilder {
564  inner: InternalLinkTypeBotStart
565}
566
567impl RTDInternalLinkTypeBotStartBuilder {
568  pub fn build(&self) -> InternalLinkTypeBotStart { self.inner.clone() }
569
570   
571  pub fn bot_username<T: AsRef<str>>(&mut self, bot_username: T) -> &mut Self {
572    self.inner.bot_username = bot_username.as_ref().to_string();
573    self
574  }
575
576   
577  pub fn start_parameter<T: AsRef<str>>(&mut self, start_parameter: T) -> &mut Self {
578    self.inner.start_parameter = start_parameter.as_ref().to_string();
579    self
580  }
581
582}
583
584impl AsRef<InternalLinkTypeBotStart> for InternalLinkTypeBotStart {
585  fn as_ref(&self) -> &InternalLinkTypeBotStart { self }
586}
587
588impl AsRef<InternalLinkTypeBotStart> for RTDInternalLinkTypeBotStartBuilder {
589  fn as_ref(&self) -> &InternalLinkTypeBotStart { &self.inner }
590}
591
592
593
594
595
596
597
598/// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a group to add the bot to, and then call sendBotStartMessage with the given start parameter and the chosen group chat. Bots can be added to a public group only by administrators of the group
599#[derive(Debug, Clone, Default, Serialize, Deserialize)]
600pub struct InternalLinkTypeBotStartInGroup {
601  #[doc(hidden)]
602  #[serde(rename(serialize = "@type", deserialize = "@type"))]
603  td_name: String,
604  #[doc(hidden)]
605  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
606  extra: Option<String>,
607  /// Username of the bot
608  bot_username: String,
609  /// The parameter to be passed to sendBotStartMessage
610  start_parameter: String,
611  
612}
613
614impl RObject for InternalLinkTypeBotStartInGroup {
615  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeBotStartInGroup" }
616  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
617  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
618}
619
620
621impl TDInternalLinkType for InternalLinkTypeBotStartInGroup {}
622
623
624
625impl InternalLinkTypeBotStartInGroup {
626  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
627  pub fn builder() -> RTDInternalLinkTypeBotStartInGroupBuilder {
628    let mut inner = InternalLinkTypeBotStartInGroup::default();
629    inner.td_name = "internalLinkTypeBotStartInGroup".to_string();
630    inner.extra = Some(Uuid::new_v4().to_string());
631    RTDInternalLinkTypeBotStartInGroupBuilder { inner }
632  }
633
634  pub fn bot_username(&self) -> &String { &self.bot_username }
635
636  pub fn start_parameter(&self) -> &String { &self.start_parameter }
637
638}
639
640#[doc(hidden)]
641pub struct RTDInternalLinkTypeBotStartInGroupBuilder {
642  inner: InternalLinkTypeBotStartInGroup
643}
644
645impl RTDInternalLinkTypeBotStartInGroupBuilder {
646  pub fn build(&self) -> InternalLinkTypeBotStartInGroup { self.inner.clone() }
647
648   
649  pub fn bot_username<T: AsRef<str>>(&mut self, bot_username: T) -> &mut Self {
650    self.inner.bot_username = bot_username.as_ref().to_string();
651    self
652  }
653
654   
655  pub fn start_parameter<T: AsRef<str>>(&mut self, start_parameter: T) -> &mut Self {
656    self.inner.start_parameter = start_parameter.as_ref().to_string();
657    self
658  }
659
660}
661
662impl AsRef<InternalLinkTypeBotStartInGroup> for InternalLinkTypeBotStartInGroup {
663  fn as_ref(&self) -> &InternalLinkTypeBotStartInGroup { self }
664}
665
666impl AsRef<InternalLinkTypeBotStartInGroup> for RTDInternalLinkTypeBotStartInGroupBuilder {
667  fn as_ref(&self) -> &InternalLinkTypeBotStartInGroup { &self.inner }
668}
669
670
671
672
673
674
675
676/// The link is a link to the change phone number section of the app
677#[derive(Debug, Clone, Default, Serialize, Deserialize)]
678pub struct InternalLinkTypeChangePhoneNumber {
679  #[doc(hidden)]
680  #[serde(rename(serialize = "@type", deserialize = "@type"))]
681  td_name: String,
682  #[doc(hidden)]
683  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
684  extra: Option<String>,
685  
686}
687
688impl RObject for InternalLinkTypeChangePhoneNumber {
689  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeChangePhoneNumber" }
690  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
691  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
692}
693
694
695impl TDInternalLinkType for InternalLinkTypeChangePhoneNumber {}
696
697
698
699impl InternalLinkTypeChangePhoneNumber {
700  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
701  pub fn builder() -> RTDInternalLinkTypeChangePhoneNumberBuilder {
702    let mut inner = InternalLinkTypeChangePhoneNumber::default();
703    inner.td_name = "internalLinkTypeChangePhoneNumber".to_string();
704    inner.extra = Some(Uuid::new_v4().to_string());
705    RTDInternalLinkTypeChangePhoneNumberBuilder { inner }
706  }
707
708}
709
710#[doc(hidden)]
711pub struct RTDInternalLinkTypeChangePhoneNumberBuilder {
712  inner: InternalLinkTypeChangePhoneNumber
713}
714
715impl RTDInternalLinkTypeChangePhoneNumberBuilder {
716  pub fn build(&self) -> InternalLinkTypeChangePhoneNumber { self.inner.clone() }
717
718}
719
720impl AsRef<InternalLinkTypeChangePhoneNumber> for InternalLinkTypeChangePhoneNumber {
721  fn as_ref(&self) -> &InternalLinkTypeChangePhoneNumber { self }
722}
723
724impl AsRef<InternalLinkTypeChangePhoneNumber> for RTDInternalLinkTypeChangePhoneNumberBuilder {
725  fn as_ref(&self) -> &InternalLinkTypeChangePhoneNumber { &self.inner }
726}
727
728
729
730
731
732
733
734/// The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link
735#[derive(Debug, Clone, Default, Serialize, Deserialize)]
736pub struct InternalLinkTypeChatInvite {
737  #[doc(hidden)]
738  #[serde(rename(serialize = "@type", deserialize = "@type"))]
739  td_name: String,
740  #[doc(hidden)]
741  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
742  extra: Option<String>,
743  /// Internal representation of the invite link
744  invite_link: String,
745  
746}
747
748impl RObject for InternalLinkTypeChatInvite {
749  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeChatInvite" }
750  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
751  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
752}
753
754
755impl TDInternalLinkType for InternalLinkTypeChatInvite {}
756
757
758
759impl InternalLinkTypeChatInvite {
760  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
761  pub fn builder() -> RTDInternalLinkTypeChatInviteBuilder {
762    let mut inner = InternalLinkTypeChatInvite::default();
763    inner.td_name = "internalLinkTypeChatInvite".to_string();
764    inner.extra = Some(Uuid::new_v4().to_string());
765    RTDInternalLinkTypeChatInviteBuilder { inner }
766  }
767
768  pub fn invite_link(&self) -> &String { &self.invite_link }
769
770}
771
772#[doc(hidden)]
773pub struct RTDInternalLinkTypeChatInviteBuilder {
774  inner: InternalLinkTypeChatInvite
775}
776
777impl RTDInternalLinkTypeChatInviteBuilder {
778  pub fn build(&self) -> InternalLinkTypeChatInvite { self.inner.clone() }
779
780   
781  pub fn invite_link<T: AsRef<str>>(&mut self, invite_link: T) -> &mut Self {
782    self.inner.invite_link = invite_link.as_ref().to_string();
783    self
784  }
785
786}
787
788impl AsRef<InternalLinkTypeChatInvite> for InternalLinkTypeChatInvite {
789  fn as_ref(&self) -> &InternalLinkTypeChatInvite { self }
790}
791
792impl AsRef<InternalLinkTypeChatInvite> for RTDInternalLinkTypeChatInviteBuilder {
793  fn as_ref(&self) -> &InternalLinkTypeChatInvite { &self.inner }
794}
795
796
797
798
799
800
801
802/// The link is a link to the filter settings section of the app
803#[derive(Debug, Clone, Default, Serialize, Deserialize)]
804pub struct InternalLinkTypeFilterSettings {
805  #[doc(hidden)]
806  #[serde(rename(serialize = "@type", deserialize = "@type"))]
807  td_name: String,
808  #[doc(hidden)]
809  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
810  extra: Option<String>,
811  
812}
813
814impl RObject for InternalLinkTypeFilterSettings {
815  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeFilterSettings" }
816  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
817  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
818}
819
820
821impl TDInternalLinkType for InternalLinkTypeFilterSettings {}
822
823
824
825impl InternalLinkTypeFilterSettings {
826  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
827  pub fn builder() -> RTDInternalLinkTypeFilterSettingsBuilder {
828    let mut inner = InternalLinkTypeFilterSettings::default();
829    inner.td_name = "internalLinkTypeFilterSettings".to_string();
830    inner.extra = Some(Uuid::new_v4().to_string());
831    RTDInternalLinkTypeFilterSettingsBuilder { inner }
832  }
833
834}
835
836#[doc(hidden)]
837pub struct RTDInternalLinkTypeFilterSettingsBuilder {
838  inner: InternalLinkTypeFilterSettings
839}
840
841impl RTDInternalLinkTypeFilterSettingsBuilder {
842  pub fn build(&self) -> InternalLinkTypeFilterSettings { self.inner.clone() }
843
844}
845
846impl AsRef<InternalLinkTypeFilterSettings> for InternalLinkTypeFilterSettings {
847  fn as_ref(&self) -> &InternalLinkTypeFilterSettings { self }
848}
849
850impl AsRef<InternalLinkTypeFilterSettings> for RTDInternalLinkTypeFilterSettingsBuilder {
851  fn as_ref(&self) -> &InternalLinkTypeFilterSettings { &self.inner }
852}
853
854
855
856
857
858
859
860/// The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, ask the current user to select a chat to send the game, and then call sendMessage with inputMessageGame
861#[derive(Debug, Clone, Default, Serialize, Deserialize)]
862pub struct InternalLinkTypeGame {
863  #[doc(hidden)]
864  #[serde(rename(serialize = "@type", deserialize = "@type"))]
865  td_name: String,
866  #[doc(hidden)]
867  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
868  extra: Option<String>,
869  /// Username of the bot that owns the game
870  bot_username: String,
871  /// Short name of the game
872  game_short_name: String,
873  
874}
875
876impl RObject for InternalLinkTypeGame {
877  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeGame" }
878  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
879  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
880}
881
882
883impl TDInternalLinkType for InternalLinkTypeGame {}
884
885
886
887impl InternalLinkTypeGame {
888  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
889  pub fn builder() -> RTDInternalLinkTypeGameBuilder {
890    let mut inner = InternalLinkTypeGame::default();
891    inner.td_name = "internalLinkTypeGame".to_string();
892    inner.extra = Some(Uuid::new_v4().to_string());
893    RTDInternalLinkTypeGameBuilder { inner }
894  }
895
896  pub fn bot_username(&self) -> &String { &self.bot_username }
897
898  pub fn game_short_name(&self) -> &String { &self.game_short_name }
899
900}
901
902#[doc(hidden)]
903pub struct RTDInternalLinkTypeGameBuilder {
904  inner: InternalLinkTypeGame
905}
906
907impl RTDInternalLinkTypeGameBuilder {
908  pub fn build(&self) -> InternalLinkTypeGame { self.inner.clone() }
909
910   
911  pub fn bot_username<T: AsRef<str>>(&mut self, bot_username: T) -> &mut Self {
912    self.inner.bot_username = bot_username.as_ref().to_string();
913    self
914  }
915
916   
917  pub fn game_short_name<T: AsRef<str>>(&mut self, game_short_name: T) -> &mut Self {
918    self.inner.game_short_name = game_short_name.as_ref().to_string();
919    self
920  }
921
922}
923
924impl AsRef<InternalLinkTypeGame> for InternalLinkTypeGame {
925  fn as_ref(&self) -> &InternalLinkTypeGame { self }
926}
927
928impl AsRef<InternalLinkTypeGame> for RTDInternalLinkTypeGameBuilder {
929  fn as_ref(&self) -> &InternalLinkTypeGame { &self.inner }
930}
931
932
933
934
935
936
937
938/// The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link
939#[derive(Debug, Clone, Default, Serialize, Deserialize)]
940pub struct InternalLinkTypeLanguagePack {
941  #[doc(hidden)]
942  #[serde(rename(serialize = "@type", deserialize = "@type"))]
943  td_name: String,
944  #[doc(hidden)]
945  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
946  extra: Option<String>,
947  /// Language pack identifier
948  language_pack_id: String,
949  
950}
951
952impl RObject for InternalLinkTypeLanguagePack {
953  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeLanguagePack" }
954  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
955  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
956}
957
958
959impl TDInternalLinkType for InternalLinkTypeLanguagePack {}
960
961
962
963impl InternalLinkTypeLanguagePack {
964  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
965  pub fn builder() -> RTDInternalLinkTypeLanguagePackBuilder {
966    let mut inner = InternalLinkTypeLanguagePack::default();
967    inner.td_name = "internalLinkTypeLanguagePack".to_string();
968    inner.extra = Some(Uuid::new_v4().to_string());
969    RTDInternalLinkTypeLanguagePackBuilder { inner }
970  }
971
972  pub fn language_pack_id(&self) -> &String { &self.language_pack_id }
973
974}
975
976#[doc(hidden)]
977pub struct RTDInternalLinkTypeLanguagePackBuilder {
978  inner: InternalLinkTypeLanguagePack
979}
980
981impl RTDInternalLinkTypeLanguagePackBuilder {
982  pub fn build(&self) -> InternalLinkTypeLanguagePack { self.inner.clone() }
983
984   
985  pub fn language_pack_id<T: AsRef<str>>(&mut self, language_pack_id: T) -> &mut Self {
986    self.inner.language_pack_id = language_pack_id.as_ref().to_string();
987    self
988  }
989
990}
991
992impl AsRef<InternalLinkTypeLanguagePack> for InternalLinkTypeLanguagePack {
993  fn as_ref(&self) -> &InternalLinkTypeLanguagePack { self }
994}
995
996impl AsRef<InternalLinkTypeLanguagePack> for RTDInternalLinkTypeLanguagePackBuilder {
997  fn as_ref(&self) -> &InternalLinkTypeLanguagePack { &self.inner }
998}
999
1000
1001
1002
1003
1004
1005
1006/// The link is a link to a Telegram message. Call getMessageLinkInfo with the given URL to process the link
1007#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1008pub struct InternalLinkTypeMessage {
1009  #[doc(hidden)]
1010  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1011  td_name: String,
1012  #[doc(hidden)]
1013  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1014  extra: Option<String>,
1015  /// URL to be passed to getMessageLinkInfo
1016  url: String,
1017  
1018}
1019
1020impl RObject for InternalLinkTypeMessage {
1021  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeMessage" }
1022  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1023  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1024}
1025
1026
1027impl TDInternalLinkType for InternalLinkTypeMessage {}
1028
1029
1030
1031impl InternalLinkTypeMessage {
1032  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1033  pub fn builder() -> RTDInternalLinkTypeMessageBuilder {
1034    let mut inner = InternalLinkTypeMessage::default();
1035    inner.td_name = "internalLinkTypeMessage".to_string();
1036    inner.extra = Some(Uuid::new_v4().to_string());
1037    RTDInternalLinkTypeMessageBuilder { inner }
1038  }
1039
1040  pub fn url(&self) -> &String { &self.url }
1041
1042}
1043
1044#[doc(hidden)]
1045pub struct RTDInternalLinkTypeMessageBuilder {
1046  inner: InternalLinkTypeMessage
1047}
1048
1049impl RTDInternalLinkTypeMessageBuilder {
1050  pub fn build(&self) -> InternalLinkTypeMessage { self.inner.clone() }
1051
1052   
1053  pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
1054    self.inner.url = url.as_ref().to_string();
1055    self
1056  }
1057
1058}
1059
1060impl AsRef<InternalLinkTypeMessage> for InternalLinkTypeMessage {
1061  fn as_ref(&self) -> &InternalLinkTypeMessage { self }
1062}
1063
1064impl AsRef<InternalLinkTypeMessage> for RTDInternalLinkTypeMessageBuilder {
1065  fn as_ref(&self) -> &InternalLinkTypeMessage { &self.inner }
1066}
1067
1068
1069
1070
1071
1072
1073
1074/// The link contains a message draft text. A share screen needs to be shown to the user, then the chosen chat must be opened and the text is added to the input field
1075#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1076pub struct InternalLinkTypeMessageDraft {
1077  #[doc(hidden)]
1078  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1079  td_name: String,
1080  #[doc(hidden)]
1081  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1082  extra: Option<String>,
1083  /// Message draft text
1084  text: FormattedText,
1085  /// True, if the first line of the text contains a link. If true, the input field needs to be focused and the text after the link must be selected
1086  contains_link: bool,
1087  
1088}
1089
1090impl RObject for InternalLinkTypeMessageDraft {
1091  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeMessageDraft" }
1092  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1093  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1094}
1095
1096
1097impl TDInternalLinkType for InternalLinkTypeMessageDraft {}
1098
1099
1100
1101impl InternalLinkTypeMessageDraft {
1102  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1103  pub fn builder() -> RTDInternalLinkTypeMessageDraftBuilder {
1104    let mut inner = InternalLinkTypeMessageDraft::default();
1105    inner.td_name = "internalLinkTypeMessageDraft".to_string();
1106    inner.extra = Some(Uuid::new_v4().to_string());
1107    RTDInternalLinkTypeMessageDraftBuilder { inner }
1108  }
1109
1110  pub fn text(&self) -> &FormattedText { &self.text }
1111
1112  pub fn contains_link(&self) -> bool { self.contains_link }
1113
1114}
1115
1116#[doc(hidden)]
1117pub struct RTDInternalLinkTypeMessageDraftBuilder {
1118  inner: InternalLinkTypeMessageDraft
1119}
1120
1121impl RTDInternalLinkTypeMessageDraftBuilder {
1122  pub fn build(&self) -> InternalLinkTypeMessageDraft { self.inner.clone() }
1123
1124   
1125  pub fn text<T: AsRef<FormattedText>>(&mut self, text: T) -> &mut Self {
1126    self.inner.text = text.as_ref().clone();
1127    self
1128  }
1129
1130   
1131  pub fn contains_link(&mut self, contains_link: bool) -> &mut Self {
1132    self.inner.contains_link = contains_link;
1133    self
1134  }
1135
1136}
1137
1138impl AsRef<InternalLinkTypeMessageDraft> for InternalLinkTypeMessageDraft {
1139  fn as_ref(&self) -> &InternalLinkTypeMessageDraft { self }
1140}
1141
1142impl AsRef<InternalLinkTypeMessageDraft> for RTDInternalLinkTypeMessageDraftBuilder {
1143  fn as_ref(&self) -> &InternalLinkTypeMessageDraft { &self.inner }
1144}
1145
1146
1147
1148
1149
1150
1151
1152/// The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the app, otherwise ignore it
1153#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1154pub struct InternalLinkTypePassportDataRequest {
1155  #[doc(hidden)]
1156  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1157  td_name: String,
1158  #[doc(hidden)]
1159  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1160  extra: Option<String>,
1161  /// User identifier of the service's bot
1162  bot_user_id: i64,
1163  /// Telegram Passport element types requested by the service
1164  scope: String,
1165  /// Service's public key
1166  public_key: String,
1167  /// Unique request identifier provided by the service
1168  nonce: String,
1169  /// An HTTP URL to open once the request is finished or canceled with the parameter tg_passport=success or tg_passport=cancel respectively. If empty, then the link tgbot{bot_user_id}://passport/success or tgbot{bot_user_id}://passport/cancel needs to be opened instead
1170  callback_url: String,
1171  
1172}
1173
1174impl RObject for InternalLinkTypePassportDataRequest {
1175  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypePassportDataRequest" }
1176  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1177  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1178}
1179
1180
1181impl TDInternalLinkType for InternalLinkTypePassportDataRequest {}
1182
1183
1184
1185impl InternalLinkTypePassportDataRequest {
1186  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1187  pub fn builder() -> RTDInternalLinkTypePassportDataRequestBuilder {
1188    let mut inner = InternalLinkTypePassportDataRequest::default();
1189    inner.td_name = "internalLinkTypePassportDataRequest".to_string();
1190    inner.extra = Some(Uuid::new_v4().to_string());
1191    RTDInternalLinkTypePassportDataRequestBuilder { inner }
1192  }
1193
1194  pub fn bot_user_id(&self) -> i64 { self.bot_user_id }
1195
1196  pub fn scope(&self) -> &String { &self.scope }
1197
1198  pub fn public_key(&self) -> &String { &self.public_key }
1199
1200  pub fn nonce(&self) -> &String { &self.nonce }
1201
1202  pub fn callback_url(&self) -> &String { &self.callback_url }
1203
1204}
1205
1206#[doc(hidden)]
1207pub struct RTDInternalLinkTypePassportDataRequestBuilder {
1208  inner: InternalLinkTypePassportDataRequest
1209}
1210
1211impl RTDInternalLinkTypePassportDataRequestBuilder {
1212  pub fn build(&self) -> InternalLinkTypePassportDataRequest { self.inner.clone() }
1213
1214   
1215  pub fn bot_user_id(&mut self, bot_user_id: i64) -> &mut Self {
1216    self.inner.bot_user_id = bot_user_id;
1217    self
1218  }
1219
1220   
1221  pub fn scope<T: AsRef<str>>(&mut self, scope: T) -> &mut Self {
1222    self.inner.scope = scope.as_ref().to_string();
1223    self
1224  }
1225
1226   
1227  pub fn public_key<T: AsRef<str>>(&mut self, public_key: T) -> &mut Self {
1228    self.inner.public_key = public_key.as_ref().to_string();
1229    self
1230  }
1231
1232   
1233  pub fn nonce<T: AsRef<str>>(&mut self, nonce: T) -> &mut Self {
1234    self.inner.nonce = nonce.as_ref().to_string();
1235    self
1236  }
1237
1238   
1239  pub fn callback_url<T: AsRef<str>>(&mut self, callback_url: T) -> &mut Self {
1240    self.inner.callback_url = callback_url.as_ref().to_string();
1241    self
1242  }
1243
1244}
1245
1246impl AsRef<InternalLinkTypePassportDataRequest> for InternalLinkTypePassportDataRequest {
1247  fn as_ref(&self) -> &InternalLinkTypePassportDataRequest { self }
1248}
1249
1250impl AsRef<InternalLinkTypePassportDataRequest> for RTDInternalLinkTypePassportDataRequestBuilder {
1251  fn as_ref(&self) -> &InternalLinkTypePassportDataRequest { &self.inner }
1252}
1253
1254
1255
1256
1257
1258
1259
1260/// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link
1261#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1262pub struct InternalLinkTypePhoneNumberConfirmation {
1263  #[doc(hidden)]
1264  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1265  td_name: String,
1266  #[doc(hidden)]
1267  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1268  extra: Option<String>,
1269  /// Hash value from the link
1270  hash: String,
1271  /// Phone number value from the link
1272  phone_number: String,
1273  
1274}
1275
1276impl RObject for InternalLinkTypePhoneNumberConfirmation {
1277  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypePhoneNumberConfirmation" }
1278  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1279  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1280}
1281
1282
1283impl TDInternalLinkType for InternalLinkTypePhoneNumberConfirmation {}
1284
1285
1286
1287impl InternalLinkTypePhoneNumberConfirmation {
1288  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1289  pub fn builder() -> RTDInternalLinkTypePhoneNumberConfirmationBuilder {
1290    let mut inner = InternalLinkTypePhoneNumberConfirmation::default();
1291    inner.td_name = "internalLinkTypePhoneNumberConfirmation".to_string();
1292    inner.extra = Some(Uuid::new_v4().to_string());
1293    RTDInternalLinkTypePhoneNumberConfirmationBuilder { inner }
1294  }
1295
1296  pub fn hash(&self) -> &String { &self.hash }
1297
1298  pub fn phone_number(&self) -> &String { &self.phone_number }
1299
1300}
1301
1302#[doc(hidden)]
1303pub struct RTDInternalLinkTypePhoneNumberConfirmationBuilder {
1304  inner: InternalLinkTypePhoneNumberConfirmation
1305}
1306
1307impl RTDInternalLinkTypePhoneNumberConfirmationBuilder {
1308  pub fn build(&self) -> InternalLinkTypePhoneNumberConfirmation { self.inner.clone() }
1309
1310   
1311  pub fn hash<T: AsRef<str>>(&mut self, hash: T) -> &mut Self {
1312    self.inner.hash = hash.as_ref().to_string();
1313    self
1314  }
1315
1316   
1317  pub fn phone_number<T: AsRef<str>>(&mut self, phone_number: T) -> &mut Self {
1318    self.inner.phone_number = phone_number.as_ref().to_string();
1319    self
1320  }
1321
1322}
1323
1324impl AsRef<InternalLinkTypePhoneNumberConfirmation> for InternalLinkTypePhoneNumberConfirmation {
1325  fn as_ref(&self) -> &InternalLinkTypePhoneNumberConfirmation { self }
1326}
1327
1328impl AsRef<InternalLinkTypePhoneNumberConfirmation> for RTDInternalLinkTypePhoneNumberConfirmationBuilder {
1329  fn as_ref(&self) -> &InternalLinkTypePhoneNumberConfirmation { &self.inner }
1330}
1331
1332
1333
1334
1335
1336
1337
1338/// The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy
1339#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1340pub struct InternalLinkTypeProxy {
1341  #[doc(hidden)]
1342  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1343  td_name: String,
1344  #[doc(hidden)]
1345  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1346  extra: Option<String>,
1347  /// Proxy server IP address
1348  server: String,
1349  /// Proxy server port
1350  port: i64,
1351  /// Type of the proxy
1352  #[serde(rename(serialize = "type", deserialize = "type"))] type_: ProxyType,
1353  
1354}
1355
1356impl RObject for InternalLinkTypeProxy {
1357  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeProxy" }
1358  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1359  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1360}
1361
1362
1363impl TDInternalLinkType for InternalLinkTypeProxy {}
1364
1365
1366
1367impl InternalLinkTypeProxy {
1368  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1369  pub fn builder() -> RTDInternalLinkTypeProxyBuilder {
1370    let mut inner = InternalLinkTypeProxy::default();
1371    inner.td_name = "internalLinkTypeProxy".to_string();
1372    inner.extra = Some(Uuid::new_v4().to_string());
1373    RTDInternalLinkTypeProxyBuilder { inner }
1374  }
1375
1376  pub fn server(&self) -> &String { &self.server }
1377
1378  pub fn port(&self) -> i64 { self.port }
1379
1380  pub fn type_(&self) -> &ProxyType { &self.type_ }
1381
1382}
1383
1384#[doc(hidden)]
1385pub struct RTDInternalLinkTypeProxyBuilder {
1386  inner: InternalLinkTypeProxy
1387}
1388
1389impl RTDInternalLinkTypeProxyBuilder {
1390  pub fn build(&self) -> InternalLinkTypeProxy { self.inner.clone() }
1391
1392   
1393  pub fn server<T: AsRef<str>>(&mut self, server: T) -> &mut Self {
1394    self.inner.server = server.as_ref().to_string();
1395    self
1396  }
1397
1398   
1399  pub fn port(&mut self, port: i64) -> &mut Self {
1400    self.inner.port = port;
1401    self
1402  }
1403
1404   
1405  pub fn type_<T: AsRef<ProxyType>>(&mut self, type_: T) -> &mut Self {
1406    self.inner.type_ = type_.as_ref().clone();
1407    self
1408  }
1409
1410}
1411
1412impl AsRef<InternalLinkTypeProxy> for InternalLinkTypeProxy {
1413  fn as_ref(&self) -> &InternalLinkTypeProxy { self }
1414}
1415
1416impl AsRef<InternalLinkTypeProxy> for RTDInternalLinkTypeProxyBuilder {
1417  fn as_ref(&self) -> &InternalLinkTypeProxy { &self.inner }
1418}
1419
1420
1421
1422
1423
1424
1425
1426/// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link
1427#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1428pub struct InternalLinkTypePublicChat {
1429  #[doc(hidden)]
1430  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1431  td_name: String,
1432  #[doc(hidden)]
1433  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1434  extra: Option<String>,
1435  /// Username of the chat
1436  chat_username: String,
1437  
1438}
1439
1440impl RObject for InternalLinkTypePublicChat {
1441  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypePublicChat" }
1442  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1443  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1444}
1445
1446
1447impl TDInternalLinkType for InternalLinkTypePublicChat {}
1448
1449
1450
1451impl InternalLinkTypePublicChat {
1452  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1453  pub fn builder() -> RTDInternalLinkTypePublicChatBuilder {
1454    let mut inner = InternalLinkTypePublicChat::default();
1455    inner.td_name = "internalLinkTypePublicChat".to_string();
1456    inner.extra = Some(Uuid::new_v4().to_string());
1457    RTDInternalLinkTypePublicChatBuilder { inner }
1458  }
1459
1460  pub fn chat_username(&self) -> &String { &self.chat_username }
1461
1462}
1463
1464#[doc(hidden)]
1465pub struct RTDInternalLinkTypePublicChatBuilder {
1466  inner: InternalLinkTypePublicChat
1467}
1468
1469impl RTDInternalLinkTypePublicChatBuilder {
1470  pub fn build(&self) -> InternalLinkTypePublicChat { self.inner.clone() }
1471
1472   
1473  pub fn chat_username<T: AsRef<str>>(&mut self, chat_username: T) -> &mut Self {
1474    self.inner.chat_username = chat_username.as_ref().to_string();
1475    self
1476  }
1477
1478}
1479
1480impl AsRef<InternalLinkTypePublicChat> for InternalLinkTypePublicChat {
1481  fn as_ref(&self) -> &InternalLinkTypePublicChat { self }
1482}
1483
1484impl AsRef<InternalLinkTypePublicChat> for RTDInternalLinkTypePublicChatBuilder {
1485  fn as_ref(&self) -> &InternalLinkTypePublicChat { &self.inner }
1486}
1487
1488
1489
1490
1491
1492
1493
1494/// The link can be used to login the current user on another device, but it must be scanned from QR-code using in-app camera. An alert similar to "This code can be used to allow someone to log in to your Telegram account. To confirm Telegram login, please go to Settings > Devices > Scan QR and scan the code" needs to be shown
1495#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1496pub struct InternalLinkTypeQrCodeAuthentication {
1497  #[doc(hidden)]
1498  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1499  td_name: String,
1500  #[doc(hidden)]
1501  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1502  extra: Option<String>,
1503  
1504}
1505
1506impl RObject for InternalLinkTypeQrCodeAuthentication {
1507  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeQrCodeAuthentication" }
1508  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1509  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1510}
1511
1512
1513impl TDInternalLinkType for InternalLinkTypeQrCodeAuthentication {}
1514
1515
1516
1517impl InternalLinkTypeQrCodeAuthentication {
1518  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1519  pub fn builder() -> RTDInternalLinkTypeQrCodeAuthenticationBuilder {
1520    let mut inner = InternalLinkTypeQrCodeAuthentication::default();
1521    inner.td_name = "internalLinkTypeQrCodeAuthentication".to_string();
1522    inner.extra = Some(Uuid::new_v4().to_string());
1523    RTDInternalLinkTypeQrCodeAuthenticationBuilder { inner }
1524  }
1525
1526}
1527
1528#[doc(hidden)]
1529pub struct RTDInternalLinkTypeQrCodeAuthenticationBuilder {
1530  inner: InternalLinkTypeQrCodeAuthentication
1531}
1532
1533impl RTDInternalLinkTypeQrCodeAuthenticationBuilder {
1534  pub fn build(&self) -> InternalLinkTypeQrCodeAuthentication { self.inner.clone() }
1535
1536}
1537
1538impl AsRef<InternalLinkTypeQrCodeAuthentication> for InternalLinkTypeQrCodeAuthentication {
1539  fn as_ref(&self) -> &InternalLinkTypeQrCodeAuthentication { self }
1540}
1541
1542impl AsRef<InternalLinkTypeQrCodeAuthentication> for RTDInternalLinkTypeQrCodeAuthenticationBuilder {
1543  fn as_ref(&self) -> &InternalLinkTypeQrCodeAuthentication { &self.inner }
1544}
1545
1546
1547
1548
1549
1550
1551
1552/// The link is a link to app settings
1553#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1554pub struct InternalLinkTypeSettings {
1555  #[doc(hidden)]
1556  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1557  td_name: String,
1558  #[doc(hidden)]
1559  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1560  extra: Option<String>,
1561  
1562}
1563
1564impl RObject for InternalLinkTypeSettings {
1565  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeSettings" }
1566  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1567  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1568}
1569
1570
1571impl TDInternalLinkType for InternalLinkTypeSettings {}
1572
1573
1574
1575impl InternalLinkTypeSettings {
1576  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1577  pub fn builder() -> RTDInternalLinkTypeSettingsBuilder {
1578    let mut inner = InternalLinkTypeSettings::default();
1579    inner.td_name = "internalLinkTypeSettings".to_string();
1580    inner.extra = Some(Uuid::new_v4().to_string());
1581    RTDInternalLinkTypeSettingsBuilder { inner }
1582  }
1583
1584}
1585
1586#[doc(hidden)]
1587pub struct RTDInternalLinkTypeSettingsBuilder {
1588  inner: InternalLinkTypeSettings
1589}
1590
1591impl RTDInternalLinkTypeSettingsBuilder {
1592  pub fn build(&self) -> InternalLinkTypeSettings { self.inner.clone() }
1593
1594}
1595
1596impl AsRef<InternalLinkTypeSettings> for InternalLinkTypeSettings {
1597  fn as_ref(&self) -> &InternalLinkTypeSettings { self }
1598}
1599
1600impl AsRef<InternalLinkTypeSettings> for RTDInternalLinkTypeSettingsBuilder {
1601  fn as_ref(&self) -> &InternalLinkTypeSettings { &self.inner }
1602}
1603
1604
1605
1606
1607
1608
1609
1610/// The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set
1611#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1612pub struct InternalLinkTypeStickerSet {
1613  #[doc(hidden)]
1614  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1615  td_name: String,
1616  #[doc(hidden)]
1617  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1618  extra: Option<String>,
1619  /// Name of the sticker set
1620  sticker_set_name: String,
1621  
1622}
1623
1624impl RObject for InternalLinkTypeStickerSet {
1625  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeStickerSet" }
1626  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1627  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1628}
1629
1630
1631impl TDInternalLinkType for InternalLinkTypeStickerSet {}
1632
1633
1634
1635impl InternalLinkTypeStickerSet {
1636  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1637  pub fn builder() -> RTDInternalLinkTypeStickerSetBuilder {
1638    let mut inner = InternalLinkTypeStickerSet::default();
1639    inner.td_name = "internalLinkTypeStickerSet".to_string();
1640    inner.extra = Some(Uuid::new_v4().to_string());
1641    RTDInternalLinkTypeStickerSetBuilder { inner }
1642  }
1643
1644  pub fn sticker_set_name(&self) -> &String { &self.sticker_set_name }
1645
1646}
1647
1648#[doc(hidden)]
1649pub struct RTDInternalLinkTypeStickerSetBuilder {
1650  inner: InternalLinkTypeStickerSet
1651}
1652
1653impl RTDInternalLinkTypeStickerSetBuilder {
1654  pub fn build(&self) -> InternalLinkTypeStickerSet { self.inner.clone() }
1655
1656   
1657  pub fn sticker_set_name<T: AsRef<str>>(&mut self, sticker_set_name: T) -> &mut Self {
1658    self.inner.sticker_set_name = sticker_set_name.as_ref().to_string();
1659    self
1660  }
1661
1662}
1663
1664impl AsRef<InternalLinkTypeStickerSet> for InternalLinkTypeStickerSet {
1665  fn as_ref(&self) -> &InternalLinkTypeStickerSet { self }
1666}
1667
1668impl AsRef<InternalLinkTypeStickerSet> for RTDInternalLinkTypeStickerSetBuilder {
1669  fn as_ref(&self) -> &InternalLinkTypeStickerSet { &self.inner }
1670}
1671
1672
1673
1674
1675
1676
1677
1678/// The link is a link to a theme. TDLib has no theme support yet
1679#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1680pub struct InternalLinkTypeTheme {
1681  #[doc(hidden)]
1682  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1683  td_name: String,
1684  #[doc(hidden)]
1685  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1686  extra: Option<String>,
1687  /// Name of the theme
1688  theme_name: String,
1689  
1690}
1691
1692impl RObject for InternalLinkTypeTheme {
1693  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeTheme" }
1694  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1695  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1696}
1697
1698
1699impl TDInternalLinkType for InternalLinkTypeTheme {}
1700
1701
1702
1703impl InternalLinkTypeTheme {
1704  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1705  pub fn builder() -> RTDInternalLinkTypeThemeBuilder {
1706    let mut inner = InternalLinkTypeTheme::default();
1707    inner.td_name = "internalLinkTypeTheme".to_string();
1708    inner.extra = Some(Uuid::new_v4().to_string());
1709    RTDInternalLinkTypeThemeBuilder { inner }
1710  }
1711
1712  pub fn theme_name(&self) -> &String { &self.theme_name }
1713
1714}
1715
1716#[doc(hidden)]
1717pub struct RTDInternalLinkTypeThemeBuilder {
1718  inner: InternalLinkTypeTheme
1719}
1720
1721impl RTDInternalLinkTypeThemeBuilder {
1722  pub fn build(&self) -> InternalLinkTypeTheme { self.inner.clone() }
1723
1724   
1725  pub fn theme_name<T: AsRef<str>>(&mut self, theme_name: T) -> &mut Self {
1726    self.inner.theme_name = theme_name.as_ref().to_string();
1727    self
1728  }
1729
1730}
1731
1732impl AsRef<InternalLinkTypeTheme> for InternalLinkTypeTheme {
1733  fn as_ref(&self) -> &InternalLinkTypeTheme { self }
1734}
1735
1736impl AsRef<InternalLinkTypeTheme> for RTDInternalLinkTypeThemeBuilder {
1737  fn as_ref(&self) -> &InternalLinkTypeTheme { &self.inner }
1738}
1739
1740
1741
1742
1743
1744
1745
1746/// The link is a link to the theme settings section of the app
1747#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1748pub struct InternalLinkTypeThemeSettings {
1749  #[doc(hidden)]
1750  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1751  td_name: String,
1752  #[doc(hidden)]
1753  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1754  extra: Option<String>,
1755  
1756}
1757
1758impl RObject for InternalLinkTypeThemeSettings {
1759  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeThemeSettings" }
1760  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1761  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1762}
1763
1764
1765impl TDInternalLinkType for InternalLinkTypeThemeSettings {}
1766
1767
1768
1769impl InternalLinkTypeThemeSettings {
1770  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1771  pub fn builder() -> RTDInternalLinkTypeThemeSettingsBuilder {
1772    let mut inner = InternalLinkTypeThemeSettings::default();
1773    inner.td_name = "internalLinkTypeThemeSettings".to_string();
1774    inner.extra = Some(Uuid::new_v4().to_string());
1775    RTDInternalLinkTypeThemeSettingsBuilder { inner }
1776  }
1777
1778}
1779
1780#[doc(hidden)]
1781pub struct RTDInternalLinkTypeThemeSettingsBuilder {
1782  inner: InternalLinkTypeThemeSettings
1783}
1784
1785impl RTDInternalLinkTypeThemeSettingsBuilder {
1786  pub fn build(&self) -> InternalLinkTypeThemeSettings { self.inner.clone() }
1787
1788}
1789
1790impl AsRef<InternalLinkTypeThemeSettings> for InternalLinkTypeThemeSettings {
1791  fn as_ref(&self) -> &InternalLinkTypeThemeSettings { self }
1792}
1793
1794impl AsRef<InternalLinkTypeThemeSettings> for RTDInternalLinkTypeThemeSettingsBuilder {
1795  fn as_ref(&self) -> &InternalLinkTypeThemeSettings { &self.inner }
1796}
1797
1798
1799
1800
1801
1802
1803
1804/// The link is an unknown tg: link. Call getDeepLinkInfo to process the link
1805#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1806pub struct InternalLinkTypeUnknownDeepLink {
1807  #[doc(hidden)]
1808  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1809  td_name: String,
1810  #[doc(hidden)]
1811  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1812  extra: Option<String>,
1813  /// Link to be passed to getDeepLinkInfo
1814  link: String,
1815  
1816}
1817
1818impl RObject for InternalLinkTypeUnknownDeepLink {
1819  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeUnknownDeepLink" }
1820  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1821  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1822}
1823
1824
1825impl TDInternalLinkType for InternalLinkTypeUnknownDeepLink {}
1826
1827
1828
1829impl InternalLinkTypeUnknownDeepLink {
1830  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1831  pub fn builder() -> RTDInternalLinkTypeUnknownDeepLinkBuilder {
1832    let mut inner = InternalLinkTypeUnknownDeepLink::default();
1833    inner.td_name = "internalLinkTypeUnknownDeepLink".to_string();
1834    inner.extra = Some(Uuid::new_v4().to_string());
1835    RTDInternalLinkTypeUnknownDeepLinkBuilder { inner }
1836  }
1837
1838  pub fn link(&self) -> &String { &self.link }
1839
1840}
1841
1842#[doc(hidden)]
1843pub struct RTDInternalLinkTypeUnknownDeepLinkBuilder {
1844  inner: InternalLinkTypeUnknownDeepLink
1845}
1846
1847impl RTDInternalLinkTypeUnknownDeepLinkBuilder {
1848  pub fn build(&self) -> InternalLinkTypeUnknownDeepLink { self.inner.clone() }
1849
1850   
1851  pub fn link<T: AsRef<str>>(&mut self, link: T) -> &mut Self {
1852    self.inner.link = link.as_ref().to_string();
1853    self
1854  }
1855
1856}
1857
1858impl AsRef<InternalLinkTypeUnknownDeepLink> for InternalLinkTypeUnknownDeepLink {
1859  fn as_ref(&self) -> &InternalLinkTypeUnknownDeepLink { self }
1860}
1861
1862impl AsRef<InternalLinkTypeUnknownDeepLink> for RTDInternalLinkTypeUnknownDeepLinkBuilder {
1863  fn as_ref(&self) -> &InternalLinkTypeUnknownDeepLink { &self.inner }
1864}
1865
1866
1867
1868
1869
1870
1871
1872/// The link is a link to an unsupported proxy. An alert can be shown to the user
1873#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1874pub struct InternalLinkTypeUnsupportedProxy {
1875  #[doc(hidden)]
1876  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1877  td_name: String,
1878  #[doc(hidden)]
1879  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1880  extra: Option<String>,
1881  
1882}
1883
1884impl RObject for InternalLinkTypeUnsupportedProxy {
1885  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeUnsupportedProxy" }
1886  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1887  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1888}
1889
1890
1891impl TDInternalLinkType for InternalLinkTypeUnsupportedProxy {}
1892
1893
1894
1895impl InternalLinkTypeUnsupportedProxy {
1896  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1897  pub fn builder() -> RTDInternalLinkTypeUnsupportedProxyBuilder {
1898    let mut inner = InternalLinkTypeUnsupportedProxy::default();
1899    inner.td_name = "internalLinkTypeUnsupportedProxy".to_string();
1900    inner.extra = Some(Uuid::new_v4().to_string());
1901    RTDInternalLinkTypeUnsupportedProxyBuilder { inner }
1902  }
1903
1904}
1905
1906#[doc(hidden)]
1907pub struct RTDInternalLinkTypeUnsupportedProxyBuilder {
1908  inner: InternalLinkTypeUnsupportedProxy
1909}
1910
1911impl RTDInternalLinkTypeUnsupportedProxyBuilder {
1912  pub fn build(&self) -> InternalLinkTypeUnsupportedProxy { self.inner.clone() }
1913
1914}
1915
1916impl AsRef<InternalLinkTypeUnsupportedProxy> for InternalLinkTypeUnsupportedProxy {
1917  fn as_ref(&self) -> &InternalLinkTypeUnsupportedProxy { self }
1918}
1919
1920impl AsRef<InternalLinkTypeUnsupportedProxy> for RTDInternalLinkTypeUnsupportedProxyBuilder {
1921  fn as_ref(&self) -> &InternalLinkTypeUnsupportedProxy { &self.inner }
1922}
1923
1924
1925
1926
1927
1928
1929
1930/// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGoupCall with the given invite hash to process the link
1931#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1932pub struct InternalLinkTypeVideoChat {
1933  #[doc(hidden)]
1934  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1935  td_name: String,
1936  #[doc(hidden)]
1937  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1938  extra: Option<String>,
1939  /// Username of the chat with the video chat
1940  chat_username: String,
1941  /// If non-empty, invite hash to be used to join the video chat without being muted by administrators
1942  invite_hash: String,
1943  /// True, if the video chat is expected to be a live stream in a channel or a broadcast group
1944  is_live_stream: bool,
1945  
1946}
1947
1948impl RObject for InternalLinkTypeVideoChat {
1949  #[doc(hidden)] fn td_name(&self) -> &'static str { "internalLinkTypeVideoChat" }
1950  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1951  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1952}
1953
1954
1955impl TDInternalLinkType for InternalLinkTypeVideoChat {}
1956
1957
1958
1959impl InternalLinkTypeVideoChat {
1960  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1961  pub fn builder() -> RTDInternalLinkTypeVideoChatBuilder {
1962    let mut inner = InternalLinkTypeVideoChat::default();
1963    inner.td_name = "internalLinkTypeVideoChat".to_string();
1964    inner.extra = Some(Uuid::new_v4().to_string());
1965    RTDInternalLinkTypeVideoChatBuilder { inner }
1966  }
1967
1968  pub fn chat_username(&self) -> &String { &self.chat_username }
1969
1970  pub fn invite_hash(&self) -> &String { &self.invite_hash }
1971
1972  pub fn is_live_stream(&self) -> bool { self.is_live_stream }
1973
1974}
1975
1976#[doc(hidden)]
1977pub struct RTDInternalLinkTypeVideoChatBuilder {
1978  inner: InternalLinkTypeVideoChat
1979}
1980
1981impl RTDInternalLinkTypeVideoChatBuilder {
1982  pub fn build(&self) -> InternalLinkTypeVideoChat { self.inner.clone() }
1983
1984   
1985  pub fn chat_username<T: AsRef<str>>(&mut self, chat_username: T) -> &mut Self {
1986    self.inner.chat_username = chat_username.as_ref().to_string();
1987    self
1988  }
1989
1990   
1991  pub fn invite_hash<T: AsRef<str>>(&mut self, invite_hash: T) -> &mut Self {
1992    self.inner.invite_hash = invite_hash.as_ref().to_string();
1993    self
1994  }
1995
1996   
1997  pub fn is_live_stream(&mut self, is_live_stream: bool) -> &mut Self {
1998    self.inner.is_live_stream = is_live_stream;
1999    self
2000  }
2001
2002}
2003
2004impl AsRef<InternalLinkTypeVideoChat> for InternalLinkTypeVideoChat {
2005  fn as_ref(&self) -> &InternalLinkTypeVideoChat { self }
2006}
2007
2008impl AsRef<InternalLinkTypeVideoChat> for RTDInternalLinkTypeVideoChatBuilder {
2009  fn as_ref(&self) -> &InternalLinkTypeVideoChat { &self.inner }
2010}
2011
2012
2013