rtdlib/types/
inline_query_result.rs

1
2use crate::types::*;
3use crate::errors::*;
4use uuid::Uuid;
5
6
7
8
9use std::fmt::Debug;
10use serde::de::{Deserialize, Deserializer};
11
12
13
14/// TRAIT | Represents a single result of an inline query
15pub trait TDInlineQueryResult: Debug + RObject {}
16
17/// Represents a single result of an inline query
18#[derive(Debug, Clone, Serialize)]
19#[serde(untagged)]
20pub enum InlineQueryResult {
21  #[doc(hidden)] _Default(()),
22  /// Represents an animation file
23  Animation(InlineQueryResultAnimation),
24  /// Represents a link to an article or web page
25  Article(InlineQueryResultArticle),
26  /// Represents an audio file
27  Audio(InlineQueryResultAudio),
28  /// Represents a user contact
29  Contact(InlineQueryResultContact),
30  /// Represents a document
31  Document(InlineQueryResultDocument),
32  /// Represents information about a game
33  Game(InlineQueryResultGame),
34  /// Represents a point on the map
35  Location(InlineQueryResultLocation),
36  /// Represents a photo
37  Photo(InlineQueryResultPhoto),
38  /// Represents a sticker
39  Sticker(InlineQueryResultSticker),
40  /// Represents information about a venue
41  Venue(InlineQueryResultVenue),
42  /// Represents a video
43  Video(InlineQueryResultVideo),
44  /// Represents a voice note
45  VoiceNote(InlineQueryResultVoiceNote),
46
47}
48
49impl Default for InlineQueryResult {
50  fn default() -> Self { InlineQueryResult::_Default(()) }
51}
52
53impl<'de> Deserialize<'de> for InlineQueryResult {
54  fn deserialize<D>(deserializer: D) -> Result<InlineQueryResult, D::Error> where D: Deserializer<'de> {
55    use serde::de::Error;
56    rtd_enum_deserialize!(
57      InlineQueryResult,
58      (inlineQueryResultAnimation, Animation);
59      (inlineQueryResultArticle, Article);
60      (inlineQueryResultAudio, Audio);
61      (inlineQueryResultContact, Contact);
62      (inlineQueryResultDocument, Document);
63      (inlineQueryResultGame, Game);
64      (inlineQueryResultLocation, Location);
65      (inlineQueryResultPhoto, Photo);
66      (inlineQueryResultSticker, Sticker);
67      (inlineQueryResultVenue, Venue);
68      (inlineQueryResultVideo, Video);
69      (inlineQueryResultVoiceNote, VoiceNote);
70
71    )(deserializer)
72  }
73}
74
75impl RObject for InlineQueryResult {
76  #[doc(hidden)] fn td_name(&self) -> &'static str {
77    match self {
78      InlineQueryResult::Animation(t) => t.td_name(),
79      InlineQueryResult::Article(t) => t.td_name(),
80      InlineQueryResult::Audio(t) => t.td_name(),
81      InlineQueryResult::Contact(t) => t.td_name(),
82      InlineQueryResult::Document(t) => t.td_name(),
83      InlineQueryResult::Game(t) => t.td_name(),
84      InlineQueryResult::Location(t) => t.td_name(),
85      InlineQueryResult::Photo(t) => t.td_name(),
86      InlineQueryResult::Sticker(t) => t.td_name(),
87      InlineQueryResult::Venue(t) => t.td_name(),
88      InlineQueryResult::Video(t) => t.td_name(),
89      InlineQueryResult::VoiceNote(t) => t.td_name(),
90
91      _ => "-1",
92    }
93  }
94  #[doc(hidden)] fn extra(&self) -> Option<String> {
95    match self {
96      InlineQueryResult::Animation(t) => t.extra(),
97      InlineQueryResult::Article(t) => t.extra(),
98      InlineQueryResult::Audio(t) => t.extra(),
99      InlineQueryResult::Contact(t) => t.extra(),
100      InlineQueryResult::Document(t) => t.extra(),
101      InlineQueryResult::Game(t) => t.extra(),
102      InlineQueryResult::Location(t) => t.extra(),
103      InlineQueryResult::Photo(t) => t.extra(),
104      InlineQueryResult::Sticker(t) => t.extra(),
105      InlineQueryResult::Venue(t) => t.extra(),
106      InlineQueryResult::Video(t) => t.extra(),
107      InlineQueryResult::VoiceNote(t) => t.extra(),
108
109      _ => None,
110    }
111  }
112  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
113}
114
115impl InlineQueryResult {
116  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
117  #[doc(hidden)] pub fn _is_default(&self) -> bool { if let InlineQueryResult::_Default(_) = self { true } else { false } }
118
119  pub fn is_animation(&self) -> bool { if let InlineQueryResult::Animation(_) = self { true } else { false } }
120  pub fn is_article(&self) -> bool { if let InlineQueryResult::Article(_) = self { true } else { false } }
121  pub fn is_audio(&self) -> bool { if let InlineQueryResult::Audio(_) = self { true } else { false } }
122  pub fn is_contact(&self) -> bool { if let InlineQueryResult::Contact(_) = self { true } else { false } }
123  pub fn is_document(&self) -> bool { if let InlineQueryResult::Document(_) = self { true } else { false } }
124  pub fn is_game(&self) -> bool { if let InlineQueryResult::Game(_) = self { true } else { false } }
125  pub fn is_location(&self) -> bool { if let InlineQueryResult::Location(_) = self { true } else { false } }
126  pub fn is_photo(&self) -> bool { if let InlineQueryResult::Photo(_) = self { true } else { false } }
127  pub fn is_sticker(&self) -> bool { if let InlineQueryResult::Sticker(_) = self { true } else { false } }
128  pub fn is_venue(&self) -> bool { if let InlineQueryResult::Venue(_) = self { true } else { false } }
129  pub fn is_video(&self) -> bool { if let InlineQueryResult::Video(_) = self { true } else { false } }
130  pub fn is_voice_note(&self) -> bool { if let InlineQueryResult::VoiceNote(_) = self { true } else { false } }
131
132  pub fn on_animation<F: FnOnce(&InlineQueryResultAnimation)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Animation(t) = self { fnc(t) }; self }
133  pub fn on_article<F: FnOnce(&InlineQueryResultArticle)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Article(t) = self { fnc(t) }; self }
134  pub fn on_audio<F: FnOnce(&InlineQueryResultAudio)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Audio(t) = self { fnc(t) }; self }
135  pub fn on_contact<F: FnOnce(&InlineQueryResultContact)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Contact(t) = self { fnc(t) }; self }
136  pub fn on_document<F: FnOnce(&InlineQueryResultDocument)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Document(t) = self { fnc(t) }; self }
137  pub fn on_game<F: FnOnce(&InlineQueryResultGame)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Game(t) = self { fnc(t) }; self }
138  pub fn on_location<F: FnOnce(&InlineQueryResultLocation)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Location(t) = self { fnc(t) }; self }
139  pub fn on_photo<F: FnOnce(&InlineQueryResultPhoto)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Photo(t) = self { fnc(t) }; self }
140  pub fn on_sticker<F: FnOnce(&InlineQueryResultSticker)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Sticker(t) = self { fnc(t) }; self }
141  pub fn on_venue<F: FnOnce(&InlineQueryResultVenue)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Venue(t) = self { fnc(t) }; self }
142  pub fn on_video<F: FnOnce(&InlineQueryResultVideo)>(&self, fnc: F) -> &Self { if let InlineQueryResult::Video(t) = self { fnc(t) }; self }
143  pub fn on_voice_note<F: FnOnce(&InlineQueryResultVoiceNote)>(&self, fnc: F) -> &Self { if let InlineQueryResult::VoiceNote(t) = self { fnc(t) }; self }
144
145  pub fn as_animation(&self) -> Option<&InlineQueryResultAnimation> { if let InlineQueryResult::Animation(t) = self { return Some(t) } None }
146  pub fn as_article(&self) -> Option<&InlineQueryResultArticle> { if let InlineQueryResult::Article(t) = self { return Some(t) } None }
147  pub fn as_audio(&self) -> Option<&InlineQueryResultAudio> { if let InlineQueryResult::Audio(t) = self { return Some(t) } None }
148  pub fn as_contact(&self) -> Option<&InlineQueryResultContact> { if let InlineQueryResult::Contact(t) = self { return Some(t) } None }
149  pub fn as_document(&self) -> Option<&InlineQueryResultDocument> { if let InlineQueryResult::Document(t) = self { return Some(t) } None }
150  pub fn as_game(&self) -> Option<&InlineQueryResultGame> { if let InlineQueryResult::Game(t) = self { return Some(t) } None }
151  pub fn as_location(&self) -> Option<&InlineQueryResultLocation> { if let InlineQueryResult::Location(t) = self { return Some(t) } None }
152  pub fn as_photo(&self) -> Option<&InlineQueryResultPhoto> { if let InlineQueryResult::Photo(t) = self { return Some(t) } None }
153  pub fn as_sticker(&self) -> Option<&InlineQueryResultSticker> { if let InlineQueryResult::Sticker(t) = self { return Some(t) } None }
154  pub fn as_venue(&self) -> Option<&InlineQueryResultVenue> { if let InlineQueryResult::Venue(t) = self { return Some(t) } None }
155  pub fn as_video(&self) -> Option<&InlineQueryResultVideo> { if let InlineQueryResult::Video(t) = self { return Some(t) } None }
156  pub fn as_voice_note(&self) -> Option<&InlineQueryResultVoiceNote> { if let InlineQueryResult::VoiceNote(t) = self { return Some(t) } None }
157
158
159
160  pub fn animation<T: AsRef<InlineQueryResultAnimation>>(t: T) -> Self { InlineQueryResult::Animation(t.as_ref().clone()) }
161
162  pub fn article<T: AsRef<InlineQueryResultArticle>>(t: T) -> Self { InlineQueryResult::Article(t.as_ref().clone()) }
163
164  pub fn audio<T: AsRef<InlineQueryResultAudio>>(t: T) -> Self { InlineQueryResult::Audio(t.as_ref().clone()) }
165
166  pub fn contact<T: AsRef<InlineQueryResultContact>>(t: T) -> Self { InlineQueryResult::Contact(t.as_ref().clone()) }
167
168  pub fn document<T: AsRef<InlineQueryResultDocument>>(t: T) -> Self { InlineQueryResult::Document(t.as_ref().clone()) }
169
170  pub fn game<T: AsRef<InlineQueryResultGame>>(t: T) -> Self { InlineQueryResult::Game(t.as_ref().clone()) }
171
172  pub fn location<T: AsRef<InlineQueryResultLocation>>(t: T) -> Self { InlineQueryResult::Location(t.as_ref().clone()) }
173
174  pub fn photo<T: AsRef<InlineQueryResultPhoto>>(t: T) -> Self { InlineQueryResult::Photo(t.as_ref().clone()) }
175
176  pub fn sticker<T: AsRef<InlineQueryResultSticker>>(t: T) -> Self { InlineQueryResult::Sticker(t.as_ref().clone()) }
177
178  pub fn venue<T: AsRef<InlineQueryResultVenue>>(t: T) -> Self { InlineQueryResult::Venue(t.as_ref().clone()) }
179
180  pub fn video<T: AsRef<InlineQueryResultVideo>>(t: T) -> Self { InlineQueryResult::Video(t.as_ref().clone()) }
181
182  pub fn voice_note<T: AsRef<InlineQueryResultVoiceNote>>(t: T) -> Self { InlineQueryResult::VoiceNote(t.as_ref().clone()) }
183
184}
185
186impl AsRef<InlineQueryResult> for InlineQueryResult {
187  fn as_ref(&self) -> &InlineQueryResult { self }
188}
189
190
191
192
193
194
195
196/// Represents an animation file
197#[derive(Debug, Clone, Default, Serialize, Deserialize)]
198pub struct InlineQueryResultAnimation {
199  #[doc(hidden)]
200  #[serde(rename(serialize = "@type", deserialize = "@type"))]
201  td_name: String,
202  #[doc(hidden)]
203  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
204  extra: Option<String>,
205  /// Unique identifier of the query result
206  id: String,
207  /// Animation file
208  animation: Animation,
209  /// Animation title
210  title: String,
211  
212}
213
214impl RObject for InlineQueryResultAnimation {
215  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultAnimation" }
216  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
217  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
218}
219
220
221impl TDInlineQueryResult for InlineQueryResultAnimation {}
222
223
224
225impl InlineQueryResultAnimation {
226  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
227  pub fn builder() -> RTDInlineQueryResultAnimationBuilder {
228    let mut inner = InlineQueryResultAnimation::default();
229    inner.td_name = "inlineQueryResultAnimation".to_string();
230    inner.extra = Some(Uuid::new_v4().to_string());
231    RTDInlineQueryResultAnimationBuilder { inner }
232  }
233
234  pub fn id(&self) -> &String { &self.id }
235
236  pub fn animation(&self) -> &Animation { &self.animation }
237
238  pub fn title(&self) -> &String { &self.title }
239
240}
241
242#[doc(hidden)]
243pub struct RTDInlineQueryResultAnimationBuilder {
244  inner: InlineQueryResultAnimation
245}
246
247impl RTDInlineQueryResultAnimationBuilder {
248  pub fn build(&self) -> InlineQueryResultAnimation { self.inner.clone() }
249
250   
251  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
252    self.inner.id = id.as_ref().to_string();
253    self
254  }
255
256   
257  pub fn animation<T: AsRef<Animation>>(&mut self, animation: T) -> &mut Self {
258    self.inner.animation = animation.as_ref().clone();
259    self
260  }
261
262   
263  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
264    self.inner.title = title.as_ref().to_string();
265    self
266  }
267
268}
269
270impl AsRef<InlineQueryResultAnimation> for InlineQueryResultAnimation {
271  fn as_ref(&self) -> &InlineQueryResultAnimation { self }
272}
273
274impl AsRef<InlineQueryResultAnimation> for RTDInlineQueryResultAnimationBuilder {
275  fn as_ref(&self) -> &InlineQueryResultAnimation { &self.inner }
276}
277
278
279
280
281
282
283
284/// Represents a link to an article or web page
285#[derive(Debug, Clone, Default, Serialize, Deserialize)]
286pub struct InlineQueryResultArticle {
287  #[doc(hidden)]
288  #[serde(rename(serialize = "@type", deserialize = "@type"))]
289  td_name: String,
290  #[doc(hidden)]
291  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
292  extra: Option<String>,
293  /// Unique identifier of the query result
294  id: String,
295  /// URL of the result, if it exists
296  url: String,
297  /// True, if the URL must be not shown
298  hide_url: bool,
299  /// Title of the result
300  title: String,
301  /// Represents a link to an article or web page
302  description: String,
303  /// Result thumbnail in JPEG format; may be null
304  thumbnail: Option<Thumbnail>,
305  
306}
307
308impl RObject for InlineQueryResultArticle {
309  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultArticle" }
310  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
311  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
312}
313
314
315impl TDInlineQueryResult for InlineQueryResultArticle {}
316
317
318
319impl InlineQueryResultArticle {
320  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
321  pub fn builder() -> RTDInlineQueryResultArticleBuilder {
322    let mut inner = InlineQueryResultArticle::default();
323    inner.td_name = "inlineQueryResultArticle".to_string();
324    inner.extra = Some(Uuid::new_v4().to_string());
325    RTDInlineQueryResultArticleBuilder { inner }
326  }
327
328  pub fn id(&self) -> &String { &self.id }
329
330  pub fn url(&self) -> &String { &self.url }
331
332  pub fn hide_url(&self) -> bool { self.hide_url }
333
334  pub fn title(&self) -> &String { &self.title }
335
336  pub fn description(&self) -> &String { &self.description }
337
338  pub fn thumbnail(&self) -> &Option<Thumbnail> { &self.thumbnail }
339
340}
341
342#[doc(hidden)]
343pub struct RTDInlineQueryResultArticleBuilder {
344  inner: InlineQueryResultArticle
345}
346
347impl RTDInlineQueryResultArticleBuilder {
348  pub fn build(&self) -> InlineQueryResultArticle { self.inner.clone() }
349
350   
351  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
352    self.inner.id = id.as_ref().to_string();
353    self
354  }
355
356   
357  pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
358    self.inner.url = url.as_ref().to_string();
359    self
360  }
361
362   
363  pub fn hide_url(&mut self, hide_url: bool) -> &mut Self {
364    self.inner.hide_url = hide_url;
365    self
366  }
367
368   
369  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
370    self.inner.title = title.as_ref().to_string();
371    self
372  }
373
374   
375  pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
376    self.inner.description = description.as_ref().to_string();
377    self
378  }
379
380   
381  pub fn thumbnail<T: AsRef<Thumbnail>>(&mut self, thumbnail: T) -> &mut Self {
382    self.inner.thumbnail = Some(thumbnail.as_ref().clone());
383    self
384  }
385
386}
387
388impl AsRef<InlineQueryResultArticle> for InlineQueryResultArticle {
389  fn as_ref(&self) -> &InlineQueryResultArticle { self }
390}
391
392impl AsRef<InlineQueryResultArticle> for RTDInlineQueryResultArticleBuilder {
393  fn as_ref(&self) -> &InlineQueryResultArticle { &self.inner }
394}
395
396
397
398
399
400
401
402/// Represents an audio file
403#[derive(Debug, Clone, Default, Serialize, Deserialize)]
404pub struct InlineQueryResultAudio {
405  #[doc(hidden)]
406  #[serde(rename(serialize = "@type", deserialize = "@type"))]
407  td_name: String,
408  #[doc(hidden)]
409  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
410  extra: Option<String>,
411  /// Unique identifier of the query result
412  id: String,
413  /// Audio file
414  audio: Audio,
415  
416}
417
418impl RObject for InlineQueryResultAudio {
419  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultAudio" }
420  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
421  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
422}
423
424
425impl TDInlineQueryResult for InlineQueryResultAudio {}
426
427
428
429impl InlineQueryResultAudio {
430  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
431  pub fn builder() -> RTDInlineQueryResultAudioBuilder {
432    let mut inner = InlineQueryResultAudio::default();
433    inner.td_name = "inlineQueryResultAudio".to_string();
434    inner.extra = Some(Uuid::new_v4().to_string());
435    RTDInlineQueryResultAudioBuilder { inner }
436  }
437
438  pub fn id(&self) -> &String { &self.id }
439
440  pub fn audio(&self) -> &Audio { &self.audio }
441
442}
443
444#[doc(hidden)]
445pub struct RTDInlineQueryResultAudioBuilder {
446  inner: InlineQueryResultAudio
447}
448
449impl RTDInlineQueryResultAudioBuilder {
450  pub fn build(&self) -> InlineQueryResultAudio { self.inner.clone() }
451
452   
453  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
454    self.inner.id = id.as_ref().to_string();
455    self
456  }
457
458   
459  pub fn audio<T: AsRef<Audio>>(&mut self, audio: T) -> &mut Self {
460    self.inner.audio = audio.as_ref().clone();
461    self
462  }
463
464}
465
466impl AsRef<InlineQueryResultAudio> for InlineQueryResultAudio {
467  fn as_ref(&self) -> &InlineQueryResultAudio { self }
468}
469
470impl AsRef<InlineQueryResultAudio> for RTDInlineQueryResultAudioBuilder {
471  fn as_ref(&self) -> &InlineQueryResultAudio { &self.inner }
472}
473
474
475
476
477
478
479
480/// Represents a user contact
481#[derive(Debug, Clone, Default, Serialize, Deserialize)]
482pub struct InlineQueryResultContact {
483  #[doc(hidden)]
484  #[serde(rename(serialize = "@type", deserialize = "@type"))]
485  td_name: String,
486  #[doc(hidden)]
487  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
488  extra: Option<String>,
489  /// Unique identifier of the query result
490  id: String,
491  /// A user contact
492  contact: Contact,
493  /// Result thumbnail in JPEG format; may be null
494  thumbnail: Option<Thumbnail>,
495  
496}
497
498impl RObject for InlineQueryResultContact {
499  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultContact" }
500  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
501  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
502}
503
504
505impl TDInlineQueryResult for InlineQueryResultContact {}
506
507
508
509impl InlineQueryResultContact {
510  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
511  pub fn builder() -> RTDInlineQueryResultContactBuilder {
512    let mut inner = InlineQueryResultContact::default();
513    inner.td_name = "inlineQueryResultContact".to_string();
514    inner.extra = Some(Uuid::new_v4().to_string());
515    RTDInlineQueryResultContactBuilder { inner }
516  }
517
518  pub fn id(&self) -> &String { &self.id }
519
520  pub fn contact(&self) -> &Contact { &self.contact }
521
522  pub fn thumbnail(&self) -> &Option<Thumbnail> { &self.thumbnail }
523
524}
525
526#[doc(hidden)]
527pub struct RTDInlineQueryResultContactBuilder {
528  inner: InlineQueryResultContact
529}
530
531impl RTDInlineQueryResultContactBuilder {
532  pub fn build(&self) -> InlineQueryResultContact { self.inner.clone() }
533
534   
535  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
536    self.inner.id = id.as_ref().to_string();
537    self
538  }
539
540   
541  pub fn contact<T: AsRef<Contact>>(&mut self, contact: T) -> &mut Self {
542    self.inner.contact = contact.as_ref().clone();
543    self
544  }
545
546   
547  pub fn thumbnail<T: AsRef<Thumbnail>>(&mut self, thumbnail: T) -> &mut Self {
548    self.inner.thumbnail = Some(thumbnail.as_ref().clone());
549    self
550  }
551
552}
553
554impl AsRef<InlineQueryResultContact> for InlineQueryResultContact {
555  fn as_ref(&self) -> &InlineQueryResultContact { self }
556}
557
558impl AsRef<InlineQueryResultContact> for RTDInlineQueryResultContactBuilder {
559  fn as_ref(&self) -> &InlineQueryResultContact { &self.inner }
560}
561
562
563
564
565
566
567
568/// Represents a document
569#[derive(Debug, Clone, Default, Serialize, Deserialize)]
570pub struct InlineQueryResultDocument {
571  #[doc(hidden)]
572  #[serde(rename(serialize = "@type", deserialize = "@type"))]
573  td_name: String,
574  #[doc(hidden)]
575  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
576  extra: Option<String>,
577  /// Unique identifier of the query result
578  id: String,
579  /// Document
580  document: Document,
581  /// Document title
582  title: String,
583  /// Represents a document
584  description: String,
585  
586}
587
588impl RObject for InlineQueryResultDocument {
589  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultDocument" }
590  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
591  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
592}
593
594
595impl TDInlineQueryResult for InlineQueryResultDocument {}
596
597
598
599impl InlineQueryResultDocument {
600  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
601  pub fn builder() -> RTDInlineQueryResultDocumentBuilder {
602    let mut inner = InlineQueryResultDocument::default();
603    inner.td_name = "inlineQueryResultDocument".to_string();
604    inner.extra = Some(Uuid::new_v4().to_string());
605    RTDInlineQueryResultDocumentBuilder { inner }
606  }
607
608  pub fn id(&self) -> &String { &self.id }
609
610  pub fn document(&self) -> &Document { &self.document }
611
612  pub fn title(&self) -> &String { &self.title }
613
614  pub fn description(&self) -> &String { &self.description }
615
616}
617
618#[doc(hidden)]
619pub struct RTDInlineQueryResultDocumentBuilder {
620  inner: InlineQueryResultDocument
621}
622
623impl RTDInlineQueryResultDocumentBuilder {
624  pub fn build(&self) -> InlineQueryResultDocument { self.inner.clone() }
625
626   
627  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
628    self.inner.id = id.as_ref().to_string();
629    self
630  }
631
632   
633  pub fn document<T: AsRef<Document>>(&mut self, document: T) -> &mut Self {
634    self.inner.document = document.as_ref().clone();
635    self
636  }
637
638   
639  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
640    self.inner.title = title.as_ref().to_string();
641    self
642  }
643
644   
645  pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
646    self.inner.description = description.as_ref().to_string();
647    self
648  }
649
650}
651
652impl AsRef<InlineQueryResultDocument> for InlineQueryResultDocument {
653  fn as_ref(&self) -> &InlineQueryResultDocument { self }
654}
655
656impl AsRef<InlineQueryResultDocument> for RTDInlineQueryResultDocumentBuilder {
657  fn as_ref(&self) -> &InlineQueryResultDocument { &self.inner }
658}
659
660
661
662
663
664
665
666/// Represents information about a game
667#[derive(Debug, Clone, Default, Serialize, Deserialize)]
668pub struct InlineQueryResultGame {
669  #[doc(hidden)]
670  #[serde(rename(serialize = "@type", deserialize = "@type"))]
671  td_name: String,
672  #[doc(hidden)]
673  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
674  extra: Option<String>,
675  /// Unique identifier of the query result
676  id: String,
677  /// Game result
678  game: Game,
679  
680}
681
682impl RObject for InlineQueryResultGame {
683  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultGame" }
684  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
685  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
686}
687
688
689impl TDInlineQueryResult for InlineQueryResultGame {}
690
691
692
693impl InlineQueryResultGame {
694  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
695  pub fn builder() -> RTDInlineQueryResultGameBuilder {
696    let mut inner = InlineQueryResultGame::default();
697    inner.td_name = "inlineQueryResultGame".to_string();
698    inner.extra = Some(Uuid::new_v4().to_string());
699    RTDInlineQueryResultGameBuilder { inner }
700  }
701
702  pub fn id(&self) -> &String { &self.id }
703
704  pub fn game(&self) -> &Game { &self.game }
705
706}
707
708#[doc(hidden)]
709pub struct RTDInlineQueryResultGameBuilder {
710  inner: InlineQueryResultGame
711}
712
713impl RTDInlineQueryResultGameBuilder {
714  pub fn build(&self) -> InlineQueryResultGame { self.inner.clone() }
715
716   
717  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
718    self.inner.id = id.as_ref().to_string();
719    self
720  }
721
722   
723  pub fn game<T: AsRef<Game>>(&mut self, game: T) -> &mut Self {
724    self.inner.game = game.as_ref().clone();
725    self
726  }
727
728}
729
730impl AsRef<InlineQueryResultGame> for InlineQueryResultGame {
731  fn as_ref(&self) -> &InlineQueryResultGame { self }
732}
733
734impl AsRef<InlineQueryResultGame> for RTDInlineQueryResultGameBuilder {
735  fn as_ref(&self) -> &InlineQueryResultGame { &self.inner }
736}
737
738
739
740
741
742
743
744/// Represents a point on the map
745#[derive(Debug, Clone, Default, Serialize, Deserialize)]
746pub struct InlineQueryResultLocation {
747  #[doc(hidden)]
748  #[serde(rename(serialize = "@type", deserialize = "@type"))]
749  td_name: String,
750  #[doc(hidden)]
751  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
752  extra: Option<String>,
753  /// Unique identifier of the query result
754  id: String,
755  /// Location result
756  location: Location,
757  /// Title of the result
758  title: String,
759  /// Result thumbnail in JPEG format; may be null
760  thumbnail: Option<Thumbnail>,
761  
762}
763
764impl RObject for InlineQueryResultLocation {
765  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultLocation" }
766  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
767  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
768}
769
770
771impl TDInlineQueryResult for InlineQueryResultLocation {}
772
773
774
775impl InlineQueryResultLocation {
776  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
777  pub fn builder() -> RTDInlineQueryResultLocationBuilder {
778    let mut inner = InlineQueryResultLocation::default();
779    inner.td_name = "inlineQueryResultLocation".to_string();
780    inner.extra = Some(Uuid::new_v4().to_string());
781    RTDInlineQueryResultLocationBuilder { inner }
782  }
783
784  pub fn id(&self) -> &String { &self.id }
785
786  pub fn location(&self) -> &Location { &self.location }
787
788  pub fn title(&self) -> &String { &self.title }
789
790  pub fn thumbnail(&self) -> &Option<Thumbnail> { &self.thumbnail }
791
792}
793
794#[doc(hidden)]
795pub struct RTDInlineQueryResultLocationBuilder {
796  inner: InlineQueryResultLocation
797}
798
799impl RTDInlineQueryResultLocationBuilder {
800  pub fn build(&self) -> InlineQueryResultLocation { self.inner.clone() }
801
802   
803  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
804    self.inner.id = id.as_ref().to_string();
805    self
806  }
807
808   
809  pub fn location<T: AsRef<Location>>(&mut self, location: T) -> &mut Self {
810    self.inner.location = location.as_ref().clone();
811    self
812  }
813
814   
815  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
816    self.inner.title = title.as_ref().to_string();
817    self
818  }
819
820   
821  pub fn thumbnail<T: AsRef<Thumbnail>>(&mut self, thumbnail: T) -> &mut Self {
822    self.inner.thumbnail = Some(thumbnail.as_ref().clone());
823    self
824  }
825
826}
827
828impl AsRef<InlineQueryResultLocation> for InlineQueryResultLocation {
829  fn as_ref(&self) -> &InlineQueryResultLocation { self }
830}
831
832impl AsRef<InlineQueryResultLocation> for RTDInlineQueryResultLocationBuilder {
833  fn as_ref(&self) -> &InlineQueryResultLocation { &self.inner }
834}
835
836
837
838
839
840
841
842/// Represents a photo
843#[derive(Debug, Clone, Default, Serialize, Deserialize)]
844pub struct InlineQueryResultPhoto {
845  #[doc(hidden)]
846  #[serde(rename(serialize = "@type", deserialize = "@type"))]
847  td_name: String,
848  #[doc(hidden)]
849  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
850  extra: Option<String>,
851  /// Unique identifier of the query result
852  id: String,
853  /// Photo
854  photo: Photo,
855  /// Title of the result, if known
856  title: String,
857  /// Represents a photo
858  description: String,
859  
860}
861
862impl RObject for InlineQueryResultPhoto {
863  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultPhoto" }
864  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
865  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
866}
867
868
869impl TDInlineQueryResult for InlineQueryResultPhoto {}
870
871
872
873impl InlineQueryResultPhoto {
874  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
875  pub fn builder() -> RTDInlineQueryResultPhotoBuilder {
876    let mut inner = InlineQueryResultPhoto::default();
877    inner.td_name = "inlineQueryResultPhoto".to_string();
878    inner.extra = Some(Uuid::new_v4().to_string());
879    RTDInlineQueryResultPhotoBuilder { inner }
880  }
881
882  pub fn id(&self) -> &String { &self.id }
883
884  pub fn photo(&self) -> &Photo { &self.photo }
885
886  pub fn title(&self) -> &String { &self.title }
887
888  pub fn description(&self) -> &String { &self.description }
889
890}
891
892#[doc(hidden)]
893pub struct RTDInlineQueryResultPhotoBuilder {
894  inner: InlineQueryResultPhoto
895}
896
897impl RTDInlineQueryResultPhotoBuilder {
898  pub fn build(&self) -> InlineQueryResultPhoto { self.inner.clone() }
899
900   
901  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
902    self.inner.id = id.as_ref().to_string();
903    self
904  }
905
906   
907  pub fn photo<T: AsRef<Photo>>(&mut self, photo: T) -> &mut Self {
908    self.inner.photo = photo.as_ref().clone();
909    self
910  }
911
912   
913  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
914    self.inner.title = title.as_ref().to_string();
915    self
916  }
917
918   
919  pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
920    self.inner.description = description.as_ref().to_string();
921    self
922  }
923
924}
925
926impl AsRef<InlineQueryResultPhoto> for InlineQueryResultPhoto {
927  fn as_ref(&self) -> &InlineQueryResultPhoto { self }
928}
929
930impl AsRef<InlineQueryResultPhoto> for RTDInlineQueryResultPhotoBuilder {
931  fn as_ref(&self) -> &InlineQueryResultPhoto { &self.inner }
932}
933
934
935
936
937
938
939
940/// Represents a sticker
941#[derive(Debug, Clone, Default, Serialize, Deserialize)]
942pub struct InlineQueryResultSticker {
943  #[doc(hidden)]
944  #[serde(rename(serialize = "@type", deserialize = "@type"))]
945  td_name: String,
946  #[doc(hidden)]
947  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
948  extra: Option<String>,
949  /// Unique identifier of the query result
950  id: String,
951  /// Sticker
952  sticker: Sticker,
953  
954}
955
956impl RObject for InlineQueryResultSticker {
957  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultSticker" }
958  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
959  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
960}
961
962
963impl TDInlineQueryResult for InlineQueryResultSticker {}
964
965
966
967impl InlineQueryResultSticker {
968  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
969  pub fn builder() -> RTDInlineQueryResultStickerBuilder {
970    let mut inner = InlineQueryResultSticker::default();
971    inner.td_name = "inlineQueryResultSticker".to_string();
972    inner.extra = Some(Uuid::new_v4().to_string());
973    RTDInlineQueryResultStickerBuilder { inner }
974  }
975
976  pub fn id(&self) -> &String { &self.id }
977
978  pub fn sticker(&self) -> &Sticker { &self.sticker }
979
980}
981
982#[doc(hidden)]
983pub struct RTDInlineQueryResultStickerBuilder {
984  inner: InlineQueryResultSticker
985}
986
987impl RTDInlineQueryResultStickerBuilder {
988  pub fn build(&self) -> InlineQueryResultSticker { self.inner.clone() }
989
990   
991  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
992    self.inner.id = id.as_ref().to_string();
993    self
994  }
995
996   
997  pub fn sticker<T: AsRef<Sticker>>(&mut self, sticker: T) -> &mut Self {
998    self.inner.sticker = sticker.as_ref().clone();
999    self
1000  }
1001
1002}
1003
1004impl AsRef<InlineQueryResultSticker> for InlineQueryResultSticker {
1005  fn as_ref(&self) -> &InlineQueryResultSticker { self }
1006}
1007
1008impl AsRef<InlineQueryResultSticker> for RTDInlineQueryResultStickerBuilder {
1009  fn as_ref(&self) -> &InlineQueryResultSticker { &self.inner }
1010}
1011
1012
1013
1014
1015
1016
1017
1018/// Represents information about a venue
1019#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1020pub struct InlineQueryResultVenue {
1021  #[doc(hidden)]
1022  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1023  td_name: String,
1024  #[doc(hidden)]
1025  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1026  extra: Option<String>,
1027  /// Unique identifier of the query result
1028  id: String,
1029  /// Venue result
1030  venue: Venue,
1031  /// Result thumbnail in JPEG format; may be null
1032  thumbnail: Option<Thumbnail>,
1033  
1034}
1035
1036impl RObject for InlineQueryResultVenue {
1037  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultVenue" }
1038  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1039  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1040}
1041
1042
1043impl TDInlineQueryResult for InlineQueryResultVenue {}
1044
1045
1046
1047impl InlineQueryResultVenue {
1048  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1049  pub fn builder() -> RTDInlineQueryResultVenueBuilder {
1050    let mut inner = InlineQueryResultVenue::default();
1051    inner.td_name = "inlineQueryResultVenue".to_string();
1052    inner.extra = Some(Uuid::new_v4().to_string());
1053    RTDInlineQueryResultVenueBuilder { inner }
1054  }
1055
1056  pub fn id(&self) -> &String { &self.id }
1057
1058  pub fn venue(&self) -> &Venue { &self.venue }
1059
1060  pub fn thumbnail(&self) -> &Option<Thumbnail> { &self.thumbnail }
1061
1062}
1063
1064#[doc(hidden)]
1065pub struct RTDInlineQueryResultVenueBuilder {
1066  inner: InlineQueryResultVenue
1067}
1068
1069impl RTDInlineQueryResultVenueBuilder {
1070  pub fn build(&self) -> InlineQueryResultVenue { self.inner.clone() }
1071
1072   
1073  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1074    self.inner.id = id.as_ref().to_string();
1075    self
1076  }
1077
1078   
1079  pub fn venue<T: AsRef<Venue>>(&mut self, venue: T) -> &mut Self {
1080    self.inner.venue = venue.as_ref().clone();
1081    self
1082  }
1083
1084   
1085  pub fn thumbnail<T: AsRef<Thumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1086    self.inner.thumbnail = Some(thumbnail.as_ref().clone());
1087    self
1088  }
1089
1090}
1091
1092impl AsRef<InlineQueryResultVenue> for InlineQueryResultVenue {
1093  fn as_ref(&self) -> &InlineQueryResultVenue { self }
1094}
1095
1096impl AsRef<InlineQueryResultVenue> for RTDInlineQueryResultVenueBuilder {
1097  fn as_ref(&self) -> &InlineQueryResultVenue { &self.inner }
1098}
1099
1100
1101
1102
1103
1104
1105
1106/// Represents a video
1107#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1108pub struct InlineQueryResultVideo {
1109  #[doc(hidden)]
1110  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1111  td_name: String,
1112  #[doc(hidden)]
1113  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1114  extra: Option<String>,
1115  /// Unique identifier of the query result
1116  id: String,
1117  /// Video
1118  video: Video,
1119  /// Title of the video
1120  title: String,
1121  /// Represents a video
1122  description: String,
1123  
1124}
1125
1126impl RObject for InlineQueryResultVideo {
1127  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultVideo" }
1128  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1129  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1130}
1131
1132
1133impl TDInlineQueryResult for InlineQueryResultVideo {}
1134
1135
1136
1137impl InlineQueryResultVideo {
1138  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1139  pub fn builder() -> RTDInlineQueryResultVideoBuilder {
1140    let mut inner = InlineQueryResultVideo::default();
1141    inner.td_name = "inlineQueryResultVideo".to_string();
1142    inner.extra = Some(Uuid::new_v4().to_string());
1143    RTDInlineQueryResultVideoBuilder { inner }
1144  }
1145
1146  pub fn id(&self) -> &String { &self.id }
1147
1148  pub fn video(&self) -> &Video { &self.video }
1149
1150  pub fn title(&self) -> &String { &self.title }
1151
1152  pub fn description(&self) -> &String { &self.description }
1153
1154}
1155
1156#[doc(hidden)]
1157pub struct RTDInlineQueryResultVideoBuilder {
1158  inner: InlineQueryResultVideo
1159}
1160
1161impl RTDInlineQueryResultVideoBuilder {
1162  pub fn build(&self) -> InlineQueryResultVideo { self.inner.clone() }
1163
1164   
1165  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1166    self.inner.id = id.as_ref().to_string();
1167    self
1168  }
1169
1170   
1171  pub fn video<T: AsRef<Video>>(&mut self, video: T) -> &mut Self {
1172    self.inner.video = video.as_ref().clone();
1173    self
1174  }
1175
1176   
1177  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
1178    self.inner.title = title.as_ref().to_string();
1179    self
1180  }
1181
1182   
1183  pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
1184    self.inner.description = description.as_ref().to_string();
1185    self
1186  }
1187
1188}
1189
1190impl AsRef<InlineQueryResultVideo> for InlineQueryResultVideo {
1191  fn as_ref(&self) -> &InlineQueryResultVideo { self }
1192}
1193
1194impl AsRef<InlineQueryResultVideo> for RTDInlineQueryResultVideoBuilder {
1195  fn as_ref(&self) -> &InlineQueryResultVideo { &self.inner }
1196}
1197
1198
1199
1200
1201
1202
1203
1204/// Represents a voice note
1205#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1206pub struct InlineQueryResultVoiceNote {
1207  #[doc(hidden)]
1208  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1209  td_name: String,
1210  #[doc(hidden)]
1211  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1212  extra: Option<String>,
1213  /// Unique identifier of the query result
1214  id: String,
1215  /// Voice note
1216  voice_note: VoiceNote,
1217  /// Title of the voice note
1218  title: String,
1219  
1220}
1221
1222impl RObject for InlineQueryResultVoiceNote {
1223  #[doc(hidden)] fn td_name(&self) -> &'static str { "inlineQueryResultVoiceNote" }
1224  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1225  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1226}
1227
1228
1229impl TDInlineQueryResult for InlineQueryResultVoiceNote {}
1230
1231
1232
1233impl InlineQueryResultVoiceNote {
1234  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1235  pub fn builder() -> RTDInlineQueryResultVoiceNoteBuilder {
1236    let mut inner = InlineQueryResultVoiceNote::default();
1237    inner.td_name = "inlineQueryResultVoiceNote".to_string();
1238    inner.extra = Some(Uuid::new_v4().to_string());
1239    RTDInlineQueryResultVoiceNoteBuilder { inner }
1240  }
1241
1242  pub fn id(&self) -> &String { &self.id }
1243
1244  pub fn voice_note(&self) -> &VoiceNote { &self.voice_note }
1245
1246  pub fn title(&self) -> &String { &self.title }
1247
1248}
1249
1250#[doc(hidden)]
1251pub struct RTDInlineQueryResultVoiceNoteBuilder {
1252  inner: InlineQueryResultVoiceNote
1253}
1254
1255impl RTDInlineQueryResultVoiceNoteBuilder {
1256  pub fn build(&self) -> InlineQueryResultVoiceNote { self.inner.clone() }
1257
1258   
1259  pub fn id<T: AsRef<str>>(&mut self, id: T) -> &mut Self {
1260    self.inner.id = id.as_ref().to_string();
1261    self
1262  }
1263
1264   
1265  pub fn voice_note<T: AsRef<VoiceNote>>(&mut self, voice_note: T) -> &mut Self {
1266    self.inner.voice_note = voice_note.as_ref().clone();
1267    self
1268  }
1269
1270   
1271  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
1272    self.inner.title = title.as_ref().to_string();
1273    self
1274  }
1275
1276}
1277
1278impl AsRef<InlineQueryResultVoiceNote> for InlineQueryResultVoiceNote {
1279  fn as_ref(&self) -> &InlineQueryResultVoiceNote { self }
1280}
1281
1282impl AsRef<InlineQueryResultVoiceNote> for RTDInlineQueryResultVoiceNoteBuilder {
1283  fn as_ref(&self) -> &InlineQueryResultVoiceNote { &self.inner }
1284}
1285
1286
1287