rust_tdlib/types/
internal_link_type.rs

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