rust_tdlib/types/
input_inline_query_result.rs

1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5use std::fmt::Debug;
6
7/// Represents a single result of an inline query; for bots only
8pub trait TDInputInlineQueryResult: Debug + RObject {}
9
10/// Represents a single result of an inline query; for bots only
11#[derive(Debug, Clone, Deserialize, Serialize, Default)]
12#[serde(tag = "@type")]
13pub enum InputInlineQueryResult {
14    #[doc(hidden)]
15    #[default]
16    _Default,
17    /// Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video
18    #[serde(rename = "inputInlineQueryResultAnimation")]
19    Animation(InputInlineQueryResultAnimation),
20    /// Represents a link to an article or web page
21    #[serde(rename = "inputInlineQueryResultArticle")]
22    Article(InputInlineQueryResultArticle),
23    /// Represents a link to an MP3 audio file
24    #[serde(rename = "inputInlineQueryResultAudio")]
25    Audio(InputInlineQueryResultAudio),
26    /// Represents a user contact
27    #[serde(rename = "inputInlineQueryResultContact")]
28    Contact(InputInlineQueryResultContact),
29    /// Represents a link to a file
30    #[serde(rename = "inputInlineQueryResultDocument")]
31    Document(InputInlineQueryResultDocument),
32    /// Represents a game
33    #[serde(rename = "inputInlineQueryResultGame")]
34    Game(InputInlineQueryResultGame),
35    /// Represents a point on the map
36    #[serde(rename = "inputInlineQueryResultLocation")]
37    Location(InputInlineQueryResultLocation),
38    /// Represents link to a JPEG image
39    #[serde(rename = "inputInlineQueryResultPhoto")]
40    Photo(InputInlineQueryResultPhoto),
41    /// Represents a link to a WEBP or TGS sticker
42    #[serde(rename = "inputInlineQueryResultSticker")]
43    Sticker(InputInlineQueryResultSticker),
44    /// Represents information about a venue
45    #[serde(rename = "inputInlineQueryResultVenue")]
46    Venue(InputInlineQueryResultVenue),
47    /// Represents a link to a page containing an embedded video player or a video file
48    #[serde(rename = "inputInlineQueryResultVideo")]
49    Video(InputInlineQueryResultVideo),
50    /// Represents a link to an opus-encoded audio file within an OGG container, single channel audio
51    #[serde(rename = "inputInlineQueryResultVoiceNote")]
52    VoiceNote(InputInlineQueryResultVoiceNote),
53}
54
55impl RObject for InputInlineQueryResult {
56    #[doc(hidden)]
57    fn extra(&self) -> Option<&str> {
58        match self {
59            InputInlineQueryResult::Animation(t) => t.extra(),
60            InputInlineQueryResult::Article(t) => t.extra(),
61            InputInlineQueryResult::Audio(t) => t.extra(),
62            InputInlineQueryResult::Contact(t) => t.extra(),
63            InputInlineQueryResult::Document(t) => t.extra(),
64            InputInlineQueryResult::Game(t) => t.extra(),
65            InputInlineQueryResult::Location(t) => t.extra(),
66            InputInlineQueryResult::Photo(t) => t.extra(),
67            InputInlineQueryResult::Sticker(t) => t.extra(),
68            InputInlineQueryResult::Venue(t) => t.extra(),
69            InputInlineQueryResult::Video(t) => t.extra(),
70            InputInlineQueryResult::VoiceNote(t) => t.extra(),
71
72            _ => None,
73        }
74    }
75    #[doc(hidden)]
76    fn client_id(&self) -> Option<i32> {
77        match self {
78            InputInlineQueryResult::Animation(t) => t.client_id(),
79            InputInlineQueryResult::Article(t) => t.client_id(),
80            InputInlineQueryResult::Audio(t) => t.client_id(),
81            InputInlineQueryResult::Contact(t) => t.client_id(),
82            InputInlineQueryResult::Document(t) => t.client_id(),
83            InputInlineQueryResult::Game(t) => t.client_id(),
84            InputInlineQueryResult::Location(t) => t.client_id(),
85            InputInlineQueryResult::Photo(t) => t.client_id(),
86            InputInlineQueryResult::Sticker(t) => t.client_id(),
87            InputInlineQueryResult::Venue(t) => t.client_id(),
88            InputInlineQueryResult::Video(t) => t.client_id(),
89            InputInlineQueryResult::VoiceNote(t) => t.client_id(),
90
91            _ => None,
92        }
93    }
94}
95
96impl InputInlineQueryResult {
97    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
98        Ok(serde_json::from_str(json.as_ref())?)
99    }
100    #[doc(hidden)]
101    pub fn _is_default(&self) -> bool {
102        matches!(self, InputInlineQueryResult::_Default)
103    }
104}
105
106impl AsRef<InputInlineQueryResult> for InputInlineQueryResult {
107    fn as_ref(&self) -> &InputInlineQueryResult {
108        self
109    }
110}
111
112/// Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video
113#[derive(Debug, Clone, Default, Serialize, Deserialize)]
114pub struct InputInlineQueryResultAnimation {
115    #[doc(hidden)]
116    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
117    extra: Option<String>,
118    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
119    client_id: Option<i32>,
120    /// Unique identifier of the query result
121
122    #[serde(default)]
123    id: String,
124    /// Title of the query result
125
126    #[serde(default)]
127    title: String,
128    /// URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists
129
130    #[serde(default)]
131    thumbnail_url: String,
132    /// MIME type of the video thumbnail. If non-empty, must be one of "image/jpeg", "image/gif" and "video/mp4"
133
134    #[serde(default)]
135    thumbnail_mime_type: String,
136    /// The URL of the video file (file size must not exceed 1MB)
137
138    #[serde(default)]
139    video_url: String,
140    /// MIME type of the video file. Must be one of "image/gif" and "video/mp4"
141
142    #[serde(default)]
143    video_mime_type: String,
144    /// Duration of the video, in seconds
145
146    #[serde(default)]
147    video_duration: i32,
148    /// Width of the video
149
150    #[serde(default)]
151    video_width: i32,
152    /// Height of the video
153
154    #[serde(default)]
155    video_height: i32,
156    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
157
158    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
159    reply_markup: ReplyMarkup,
160    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
161
162    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
163    input_message_content: InputMessageContent,
164}
165
166impl RObject for InputInlineQueryResultAnimation {
167    #[doc(hidden)]
168    fn extra(&self) -> Option<&str> {
169        self.extra.as_deref()
170    }
171    #[doc(hidden)]
172    fn client_id(&self) -> Option<i32> {
173        self.client_id
174    }
175}
176
177impl TDInputInlineQueryResult for InputInlineQueryResultAnimation {}
178
179impl InputInlineQueryResultAnimation {
180    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
181        Ok(serde_json::from_str(json.as_ref())?)
182    }
183    pub fn builder() -> InputInlineQueryResultAnimationBuilder {
184        let mut inner = InputInlineQueryResultAnimation::default();
185        inner.extra = Some(Uuid::new_v4().to_string());
186
187        InputInlineQueryResultAnimationBuilder { inner }
188    }
189
190    pub fn id(&self) -> &String {
191        &self.id
192    }
193
194    pub fn title(&self) -> &String {
195        &self.title
196    }
197
198    pub fn thumbnail_url(&self) -> &String {
199        &self.thumbnail_url
200    }
201
202    pub fn thumbnail_mime_type(&self) -> &String {
203        &self.thumbnail_mime_type
204    }
205
206    pub fn video_url(&self) -> &String {
207        &self.video_url
208    }
209
210    pub fn video_mime_type(&self) -> &String {
211        &self.video_mime_type
212    }
213
214    pub fn video_duration(&self) -> i32 {
215        self.video_duration
216    }
217
218    pub fn video_width(&self) -> i32 {
219        self.video_width
220    }
221
222    pub fn video_height(&self) -> i32 {
223        self.video_height
224    }
225
226    pub fn reply_markup(&self) -> &ReplyMarkup {
227        &self.reply_markup
228    }
229
230    pub fn input_message_content(&self) -> &InputMessageContent {
231        &self.input_message_content
232    }
233}
234
235#[doc(hidden)]
236pub struct InputInlineQueryResultAnimationBuilder {
237    inner: InputInlineQueryResultAnimation,
238}
239
240#[deprecated]
241pub type RTDInputInlineQueryResultAnimationBuilder = InputInlineQueryResultAnimationBuilder;
242
243impl InputInlineQueryResultAnimationBuilder {
244    pub fn build(&self) -> InputInlineQueryResultAnimation {
245        self.inner.clone()
246    }
247
248    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
249        self.inner.id = id.as_ref().to_string();
250        self
251    }
252
253    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
254        self.inner.title = title.as_ref().to_string();
255        self
256    }
257
258    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
259        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
260        self
261    }
262
263    pub fn thumbnail_mime_type<T: AsRef<str>>(&mut self, thumbnail_mime_type: T) -> &mut Self {
264        self.inner.thumbnail_mime_type = thumbnail_mime_type.as_ref().to_string();
265        self
266    }
267
268    pub fn video_url<T: AsRef<str>>(&mut self, video_url: T) -> &mut Self {
269        self.inner.video_url = video_url.as_ref().to_string();
270        self
271    }
272
273    pub fn video_mime_type<T: AsRef<str>>(&mut self, video_mime_type: T) -> &mut Self {
274        self.inner.video_mime_type = video_mime_type.as_ref().to_string();
275        self
276    }
277
278    pub fn video_duration(&mut self, video_duration: i32) -> &mut Self {
279        self.inner.video_duration = video_duration;
280        self
281    }
282
283    pub fn video_width(&mut self, video_width: i32) -> &mut Self {
284        self.inner.video_width = video_width;
285        self
286    }
287
288    pub fn video_height(&mut self, video_height: i32) -> &mut Self {
289        self.inner.video_height = video_height;
290        self
291    }
292
293    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
294        self.inner.reply_markup = reply_markup.as_ref().clone();
295        self
296    }
297
298    pub fn input_message_content<T: AsRef<InputMessageContent>>(
299        &mut self,
300        input_message_content: T,
301    ) -> &mut Self {
302        self.inner.input_message_content = input_message_content.as_ref().clone();
303        self
304    }
305}
306
307impl AsRef<InputInlineQueryResultAnimation> for InputInlineQueryResultAnimation {
308    fn as_ref(&self) -> &InputInlineQueryResultAnimation {
309        self
310    }
311}
312
313impl AsRef<InputInlineQueryResultAnimation> for InputInlineQueryResultAnimationBuilder {
314    fn as_ref(&self) -> &InputInlineQueryResultAnimation {
315        &self.inner
316    }
317}
318
319/// Represents a link to an article or web page
320#[derive(Debug, Clone, Default, Serialize, Deserialize)]
321pub struct InputInlineQueryResultArticle {
322    #[doc(hidden)]
323    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
324    extra: Option<String>,
325    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
326    client_id: Option<i32>,
327    /// Unique identifier of the query result
328
329    #[serde(default)]
330    id: String,
331    /// URL of the result, if it exists
332
333    #[serde(default)]
334    url: String,
335    /// True, if the URL must be not shown
336
337    #[serde(default)]
338    hide_url: bool,
339    /// Title of the result
340
341    #[serde(default)]
342    title: String,
343    /// Represents a link to an article or web page
344
345    #[serde(default)]
346    description: String,
347    /// URL of the result thumbnail, if it exists
348
349    #[serde(default)]
350    thumbnail_url: String,
351    /// Thumbnail width, if known
352
353    #[serde(default)]
354    thumbnail_width: i32,
355    /// Thumbnail height, if known
356
357    #[serde(default)]
358    thumbnail_height: i32,
359    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
360
361    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
362    reply_markup: ReplyMarkup,
363    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
364
365    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
366    input_message_content: InputMessageContent,
367}
368
369impl RObject for InputInlineQueryResultArticle {
370    #[doc(hidden)]
371    fn extra(&self) -> Option<&str> {
372        self.extra.as_deref()
373    }
374    #[doc(hidden)]
375    fn client_id(&self) -> Option<i32> {
376        self.client_id
377    }
378}
379
380impl TDInputInlineQueryResult for InputInlineQueryResultArticle {}
381
382impl InputInlineQueryResultArticle {
383    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
384        Ok(serde_json::from_str(json.as_ref())?)
385    }
386    pub fn builder() -> InputInlineQueryResultArticleBuilder {
387        let mut inner = InputInlineQueryResultArticle::default();
388        inner.extra = Some(Uuid::new_v4().to_string());
389
390        InputInlineQueryResultArticleBuilder { inner }
391    }
392
393    pub fn id(&self) -> &String {
394        &self.id
395    }
396
397    pub fn url(&self) -> &String {
398        &self.url
399    }
400
401    pub fn hide_url(&self) -> bool {
402        self.hide_url
403    }
404
405    pub fn title(&self) -> &String {
406        &self.title
407    }
408
409    pub fn description(&self) -> &String {
410        &self.description
411    }
412
413    pub fn thumbnail_url(&self) -> &String {
414        &self.thumbnail_url
415    }
416
417    pub fn thumbnail_width(&self) -> i32 {
418        self.thumbnail_width
419    }
420
421    pub fn thumbnail_height(&self) -> i32 {
422        self.thumbnail_height
423    }
424
425    pub fn reply_markup(&self) -> &ReplyMarkup {
426        &self.reply_markup
427    }
428
429    pub fn input_message_content(&self) -> &InputMessageContent {
430        &self.input_message_content
431    }
432}
433
434#[doc(hidden)]
435pub struct InputInlineQueryResultArticleBuilder {
436    inner: InputInlineQueryResultArticle,
437}
438
439#[deprecated]
440pub type RTDInputInlineQueryResultArticleBuilder = InputInlineQueryResultArticleBuilder;
441
442impl InputInlineQueryResultArticleBuilder {
443    pub fn build(&self) -> InputInlineQueryResultArticle {
444        self.inner.clone()
445    }
446
447    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
448        self.inner.id = id.as_ref().to_string();
449        self
450    }
451
452    pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
453        self.inner.url = url.as_ref().to_string();
454        self
455    }
456
457    pub fn hide_url(&mut self, hide_url: bool) -> &mut Self {
458        self.inner.hide_url = hide_url;
459        self
460    }
461
462    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
463        self.inner.title = title.as_ref().to_string();
464        self
465    }
466
467    pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
468        self.inner.description = description.as_ref().to_string();
469        self
470    }
471
472    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
473        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
474        self
475    }
476
477    pub fn thumbnail_width(&mut self, thumbnail_width: i32) -> &mut Self {
478        self.inner.thumbnail_width = thumbnail_width;
479        self
480    }
481
482    pub fn thumbnail_height(&mut self, thumbnail_height: i32) -> &mut Self {
483        self.inner.thumbnail_height = thumbnail_height;
484        self
485    }
486
487    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
488        self.inner.reply_markup = reply_markup.as_ref().clone();
489        self
490    }
491
492    pub fn input_message_content<T: AsRef<InputMessageContent>>(
493        &mut self,
494        input_message_content: T,
495    ) -> &mut Self {
496        self.inner.input_message_content = input_message_content.as_ref().clone();
497        self
498    }
499}
500
501impl AsRef<InputInlineQueryResultArticle> for InputInlineQueryResultArticle {
502    fn as_ref(&self) -> &InputInlineQueryResultArticle {
503        self
504    }
505}
506
507impl AsRef<InputInlineQueryResultArticle> for InputInlineQueryResultArticleBuilder {
508    fn as_ref(&self) -> &InputInlineQueryResultArticle {
509        &self.inner
510    }
511}
512
513/// Represents a link to an MP3 audio file
514#[derive(Debug, Clone, Default, Serialize, Deserialize)]
515pub struct InputInlineQueryResultAudio {
516    #[doc(hidden)]
517    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
518    extra: Option<String>,
519    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
520    client_id: Option<i32>,
521    /// Unique identifier of the query result
522
523    #[serde(default)]
524    id: String,
525    /// Title of the audio file
526
527    #[serde(default)]
528    title: String,
529    /// Performer of the audio file
530
531    #[serde(default)]
532    performer: String,
533    /// The URL of the audio file
534
535    #[serde(default)]
536    audio_url: String,
537    /// Audio file duration, in seconds
538
539    #[serde(default)]
540    audio_duration: i32,
541    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
542
543    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
544    reply_markup: ReplyMarkup,
545    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageAudio, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
546
547    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
548    input_message_content: InputMessageContent,
549}
550
551impl RObject for InputInlineQueryResultAudio {
552    #[doc(hidden)]
553    fn extra(&self) -> Option<&str> {
554        self.extra.as_deref()
555    }
556    #[doc(hidden)]
557    fn client_id(&self) -> Option<i32> {
558        self.client_id
559    }
560}
561
562impl TDInputInlineQueryResult for InputInlineQueryResultAudio {}
563
564impl InputInlineQueryResultAudio {
565    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
566        Ok(serde_json::from_str(json.as_ref())?)
567    }
568    pub fn builder() -> InputInlineQueryResultAudioBuilder {
569        let mut inner = InputInlineQueryResultAudio::default();
570        inner.extra = Some(Uuid::new_v4().to_string());
571
572        InputInlineQueryResultAudioBuilder { inner }
573    }
574
575    pub fn id(&self) -> &String {
576        &self.id
577    }
578
579    pub fn title(&self) -> &String {
580        &self.title
581    }
582
583    pub fn performer(&self) -> &String {
584        &self.performer
585    }
586
587    pub fn audio_url(&self) -> &String {
588        &self.audio_url
589    }
590
591    pub fn audio_duration(&self) -> i32 {
592        self.audio_duration
593    }
594
595    pub fn reply_markup(&self) -> &ReplyMarkup {
596        &self.reply_markup
597    }
598
599    pub fn input_message_content(&self) -> &InputMessageContent {
600        &self.input_message_content
601    }
602}
603
604#[doc(hidden)]
605pub struct InputInlineQueryResultAudioBuilder {
606    inner: InputInlineQueryResultAudio,
607}
608
609#[deprecated]
610pub type RTDInputInlineQueryResultAudioBuilder = InputInlineQueryResultAudioBuilder;
611
612impl InputInlineQueryResultAudioBuilder {
613    pub fn build(&self) -> InputInlineQueryResultAudio {
614        self.inner.clone()
615    }
616
617    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
618        self.inner.id = id.as_ref().to_string();
619        self
620    }
621
622    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
623        self.inner.title = title.as_ref().to_string();
624        self
625    }
626
627    pub fn performer<T: AsRef<str>>(&mut self, performer: T) -> &mut Self {
628        self.inner.performer = performer.as_ref().to_string();
629        self
630    }
631
632    pub fn audio_url<T: AsRef<str>>(&mut self, audio_url: T) -> &mut Self {
633        self.inner.audio_url = audio_url.as_ref().to_string();
634        self
635    }
636
637    pub fn audio_duration(&mut self, audio_duration: i32) -> &mut Self {
638        self.inner.audio_duration = audio_duration;
639        self
640    }
641
642    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
643        self.inner.reply_markup = reply_markup.as_ref().clone();
644        self
645    }
646
647    pub fn input_message_content<T: AsRef<InputMessageContent>>(
648        &mut self,
649        input_message_content: T,
650    ) -> &mut Self {
651        self.inner.input_message_content = input_message_content.as_ref().clone();
652        self
653    }
654}
655
656impl AsRef<InputInlineQueryResultAudio> for InputInlineQueryResultAudio {
657    fn as_ref(&self) -> &InputInlineQueryResultAudio {
658        self
659    }
660}
661
662impl AsRef<InputInlineQueryResultAudio> for InputInlineQueryResultAudioBuilder {
663    fn as_ref(&self) -> &InputInlineQueryResultAudio {
664        &self.inner
665    }
666}
667
668/// Represents a user contact
669#[derive(Debug, Clone, Default, Serialize, Deserialize)]
670pub struct InputInlineQueryResultContact {
671    #[doc(hidden)]
672    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
673    extra: Option<String>,
674    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
675    client_id: Option<i32>,
676    /// Unique identifier of the query result
677
678    #[serde(default)]
679    id: String,
680    /// User contact
681    contact: Contact,
682    /// URL of the result thumbnail, if it exists
683
684    #[serde(default)]
685    thumbnail_url: String,
686    /// Thumbnail width, if known
687
688    #[serde(default)]
689    thumbnail_width: i32,
690    /// Thumbnail height, if known
691
692    #[serde(default)]
693    thumbnail_height: i32,
694    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
695
696    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
697    reply_markup: ReplyMarkup,
698    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
699
700    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
701    input_message_content: InputMessageContent,
702}
703
704impl RObject for InputInlineQueryResultContact {
705    #[doc(hidden)]
706    fn extra(&self) -> Option<&str> {
707        self.extra.as_deref()
708    }
709    #[doc(hidden)]
710    fn client_id(&self) -> Option<i32> {
711        self.client_id
712    }
713}
714
715impl TDInputInlineQueryResult for InputInlineQueryResultContact {}
716
717impl InputInlineQueryResultContact {
718    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
719        Ok(serde_json::from_str(json.as_ref())?)
720    }
721    pub fn builder() -> InputInlineQueryResultContactBuilder {
722        let mut inner = InputInlineQueryResultContact::default();
723        inner.extra = Some(Uuid::new_v4().to_string());
724
725        InputInlineQueryResultContactBuilder { inner }
726    }
727
728    pub fn id(&self) -> &String {
729        &self.id
730    }
731
732    pub fn contact(&self) -> &Contact {
733        &self.contact
734    }
735
736    pub fn thumbnail_url(&self) -> &String {
737        &self.thumbnail_url
738    }
739
740    pub fn thumbnail_width(&self) -> i32 {
741        self.thumbnail_width
742    }
743
744    pub fn thumbnail_height(&self) -> i32 {
745        self.thumbnail_height
746    }
747
748    pub fn reply_markup(&self) -> &ReplyMarkup {
749        &self.reply_markup
750    }
751
752    pub fn input_message_content(&self) -> &InputMessageContent {
753        &self.input_message_content
754    }
755}
756
757#[doc(hidden)]
758pub struct InputInlineQueryResultContactBuilder {
759    inner: InputInlineQueryResultContact,
760}
761
762#[deprecated]
763pub type RTDInputInlineQueryResultContactBuilder = InputInlineQueryResultContactBuilder;
764
765impl InputInlineQueryResultContactBuilder {
766    pub fn build(&self) -> InputInlineQueryResultContact {
767        self.inner.clone()
768    }
769
770    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
771        self.inner.id = id.as_ref().to_string();
772        self
773    }
774
775    pub fn contact<T: AsRef<Contact>>(&mut self, contact: T) -> &mut Self {
776        self.inner.contact = contact.as_ref().clone();
777        self
778    }
779
780    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
781        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
782        self
783    }
784
785    pub fn thumbnail_width(&mut self, thumbnail_width: i32) -> &mut Self {
786        self.inner.thumbnail_width = thumbnail_width;
787        self
788    }
789
790    pub fn thumbnail_height(&mut self, thumbnail_height: i32) -> &mut Self {
791        self.inner.thumbnail_height = thumbnail_height;
792        self
793    }
794
795    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
796        self.inner.reply_markup = reply_markup.as_ref().clone();
797        self
798    }
799
800    pub fn input_message_content<T: AsRef<InputMessageContent>>(
801        &mut self,
802        input_message_content: T,
803    ) -> &mut Self {
804        self.inner.input_message_content = input_message_content.as_ref().clone();
805        self
806    }
807}
808
809impl AsRef<InputInlineQueryResultContact> for InputInlineQueryResultContact {
810    fn as_ref(&self) -> &InputInlineQueryResultContact {
811        self
812    }
813}
814
815impl AsRef<InputInlineQueryResultContact> for InputInlineQueryResultContactBuilder {
816    fn as_ref(&self) -> &InputInlineQueryResultContact {
817        &self.inner
818    }
819}
820
821/// Represents a link to a file
822#[derive(Debug, Clone, Default, Serialize, Deserialize)]
823pub struct InputInlineQueryResultDocument {
824    #[doc(hidden)]
825    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
826    extra: Option<String>,
827    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
828    client_id: Option<i32>,
829    /// Unique identifier of the query result
830
831    #[serde(default)]
832    id: String,
833    /// Title of the resulting file
834
835    #[serde(default)]
836    title: String,
837    /// Represents a link to a file
838
839    #[serde(default)]
840    description: String,
841    /// URL of the file
842
843    #[serde(default)]
844    document_url: String,
845    /// MIME type of the file content; only "application/pdf" and "application/zip" are currently allowed
846
847    #[serde(default)]
848    mime_type: String,
849    /// The URL of the file thumbnail, if it exists
850
851    #[serde(default)]
852    thumbnail_url: String,
853    /// Width of the thumbnail
854
855    #[serde(default)]
856    thumbnail_width: i32,
857    /// Height of the thumbnail
858
859    #[serde(default)]
860    thumbnail_height: i32,
861    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
862
863    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
864    reply_markup: ReplyMarkup,
865    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageDocument, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
866
867    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
868    input_message_content: InputMessageContent,
869}
870
871impl RObject for InputInlineQueryResultDocument {
872    #[doc(hidden)]
873    fn extra(&self) -> Option<&str> {
874        self.extra.as_deref()
875    }
876    #[doc(hidden)]
877    fn client_id(&self) -> Option<i32> {
878        self.client_id
879    }
880}
881
882impl TDInputInlineQueryResult for InputInlineQueryResultDocument {}
883
884impl InputInlineQueryResultDocument {
885    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
886        Ok(serde_json::from_str(json.as_ref())?)
887    }
888    pub fn builder() -> InputInlineQueryResultDocumentBuilder {
889        let mut inner = InputInlineQueryResultDocument::default();
890        inner.extra = Some(Uuid::new_v4().to_string());
891
892        InputInlineQueryResultDocumentBuilder { inner }
893    }
894
895    pub fn id(&self) -> &String {
896        &self.id
897    }
898
899    pub fn title(&self) -> &String {
900        &self.title
901    }
902
903    pub fn description(&self) -> &String {
904        &self.description
905    }
906
907    pub fn document_url(&self) -> &String {
908        &self.document_url
909    }
910
911    pub fn mime_type(&self) -> &String {
912        &self.mime_type
913    }
914
915    pub fn thumbnail_url(&self) -> &String {
916        &self.thumbnail_url
917    }
918
919    pub fn thumbnail_width(&self) -> i32 {
920        self.thumbnail_width
921    }
922
923    pub fn thumbnail_height(&self) -> i32 {
924        self.thumbnail_height
925    }
926
927    pub fn reply_markup(&self) -> &ReplyMarkup {
928        &self.reply_markup
929    }
930
931    pub fn input_message_content(&self) -> &InputMessageContent {
932        &self.input_message_content
933    }
934}
935
936#[doc(hidden)]
937pub struct InputInlineQueryResultDocumentBuilder {
938    inner: InputInlineQueryResultDocument,
939}
940
941#[deprecated]
942pub type RTDInputInlineQueryResultDocumentBuilder = InputInlineQueryResultDocumentBuilder;
943
944impl InputInlineQueryResultDocumentBuilder {
945    pub fn build(&self) -> InputInlineQueryResultDocument {
946        self.inner.clone()
947    }
948
949    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
950        self.inner.id = id.as_ref().to_string();
951        self
952    }
953
954    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
955        self.inner.title = title.as_ref().to_string();
956        self
957    }
958
959    pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
960        self.inner.description = description.as_ref().to_string();
961        self
962    }
963
964    pub fn document_url<T: AsRef<str>>(&mut self, document_url: T) -> &mut Self {
965        self.inner.document_url = document_url.as_ref().to_string();
966        self
967    }
968
969    pub fn mime_type<T: AsRef<str>>(&mut self, mime_type: T) -> &mut Self {
970        self.inner.mime_type = mime_type.as_ref().to_string();
971        self
972    }
973
974    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
975        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
976        self
977    }
978
979    pub fn thumbnail_width(&mut self, thumbnail_width: i32) -> &mut Self {
980        self.inner.thumbnail_width = thumbnail_width;
981        self
982    }
983
984    pub fn thumbnail_height(&mut self, thumbnail_height: i32) -> &mut Self {
985        self.inner.thumbnail_height = thumbnail_height;
986        self
987    }
988
989    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
990        self.inner.reply_markup = reply_markup.as_ref().clone();
991        self
992    }
993
994    pub fn input_message_content<T: AsRef<InputMessageContent>>(
995        &mut self,
996        input_message_content: T,
997    ) -> &mut Self {
998        self.inner.input_message_content = input_message_content.as_ref().clone();
999        self
1000    }
1001}
1002
1003impl AsRef<InputInlineQueryResultDocument> for InputInlineQueryResultDocument {
1004    fn as_ref(&self) -> &InputInlineQueryResultDocument {
1005        self
1006    }
1007}
1008
1009impl AsRef<InputInlineQueryResultDocument> for InputInlineQueryResultDocumentBuilder {
1010    fn as_ref(&self) -> &InputInlineQueryResultDocument {
1011        &self.inner
1012    }
1013}
1014
1015/// Represents a game
1016#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1017pub struct InputInlineQueryResultGame {
1018    #[doc(hidden)]
1019    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1020    extra: Option<String>,
1021    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1022    client_id: Option<i32>,
1023    /// Unique identifier of the query result
1024
1025    #[serde(default)]
1026    id: String,
1027    /// Short name of the game
1028
1029    #[serde(default)]
1030    game_short_name: String,
1031    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
1032
1033    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
1034    reply_markup: ReplyMarkup,
1035}
1036
1037impl RObject for InputInlineQueryResultGame {
1038    #[doc(hidden)]
1039    fn extra(&self) -> Option<&str> {
1040        self.extra.as_deref()
1041    }
1042    #[doc(hidden)]
1043    fn client_id(&self) -> Option<i32> {
1044        self.client_id
1045    }
1046}
1047
1048impl TDInputInlineQueryResult for InputInlineQueryResultGame {}
1049
1050impl InputInlineQueryResultGame {
1051    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1052        Ok(serde_json::from_str(json.as_ref())?)
1053    }
1054    pub fn builder() -> InputInlineQueryResultGameBuilder {
1055        let mut inner = InputInlineQueryResultGame::default();
1056        inner.extra = Some(Uuid::new_v4().to_string());
1057
1058        InputInlineQueryResultGameBuilder { inner }
1059    }
1060
1061    pub fn id(&self) -> &String {
1062        &self.id
1063    }
1064
1065    pub fn game_short_name(&self) -> &String {
1066        &self.game_short_name
1067    }
1068
1069    pub fn reply_markup(&self) -> &ReplyMarkup {
1070        &self.reply_markup
1071    }
1072}
1073
1074#[doc(hidden)]
1075pub struct InputInlineQueryResultGameBuilder {
1076    inner: InputInlineQueryResultGame,
1077}
1078
1079#[deprecated]
1080pub type RTDInputInlineQueryResultGameBuilder = InputInlineQueryResultGameBuilder;
1081
1082impl InputInlineQueryResultGameBuilder {
1083    pub fn build(&self) -> InputInlineQueryResultGame {
1084        self.inner.clone()
1085    }
1086
1087    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1088        self.inner.id = id.as_ref().to_string();
1089        self
1090    }
1091
1092    pub fn game_short_name<T: AsRef<str>>(&mut self, game_short_name: T) -> &mut Self {
1093        self.inner.game_short_name = game_short_name.as_ref().to_string();
1094        self
1095    }
1096
1097    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
1098        self.inner.reply_markup = reply_markup.as_ref().clone();
1099        self
1100    }
1101}
1102
1103impl AsRef<InputInlineQueryResultGame> for InputInlineQueryResultGame {
1104    fn as_ref(&self) -> &InputInlineQueryResultGame {
1105        self
1106    }
1107}
1108
1109impl AsRef<InputInlineQueryResultGame> for InputInlineQueryResultGameBuilder {
1110    fn as_ref(&self) -> &InputInlineQueryResultGame {
1111        &self.inner
1112    }
1113}
1114
1115/// Represents a point on the map
1116#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1117pub struct InputInlineQueryResultLocation {
1118    #[doc(hidden)]
1119    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1120    extra: Option<String>,
1121    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1122    client_id: Option<i32>,
1123    /// Unique identifier of the query result
1124
1125    #[serde(default)]
1126    id: String,
1127    /// Location result
1128    location: Location,
1129    /// Amount of time relative to the message sent time until the location can be updated, in seconds
1130
1131    #[serde(default)]
1132    live_period: i32,
1133    /// Title of the result
1134
1135    #[serde(default)]
1136    title: String,
1137    /// URL of the result thumbnail, if it exists
1138
1139    #[serde(default)]
1140    thumbnail_url: String,
1141    /// Thumbnail width, if known
1142
1143    #[serde(default)]
1144    thumbnail_width: i32,
1145    /// Thumbnail height, if known
1146
1147    #[serde(default)]
1148    thumbnail_height: i32,
1149    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
1150
1151    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
1152    reply_markup: ReplyMarkup,
1153    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
1154
1155    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
1156    input_message_content: InputMessageContent,
1157}
1158
1159impl RObject for InputInlineQueryResultLocation {
1160    #[doc(hidden)]
1161    fn extra(&self) -> Option<&str> {
1162        self.extra.as_deref()
1163    }
1164    #[doc(hidden)]
1165    fn client_id(&self) -> Option<i32> {
1166        self.client_id
1167    }
1168}
1169
1170impl TDInputInlineQueryResult for InputInlineQueryResultLocation {}
1171
1172impl InputInlineQueryResultLocation {
1173    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1174        Ok(serde_json::from_str(json.as_ref())?)
1175    }
1176    pub fn builder() -> InputInlineQueryResultLocationBuilder {
1177        let mut inner = InputInlineQueryResultLocation::default();
1178        inner.extra = Some(Uuid::new_v4().to_string());
1179
1180        InputInlineQueryResultLocationBuilder { inner }
1181    }
1182
1183    pub fn id(&self) -> &String {
1184        &self.id
1185    }
1186
1187    pub fn location(&self) -> &Location {
1188        &self.location
1189    }
1190
1191    pub fn live_period(&self) -> i32 {
1192        self.live_period
1193    }
1194
1195    pub fn title(&self) -> &String {
1196        &self.title
1197    }
1198
1199    pub fn thumbnail_url(&self) -> &String {
1200        &self.thumbnail_url
1201    }
1202
1203    pub fn thumbnail_width(&self) -> i32 {
1204        self.thumbnail_width
1205    }
1206
1207    pub fn thumbnail_height(&self) -> i32 {
1208        self.thumbnail_height
1209    }
1210
1211    pub fn reply_markup(&self) -> &ReplyMarkup {
1212        &self.reply_markup
1213    }
1214
1215    pub fn input_message_content(&self) -> &InputMessageContent {
1216        &self.input_message_content
1217    }
1218}
1219
1220#[doc(hidden)]
1221pub struct InputInlineQueryResultLocationBuilder {
1222    inner: InputInlineQueryResultLocation,
1223}
1224
1225#[deprecated]
1226pub type RTDInputInlineQueryResultLocationBuilder = InputInlineQueryResultLocationBuilder;
1227
1228impl InputInlineQueryResultLocationBuilder {
1229    pub fn build(&self) -> InputInlineQueryResultLocation {
1230        self.inner.clone()
1231    }
1232
1233    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1234        self.inner.id = id.as_ref().to_string();
1235        self
1236    }
1237
1238    pub fn location<T: AsRef<Location>>(&mut self, location: T) -> &mut Self {
1239        self.inner.location = location.as_ref().clone();
1240        self
1241    }
1242
1243    pub fn live_period(&mut self, live_period: i32) -> &mut Self {
1244        self.inner.live_period = live_period;
1245        self
1246    }
1247
1248    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
1249        self.inner.title = title.as_ref().to_string();
1250        self
1251    }
1252
1253    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
1254        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
1255        self
1256    }
1257
1258    pub fn thumbnail_width(&mut self, thumbnail_width: i32) -> &mut Self {
1259        self.inner.thumbnail_width = thumbnail_width;
1260        self
1261    }
1262
1263    pub fn thumbnail_height(&mut self, thumbnail_height: i32) -> &mut Self {
1264        self.inner.thumbnail_height = thumbnail_height;
1265        self
1266    }
1267
1268    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
1269        self.inner.reply_markup = reply_markup.as_ref().clone();
1270        self
1271    }
1272
1273    pub fn input_message_content<T: AsRef<InputMessageContent>>(
1274        &mut self,
1275        input_message_content: T,
1276    ) -> &mut Self {
1277        self.inner.input_message_content = input_message_content.as_ref().clone();
1278        self
1279    }
1280}
1281
1282impl AsRef<InputInlineQueryResultLocation> for InputInlineQueryResultLocation {
1283    fn as_ref(&self) -> &InputInlineQueryResultLocation {
1284        self
1285    }
1286}
1287
1288impl AsRef<InputInlineQueryResultLocation> for InputInlineQueryResultLocationBuilder {
1289    fn as_ref(&self) -> &InputInlineQueryResultLocation {
1290        &self.inner
1291    }
1292}
1293
1294/// Represents link to a JPEG image
1295#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1296pub struct InputInlineQueryResultPhoto {
1297    #[doc(hidden)]
1298    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1299    extra: Option<String>,
1300    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1301    client_id: Option<i32>,
1302    /// Unique identifier of the query result
1303
1304    #[serde(default)]
1305    id: String,
1306    /// Title of the result, if known
1307
1308    #[serde(default)]
1309    title: String,
1310    /// Represents link to a JPEG image
1311
1312    #[serde(default)]
1313    description: String,
1314    /// URL of the photo thumbnail, if it exists
1315
1316    #[serde(default)]
1317    thumbnail_url: String,
1318    /// The URL of the JPEG photo (photo size must not exceed 5MB)
1319
1320    #[serde(default)]
1321    photo_url: String,
1322    /// Width of the photo
1323
1324    #[serde(default)]
1325    photo_width: i32,
1326    /// Height of the photo
1327
1328    #[serde(default)]
1329    photo_height: i32,
1330    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
1331
1332    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
1333    reply_markup: ReplyMarkup,
1334    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessagePhoto, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
1335
1336    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
1337    input_message_content: InputMessageContent,
1338}
1339
1340impl RObject for InputInlineQueryResultPhoto {
1341    #[doc(hidden)]
1342    fn extra(&self) -> Option<&str> {
1343        self.extra.as_deref()
1344    }
1345    #[doc(hidden)]
1346    fn client_id(&self) -> Option<i32> {
1347        self.client_id
1348    }
1349}
1350
1351impl TDInputInlineQueryResult for InputInlineQueryResultPhoto {}
1352
1353impl InputInlineQueryResultPhoto {
1354    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1355        Ok(serde_json::from_str(json.as_ref())?)
1356    }
1357    pub fn builder() -> InputInlineQueryResultPhotoBuilder {
1358        let mut inner = InputInlineQueryResultPhoto::default();
1359        inner.extra = Some(Uuid::new_v4().to_string());
1360
1361        InputInlineQueryResultPhotoBuilder { inner }
1362    }
1363
1364    pub fn id(&self) -> &String {
1365        &self.id
1366    }
1367
1368    pub fn title(&self) -> &String {
1369        &self.title
1370    }
1371
1372    pub fn description(&self) -> &String {
1373        &self.description
1374    }
1375
1376    pub fn thumbnail_url(&self) -> &String {
1377        &self.thumbnail_url
1378    }
1379
1380    pub fn photo_url(&self) -> &String {
1381        &self.photo_url
1382    }
1383
1384    pub fn photo_width(&self) -> i32 {
1385        self.photo_width
1386    }
1387
1388    pub fn photo_height(&self) -> i32 {
1389        self.photo_height
1390    }
1391
1392    pub fn reply_markup(&self) -> &ReplyMarkup {
1393        &self.reply_markup
1394    }
1395
1396    pub fn input_message_content(&self) -> &InputMessageContent {
1397        &self.input_message_content
1398    }
1399}
1400
1401#[doc(hidden)]
1402pub struct InputInlineQueryResultPhotoBuilder {
1403    inner: InputInlineQueryResultPhoto,
1404}
1405
1406#[deprecated]
1407pub type RTDInputInlineQueryResultPhotoBuilder = InputInlineQueryResultPhotoBuilder;
1408
1409impl InputInlineQueryResultPhotoBuilder {
1410    pub fn build(&self) -> InputInlineQueryResultPhoto {
1411        self.inner.clone()
1412    }
1413
1414    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1415        self.inner.id = id.as_ref().to_string();
1416        self
1417    }
1418
1419    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
1420        self.inner.title = title.as_ref().to_string();
1421        self
1422    }
1423
1424    pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
1425        self.inner.description = description.as_ref().to_string();
1426        self
1427    }
1428
1429    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
1430        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
1431        self
1432    }
1433
1434    pub fn photo_url<T: AsRef<str>>(&mut self, photo_url: T) -> &mut Self {
1435        self.inner.photo_url = photo_url.as_ref().to_string();
1436        self
1437    }
1438
1439    pub fn photo_width(&mut self, photo_width: i32) -> &mut Self {
1440        self.inner.photo_width = photo_width;
1441        self
1442    }
1443
1444    pub fn photo_height(&mut self, photo_height: i32) -> &mut Self {
1445        self.inner.photo_height = photo_height;
1446        self
1447    }
1448
1449    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
1450        self.inner.reply_markup = reply_markup.as_ref().clone();
1451        self
1452    }
1453
1454    pub fn input_message_content<T: AsRef<InputMessageContent>>(
1455        &mut self,
1456        input_message_content: T,
1457    ) -> &mut Self {
1458        self.inner.input_message_content = input_message_content.as_ref().clone();
1459        self
1460    }
1461}
1462
1463impl AsRef<InputInlineQueryResultPhoto> for InputInlineQueryResultPhoto {
1464    fn as_ref(&self) -> &InputInlineQueryResultPhoto {
1465        self
1466    }
1467}
1468
1469impl AsRef<InputInlineQueryResultPhoto> for InputInlineQueryResultPhotoBuilder {
1470    fn as_ref(&self) -> &InputInlineQueryResultPhoto {
1471        &self.inner
1472    }
1473}
1474
1475/// Represents a link to a WEBP or TGS sticker
1476#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1477pub struct InputInlineQueryResultSticker {
1478    #[doc(hidden)]
1479    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1480    extra: Option<String>,
1481    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1482    client_id: Option<i32>,
1483    /// Unique identifier of the query result
1484
1485    #[serde(default)]
1486    id: String,
1487    /// URL of the sticker thumbnail, if it exists
1488
1489    #[serde(default)]
1490    thumbnail_url: String,
1491    /// The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB)
1492
1493    #[serde(default)]
1494    sticker_url: String,
1495    /// Width of the sticker
1496
1497    #[serde(default)]
1498    sticker_width: i32,
1499    /// Height of the sticker
1500
1501    #[serde(default)]
1502    sticker_height: i32,
1503    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
1504
1505    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
1506    reply_markup: ReplyMarkup,
1507    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageSticker, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
1508
1509    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
1510    input_message_content: InputMessageContent,
1511}
1512
1513impl RObject for InputInlineQueryResultSticker {
1514    #[doc(hidden)]
1515    fn extra(&self) -> Option<&str> {
1516        self.extra.as_deref()
1517    }
1518    #[doc(hidden)]
1519    fn client_id(&self) -> Option<i32> {
1520        self.client_id
1521    }
1522}
1523
1524impl TDInputInlineQueryResult for InputInlineQueryResultSticker {}
1525
1526impl InputInlineQueryResultSticker {
1527    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1528        Ok(serde_json::from_str(json.as_ref())?)
1529    }
1530    pub fn builder() -> InputInlineQueryResultStickerBuilder {
1531        let mut inner = InputInlineQueryResultSticker::default();
1532        inner.extra = Some(Uuid::new_v4().to_string());
1533
1534        InputInlineQueryResultStickerBuilder { inner }
1535    }
1536
1537    pub fn id(&self) -> &String {
1538        &self.id
1539    }
1540
1541    pub fn thumbnail_url(&self) -> &String {
1542        &self.thumbnail_url
1543    }
1544
1545    pub fn sticker_url(&self) -> &String {
1546        &self.sticker_url
1547    }
1548
1549    pub fn sticker_width(&self) -> i32 {
1550        self.sticker_width
1551    }
1552
1553    pub fn sticker_height(&self) -> i32 {
1554        self.sticker_height
1555    }
1556
1557    pub fn reply_markup(&self) -> &ReplyMarkup {
1558        &self.reply_markup
1559    }
1560
1561    pub fn input_message_content(&self) -> &InputMessageContent {
1562        &self.input_message_content
1563    }
1564}
1565
1566#[doc(hidden)]
1567pub struct InputInlineQueryResultStickerBuilder {
1568    inner: InputInlineQueryResultSticker,
1569}
1570
1571#[deprecated]
1572pub type RTDInputInlineQueryResultStickerBuilder = InputInlineQueryResultStickerBuilder;
1573
1574impl InputInlineQueryResultStickerBuilder {
1575    pub fn build(&self) -> InputInlineQueryResultSticker {
1576        self.inner.clone()
1577    }
1578
1579    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1580        self.inner.id = id.as_ref().to_string();
1581        self
1582    }
1583
1584    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
1585        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
1586        self
1587    }
1588
1589    pub fn sticker_url<T: AsRef<str>>(&mut self, sticker_url: T) -> &mut Self {
1590        self.inner.sticker_url = sticker_url.as_ref().to_string();
1591        self
1592    }
1593
1594    pub fn sticker_width(&mut self, sticker_width: i32) -> &mut Self {
1595        self.inner.sticker_width = sticker_width;
1596        self
1597    }
1598
1599    pub fn sticker_height(&mut self, sticker_height: i32) -> &mut Self {
1600        self.inner.sticker_height = sticker_height;
1601        self
1602    }
1603
1604    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
1605        self.inner.reply_markup = reply_markup.as_ref().clone();
1606        self
1607    }
1608
1609    pub fn input_message_content<T: AsRef<InputMessageContent>>(
1610        &mut self,
1611        input_message_content: T,
1612    ) -> &mut Self {
1613        self.inner.input_message_content = input_message_content.as_ref().clone();
1614        self
1615    }
1616}
1617
1618impl AsRef<InputInlineQueryResultSticker> for InputInlineQueryResultSticker {
1619    fn as_ref(&self) -> &InputInlineQueryResultSticker {
1620        self
1621    }
1622}
1623
1624impl AsRef<InputInlineQueryResultSticker> for InputInlineQueryResultStickerBuilder {
1625    fn as_ref(&self) -> &InputInlineQueryResultSticker {
1626        &self.inner
1627    }
1628}
1629
1630/// Represents information about a venue
1631#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1632pub struct InputInlineQueryResultVenue {
1633    #[doc(hidden)]
1634    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1635    extra: Option<String>,
1636    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1637    client_id: Option<i32>,
1638    /// Unique identifier of the query result
1639
1640    #[serde(default)]
1641    id: String,
1642    /// Venue result
1643    venue: Venue,
1644    /// URL of the result thumbnail, if it exists
1645
1646    #[serde(default)]
1647    thumbnail_url: String,
1648    /// Thumbnail width, if known
1649
1650    #[serde(default)]
1651    thumbnail_width: i32,
1652    /// Thumbnail height, if known
1653
1654    #[serde(default)]
1655    thumbnail_height: i32,
1656    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
1657
1658    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
1659    reply_markup: ReplyMarkup,
1660    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
1661
1662    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
1663    input_message_content: InputMessageContent,
1664}
1665
1666impl RObject for InputInlineQueryResultVenue {
1667    #[doc(hidden)]
1668    fn extra(&self) -> Option<&str> {
1669        self.extra.as_deref()
1670    }
1671    #[doc(hidden)]
1672    fn client_id(&self) -> Option<i32> {
1673        self.client_id
1674    }
1675}
1676
1677impl TDInputInlineQueryResult for InputInlineQueryResultVenue {}
1678
1679impl InputInlineQueryResultVenue {
1680    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1681        Ok(serde_json::from_str(json.as_ref())?)
1682    }
1683    pub fn builder() -> InputInlineQueryResultVenueBuilder {
1684        let mut inner = InputInlineQueryResultVenue::default();
1685        inner.extra = Some(Uuid::new_v4().to_string());
1686
1687        InputInlineQueryResultVenueBuilder { inner }
1688    }
1689
1690    pub fn id(&self) -> &String {
1691        &self.id
1692    }
1693
1694    pub fn venue(&self) -> &Venue {
1695        &self.venue
1696    }
1697
1698    pub fn thumbnail_url(&self) -> &String {
1699        &self.thumbnail_url
1700    }
1701
1702    pub fn thumbnail_width(&self) -> i32 {
1703        self.thumbnail_width
1704    }
1705
1706    pub fn thumbnail_height(&self) -> i32 {
1707        self.thumbnail_height
1708    }
1709
1710    pub fn reply_markup(&self) -> &ReplyMarkup {
1711        &self.reply_markup
1712    }
1713
1714    pub fn input_message_content(&self) -> &InputMessageContent {
1715        &self.input_message_content
1716    }
1717}
1718
1719#[doc(hidden)]
1720pub struct InputInlineQueryResultVenueBuilder {
1721    inner: InputInlineQueryResultVenue,
1722}
1723
1724#[deprecated]
1725pub type RTDInputInlineQueryResultVenueBuilder = InputInlineQueryResultVenueBuilder;
1726
1727impl InputInlineQueryResultVenueBuilder {
1728    pub fn build(&self) -> InputInlineQueryResultVenue {
1729        self.inner.clone()
1730    }
1731
1732    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1733        self.inner.id = id.as_ref().to_string();
1734        self
1735    }
1736
1737    pub fn venue<T: AsRef<Venue>>(&mut self, venue: T) -> &mut Self {
1738        self.inner.venue = venue.as_ref().clone();
1739        self
1740    }
1741
1742    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
1743        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
1744        self
1745    }
1746
1747    pub fn thumbnail_width(&mut self, thumbnail_width: i32) -> &mut Self {
1748        self.inner.thumbnail_width = thumbnail_width;
1749        self
1750    }
1751
1752    pub fn thumbnail_height(&mut self, thumbnail_height: i32) -> &mut Self {
1753        self.inner.thumbnail_height = thumbnail_height;
1754        self
1755    }
1756
1757    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
1758        self.inner.reply_markup = reply_markup.as_ref().clone();
1759        self
1760    }
1761
1762    pub fn input_message_content<T: AsRef<InputMessageContent>>(
1763        &mut self,
1764        input_message_content: T,
1765    ) -> &mut Self {
1766        self.inner.input_message_content = input_message_content.as_ref().clone();
1767        self
1768    }
1769}
1770
1771impl AsRef<InputInlineQueryResultVenue> for InputInlineQueryResultVenue {
1772    fn as_ref(&self) -> &InputInlineQueryResultVenue {
1773        self
1774    }
1775}
1776
1777impl AsRef<InputInlineQueryResultVenue> for InputInlineQueryResultVenueBuilder {
1778    fn as_ref(&self) -> &InputInlineQueryResultVenue {
1779        &self.inner
1780    }
1781}
1782
1783/// Represents a link to a page containing an embedded video player or a video file
1784#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1785pub struct InputInlineQueryResultVideo {
1786    #[doc(hidden)]
1787    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1788    extra: Option<String>,
1789    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1790    client_id: Option<i32>,
1791    /// Unique identifier of the query result
1792
1793    #[serde(default)]
1794    id: String,
1795    /// Title of the result
1796
1797    #[serde(default)]
1798    title: String,
1799    /// Represents a link to a page containing an embedded video player or a video file
1800
1801    #[serde(default)]
1802    description: String,
1803    /// The URL of the video thumbnail (JPEG), if it exists
1804
1805    #[serde(default)]
1806    thumbnail_url: String,
1807    /// URL of the embedded video player or video file
1808
1809    #[serde(default)]
1810    video_url: String,
1811    /// MIME type of the content of the video URL, only "text/html" or "video/mp4" are currently supported
1812
1813    #[serde(default)]
1814    mime_type: String,
1815    /// Width of the video
1816
1817    #[serde(default)]
1818    video_width: i32,
1819    /// Height of the video
1820
1821    #[serde(default)]
1822    video_height: i32,
1823    /// Video duration, in seconds
1824
1825    #[serde(default)]
1826    video_duration: i32,
1827    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
1828
1829    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
1830    reply_markup: ReplyMarkup,
1831    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageVideo, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
1832
1833    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
1834    input_message_content: InputMessageContent,
1835}
1836
1837impl RObject for InputInlineQueryResultVideo {
1838    #[doc(hidden)]
1839    fn extra(&self) -> Option<&str> {
1840        self.extra.as_deref()
1841    }
1842    #[doc(hidden)]
1843    fn client_id(&self) -> Option<i32> {
1844        self.client_id
1845    }
1846}
1847
1848impl TDInputInlineQueryResult for InputInlineQueryResultVideo {}
1849
1850impl InputInlineQueryResultVideo {
1851    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1852        Ok(serde_json::from_str(json.as_ref())?)
1853    }
1854    pub fn builder() -> InputInlineQueryResultVideoBuilder {
1855        let mut inner = InputInlineQueryResultVideo::default();
1856        inner.extra = Some(Uuid::new_v4().to_string());
1857
1858        InputInlineQueryResultVideoBuilder { inner }
1859    }
1860
1861    pub fn id(&self) -> &String {
1862        &self.id
1863    }
1864
1865    pub fn title(&self) -> &String {
1866        &self.title
1867    }
1868
1869    pub fn description(&self) -> &String {
1870        &self.description
1871    }
1872
1873    pub fn thumbnail_url(&self) -> &String {
1874        &self.thumbnail_url
1875    }
1876
1877    pub fn video_url(&self) -> &String {
1878        &self.video_url
1879    }
1880
1881    pub fn mime_type(&self) -> &String {
1882        &self.mime_type
1883    }
1884
1885    pub fn video_width(&self) -> i32 {
1886        self.video_width
1887    }
1888
1889    pub fn video_height(&self) -> i32 {
1890        self.video_height
1891    }
1892
1893    pub fn video_duration(&self) -> i32 {
1894        self.video_duration
1895    }
1896
1897    pub fn reply_markup(&self) -> &ReplyMarkup {
1898        &self.reply_markup
1899    }
1900
1901    pub fn input_message_content(&self) -> &InputMessageContent {
1902        &self.input_message_content
1903    }
1904}
1905
1906#[doc(hidden)]
1907pub struct InputInlineQueryResultVideoBuilder {
1908    inner: InputInlineQueryResultVideo,
1909}
1910
1911#[deprecated]
1912pub type RTDInputInlineQueryResultVideoBuilder = InputInlineQueryResultVideoBuilder;
1913
1914impl InputInlineQueryResultVideoBuilder {
1915    pub fn build(&self) -> InputInlineQueryResultVideo {
1916        self.inner.clone()
1917    }
1918
1919    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1920        self.inner.id = id.as_ref().to_string();
1921        self
1922    }
1923
1924    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
1925        self.inner.title = title.as_ref().to_string();
1926        self
1927    }
1928
1929    pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
1930        self.inner.description = description.as_ref().to_string();
1931        self
1932    }
1933
1934    pub fn thumbnail_url<T: AsRef<str>>(&mut self, thumbnail_url: T) -> &mut Self {
1935        self.inner.thumbnail_url = thumbnail_url.as_ref().to_string();
1936        self
1937    }
1938
1939    pub fn video_url<T: AsRef<str>>(&mut self, video_url: T) -> &mut Self {
1940        self.inner.video_url = video_url.as_ref().to_string();
1941        self
1942    }
1943
1944    pub fn mime_type<T: AsRef<str>>(&mut self, mime_type: T) -> &mut Self {
1945        self.inner.mime_type = mime_type.as_ref().to_string();
1946        self
1947    }
1948
1949    pub fn video_width(&mut self, video_width: i32) -> &mut Self {
1950        self.inner.video_width = video_width;
1951        self
1952    }
1953
1954    pub fn video_height(&mut self, video_height: i32) -> &mut Self {
1955        self.inner.video_height = video_height;
1956        self
1957    }
1958
1959    pub fn video_duration(&mut self, video_duration: i32) -> &mut Self {
1960        self.inner.video_duration = video_duration;
1961        self
1962    }
1963
1964    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
1965        self.inner.reply_markup = reply_markup.as_ref().clone();
1966        self
1967    }
1968
1969    pub fn input_message_content<T: AsRef<InputMessageContent>>(
1970        &mut self,
1971        input_message_content: T,
1972    ) -> &mut Self {
1973        self.inner.input_message_content = input_message_content.as_ref().clone();
1974        self
1975    }
1976}
1977
1978impl AsRef<InputInlineQueryResultVideo> for InputInlineQueryResultVideo {
1979    fn as_ref(&self) -> &InputInlineQueryResultVideo {
1980        self
1981    }
1982}
1983
1984impl AsRef<InputInlineQueryResultVideo> for InputInlineQueryResultVideoBuilder {
1985    fn as_ref(&self) -> &InputInlineQueryResultVideo {
1986        &self.inner
1987    }
1988}
1989
1990/// Represents a link to an opus-encoded audio file within an OGG container, single channel audio
1991#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1992pub struct InputInlineQueryResultVoiceNote {
1993    #[doc(hidden)]
1994    #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1995    extra: Option<String>,
1996    #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1997    client_id: Option<i32>,
1998    /// Unique identifier of the query result
1999
2000    #[serde(default)]
2001    id: String,
2002    /// Title of the voice note
2003
2004    #[serde(default)]
2005    title: String,
2006    /// The URL of the voice note file
2007
2008    #[serde(default)]
2009    voice_note_url: String,
2010    /// Duration of the voice note, in seconds
2011
2012    #[serde(default)]
2013    voice_note_duration: i32,
2014    /// The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null
2015
2016    #[serde(skip_serializing_if = "ReplyMarkup::_is_default")]
2017    reply_markup: ReplyMarkup,
2018    /// The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageVoiceNote, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact
2019
2020    #[serde(skip_serializing_if = "InputMessageContent::_is_default")]
2021    input_message_content: InputMessageContent,
2022}
2023
2024impl RObject for InputInlineQueryResultVoiceNote {
2025    #[doc(hidden)]
2026    fn extra(&self) -> Option<&str> {
2027        self.extra.as_deref()
2028    }
2029    #[doc(hidden)]
2030    fn client_id(&self) -> Option<i32> {
2031        self.client_id
2032    }
2033}
2034
2035impl TDInputInlineQueryResult for InputInlineQueryResultVoiceNote {}
2036
2037impl InputInlineQueryResultVoiceNote {
2038    pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2039        Ok(serde_json::from_str(json.as_ref())?)
2040    }
2041    pub fn builder() -> InputInlineQueryResultVoiceNoteBuilder {
2042        let mut inner = InputInlineQueryResultVoiceNote::default();
2043        inner.extra = Some(Uuid::new_v4().to_string());
2044
2045        InputInlineQueryResultVoiceNoteBuilder { inner }
2046    }
2047
2048    pub fn id(&self) -> &String {
2049        &self.id
2050    }
2051
2052    pub fn title(&self) -> &String {
2053        &self.title
2054    }
2055
2056    pub fn voice_note_url(&self) -> &String {
2057        &self.voice_note_url
2058    }
2059
2060    pub fn voice_note_duration(&self) -> i32 {
2061        self.voice_note_duration
2062    }
2063
2064    pub fn reply_markup(&self) -> &ReplyMarkup {
2065        &self.reply_markup
2066    }
2067
2068    pub fn input_message_content(&self) -> &InputMessageContent {
2069        &self.input_message_content
2070    }
2071}
2072
2073#[doc(hidden)]
2074pub struct InputInlineQueryResultVoiceNoteBuilder {
2075    inner: InputInlineQueryResultVoiceNote,
2076}
2077
2078#[deprecated]
2079pub type RTDInputInlineQueryResultVoiceNoteBuilder = InputInlineQueryResultVoiceNoteBuilder;
2080
2081impl InputInlineQueryResultVoiceNoteBuilder {
2082    pub fn build(&self) -> InputInlineQueryResultVoiceNote {
2083        self.inner.clone()
2084    }
2085
2086    pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
2087        self.inner.id = id.as_ref().to_string();
2088        self
2089    }
2090
2091    pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
2092        self.inner.title = title.as_ref().to_string();
2093        self
2094    }
2095
2096    pub fn voice_note_url<T: AsRef<str>>(&mut self, voice_note_url: T) -> &mut Self {
2097        self.inner.voice_note_url = voice_note_url.as_ref().to_string();
2098        self
2099    }
2100
2101    pub fn voice_note_duration(&mut self, voice_note_duration: i32) -> &mut Self {
2102        self.inner.voice_note_duration = voice_note_duration;
2103        self
2104    }
2105
2106    pub fn reply_markup<T: AsRef<ReplyMarkup>>(&mut self, reply_markup: T) -> &mut Self {
2107        self.inner.reply_markup = reply_markup.as_ref().clone();
2108        self
2109    }
2110
2111    pub fn input_message_content<T: AsRef<InputMessageContent>>(
2112        &mut self,
2113        input_message_content: T,
2114    ) -> &mut Self {
2115        self.inner.input_message_content = input_message_content.as_ref().clone();
2116        self
2117    }
2118}
2119
2120impl AsRef<InputInlineQueryResultVoiceNote> for InputInlineQueryResultVoiceNote {
2121    fn as_ref(&self) -> &InputInlineQueryResultVoiceNote {
2122        self
2123    }
2124}
2125
2126impl AsRef<InputInlineQueryResultVoiceNote> for InputInlineQueryResultVoiceNoteBuilder {
2127    fn as_ref(&self) -> &InputInlineQueryResultVoiceNote {
2128        &self.inner
2129    }
2130}