rtdlib/types/
input_message_content.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 | The content of a message to send
15pub trait TDInputMessageContent: Debug + RObject {}
16
17/// The content of a message to send
18#[derive(Debug, Clone, Serialize)]
19#[serde(untagged)]
20pub enum InputMessageContent {
21  #[doc(hidden)] _Default(()),
22  /// An animation message (GIF-style).
23  InputMessageAnimation(InputMessageAnimation),
24  /// An audio message
25  InputMessageAudio(InputMessageAudio),
26  /// A message containing a user contact
27  InputMessageContact(InputMessageContact),
28  /// A dice message
29  InputMessageDice(InputMessageDice),
30  /// A document message (general file)
31  InputMessageDocument(InputMessageDocument),
32  /// A forwarded message
33  InputMessageForwarded(InputMessageForwarded),
34  /// A message with a game; not supported for channels or secret chats
35  InputMessageGame(InputMessageGame),
36  /// A message with an invoice; can be used only by bots
37  InputMessageInvoice(InputMessageInvoice),
38  /// A message with a location
39  InputMessageLocation(InputMessageLocation),
40  /// A photo message
41  InputMessagePhoto(InputMessagePhoto),
42  /// A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot
43  InputMessagePoll(InputMessagePoll),
44  /// A sticker message
45  InputMessageSticker(InputMessageSticker),
46  /// A text message
47  InputMessageText(InputMessageText),
48  /// A message with information about a venue
49  InputMessageVenue(InputMessageVenue),
50  /// A video message
51  InputMessageVideo(InputMessageVideo),
52  /// A video note message
53  InputMessageVideoNote(InputMessageVideoNote),
54  /// A voice note message
55  InputMessageVoiceNote(InputMessageVoiceNote),
56
57}
58
59impl Default for InputMessageContent {
60  fn default() -> Self { InputMessageContent::_Default(()) }
61}
62
63impl<'de> Deserialize<'de> for InputMessageContent {
64  fn deserialize<D>(deserializer: D) -> Result<InputMessageContent, D::Error> where D: Deserializer<'de> {
65    use serde::de::Error;
66    rtd_enum_deserialize!(
67      InputMessageContent,
68      (inputMessageAnimation, InputMessageAnimation);
69      (inputMessageAudio, InputMessageAudio);
70      (inputMessageContact, InputMessageContact);
71      (inputMessageDice, InputMessageDice);
72      (inputMessageDocument, InputMessageDocument);
73      (inputMessageForwarded, InputMessageForwarded);
74      (inputMessageGame, InputMessageGame);
75      (inputMessageInvoice, InputMessageInvoice);
76      (inputMessageLocation, InputMessageLocation);
77      (inputMessagePhoto, InputMessagePhoto);
78      (inputMessagePoll, InputMessagePoll);
79      (inputMessageSticker, InputMessageSticker);
80      (inputMessageText, InputMessageText);
81      (inputMessageVenue, InputMessageVenue);
82      (inputMessageVideo, InputMessageVideo);
83      (inputMessageVideoNote, InputMessageVideoNote);
84      (inputMessageVoiceNote, InputMessageVoiceNote);
85
86    )(deserializer)
87  }
88}
89
90impl RObject for InputMessageContent {
91  #[doc(hidden)] fn td_name(&self) -> &'static str {
92    match self {
93      InputMessageContent::InputMessageAnimation(t) => t.td_name(),
94      InputMessageContent::InputMessageAudio(t) => t.td_name(),
95      InputMessageContent::InputMessageContact(t) => t.td_name(),
96      InputMessageContent::InputMessageDice(t) => t.td_name(),
97      InputMessageContent::InputMessageDocument(t) => t.td_name(),
98      InputMessageContent::InputMessageForwarded(t) => t.td_name(),
99      InputMessageContent::InputMessageGame(t) => t.td_name(),
100      InputMessageContent::InputMessageInvoice(t) => t.td_name(),
101      InputMessageContent::InputMessageLocation(t) => t.td_name(),
102      InputMessageContent::InputMessagePhoto(t) => t.td_name(),
103      InputMessageContent::InputMessagePoll(t) => t.td_name(),
104      InputMessageContent::InputMessageSticker(t) => t.td_name(),
105      InputMessageContent::InputMessageText(t) => t.td_name(),
106      InputMessageContent::InputMessageVenue(t) => t.td_name(),
107      InputMessageContent::InputMessageVideo(t) => t.td_name(),
108      InputMessageContent::InputMessageVideoNote(t) => t.td_name(),
109      InputMessageContent::InputMessageVoiceNote(t) => t.td_name(),
110
111      _ => "-1",
112    }
113  }
114  #[doc(hidden)] fn extra(&self) -> Option<String> {
115    match self {
116      InputMessageContent::InputMessageAnimation(t) => t.extra(),
117      InputMessageContent::InputMessageAudio(t) => t.extra(),
118      InputMessageContent::InputMessageContact(t) => t.extra(),
119      InputMessageContent::InputMessageDice(t) => t.extra(),
120      InputMessageContent::InputMessageDocument(t) => t.extra(),
121      InputMessageContent::InputMessageForwarded(t) => t.extra(),
122      InputMessageContent::InputMessageGame(t) => t.extra(),
123      InputMessageContent::InputMessageInvoice(t) => t.extra(),
124      InputMessageContent::InputMessageLocation(t) => t.extra(),
125      InputMessageContent::InputMessagePhoto(t) => t.extra(),
126      InputMessageContent::InputMessagePoll(t) => t.extra(),
127      InputMessageContent::InputMessageSticker(t) => t.extra(),
128      InputMessageContent::InputMessageText(t) => t.extra(),
129      InputMessageContent::InputMessageVenue(t) => t.extra(),
130      InputMessageContent::InputMessageVideo(t) => t.extra(),
131      InputMessageContent::InputMessageVideoNote(t) => t.extra(),
132      InputMessageContent::InputMessageVoiceNote(t) => t.extra(),
133
134      _ => None,
135    }
136  }
137  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
138}
139
140impl InputMessageContent {
141  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
142  #[doc(hidden)] pub fn _is_default(&self) -> bool { if let InputMessageContent::_Default(_) = self { true } else { false } }
143
144  pub fn is_input_message_animation(&self) -> bool { if let InputMessageContent::InputMessageAnimation(_) = self { true } else { false } }
145  pub fn is_input_message_audio(&self) -> bool { if let InputMessageContent::InputMessageAudio(_) = self { true } else { false } }
146  pub fn is_input_message_contact(&self) -> bool { if let InputMessageContent::InputMessageContact(_) = self { true } else { false } }
147  pub fn is_input_message_dice(&self) -> bool { if let InputMessageContent::InputMessageDice(_) = self { true } else { false } }
148  pub fn is_input_message_document(&self) -> bool { if let InputMessageContent::InputMessageDocument(_) = self { true } else { false } }
149  pub fn is_input_message_forwarded(&self) -> bool { if let InputMessageContent::InputMessageForwarded(_) = self { true } else { false } }
150  pub fn is_input_message_game(&self) -> bool { if let InputMessageContent::InputMessageGame(_) = self { true } else { false } }
151  pub fn is_input_message_invoice(&self) -> bool { if let InputMessageContent::InputMessageInvoice(_) = self { true } else { false } }
152  pub fn is_input_message_location(&self) -> bool { if let InputMessageContent::InputMessageLocation(_) = self { true } else { false } }
153  pub fn is_input_message_photo(&self) -> bool { if let InputMessageContent::InputMessagePhoto(_) = self { true } else { false } }
154  pub fn is_input_message_poll(&self) -> bool { if let InputMessageContent::InputMessagePoll(_) = self { true } else { false } }
155  pub fn is_input_message_sticker(&self) -> bool { if let InputMessageContent::InputMessageSticker(_) = self { true } else { false } }
156  pub fn is_input_message_text(&self) -> bool { if let InputMessageContent::InputMessageText(_) = self { true } else { false } }
157  pub fn is_input_message_venue(&self) -> bool { if let InputMessageContent::InputMessageVenue(_) = self { true } else { false } }
158  pub fn is_input_message_video(&self) -> bool { if let InputMessageContent::InputMessageVideo(_) = self { true } else { false } }
159  pub fn is_input_message_video_note(&self) -> bool { if let InputMessageContent::InputMessageVideoNote(_) = self { true } else { false } }
160  pub fn is_input_message_voice_note(&self) -> bool { if let InputMessageContent::InputMessageVoiceNote(_) = self { true } else { false } }
161
162  pub fn on_input_message_animation<F: FnOnce(&InputMessageAnimation)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageAnimation(t) = self { fnc(t) }; self }
163  pub fn on_input_message_audio<F: FnOnce(&InputMessageAudio)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageAudio(t) = self { fnc(t) }; self }
164  pub fn on_input_message_contact<F: FnOnce(&InputMessageContact)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageContact(t) = self { fnc(t) }; self }
165  pub fn on_input_message_dice<F: FnOnce(&InputMessageDice)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageDice(t) = self { fnc(t) }; self }
166  pub fn on_input_message_document<F: FnOnce(&InputMessageDocument)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageDocument(t) = self { fnc(t) }; self }
167  pub fn on_input_message_forwarded<F: FnOnce(&InputMessageForwarded)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageForwarded(t) = self { fnc(t) }; self }
168  pub fn on_input_message_game<F: FnOnce(&InputMessageGame)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageGame(t) = self { fnc(t) }; self }
169  pub fn on_input_message_invoice<F: FnOnce(&InputMessageInvoice)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageInvoice(t) = self { fnc(t) }; self }
170  pub fn on_input_message_location<F: FnOnce(&InputMessageLocation)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageLocation(t) = self { fnc(t) }; self }
171  pub fn on_input_message_photo<F: FnOnce(&InputMessagePhoto)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessagePhoto(t) = self { fnc(t) }; self }
172  pub fn on_input_message_poll<F: FnOnce(&InputMessagePoll)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessagePoll(t) = self { fnc(t) }; self }
173  pub fn on_input_message_sticker<F: FnOnce(&InputMessageSticker)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageSticker(t) = self { fnc(t) }; self }
174  pub fn on_input_message_text<F: FnOnce(&InputMessageText)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageText(t) = self { fnc(t) }; self }
175  pub fn on_input_message_venue<F: FnOnce(&InputMessageVenue)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageVenue(t) = self { fnc(t) }; self }
176  pub fn on_input_message_video<F: FnOnce(&InputMessageVideo)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageVideo(t) = self { fnc(t) }; self }
177  pub fn on_input_message_video_note<F: FnOnce(&InputMessageVideoNote)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageVideoNote(t) = self { fnc(t) }; self }
178  pub fn on_input_message_voice_note<F: FnOnce(&InputMessageVoiceNote)>(&self, fnc: F) -> &Self { if let InputMessageContent::InputMessageVoiceNote(t) = self { fnc(t) }; self }
179
180  pub fn as_input_message_animation(&self) -> Option<&InputMessageAnimation> { if let InputMessageContent::InputMessageAnimation(t) = self { return Some(t) } None }
181  pub fn as_input_message_audio(&self) -> Option<&InputMessageAudio> { if let InputMessageContent::InputMessageAudio(t) = self { return Some(t) } None }
182  pub fn as_input_message_contact(&self) -> Option<&InputMessageContact> { if let InputMessageContent::InputMessageContact(t) = self { return Some(t) } None }
183  pub fn as_input_message_dice(&self) -> Option<&InputMessageDice> { if let InputMessageContent::InputMessageDice(t) = self { return Some(t) } None }
184  pub fn as_input_message_document(&self) -> Option<&InputMessageDocument> { if let InputMessageContent::InputMessageDocument(t) = self { return Some(t) } None }
185  pub fn as_input_message_forwarded(&self) -> Option<&InputMessageForwarded> { if let InputMessageContent::InputMessageForwarded(t) = self { return Some(t) } None }
186  pub fn as_input_message_game(&self) -> Option<&InputMessageGame> { if let InputMessageContent::InputMessageGame(t) = self { return Some(t) } None }
187  pub fn as_input_message_invoice(&self) -> Option<&InputMessageInvoice> { if let InputMessageContent::InputMessageInvoice(t) = self { return Some(t) } None }
188  pub fn as_input_message_location(&self) -> Option<&InputMessageLocation> { if let InputMessageContent::InputMessageLocation(t) = self { return Some(t) } None }
189  pub fn as_input_message_photo(&self) -> Option<&InputMessagePhoto> { if let InputMessageContent::InputMessagePhoto(t) = self { return Some(t) } None }
190  pub fn as_input_message_poll(&self) -> Option<&InputMessagePoll> { if let InputMessageContent::InputMessagePoll(t) = self { return Some(t) } None }
191  pub fn as_input_message_sticker(&self) -> Option<&InputMessageSticker> { if let InputMessageContent::InputMessageSticker(t) = self { return Some(t) } None }
192  pub fn as_input_message_text(&self) -> Option<&InputMessageText> { if let InputMessageContent::InputMessageText(t) = self { return Some(t) } None }
193  pub fn as_input_message_venue(&self) -> Option<&InputMessageVenue> { if let InputMessageContent::InputMessageVenue(t) = self { return Some(t) } None }
194  pub fn as_input_message_video(&self) -> Option<&InputMessageVideo> { if let InputMessageContent::InputMessageVideo(t) = self { return Some(t) } None }
195  pub fn as_input_message_video_note(&self) -> Option<&InputMessageVideoNote> { if let InputMessageContent::InputMessageVideoNote(t) = self { return Some(t) } None }
196  pub fn as_input_message_voice_note(&self) -> Option<&InputMessageVoiceNote> { if let InputMessageContent::InputMessageVoiceNote(t) = self { return Some(t) } None }
197
198
199
200  pub fn input_message_animation<T: AsRef<InputMessageAnimation>>(t: T) -> Self { InputMessageContent::InputMessageAnimation(t.as_ref().clone()) }
201
202  pub fn input_message_audio<T: AsRef<InputMessageAudio>>(t: T) -> Self { InputMessageContent::InputMessageAudio(t.as_ref().clone()) }
203
204  pub fn input_message_contact<T: AsRef<InputMessageContact>>(t: T) -> Self { InputMessageContent::InputMessageContact(t.as_ref().clone()) }
205
206  pub fn input_message_dice<T: AsRef<InputMessageDice>>(t: T) -> Self { InputMessageContent::InputMessageDice(t.as_ref().clone()) }
207
208  pub fn input_message_document<T: AsRef<InputMessageDocument>>(t: T) -> Self { InputMessageContent::InputMessageDocument(t.as_ref().clone()) }
209
210  pub fn input_message_forwarded<T: AsRef<InputMessageForwarded>>(t: T) -> Self { InputMessageContent::InputMessageForwarded(t.as_ref().clone()) }
211
212  pub fn input_message_game<T: AsRef<InputMessageGame>>(t: T) -> Self { InputMessageContent::InputMessageGame(t.as_ref().clone()) }
213
214  pub fn input_message_invoice<T: AsRef<InputMessageInvoice>>(t: T) -> Self { InputMessageContent::InputMessageInvoice(t.as_ref().clone()) }
215
216  pub fn input_message_location<T: AsRef<InputMessageLocation>>(t: T) -> Self { InputMessageContent::InputMessageLocation(t.as_ref().clone()) }
217
218  pub fn input_message_photo<T: AsRef<InputMessagePhoto>>(t: T) -> Self { InputMessageContent::InputMessagePhoto(t.as_ref().clone()) }
219
220  pub fn input_message_poll<T: AsRef<InputMessagePoll>>(t: T) -> Self { InputMessageContent::InputMessagePoll(t.as_ref().clone()) }
221
222  pub fn input_message_sticker<T: AsRef<InputMessageSticker>>(t: T) -> Self { InputMessageContent::InputMessageSticker(t.as_ref().clone()) }
223
224  pub fn input_message_text<T: AsRef<InputMessageText>>(t: T) -> Self { InputMessageContent::InputMessageText(t.as_ref().clone()) }
225
226  pub fn input_message_venue<T: AsRef<InputMessageVenue>>(t: T) -> Self { InputMessageContent::InputMessageVenue(t.as_ref().clone()) }
227
228  pub fn input_message_video<T: AsRef<InputMessageVideo>>(t: T) -> Self { InputMessageContent::InputMessageVideo(t.as_ref().clone()) }
229
230  pub fn input_message_video_note<T: AsRef<InputMessageVideoNote>>(t: T) -> Self { InputMessageContent::InputMessageVideoNote(t.as_ref().clone()) }
231
232  pub fn input_message_voice_note<T: AsRef<InputMessageVoiceNote>>(t: T) -> Self { InputMessageContent::InputMessageVoiceNote(t.as_ref().clone()) }
233
234}
235
236impl AsRef<InputMessageContent> for InputMessageContent {
237  fn as_ref(&self) -> &InputMessageContent { self }
238}
239
240
241
242
243
244
245
246/// An animation message (GIF-style).
247#[derive(Debug, Clone, Default, Serialize, Deserialize)]
248pub struct InputMessageAnimation {
249  #[doc(hidden)]
250  #[serde(rename(serialize = "@type", deserialize = "@type"))]
251  td_name: String,
252  #[doc(hidden)]
253  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
254  extra: Option<String>,
255  /// Animation file to be sent
256  animation: InputFile,
257  /// Animation thumbnail; pass null to skip thumbnail uploading
258  thumbnail: InputThumbnail,
259  /// File identifiers of the stickers added to the animation, if applicable
260  added_sticker_file_ids: Vec<i64>,
261  /// Duration of the animation, in seconds
262  duration: i64,
263  /// Width of the animation; may be replaced by the server
264  width: i64,
265  /// Height of the animation; may be replaced by the server
266  height: i64,
267  /// Animation caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
268  caption: FormattedText,
269  
270}
271
272impl RObject for InputMessageAnimation {
273  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageAnimation" }
274  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
275  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
276}
277
278
279impl TDInputMessageContent for InputMessageAnimation {}
280
281
282
283impl InputMessageAnimation {
284  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
285  pub fn builder() -> RTDInputMessageAnimationBuilder {
286    let mut inner = InputMessageAnimation::default();
287    inner.td_name = "inputMessageAnimation".to_string();
288    inner.extra = Some(Uuid::new_v4().to_string());
289    RTDInputMessageAnimationBuilder { inner }
290  }
291
292  pub fn animation(&self) -> &InputFile { &self.animation }
293
294  pub fn thumbnail(&self) -> &InputThumbnail { &self.thumbnail }
295
296  pub fn added_sticker_file_ids(&self) -> &Vec<i64> { &self.added_sticker_file_ids }
297
298  pub fn duration(&self) -> i64 { self.duration }
299
300  pub fn width(&self) -> i64 { self.width }
301
302  pub fn height(&self) -> i64 { self.height }
303
304  pub fn caption(&self) -> &FormattedText { &self.caption }
305
306}
307
308#[doc(hidden)]
309pub struct RTDInputMessageAnimationBuilder {
310  inner: InputMessageAnimation
311}
312
313impl RTDInputMessageAnimationBuilder {
314  pub fn build(&self) -> InputMessageAnimation { self.inner.clone() }
315
316   
317  pub fn animation<T: AsRef<InputFile>>(&mut self, animation: T) -> &mut Self {
318    self.inner.animation = animation.as_ref().clone();
319    self
320  }
321
322   
323  pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
324    self.inner.thumbnail = thumbnail.as_ref().clone();
325    self
326  }
327
328   
329  pub fn added_sticker_file_ids(&mut self, added_sticker_file_ids: Vec<i64>) -> &mut Self {
330    self.inner.added_sticker_file_ids = added_sticker_file_ids;
331    self
332  }
333
334   
335  pub fn duration(&mut self, duration: i64) -> &mut Self {
336    self.inner.duration = duration;
337    self
338  }
339
340   
341  pub fn width(&mut self, width: i64) -> &mut Self {
342    self.inner.width = width;
343    self
344  }
345
346   
347  pub fn height(&mut self, height: i64) -> &mut Self {
348    self.inner.height = height;
349    self
350  }
351
352   
353  pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
354    self.inner.caption = caption.as_ref().clone();
355    self
356  }
357
358}
359
360impl AsRef<InputMessageAnimation> for InputMessageAnimation {
361  fn as_ref(&self) -> &InputMessageAnimation { self }
362}
363
364impl AsRef<InputMessageAnimation> for RTDInputMessageAnimationBuilder {
365  fn as_ref(&self) -> &InputMessageAnimation { &self.inner }
366}
367
368
369
370
371
372
373
374/// An audio message
375#[derive(Debug, Clone, Default, Serialize, Deserialize)]
376pub struct InputMessageAudio {
377  #[doc(hidden)]
378  #[serde(rename(serialize = "@type", deserialize = "@type"))]
379  td_name: String,
380  #[doc(hidden)]
381  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
382  extra: Option<String>,
383  /// Audio file to be sent
384  audio: InputFile,
385  /// Thumbnail of the cover for the album; pass null to skip thumbnail uploading
386  album_cover_thumbnail: InputThumbnail,
387  /// Duration of the audio, in seconds; may be replaced by the server
388  duration: i64,
389  /// Title of the audio; 0-64 characters; may be replaced by the server
390  title: String,
391  /// Performer of the audio; 0-64 characters, may be replaced by the server
392  performer: String,
393  /// Audio caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
394  caption: FormattedText,
395  
396}
397
398impl RObject for InputMessageAudio {
399  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageAudio" }
400  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
401  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
402}
403
404
405impl TDInputMessageContent for InputMessageAudio {}
406
407
408
409impl InputMessageAudio {
410  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
411  pub fn builder() -> RTDInputMessageAudioBuilder {
412    let mut inner = InputMessageAudio::default();
413    inner.td_name = "inputMessageAudio".to_string();
414    inner.extra = Some(Uuid::new_v4().to_string());
415    RTDInputMessageAudioBuilder { inner }
416  }
417
418  pub fn audio(&self) -> &InputFile { &self.audio }
419
420  pub fn album_cover_thumbnail(&self) -> &InputThumbnail { &self.album_cover_thumbnail }
421
422  pub fn duration(&self) -> i64 { self.duration }
423
424  pub fn title(&self) -> &String { &self.title }
425
426  pub fn performer(&self) -> &String { &self.performer }
427
428  pub fn caption(&self) -> &FormattedText { &self.caption }
429
430}
431
432#[doc(hidden)]
433pub struct RTDInputMessageAudioBuilder {
434  inner: InputMessageAudio
435}
436
437impl RTDInputMessageAudioBuilder {
438  pub fn build(&self) -> InputMessageAudio { self.inner.clone() }
439
440   
441  pub fn audio<T: AsRef<InputFile>>(&mut self, audio: T) -> &mut Self {
442    self.inner.audio = audio.as_ref().clone();
443    self
444  }
445
446   
447  pub fn album_cover_thumbnail<T: AsRef<InputThumbnail>>(&mut self, album_cover_thumbnail: T) -> &mut Self {
448    self.inner.album_cover_thumbnail = album_cover_thumbnail.as_ref().clone();
449    self
450  }
451
452   
453  pub fn duration(&mut self, duration: i64) -> &mut Self {
454    self.inner.duration = duration;
455    self
456  }
457
458   
459  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
460    self.inner.title = title.as_ref().to_string();
461    self
462  }
463
464   
465  pub fn performer<T: AsRef<str>>(&mut self, performer: T) -> &mut Self {
466    self.inner.performer = performer.as_ref().to_string();
467    self
468  }
469
470   
471  pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
472    self.inner.caption = caption.as_ref().clone();
473    self
474  }
475
476}
477
478impl AsRef<InputMessageAudio> for InputMessageAudio {
479  fn as_ref(&self) -> &InputMessageAudio { self }
480}
481
482impl AsRef<InputMessageAudio> for RTDInputMessageAudioBuilder {
483  fn as_ref(&self) -> &InputMessageAudio { &self.inner }
484}
485
486
487
488
489
490
491
492/// A message containing a user contact
493#[derive(Debug, Clone, Default, Serialize, Deserialize)]
494pub struct InputMessageContact {
495  #[doc(hidden)]
496  #[serde(rename(serialize = "@type", deserialize = "@type"))]
497  td_name: String,
498  #[doc(hidden)]
499  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
500  extra: Option<String>,
501  /// Contact to send
502  contact: Contact,
503  
504}
505
506impl RObject for InputMessageContact {
507  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageContact" }
508  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
509  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
510}
511
512
513impl TDInputMessageContent for InputMessageContact {}
514
515
516
517impl InputMessageContact {
518  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
519  pub fn builder() -> RTDInputMessageContactBuilder {
520    let mut inner = InputMessageContact::default();
521    inner.td_name = "inputMessageContact".to_string();
522    inner.extra = Some(Uuid::new_v4().to_string());
523    RTDInputMessageContactBuilder { inner }
524  }
525
526  pub fn contact(&self) -> &Contact { &self.contact }
527
528}
529
530#[doc(hidden)]
531pub struct RTDInputMessageContactBuilder {
532  inner: InputMessageContact
533}
534
535impl RTDInputMessageContactBuilder {
536  pub fn build(&self) -> InputMessageContact { self.inner.clone() }
537
538   
539  pub fn contact<T: AsRef<Contact>>(&mut self, contact: T) -> &mut Self {
540    self.inner.contact = contact.as_ref().clone();
541    self
542  }
543
544}
545
546impl AsRef<InputMessageContact> for InputMessageContact {
547  fn as_ref(&self) -> &InputMessageContact { self }
548}
549
550impl AsRef<InputMessageContact> for RTDInputMessageContactBuilder {
551  fn as_ref(&self) -> &InputMessageContact { &self.inner }
552}
553
554
555
556
557
558
559
560/// A dice message
561#[derive(Debug, Clone, Default, Serialize, Deserialize)]
562pub struct InputMessageDice {
563  #[doc(hidden)]
564  #[serde(rename(serialize = "@type", deserialize = "@type"))]
565  td_name: String,
566  #[doc(hidden)]
567  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
568  extra: Option<String>,
569  /// Emoji on which the dice throw animation is based
570  emoji: String,
571  /// True, if the chat message draft must be deleted
572  clear_draft: bool,
573  
574}
575
576impl RObject for InputMessageDice {
577  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageDice" }
578  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
579  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
580}
581
582
583impl TDInputMessageContent for InputMessageDice {}
584
585
586
587impl InputMessageDice {
588  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
589  pub fn builder() -> RTDInputMessageDiceBuilder {
590    let mut inner = InputMessageDice::default();
591    inner.td_name = "inputMessageDice".to_string();
592    inner.extra = Some(Uuid::new_v4().to_string());
593    RTDInputMessageDiceBuilder { inner }
594  }
595
596  pub fn emoji(&self) -> &String { &self.emoji }
597
598  pub fn clear_draft(&self) -> bool { self.clear_draft }
599
600}
601
602#[doc(hidden)]
603pub struct RTDInputMessageDiceBuilder {
604  inner: InputMessageDice
605}
606
607impl RTDInputMessageDiceBuilder {
608  pub fn build(&self) -> InputMessageDice { self.inner.clone() }
609
610   
611  pub fn emoji<T: AsRef<str>>(&mut self, emoji: T) -> &mut Self {
612    self.inner.emoji = emoji.as_ref().to_string();
613    self
614  }
615
616   
617  pub fn clear_draft(&mut self, clear_draft: bool) -> &mut Self {
618    self.inner.clear_draft = clear_draft;
619    self
620  }
621
622}
623
624impl AsRef<InputMessageDice> for InputMessageDice {
625  fn as_ref(&self) -> &InputMessageDice { self }
626}
627
628impl AsRef<InputMessageDice> for RTDInputMessageDiceBuilder {
629  fn as_ref(&self) -> &InputMessageDice { &self.inner }
630}
631
632
633
634
635
636
637
638/// A document message (general file)
639#[derive(Debug, Clone, Default, Serialize, Deserialize)]
640pub struct InputMessageDocument {
641  #[doc(hidden)]
642  #[serde(rename(serialize = "@type", deserialize = "@type"))]
643  td_name: String,
644  #[doc(hidden)]
645  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
646  extra: Option<String>,
647  /// Document to be sent
648  document: InputFile,
649  /// Document thumbnail; pass null to skip thumbnail uploading
650  thumbnail: InputThumbnail,
651  /// If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats
652  disable_content_type_detection: bool,
653  /// Document caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
654  caption: FormattedText,
655  
656}
657
658impl RObject for InputMessageDocument {
659  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageDocument" }
660  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
661  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
662}
663
664
665impl TDInputMessageContent for InputMessageDocument {}
666
667
668
669impl InputMessageDocument {
670  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
671  pub fn builder() -> RTDInputMessageDocumentBuilder {
672    let mut inner = InputMessageDocument::default();
673    inner.td_name = "inputMessageDocument".to_string();
674    inner.extra = Some(Uuid::new_v4().to_string());
675    RTDInputMessageDocumentBuilder { inner }
676  }
677
678  pub fn document(&self) -> &InputFile { &self.document }
679
680  pub fn thumbnail(&self) -> &InputThumbnail { &self.thumbnail }
681
682  pub fn disable_content_type_detection(&self) -> bool { self.disable_content_type_detection }
683
684  pub fn caption(&self) -> &FormattedText { &self.caption }
685
686}
687
688#[doc(hidden)]
689pub struct RTDInputMessageDocumentBuilder {
690  inner: InputMessageDocument
691}
692
693impl RTDInputMessageDocumentBuilder {
694  pub fn build(&self) -> InputMessageDocument { self.inner.clone() }
695
696   
697  pub fn document<T: AsRef<InputFile>>(&mut self, document: T) -> &mut Self {
698    self.inner.document = document.as_ref().clone();
699    self
700  }
701
702   
703  pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
704    self.inner.thumbnail = thumbnail.as_ref().clone();
705    self
706  }
707
708   
709  pub fn disable_content_type_detection(&mut self, disable_content_type_detection: bool) -> &mut Self {
710    self.inner.disable_content_type_detection = disable_content_type_detection;
711    self
712  }
713
714   
715  pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
716    self.inner.caption = caption.as_ref().clone();
717    self
718  }
719
720}
721
722impl AsRef<InputMessageDocument> for InputMessageDocument {
723  fn as_ref(&self) -> &InputMessageDocument { self }
724}
725
726impl AsRef<InputMessageDocument> for RTDInputMessageDocumentBuilder {
727  fn as_ref(&self) -> &InputMessageDocument { &self.inner }
728}
729
730
731
732
733
734
735
736/// A forwarded message
737#[derive(Debug, Clone, Default, Serialize, Deserialize)]
738pub struct InputMessageForwarded {
739  #[doc(hidden)]
740  #[serde(rename(serialize = "@type", deserialize = "@type"))]
741  td_name: String,
742  #[doc(hidden)]
743  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
744  extra: Option<String>,
745  /// Identifier for the chat this forwarded message came from
746  from_chat_id: i64,
747  /// Identifier of the message to forward
748  message_id: i64,
749  /// True, if a game message is being shared from a launched game; applies only to game messages
750  in_game_share: bool,
751  /// Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual
752  copy_options: MessageCopyOptions,
753  
754}
755
756impl RObject for InputMessageForwarded {
757  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageForwarded" }
758  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
759  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
760}
761
762
763impl TDInputMessageContent for InputMessageForwarded {}
764
765
766
767impl InputMessageForwarded {
768  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
769  pub fn builder() -> RTDInputMessageForwardedBuilder {
770    let mut inner = InputMessageForwarded::default();
771    inner.td_name = "inputMessageForwarded".to_string();
772    inner.extra = Some(Uuid::new_v4().to_string());
773    RTDInputMessageForwardedBuilder { inner }
774  }
775
776  pub fn from_chat_id(&self) -> i64 { self.from_chat_id }
777
778  pub fn message_id(&self) -> i64 { self.message_id }
779
780  pub fn in_game_share(&self) -> bool { self.in_game_share }
781
782  pub fn copy_options(&self) -> &MessageCopyOptions { &self.copy_options }
783
784}
785
786#[doc(hidden)]
787pub struct RTDInputMessageForwardedBuilder {
788  inner: InputMessageForwarded
789}
790
791impl RTDInputMessageForwardedBuilder {
792  pub fn build(&self) -> InputMessageForwarded { self.inner.clone() }
793
794   
795  pub fn from_chat_id(&mut self, from_chat_id: i64) -> &mut Self {
796    self.inner.from_chat_id = from_chat_id;
797    self
798  }
799
800   
801  pub fn message_id(&mut self, message_id: i64) -> &mut Self {
802    self.inner.message_id = message_id;
803    self
804  }
805
806   
807  pub fn in_game_share(&mut self, in_game_share: bool) -> &mut Self {
808    self.inner.in_game_share = in_game_share;
809    self
810  }
811
812   
813  pub fn copy_options<T: AsRef<MessageCopyOptions>>(&mut self, copy_options: T) -> &mut Self {
814    self.inner.copy_options = copy_options.as_ref().clone();
815    self
816  }
817
818}
819
820impl AsRef<InputMessageForwarded> for InputMessageForwarded {
821  fn as_ref(&self) -> &InputMessageForwarded { self }
822}
823
824impl AsRef<InputMessageForwarded> for RTDInputMessageForwardedBuilder {
825  fn as_ref(&self) -> &InputMessageForwarded { &self.inner }
826}
827
828
829
830
831
832
833
834/// A message with a game; not supported for channels or secret chats
835#[derive(Debug, Clone, Default, Serialize, Deserialize)]
836pub struct InputMessageGame {
837  #[doc(hidden)]
838  #[serde(rename(serialize = "@type", deserialize = "@type"))]
839  td_name: String,
840  #[doc(hidden)]
841  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
842  extra: Option<String>,
843  /// User identifier of the bot that owns the game
844  bot_user_id: i64,
845  /// Short name of the game
846  game_short_name: String,
847  
848}
849
850impl RObject for InputMessageGame {
851  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageGame" }
852  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
853  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
854}
855
856
857impl TDInputMessageContent for InputMessageGame {}
858
859
860
861impl InputMessageGame {
862  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
863  pub fn builder() -> RTDInputMessageGameBuilder {
864    let mut inner = InputMessageGame::default();
865    inner.td_name = "inputMessageGame".to_string();
866    inner.extra = Some(Uuid::new_v4().to_string());
867    RTDInputMessageGameBuilder { inner }
868  }
869
870  pub fn bot_user_id(&self) -> i64 { self.bot_user_id }
871
872  pub fn game_short_name(&self) -> &String { &self.game_short_name }
873
874}
875
876#[doc(hidden)]
877pub struct RTDInputMessageGameBuilder {
878  inner: InputMessageGame
879}
880
881impl RTDInputMessageGameBuilder {
882  pub fn build(&self) -> InputMessageGame { self.inner.clone() }
883
884   
885  pub fn bot_user_id(&mut self, bot_user_id: i64) -> &mut Self {
886    self.inner.bot_user_id = bot_user_id;
887    self
888  }
889
890   
891  pub fn game_short_name<T: AsRef<str>>(&mut self, game_short_name: T) -> &mut Self {
892    self.inner.game_short_name = game_short_name.as_ref().to_string();
893    self
894  }
895
896}
897
898impl AsRef<InputMessageGame> for InputMessageGame {
899  fn as_ref(&self) -> &InputMessageGame { self }
900}
901
902impl AsRef<InputMessageGame> for RTDInputMessageGameBuilder {
903  fn as_ref(&self) -> &InputMessageGame { &self.inner }
904}
905
906
907
908
909
910
911
912/// A message with an invoice; can be used only by bots
913#[derive(Debug, Clone, Default, Serialize, Deserialize)]
914pub struct InputMessageInvoice {
915  #[doc(hidden)]
916  #[serde(rename(serialize = "@type", deserialize = "@type"))]
917  td_name: String,
918  #[doc(hidden)]
919  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
920  extra: Option<String>,
921  /// Invoice
922  invoice: Invoice,
923  /// Product title; 1-32 characters
924  title: String,
925  /// A message with an invoice; can be used only by bots
926  description: String,
927  /// Product photo URL; optional
928  photo_url: String,
929  /// Product photo size
930  photo_size: i64,
931  /// Product photo width
932  photo_width: i64,
933  /// Product photo height
934  photo_height: i64,
935  /// The invoice payload
936  payload: String,
937  /// Payment provider token
938  provider_token: String,
939  /// JSON-encoded data about the invoice, which will be shared with the payment provider
940  provider_data: String,
941  /// Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message
942  start_parameter: String,
943  
944}
945
946impl RObject for InputMessageInvoice {
947  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageInvoice" }
948  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
949  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
950}
951
952
953impl TDInputMessageContent for InputMessageInvoice {}
954
955
956
957impl InputMessageInvoice {
958  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
959  pub fn builder() -> RTDInputMessageInvoiceBuilder {
960    let mut inner = InputMessageInvoice::default();
961    inner.td_name = "inputMessageInvoice".to_string();
962    inner.extra = Some(Uuid::new_v4().to_string());
963    RTDInputMessageInvoiceBuilder { inner }
964  }
965
966  pub fn invoice(&self) -> &Invoice { &self.invoice }
967
968  pub fn title(&self) -> &String { &self.title }
969
970  pub fn description(&self) -> &String { &self.description }
971
972  pub fn photo_url(&self) -> &String { &self.photo_url }
973
974  pub fn photo_size(&self) -> i64 { self.photo_size }
975
976  pub fn photo_width(&self) -> i64 { self.photo_width }
977
978  pub fn photo_height(&self) -> i64 { self.photo_height }
979
980  pub fn payload(&self) -> &String { &self.payload }
981
982  pub fn provider_token(&self) -> &String { &self.provider_token }
983
984  pub fn provider_data(&self) -> &String { &self.provider_data }
985
986  pub fn start_parameter(&self) -> &String { &self.start_parameter }
987
988}
989
990#[doc(hidden)]
991pub struct RTDInputMessageInvoiceBuilder {
992  inner: InputMessageInvoice
993}
994
995impl RTDInputMessageInvoiceBuilder {
996  pub fn build(&self) -> InputMessageInvoice { self.inner.clone() }
997
998   
999  pub fn invoice<T: AsRef<Invoice>>(&mut self, invoice: T) -> &mut Self {
1000    self.inner.invoice = invoice.as_ref().clone();
1001    self
1002  }
1003
1004   
1005  pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
1006    self.inner.title = title.as_ref().to_string();
1007    self
1008  }
1009
1010   
1011  pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
1012    self.inner.description = description.as_ref().to_string();
1013    self
1014  }
1015
1016   
1017  pub fn photo_url<T: AsRef<str>>(&mut self, photo_url: T) -> &mut Self {
1018    self.inner.photo_url = photo_url.as_ref().to_string();
1019    self
1020  }
1021
1022   
1023  pub fn photo_size(&mut self, photo_size: i64) -> &mut Self {
1024    self.inner.photo_size = photo_size;
1025    self
1026  }
1027
1028   
1029  pub fn photo_width(&mut self, photo_width: i64) -> &mut Self {
1030    self.inner.photo_width = photo_width;
1031    self
1032  }
1033
1034   
1035  pub fn photo_height(&mut self, photo_height: i64) -> &mut Self {
1036    self.inner.photo_height = photo_height;
1037    self
1038  }
1039
1040   
1041  pub fn payload<T: AsRef<str>>(&mut self, payload: T) -> &mut Self {
1042    self.inner.payload = payload.as_ref().to_string();
1043    self
1044  }
1045
1046   
1047  pub fn provider_token<T: AsRef<str>>(&mut self, provider_token: T) -> &mut Self {
1048    self.inner.provider_token = provider_token.as_ref().to_string();
1049    self
1050  }
1051
1052   
1053  pub fn provider_data<T: AsRef<str>>(&mut self, provider_data: T) -> &mut Self {
1054    self.inner.provider_data = provider_data.as_ref().to_string();
1055    self
1056  }
1057
1058   
1059  pub fn start_parameter<T: AsRef<str>>(&mut self, start_parameter: T) -> &mut Self {
1060    self.inner.start_parameter = start_parameter.as_ref().to_string();
1061    self
1062  }
1063
1064}
1065
1066impl AsRef<InputMessageInvoice> for InputMessageInvoice {
1067  fn as_ref(&self) -> &InputMessageInvoice { self }
1068}
1069
1070impl AsRef<InputMessageInvoice> for RTDInputMessageInvoiceBuilder {
1071  fn as_ref(&self) -> &InputMessageInvoice { &self.inner }
1072}
1073
1074
1075
1076
1077
1078
1079
1080/// A message with a location
1081#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1082pub struct InputMessageLocation {
1083  #[doc(hidden)]
1084  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1085  td_name: String,
1086  #[doc(hidden)]
1087  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1088  extra: Option<String>,
1089  /// Location to be sent
1090  location: Location,
1091  /// Period for which the location can be updated, in seconds; must be between 60 and 86400 for a live location and 0 otherwise
1092  live_period: i64,
1093  /// For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
1094  heading: i64,
1095  /// For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages
1096  proximity_alert_radius: i64,
1097  
1098}
1099
1100impl RObject for InputMessageLocation {
1101  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageLocation" }
1102  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1103  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1104}
1105
1106
1107impl TDInputMessageContent for InputMessageLocation {}
1108
1109
1110
1111impl InputMessageLocation {
1112  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1113  pub fn builder() -> RTDInputMessageLocationBuilder {
1114    let mut inner = InputMessageLocation::default();
1115    inner.td_name = "inputMessageLocation".to_string();
1116    inner.extra = Some(Uuid::new_v4().to_string());
1117    RTDInputMessageLocationBuilder { inner }
1118  }
1119
1120  pub fn location(&self) -> &Location { &self.location }
1121
1122  pub fn live_period(&self) -> i64 { self.live_period }
1123
1124  pub fn heading(&self) -> i64 { self.heading }
1125
1126  pub fn proximity_alert_radius(&self) -> i64 { self.proximity_alert_radius }
1127
1128}
1129
1130#[doc(hidden)]
1131pub struct RTDInputMessageLocationBuilder {
1132  inner: InputMessageLocation
1133}
1134
1135impl RTDInputMessageLocationBuilder {
1136  pub fn build(&self) -> InputMessageLocation { self.inner.clone() }
1137
1138   
1139  pub fn location<T: AsRef<Location>>(&mut self, location: T) -> &mut Self {
1140    self.inner.location = location.as_ref().clone();
1141    self
1142  }
1143
1144   
1145  pub fn live_period(&mut self, live_period: i64) -> &mut Self {
1146    self.inner.live_period = live_period;
1147    self
1148  }
1149
1150   
1151  pub fn heading(&mut self, heading: i64) -> &mut Self {
1152    self.inner.heading = heading;
1153    self
1154  }
1155
1156   
1157  pub fn proximity_alert_radius(&mut self, proximity_alert_radius: i64) -> &mut Self {
1158    self.inner.proximity_alert_radius = proximity_alert_radius;
1159    self
1160  }
1161
1162}
1163
1164impl AsRef<InputMessageLocation> for InputMessageLocation {
1165  fn as_ref(&self) -> &InputMessageLocation { self }
1166}
1167
1168impl AsRef<InputMessageLocation> for RTDInputMessageLocationBuilder {
1169  fn as_ref(&self) -> &InputMessageLocation { &self.inner }
1170}
1171
1172
1173
1174
1175
1176
1177
1178/// A photo message
1179#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1180pub struct InputMessagePhoto {
1181  #[doc(hidden)]
1182  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1183  td_name: String,
1184  #[doc(hidden)]
1185  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1186  extra: Option<String>,
1187  /// Photo to send
1188  photo: InputFile,
1189  /// Photo thumbnail to be sent; pass null to skip thumbnail uploading. The thumbnail is sent to the other party only in secret chats
1190  thumbnail: InputThumbnail,
1191  /// File identifiers of the stickers added to the photo, if applicable
1192  added_sticker_file_ids: Vec<i64>,
1193  /// Photo width
1194  width: i64,
1195  /// Photo height
1196  height: i64,
1197  /// Photo caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
1198  caption: FormattedText,
1199  /// Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
1200  ttl: i64,
1201  
1202}
1203
1204impl RObject for InputMessagePhoto {
1205  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessagePhoto" }
1206  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1207  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1208}
1209
1210
1211impl TDInputMessageContent for InputMessagePhoto {}
1212
1213
1214
1215impl InputMessagePhoto {
1216  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1217  pub fn builder() -> RTDInputMessagePhotoBuilder {
1218    let mut inner = InputMessagePhoto::default();
1219    inner.td_name = "inputMessagePhoto".to_string();
1220    inner.extra = Some(Uuid::new_v4().to_string());
1221    RTDInputMessagePhotoBuilder { inner }
1222  }
1223
1224  pub fn photo(&self) -> &InputFile { &self.photo }
1225
1226  pub fn thumbnail(&self) -> &InputThumbnail { &self.thumbnail }
1227
1228  pub fn added_sticker_file_ids(&self) -> &Vec<i64> { &self.added_sticker_file_ids }
1229
1230  pub fn width(&self) -> i64 { self.width }
1231
1232  pub fn height(&self) -> i64 { self.height }
1233
1234  pub fn caption(&self) -> &FormattedText { &self.caption }
1235
1236  pub fn ttl(&self) -> i64 { self.ttl }
1237
1238}
1239
1240#[doc(hidden)]
1241pub struct RTDInputMessagePhotoBuilder {
1242  inner: InputMessagePhoto
1243}
1244
1245impl RTDInputMessagePhotoBuilder {
1246  pub fn build(&self) -> InputMessagePhoto { self.inner.clone() }
1247
1248   
1249  pub fn photo<T: AsRef<InputFile>>(&mut self, photo: T) -> &mut Self {
1250    self.inner.photo = photo.as_ref().clone();
1251    self
1252  }
1253
1254   
1255  pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1256    self.inner.thumbnail = thumbnail.as_ref().clone();
1257    self
1258  }
1259
1260   
1261  pub fn added_sticker_file_ids(&mut self, added_sticker_file_ids: Vec<i64>) -> &mut Self {
1262    self.inner.added_sticker_file_ids = added_sticker_file_ids;
1263    self
1264  }
1265
1266   
1267  pub fn width(&mut self, width: i64) -> &mut Self {
1268    self.inner.width = width;
1269    self
1270  }
1271
1272   
1273  pub fn height(&mut self, height: i64) -> &mut Self {
1274    self.inner.height = height;
1275    self
1276  }
1277
1278   
1279  pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
1280    self.inner.caption = caption.as_ref().clone();
1281    self
1282  }
1283
1284   
1285  pub fn ttl(&mut self, ttl: i64) -> &mut Self {
1286    self.inner.ttl = ttl;
1287    self
1288  }
1289
1290}
1291
1292impl AsRef<InputMessagePhoto> for InputMessagePhoto {
1293  fn as_ref(&self) -> &InputMessagePhoto { self }
1294}
1295
1296impl AsRef<InputMessagePhoto> for RTDInputMessagePhotoBuilder {
1297  fn as_ref(&self) -> &InputMessagePhoto { &self.inner }
1298}
1299
1300
1301
1302
1303
1304
1305
1306/// A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot
1307#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1308pub struct InputMessagePoll {
1309  #[doc(hidden)]
1310  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1311  td_name: String,
1312  #[doc(hidden)]
1313  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1314  extra: Option<String>,
1315  /// Poll question; 1-255 characters (up to 300 characters for bots)
1316  question: String,
1317  /// List of poll answer options, 2-10 strings 1-100 characters each
1318  options: Vec<String>,
1319  /// True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels
1320  is_anonymous: bool,
1321  /// Type of the poll
1322  #[serde(rename(serialize = "type", deserialize = "type"))] type_: PollType,
1323  /// Amount of time the poll will be active after creation, in seconds; for bots only
1324  open_period: i64,
1325  /// Point in time (Unix timestamp) when the poll will automatically be closed; for bots only
1326  close_date: i64,
1327  /// True, if the poll needs to be sent already closed; for bots only
1328  is_closed: bool,
1329  
1330}
1331
1332impl RObject for InputMessagePoll {
1333  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessagePoll" }
1334  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1335  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1336}
1337
1338
1339impl TDInputMessageContent for InputMessagePoll {}
1340
1341
1342
1343impl InputMessagePoll {
1344  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1345  pub fn builder() -> RTDInputMessagePollBuilder {
1346    let mut inner = InputMessagePoll::default();
1347    inner.td_name = "inputMessagePoll".to_string();
1348    inner.extra = Some(Uuid::new_v4().to_string());
1349    RTDInputMessagePollBuilder { inner }
1350  }
1351
1352  pub fn question(&self) -> &String { &self.question }
1353
1354  pub fn options(&self) -> &Vec<String> { &self.options }
1355
1356  pub fn is_anonymous(&self) -> bool { self.is_anonymous }
1357
1358  pub fn type_(&self) -> &PollType { &self.type_ }
1359
1360  pub fn open_period(&self) -> i64 { self.open_period }
1361
1362  pub fn close_date(&self) -> i64 { self.close_date }
1363
1364  pub fn is_closed(&self) -> bool { self.is_closed }
1365
1366}
1367
1368#[doc(hidden)]
1369pub struct RTDInputMessagePollBuilder {
1370  inner: InputMessagePoll
1371}
1372
1373impl RTDInputMessagePollBuilder {
1374  pub fn build(&self) -> InputMessagePoll { self.inner.clone() }
1375
1376   
1377  pub fn question<T: AsRef<str>>(&mut self, question: T) -> &mut Self {
1378    self.inner.question = question.as_ref().to_string();
1379    self
1380  }
1381
1382   
1383  pub fn options(&mut self, options: Vec<String>) -> &mut Self {
1384    self.inner.options = options;
1385    self
1386  }
1387
1388   
1389  pub fn is_anonymous(&mut self, is_anonymous: bool) -> &mut Self {
1390    self.inner.is_anonymous = is_anonymous;
1391    self
1392  }
1393
1394   
1395  pub fn type_<T: AsRef<PollType>>(&mut self, type_: T) -> &mut Self {
1396    self.inner.type_ = type_.as_ref().clone();
1397    self
1398  }
1399
1400   
1401  pub fn open_period(&mut self, open_period: i64) -> &mut Self {
1402    self.inner.open_period = open_period;
1403    self
1404  }
1405
1406   
1407  pub fn close_date(&mut self, close_date: i64) -> &mut Self {
1408    self.inner.close_date = close_date;
1409    self
1410  }
1411
1412   
1413  pub fn is_closed(&mut self, is_closed: bool) -> &mut Self {
1414    self.inner.is_closed = is_closed;
1415    self
1416  }
1417
1418}
1419
1420impl AsRef<InputMessagePoll> for InputMessagePoll {
1421  fn as_ref(&self) -> &InputMessagePoll { self }
1422}
1423
1424impl AsRef<InputMessagePoll> for RTDInputMessagePollBuilder {
1425  fn as_ref(&self) -> &InputMessagePoll { &self.inner }
1426}
1427
1428
1429
1430
1431
1432
1433
1434/// A sticker message
1435#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1436pub struct InputMessageSticker {
1437  #[doc(hidden)]
1438  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1439  td_name: String,
1440  #[doc(hidden)]
1441  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1442  extra: Option<String>,
1443  /// Sticker to be sent
1444  sticker: InputFile,
1445  /// Sticker thumbnail; pass null to skip thumbnail uploading
1446  thumbnail: InputThumbnail,
1447  /// Sticker width
1448  width: i64,
1449  /// Sticker height
1450  height: i64,
1451  /// Emoji used to choose the sticker
1452  emoji: String,
1453  
1454}
1455
1456impl RObject for InputMessageSticker {
1457  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageSticker" }
1458  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1459  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1460}
1461
1462
1463impl TDInputMessageContent for InputMessageSticker {}
1464
1465
1466
1467impl InputMessageSticker {
1468  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1469  pub fn builder() -> RTDInputMessageStickerBuilder {
1470    let mut inner = InputMessageSticker::default();
1471    inner.td_name = "inputMessageSticker".to_string();
1472    inner.extra = Some(Uuid::new_v4().to_string());
1473    RTDInputMessageStickerBuilder { inner }
1474  }
1475
1476  pub fn sticker(&self) -> &InputFile { &self.sticker }
1477
1478  pub fn thumbnail(&self) -> &InputThumbnail { &self.thumbnail }
1479
1480  pub fn width(&self) -> i64 { self.width }
1481
1482  pub fn height(&self) -> i64 { self.height }
1483
1484  pub fn emoji(&self) -> &String { &self.emoji }
1485
1486}
1487
1488#[doc(hidden)]
1489pub struct RTDInputMessageStickerBuilder {
1490  inner: InputMessageSticker
1491}
1492
1493impl RTDInputMessageStickerBuilder {
1494  pub fn build(&self) -> InputMessageSticker { self.inner.clone() }
1495
1496   
1497  pub fn sticker<T: AsRef<InputFile>>(&mut self, sticker: T) -> &mut Self {
1498    self.inner.sticker = sticker.as_ref().clone();
1499    self
1500  }
1501
1502   
1503  pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1504    self.inner.thumbnail = thumbnail.as_ref().clone();
1505    self
1506  }
1507
1508   
1509  pub fn width(&mut self, width: i64) -> &mut Self {
1510    self.inner.width = width;
1511    self
1512  }
1513
1514   
1515  pub fn height(&mut self, height: i64) -> &mut Self {
1516    self.inner.height = height;
1517    self
1518  }
1519
1520   
1521  pub fn emoji<T: AsRef<str>>(&mut self, emoji: T) -> &mut Self {
1522    self.inner.emoji = emoji.as_ref().to_string();
1523    self
1524  }
1525
1526}
1527
1528impl AsRef<InputMessageSticker> for InputMessageSticker {
1529  fn as_ref(&self) -> &InputMessageSticker { self }
1530}
1531
1532impl AsRef<InputMessageSticker> for RTDInputMessageStickerBuilder {
1533  fn as_ref(&self) -> &InputMessageSticker { &self.inner }
1534}
1535
1536
1537
1538
1539
1540
1541
1542/// A text message
1543#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1544pub struct InputMessageText {
1545  #[doc(hidden)]
1546  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1547  td_name: String,
1548  #[doc(hidden)]
1549  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1550  extra: Option<String>,
1551  /// Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually
1552  text: FormattedText,
1553  /// True, if rich web page previews for URLs in the message text must be disabled
1554  disable_web_page_preview: bool,
1555  /// True, if a chat message draft must be deleted
1556  clear_draft: bool,
1557  
1558}
1559
1560impl RObject for InputMessageText {
1561  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageText" }
1562  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1563  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1564}
1565
1566
1567impl TDInputMessageContent for InputMessageText {}
1568
1569
1570
1571impl InputMessageText {
1572  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1573  pub fn builder() -> RTDInputMessageTextBuilder {
1574    let mut inner = InputMessageText::default();
1575    inner.td_name = "inputMessageText".to_string();
1576    inner.extra = Some(Uuid::new_v4().to_string());
1577    RTDInputMessageTextBuilder { inner }
1578  }
1579
1580  pub fn text(&self) -> &FormattedText { &self.text }
1581
1582  pub fn disable_web_page_preview(&self) -> bool { self.disable_web_page_preview }
1583
1584  pub fn clear_draft(&self) -> bool { self.clear_draft }
1585
1586}
1587
1588#[doc(hidden)]
1589pub struct RTDInputMessageTextBuilder {
1590  inner: InputMessageText
1591}
1592
1593impl RTDInputMessageTextBuilder {
1594  pub fn build(&self) -> InputMessageText { self.inner.clone() }
1595
1596   
1597  pub fn text<T: AsRef<FormattedText>>(&mut self, text: T) -> &mut Self {
1598    self.inner.text = text.as_ref().clone();
1599    self
1600  }
1601
1602   
1603  pub fn disable_web_page_preview(&mut self, disable_web_page_preview: bool) -> &mut Self {
1604    self.inner.disable_web_page_preview = disable_web_page_preview;
1605    self
1606  }
1607
1608   
1609  pub fn clear_draft(&mut self, clear_draft: bool) -> &mut Self {
1610    self.inner.clear_draft = clear_draft;
1611    self
1612  }
1613
1614}
1615
1616impl AsRef<InputMessageText> for InputMessageText {
1617  fn as_ref(&self) -> &InputMessageText { self }
1618}
1619
1620impl AsRef<InputMessageText> for RTDInputMessageTextBuilder {
1621  fn as_ref(&self) -> &InputMessageText { &self.inner }
1622}
1623
1624
1625
1626
1627
1628
1629
1630/// A message with information about a venue
1631#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1632pub struct InputMessageVenue {
1633  #[doc(hidden)]
1634  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1635  td_name: String,
1636  #[doc(hidden)]
1637  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1638  extra: Option<String>,
1639  /// Venue to send
1640  venue: Venue,
1641  
1642}
1643
1644impl RObject for InputMessageVenue {
1645  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageVenue" }
1646  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1647  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1648}
1649
1650
1651impl TDInputMessageContent for InputMessageVenue {}
1652
1653
1654
1655impl InputMessageVenue {
1656  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1657  pub fn builder() -> RTDInputMessageVenueBuilder {
1658    let mut inner = InputMessageVenue::default();
1659    inner.td_name = "inputMessageVenue".to_string();
1660    inner.extra = Some(Uuid::new_v4().to_string());
1661    RTDInputMessageVenueBuilder { inner }
1662  }
1663
1664  pub fn venue(&self) -> &Venue { &self.venue }
1665
1666}
1667
1668#[doc(hidden)]
1669pub struct RTDInputMessageVenueBuilder {
1670  inner: InputMessageVenue
1671}
1672
1673impl RTDInputMessageVenueBuilder {
1674  pub fn build(&self) -> InputMessageVenue { self.inner.clone() }
1675
1676   
1677  pub fn venue<T: AsRef<Venue>>(&mut self, venue: T) -> &mut Self {
1678    self.inner.venue = venue.as_ref().clone();
1679    self
1680  }
1681
1682}
1683
1684impl AsRef<InputMessageVenue> for InputMessageVenue {
1685  fn as_ref(&self) -> &InputMessageVenue { self }
1686}
1687
1688impl AsRef<InputMessageVenue> for RTDInputMessageVenueBuilder {
1689  fn as_ref(&self) -> &InputMessageVenue { &self.inner }
1690}
1691
1692
1693
1694
1695
1696
1697
1698/// A video message
1699#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1700pub struct InputMessageVideo {
1701  #[doc(hidden)]
1702  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1703  td_name: String,
1704  #[doc(hidden)]
1705  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1706  extra: Option<String>,
1707  /// Video to be sent
1708  video: InputFile,
1709  /// Video thumbnail; pass null to skip thumbnail uploading
1710  thumbnail: InputThumbnail,
1711  /// File identifiers of the stickers added to the video, if applicable
1712  added_sticker_file_ids: Vec<i64>,
1713  /// Duration of the video, in seconds
1714  duration: i64,
1715  /// Video width
1716  width: i64,
1717  /// Video height
1718  height: i64,
1719  /// True, if the video is supposed to be streamed
1720  supports_streaming: bool,
1721  /// Video caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
1722  caption: FormattedText,
1723  /// Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
1724  ttl: i64,
1725  
1726}
1727
1728impl RObject for InputMessageVideo {
1729  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageVideo" }
1730  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1731  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1732}
1733
1734
1735impl TDInputMessageContent for InputMessageVideo {}
1736
1737
1738
1739impl InputMessageVideo {
1740  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1741  pub fn builder() -> RTDInputMessageVideoBuilder {
1742    let mut inner = InputMessageVideo::default();
1743    inner.td_name = "inputMessageVideo".to_string();
1744    inner.extra = Some(Uuid::new_v4().to_string());
1745    RTDInputMessageVideoBuilder { inner }
1746  }
1747
1748  pub fn video(&self) -> &InputFile { &self.video }
1749
1750  pub fn thumbnail(&self) -> &InputThumbnail { &self.thumbnail }
1751
1752  pub fn added_sticker_file_ids(&self) -> &Vec<i64> { &self.added_sticker_file_ids }
1753
1754  pub fn duration(&self) -> i64 { self.duration }
1755
1756  pub fn width(&self) -> i64 { self.width }
1757
1758  pub fn height(&self) -> i64 { self.height }
1759
1760  pub fn supports_streaming(&self) -> bool { self.supports_streaming }
1761
1762  pub fn caption(&self) -> &FormattedText { &self.caption }
1763
1764  pub fn ttl(&self) -> i64 { self.ttl }
1765
1766}
1767
1768#[doc(hidden)]
1769pub struct RTDInputMessageVideoBuilder {
1770  inner: InputMessageVideo
1771}
1772
1773impl RTDInputMessageVideoBuilder {
1774  pub fn build(&self) -> InputMessageVideo { self.inner.clone() }
1775
1776   
1777  pub fn video<T: AsRef<InputFile>>(&mut self, video: T) -> &mut Self {
1778    self.inner.video = video.as_ref().clone();
1779    self
1780  }
1781
1782   
1783  pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1784    self.inner.thumbnail = thumbnail.as_ref().clone();
1785    self
1786  }
1787
1788   
1789  pub fn added_sticker_file_ids(&mut self, added_sticker_file_ids: Vec<i64>) -> &mut Self {
1790    self.inner.added_sticker_file_ids = added_sticker_file_ids;
1791    self
1792  }
1793
1794   
1795  pub fn duration(&mut self, duration: i64) -> &mut Self {
1796    self.inner.duration = duration;
1797    self
1798  }
1799
1800   
1801  pub fn width(&mut self, width: i64) -> &mut Self {
1802    self.inner.width = width;
1803    self
1804  }
1805
1806   
1807  pub fn height(&mut self, height: i64) -> &mut Self {
1808    self.inner.height = height;
1809    self
1810  }
1811
1812   
1813  pub fn supports_streaming(&mut self, supports_streaming: bool) -> &mut Self {
1814    self.inner.supports_streaming = supports_streaming;
1815    self
1816  }
1817
1818   
1819  pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
1820    self.inner.caption = caption.as_ref().clone();
1821    self
1822  }
1823
1824   
1825  pub fn ttl(&mut self, ttl: i64) -> &mut Self {
1826    self.inner.ttl = ttl;
1827    self
1828  }
1829
1830}
1831
1832impl AsRef<InputMessageVideo> for InputMessageVideo {
1833  fn as_ref(&self) -> &InputMessageVideo { self }
1834}
1835
1836impl AsRef<InputMessageVideo> for RTDInputMessageVideoBuilder {
1837  fn as_ref(&self) -> &InputMessageVideo { &self.inner }
1838}
1839
1840
1841
1842
1843
1844
1845
1846/// A video note message
1847#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1848pub struct InputMessageVideoNote {
1849  #[doc(hidden)]
1850  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1851  td_name: String,
1852  #[doc(hidden)]
1853  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1854  extra: Option<String>,
1855  /// Video note to be sent
1856  video_note: InputFile,
1857  /// Video thumbnail; pass null to skip thumbnail uploading
1858  thumbnail: InputThumbnail,
1859  /// Duration of the video, in seconds
1860  duration: i64,
1861  /// Video width and height; must be positive and not greater than 640
1862  length: i64,
1863  
1864}
1865
1866impl RObject for InputMessageVideoNote {
1867  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageVideoNote" }
1868  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1869  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1870}
1871
1872
1873impl TDInputMessageContent for InputMessageVideoNote {}
1874
1875
1876
1877impl InputMessageVideoNote {
1878  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1879  pub fn builder() -> RTDInputMessageVideoNoteBuilder {
1880    let mut inner = InputMessageVideoNote::default();
1881    inner.td_name = "inputMessageVideoNote".to_string();
1882    inner.extra = Some(Uuid::new_v4().to_string());
1883    RTDInputMessageVideoNoteBuilder { inner }
1884  }
1885
1886  pub fn video_note(&self) -> &InputFile { &self.video_note }
1887
1888  pub fn thumbnail(&self) -> &InputThumbnail { &self.thumbnail }
1889
1890  pub fn duration(&self) -> i64 { self.duration }
1891
1892  pub fn length(&self) -> i64 { self.length }
1893
1894}
1895
1896#[doc(hidden)]
1897pub struct RTDInputMessageVideoNoteBuilder {
1898  inner: InputMessageVideoNote
1899}
1900
1901impl RTDInputMessageVideoNoteBuilder {
1902  pub fn build(&self) -> InputMessageVideoNote { self.inner.clone() }
1903
1904   
1905  pub fn video_note<T: AsRef<InputFile>>(&mut self, video_note: T) -> &mut Self {
1906    self.inner.video_note = video_note.as_ref().clone();
1907    self
1908  }
1909
1910   
1911  pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1912    self.inner.thumbnail = thumbnail.as_ref().clone();
1913    self
1914  }
1915
1916   
1917  pub fn duration(&mut self, duration: i64) -> &mut Self {
1918    self.inner.duration = duration;
1919    self
1920  }
1921
1922   
1923  pub fn length(&mut self, length: i64) -> &mut Self {
1924    self.inner.length = length;
1925    self
1926  }
1927
1928}
1929
1930impl AsRef<InputMessageVideoNote> for InputMessageVideoNote {
1931  fn as_ref(&self) -> &InputMessageVideoNote { self }
1932}
1933
1934impl AsRef<InputMessageVideoNote> for RTDInputMessageVideoNoteBuilder {
1935  fn as_ref(&self) -> &InputMessageVideoNote { &self.inner }
1936}
1937
1938
1939
1940
1941
1942
1943
1944/// A voice note message
1945#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1946pub struct InputMessageVoiceNote {
1947  #[doc(hidden)]
1948  #[serde(rename(serialize = "@type", deserialize = "@type"))]
1949  td_name: String,
1950  #[doc(hidden)]
1951  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1952  extra: Option<String>,
1953  /// Voice note to be sent
1954  voice_note: InputFile,
1955  /// Duration of the voice note, in seconds
1956  duration: i64,
1957  /// Waveform representation of the voice note, in 5-bit format
1958  waveform: String,
1959  /// Voice note caption; pass null to use an empty caption; 0-GetOption("message_caption_length_max") characters
1960  caption: FormattedText,
1961  
1962}
1963
1964impl RObject for InputMessageVoiceNote {
1965  #[doc(hidden)] fn td_name(&self) -> &'static str { "inputMessageVoiceNote" }
1966  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
1967  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
1968}
1969
1970
1971impl TDInputMessageContent for InputMessageVoiceNote {}
1972
1973
1974
1975impl InputMessageVoiceNote {
1976  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
1977  pub fn builder() -> RTDInputMessageVoiceNoteBuilder {
1978    let mut inner = InputMessageVoiceNote::default();
1979    inner.td_name = "inputMessageVoiceNote".to_string();
1980    inner.extra = Some(Uuid::new_v4().to_string());
1981    RTDInputMessageVoiceNoteBuilder { inner }
1982  }
1983
1984  pub fn voice_note(&self) -> &InputFile { &self.voice_note }
1985
1986  pub fn duration(&self) -> i64 { self.duration }
1987
1988  pub fn waveform(&self) -> &String { &self.waveform }
1989
1990  pub fn caption(&self) -> &FormattedText { &self.caption }
1991
1992}
1993
1994#[doc(hidden)]
1995pub struct RTDInputMessageVoiceNoteBuilder {
1996  inner: InputMessageVoiceNote
1997}
1998
1999impl RTDInputMessageVoiceNoteBuilder {
2000  pub fn build(&self) -> InputMessageVoiceNote { self.inner.clone() }
2001
2002   
2003  pub fn voice_note<T: AsRef<InputFile>>(&mut self, voice_note: T) -> &mut Self {
2004    self.inner.voice_note = voice_note.as_ref().clone();
2005    self
2006  }
2007
2008   
2009  pub fn duration(&mut self, duration: i64) -> &mut Self {
2010    self.inner.duration = duration;
2011    self
2012  }
2013
2014   
2015  pub fn waveform<T: AsRef<str>>(&mut self, waveform: T) -> &mut Self {
2016    self.inner.waveform = waveform.as_ref().to_string();
2017    self
2018  }
2019
2020   
2021  pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
2022    self.inner.caption = caption.as_ref().clone();
2023    self
2024  }
2025
2026}
2027
2028impl AsRef<InputMessageVoiceNote> for InputMessageVoiceNote {
2029  fn as_ref(&self) -> &InputMessageVoiceNote { self }
2030}
2031
2032impl AsRef<InputMessageVoiceNote> for RTDInputMessageVoiceNoteBuilder {
2033  fn as_ref(&self) -> &InputMessageVoiceNote { &self.inner }
2034}
2035
2036
2037