1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5use std::fmt::Debug;
6
7pub trait TDInputMessageContent: Debug + RObject {}
9
10#[derive(Debug, Clone, Deserialize, Serialize, Default)]
12#[serde(tag = "@type")]
13pub enum InputMessageContent {
14 #[doc(hidden)]
15 #[default]
16 _Default,
17 #[serde(rename = "inputMessageAnimation")]
19 InputMessageAnimation(InputMessageAnimation),
20 #[serde(rename = "inputMessageAudio")]
22 InputMessageAudio(InputMessageAudio),
23 #[serde(rename = "inputMessageContact")]
25 InputMessageContact(InputMessageContact),
26 #[serde(rename = "inputMessageDice")]
28 InputMessageDice(InputMessageDice),
29 #[serde(rename = "inputMessageDocument")]
31 InputMessageDocument(InputMessageDocument),
32 #[serde(rename = "inputMessageForwarded")]
34 InputMessageForwarded(InputMessageForwarded),
35 #[serde(rename = "inputMessageGame")]
37 InputMessageGame(InputMessageGame),
38 #[serde(rename = "inputMessageInvoice")]
40 InputMessageInvoice(InputMessageInvoice),
41 #[serde(rename = "inputMessageLocation")]
43 InputMessageLocation(InputMessageLocation),
44 #[serde(rename = "inputMessagePhoto")]
46 InputMessagePhoto(InputMessagePhoto),
47 #[serde(rename = "inputMessagePoll")]
49 InputMessagePoll(InputMessagePoll),
50 #[serde(rename = "inputMessageSticker")]
52 InputMessageSticker(InputMessageSticker),
53 #[serde(rename = "inputMessageText")]
55 InputMessageText(InputMessageText),
56 #[serde(rename = "inputMessageVenue")]
58 InputMessageVenue(InputMessageVenue),
59 #[serde(rename = "inputMessageVideo")]
61 InputMessageVideo(InputMessageVideo),
62 #[serde(rename = "inputMessageVideoNote")]
64 InputMessageVideoNote(InputMessageVideoNote),
65 #[serde(rename = "inputMessageVoiceNote")]
67 InputMessageVoiceNote(InputMessageVoiceNote),
68}
69
70impl RObject for InputMessageContent {
71 #[doc(hidden)]
72 fn extra(&self) -> Option<&str> {
73 match self {
74 InputMessageContent::InputMessageAnimation(t) => t.extra(),
75 InputMessageContent::InputMessageAudio(t) => t.extra(),
76 InputMessageContent::InputMessageContact(t) => t.extra(),
77 InputMessageContent::InputMessageDice(t) => t.extra(),
78 InputMessageContent::InputMessageDocument(t) => t.extra(),
79 InputMessageContent::InputMessageForwarded(t) => t.extra(),
80 InputMessageContent::InputMessageGame(t) => t.extra(),
81 InputMessageContent::InputMessageInvoice(t) => t.extra(),
82 InputMessageContent::InputMessageLocation(t) => t.extra(),
83 InputMessageContent::InputMessagePhoto(t) => t.extra(),
84 InputMessageContent::InputMessagePoll(t) => t.extra(),
85 InputMessageContent::InputMessageSticker(t) => t.extra(),
86 InputMessageContent::InputMessageText(t) => t.extra(),
87 InputMessageContent::InputMessageVenue(t) => t.extra(),
88 InputMessageContent::InputMessageVideo(t) => t.extra(),
89 InputMessageContent::InputMessageVideoNote(t) => t.extra(),
90 InputMessageContent::InputMessageVoiceNote(t) => t.extra(),
91
92 _ => None,
93 }
94 }
95 #[doc(hidden)]
96 fn client_id(&self) -> Option<i32> {
97 match self {
98 InputMessageContent::InputMessageAnimation(t) => t.client_id(),
99 InputMessageContent::InputMessageAudio(t) => t.client_id(),
100 InputMessageContent::InputMessageContact(t) => t.client_id(),
101 InputMessageContent::InputMessageDice(t) => t.client_id(),
102 InputMessageContent::InputMessageDocument(t) => t.client_id(),
103 InputMessageContent::InputMessageForwarded(t) => t.client_id(),
104 InputMessageContent::InputMessageGame(t) => t.client_id(),
105 InputMessageContent::InputMessageInvoice(t) => t.client_id(),
106 InputMessageContent::InputMessageLocation(t) => t.client_id(),
107 InputMessageContent::InputMessagePhoto(t) => t.client_id(),
108 InputMessageContent::InputMessagePoll(t) => t.client_id(),
109 InputMessageContent::InputMessageSticker(t) => t.client_id(),
110 InputMessageContent::InputMessageText(t) => t.client_id(),
111 InputMessageContent::InputMessageVenue(t) => t.client_id(),
112 InputMessageContent::InputMessageVideo(t) => t.client_id(),
113 InputMessageContent::InputMessageVideoNote(t) => t.client_id(),
114 InputMessageContent::InputMessageVoiceNote(t) => t.client_id(),
115
116 _ => None,
117 }
118 }
119}
120
121impl InputMessageContent {
122 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
123 Ok(serde_json::from_str(json.as_ref())?)
124 }
125 #[doc(hidden)]
126 pub fn _is_default(&self) -> bool {
127 matches!(self, InputMessageContent::_Default)
128 }
129}
130
131impl AsRef<InputMessageContent> for InputMessageContent {
132 fn as_ref(&self) -> &InputMessageContent {
133 self
134 }
135}
136
137#[derive(Debug, Clone, Default, Serialize, Deserialize)]
139pub struct InputMessageAnimation {
140 #[doc(hidden)]
141 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
142 extra: Option<String>,
143 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
144 client_id: Option<i32>,
145 #[serde(skip_serializing_if = "InputFile::_is_default")]
148 animation: InputFile,
149 thumbnail: InputThumbnail,
151 #[serde(default)]
154 added_sticker_file_ids: Vec<i32>,
155 #[serde(default)]
158 duration: i32,
159 #[serde(default)]
162 width: i32,
163 #[serde(default)]
166 height: i32,
167 caption: FormattedText,
169}
170
171impl RObject for InputMessageAnimation {
172 #[doc(hidden)]
173 fn extra(&self) -> Option<&str> {
174 self.extra.as_deref()
175 }
176 #[doc(hidden)]
177 fn client_id(&self) -> Option<i32> {
178 self.client_id
179 }
180}
181
182impl TDInputMessageContent for InputMessageAnimation {}
183
184impl InputMessageAnimation {
185 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
186 Ok(serde_json::from_str(json.as_ref())?)
187 }
188 pub fn builder() -> InputMessageAnimationBuilder {
189 let mut inner = InputMessageAnimation::default();
190 inner.extra = Some(Uuid::new_v4().to_string());
191
192 InputMessageAnimationBuilder { inner }
193 }
194
195 pub fn animation(&self) -> &InputFile {
196 &self.animation
197 }
198
199 pub fn thumbnail(&self) -> &InputThumbnail {
200 &self.thumbnail
201 }
202
203 pub fn added_sticker_file_ids(&self) -> &Vec<i32> {
204 &self.added_sticker_file_ids
205 }
206
207 pub fn duration(&self) -> i32 {
208 self.duration
209 }
210
211 pub fn width(&self) -> i32 {
212 self.width
213 }
214
215 pub fn height(&self) -> i32 {
216 self.height
217 }
218
219 pub fn caption(&self) -> &FormattedText {
220 &self.caption
221 }
222}
223
224#[doc(hidden)]
225pub struct InputMessageAnimationBuilder {
226 inner: InputMessageAnimation,
227}
228
229#[deprecated]
230pub type RTDInputMessageAnimationBuilder = InputMessageAnimationBuilder;
231
232impl InputMessageAnimationBuilder {
233 pub fn build(&self) -> InputMessageAnimation {
234 self.inner.clone()
235 }
236
237 pub fn animation<T: AsRef<InputFile>>(&mut self, animation: T) -> &mut Self {
238 self.inner.animation = animation.as_ref().clone();
239 self
240 }
241
242 pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
243 self.inner.thumbnail = thumbnail.as_ref().clone();
244 self
245 }
246
247 pub fn added_sticker_file_ids(&mut self, added_sticker_file_ids: Vec<i32>) -> &mut Self {
248 self.inner.added_sticker_file_ids = added_sticker_file_ids;
249 self
250 }
251
252 pub fn duration(&mut self, duration: i32) -> &mut Self {
253 self.inner.duration = duration;
254 self
255 }
256
257 pub fn width(&mut self, width: i32) -> &mut Self {
258 self.inner.width = width;
259 self
260 }
261
262 pub fn height(&mut self, height: i32) -> &mut Self {
263 self.inner.height = height;
264 self
265 }
266
267 pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
268 self.inner.caption = caption.as_ref().clone();
269 self
270 }
271}
272
273impl AsRef<InputMessageAnimation> for InputMessageAnimation {
274 fn as_ref(&self) -> &InputMessageAnimation {
275 self
276 }
277}
278
279impl AsRef<InputMessageAnimation> for InputMessageAnimationBuilder {
280 fn as_ref(&self) -> &InputMessageAnimation {
281 &self.inner
282 }
283}
284
285#[derive(Debug, Clone, Default, Serialize, Deserialize)]
287pub struct InputMessageAudio {
288 #[doc(hidden)]
289 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
290 extra: Option<String>,
291 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
292 client_id: Option<i32>,
293 #[serde(skip_serializing_if = "InputFile::_is_default")]
296 audio: InputFile,
297 album_cover_thumbnail: InputThumbnail,
299 #[serde(default)]
302 duration: i32,
303 #[serde(default)]
306 title: String,
307 #[serde(default)]
310 performer: String,
311 caption: FormattedText,
313}
314
315impl RObject for InputMessageAudio {
316 #[doc(hidden)]
317 fn extra(&self) -> Option<&str> {
318 self.extra.as_deref()
319 }
320 #[doc(hidden)]
321 fn client_id(&self) -> Option<i32> {
322 self.client_id
323 }
324}
325
326impl TDInputMessageContent for InputMessageAudio {}
327
328impl InputMessageAudio {
329 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
330 Ok(serde_json::from_str(json.as_ref())?)
331 }
332 pub fn builder() -> InputMessageAudioBuilder {
333 let mut inner = InputMessageAudio::default();
334 inner.extra = Some(Uuid::new_v4().to_string());
335
336 InputMessageAudioBuilder { inner }
337 }
338
339 pub fn audio(&self) -> &InputFile {
340 &self.audio
341 }
342
343 pub fn album_cover_thumbnail(&self) -> &InputThumbnail {
344 &self.album_cover_thumbnail
345 }
346
347 pub fn duration(&self) -> i32 {
348 self.duration
349 }
350
351 pub fn title(&self) -> &String {
352 &self.title
353 }
354
355 pub fn performer(&self) -> &String {
356 &self.performer
357 }
358
359 pub fn caption(&self) -> &FormattedText {
360 &self.caption
361 }
362}
363
364#[doc(hidden)]
365pub struct InputMessageAudioBuilder {
366 inner: InputMessageAudio,
367}
368
369#[deprecated]
370pub type RTDInputMessageAudioBuilder = InputMessageAudioBuilder;
371
372impl InputMessageAudioBuilder {
373 pub fn build(&self) -> InputMessageAudio {
374 self.inner.clone()
375 }
376
377 pub fn audio<T: AsRef<InputFile>>(&mut self, audio: T) -> &mut Self {
378 self.inner.audio = audio.as_ref().clone();
379 self
380 }
381
382 pub fn album_cover_thumbnail<T: AsRef<InputThumbnail>>(
383 &mut self,
384 album_cover_thumbnail: T,
385 ) -> &mut Self {
386 self.inner.album_cover_thumbnail = album_cover_thumbnail.as_ref().clone();
387 self
388 }
389
390 pub fn duration(&mut self, duration: i32) -> &mut Self {
391 self.inner.duration = duration;
392 self
393 }
394
395 pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
396 self.inner.title = title.as_ref().to_string();
397 self
398 }
399
400 pub fn performer<T: AsRef<str>>(&mut self, performer: T) -> &mut Self {
401 self.inner.performer = performer.as_ref().to_string();
402 self
403 }
404
405 pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
406 self.inner.caption = caption.as_ref().clone();
407 self
408 }
409}
410
411impl AsRef<InputMessageAudio> for InputMessageAudio {
412 fn as_ref(&self) -> &InputMessageAudio {
413 self
414 }
415}
416
417impl AsRef<InputMessageAudio> for InputMessageAudioBuilder {
418 fn as_ref(&self) -> &InputMessageAudio {
419 &self.inner
420 }
421}
422
423#[derive(Debug, Clone, Default, Serialize, Deserialize)]
425pub struct InputMessageContact {
426 #[doc(hidden)]
427 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
428 extra: Option<String>,
429 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
430 client_id: Option<i32>,
431 contact: Contact,
433}
434
435impl RObject for InputMessageContact {
436 #[doc(hidden)]
437 fn extra(&self) -> Option<&str> {
438 self.extra.as_deref()
439 }
440 #[doc(hidden)]
441 fn client_id(&self) -> Option<i32> {
442 self.client_id
443 }
444}
445
446impl TDInputMessageContent for InputMessageContact {}
447
448impl InputMessageContact {
449 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
450 Ok(serde_json::from_str(json.as_ref())?)
451 }
452 pub fn builder() -> InputMessageContactBuilder {
453 let mut inner = InputMessageContact::default();
454 inner.extra = Some(Uuid::new_v4().to_string());
455
456 InputMessageContactBuilder { inner }
457 }
458
459 pub fn contact(&self) -> &Contact {
460 &self.contact
461 }
462}
463
464#[doc(hidden)]
465pub struct InputMessageContactBuilder {
466 inner: InputMessageContact,
467}
468
469#[deprecated]
470pub type RTDInputMessageContactBuilder = InputMessageContactBuilder;
471
472impl InputMessageContactBuilder {
473 pub fn build(&self) -> InputMessageContact {
474 self.inner.clone()
475 }
476
477 pub fn contact<T: AsRef<Contact>>(&mut self, contact: T) -> &mut Self {
478 self.inner.contact = contact.as_ref().clone();
479 self
480 }
481}
482
483impl AsRef<InputMessageContact> for InputMessageContact {
484 fn as_ref(&self) -> &InputMessageContact {
485 self
486 }
487}
488
489impl AsRef<InputMessageContact> for InputMessageContactBuilder {
490 fn as_ref(&self) -> &InputMessageContact {
491 &self.inner
492 }
493}
494
495#[derive(Debug, Clone, Default, Serialize, Deserialize)]
497pub struct InputMessageDice {
498 #[doc(hidden)]
499 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
500 extra: Option<String>,
501 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
502 client_id: Option<i32>,
503 #[serde(default)]
506 emoji: String,
507 #[serde(default)]
510 clear_draft: bool,
511}
512
513impl RObject for InputMessageDice {
514 #[doc(hidden)]
515 fn extra(&self) -> Option<&str> {
516 self.extra.as_deref()
517 }
518 #[doc(hidden)]
519 fn client_id(&self) -> Option<i32> {
520 self.client_id
521 }
522}
523
524impl TDInputMessageContent for InputMessageDice {}
525
526impl InputMessageDice {
527 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
528 Ok(serde_json::from_str(json.as_ref())?)
529 }
530 pub fn builder() -> InputMessageDiceBuilder {
531 let mut inner = InputMessageDice::default();
532 inner.extra = Some(Uuid::new_v4().to_string());
533
534 InputMessageDiceBuilder { inner }
535 }
536
537 pub fn emoji(&self) -> &String {
538 &self.emoji
539 }
540
541 pub fn clear_draft(&self) -> bool {
542 self.clear_draft
543 }
544}
545
546#[doc(hidden)]
547pub struct InputMessageDiceBuilder {
548 inner: InputMessageDice,
549}
550
551#[deprecated]
552pub type RTDInputMessageDiceBuilder = InputMessageDiceBuilder;
553
554impl InputMessageDiceBuilder {
555 pub fn build(&self) -> InputMessageDice {
556 self.inner.clone()
557 }
558
559 pub fn emoji<T: AsRef<str>>(&mut self, emoji: T) -> &mut Self {
560 self.inner.emoji = emoji.as_ref().to_string();
561 self
562 }
563
564 pub fn clear_draft(&mut self, clear_draft: bool) -> &mut Self {
565 self.inner.clear_draft = clear_draft;
566 self
567 }
568}
569
570impl AsRef<InputMessageDice> for InputMessageDice {
571 fn as_ref(&self) -> &InputMessageDice {
572 self
573 }
574}
575
576impl AsRef<InputMessageDice> for InputMessageDiceBuilder {
577 fn as_ref(&self) -> &InputMessageDice {
578 &self.inner
579 }
580}
581
582#[derive(Debug, Clone, Default, Serialize, Deserialize)]
584pub struct InputMessageDocument {
585 #[doc(hidden)]
586 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
587 extra: Option<String>,
588 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
589 client_id: Option<i32>,
590 #[serde(skip_serializing_if = "InputFile::_is_default")]
593 document: InputFile,
594 thumbnail: InputThumbnail,
596 #[serde(default)]
599 disable_content_type_detection: bool,
600 caption: FormattedText,
602}
603
604impl RObject for InputMessageDocument {
605 #[doc(hidden)]
606 fn extra(&self) -> Option<&str> {
607 self.extra.as_deref()
608 }
609 #[doc(hidden)]
610 fn client_id(&self) -> Option<i32> {
611 self.client_id
612 }
613}
614
615impl TDInputMessageContent for InputMessageDocument {}
616
617impl InputMessageDocument {
618 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
619 Ok(serde_json::from_str(json.as_ref())?)
620 }
621 pub fn builder() -> InputMessageDocumentBuilder {
622 let mut inner = InputMessageDocument::default();
623 inner.extra = Some(Uuid::new_v4().to_string());
624
625 InputMessageDocumentBuilder { inner }
626 }
627
628 pub fn document(&self) -> &InputFile {
629 &self.document
630 }
631
632 pub fn thumbnail(&self) -> &InputThumbnail {
633 &self.thumbnail
634 }
635
636 pub fn disable_content_type_detection(&self) -> bool {
637 self.disable_content_type_detection
638 }
639
640 pub fn caption(&self) -> &FormattedText {
641 &self.caption
642 }
643}
644
645#[doc(hidden)]
646pub struct InputMessageDocumentBuilder {
647 inner: InputMessageDocument,
648}
649
650#[deprecated]
651pub type RTDInputMessageDocumentBuilder = InputMessageDocumentBuilder;
652
653impl InputMessageDocumentBuilder {
654 pub fn build(&self) -> InputMessageDocument {
655 self.inner.clone()
656 }
657
658 pub fn document<T: AsRef<InputFile>>(&mut self, document: T) -> &mut Self {
659 self.inner.document = document.as_ref().clone();
660 self
661 }
662
663 pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
664 self.inner.thumbnail = thumbnail.as_ref().clone();
665 self
666 }
667
668 pub fn disable_content_type_detection(
669 &mut self,
670 disable_content_type_detection: bool,
671 ) -> &mut Self {
672 self.inner.disable_content_type_detection = disable_content_type_detection;
673 self
674 }
675
676 pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
677 self.inner.caption = caption.as_ref().clone();
678 self
679 }
680}
681
682impl AsRef<InputMessageDocument> for InputMessageDocument {
683 fn as_ref(&self) -> &InputMessageDocument {
684 self
685 }
686}
687
688impl AsRef<InputMessageDocument> for InputMessageDocumentBuilder {
689 fn as_ref(&self) -> &InputMessageDocument {
690 &self.inner
691 }
692}
693
694#[derive(Debug, Clone, Default, Serialize, Deserialize)]
696pub struct InputMessageForwarded {
697 #[doc(hidden)]
698 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
699 extra: Option<String>,
700 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
701 client_id: Option<i32>,
702 #[serde(default)]
705 from_chat_id: i64,
706 #[serde(default)]
709 message_id: i64,
710 #[serde(default)]
713 in_game_share: bool,
714 copy_options: MessageCopyOptions,
716}
717
718impl RObject for InputMessageForwarded {
719 #[doc(hidden)]
720 fn extra(&self) -> Option<&str> {
721 self.extra.as_deref()
722 }
723 #[doc(hidden)]
724 fn client_id(&self) -> Option<i32> {
725 self.client_id
726 }
727}
728
729impl TDInputMessageContent for InputMessageForwarded {}
730
731impl InputMessageForwarded {
732 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
733 Ok(serde_json::from_str(json.as_ref())?)
734 }
735 pub fn builder() -> InputMessageForwardedBuilder {
736 let mut inner = InputMessageForwarded::default();
737 inner.extra = Some(Uuid::new_v4().to_string());
738
739 InputMessageForwardedBuilder { inner }
740 }
741
742 pub fn from_chat_id(&self) -> i64 {
743 self.from_chat_id
744 }
745
746 pub fn message_id(&self) -> i64 {
747 self.message_id
748 }
749
750 pub fn in_game_share(&self) -> bool {
751 self.in_game_share
752 }
753
754 pub fn copy_options(&self) -> &MessageCopyOptions {
755 &self.copy_options
756 }
757}
758
759#[doc(hidden)]
760pub struct InputMessageForwardedBuilder {
761 inner: InputMessageForwarded,
762}
763
764#[deprecated]
765pub type RTDInputMessageForwardedBuilder = InputMessageForwardedBuilder;
766
767impl InputMessageForwardedBuilder {
768 pub fn build(&self) -> InputMessageForwarded {
769 self.inner.clone()
770 }
771
772 pub fn from_chat_id(&mut self, from_chat_id: i64) -> &mut Self {
773 self.inner.from_chat_id = from_chat_id;
774 self
775 }
776
777 pub fn message_id(&mut self, message_id: i64) -> &mut Self {
778 self.inner.message_id = message_id;
779 self
780 }
781
782 pub fn in_game_share(&mut self, in_game_share: bool) -> &mut Self {
783 self.inner.in_game_share = in_game_share;
784 self
785 }
786
787 pub fn copy_options<T: AsRef<MessageCopyOptions>>(&mut self, copy_options: T) -> &mut Self {
788 self.inner.copy_options = copy_options.as_ref().clone();
789 self
790 }
791}
792
793impl AsRef<InputMessageForwarded> for InputMessageForwarded {
794 fn as_ref(&self) -> &InputMessageForwarded {
795 self
796 }
797}
798
799impl AsRef<InputMessageForwarded> for InputMessageForwardedBuilder {
800 fn as_ref(&self) -> &InputMessageForwarded {
801 &self.inner
802 }
803}
804
805#[derive(Debug, Clone, Default, Serialize, Deserialize)]
807pub struct InputMessageGame {
808 #[doc(hidden)]
809 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
810 extra: Option<String>,
811 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
812 client_id: Option<i32>,
813 #[serde(default)]
816 bot_user_id: i64,
817 #[serde(default)]
820 game_short_name: String,
821}
822
823impl RObject for InputMessageGame {
824 #[doc(hidden)]
825 fn extra(&self) -> Option<&str> {
826 self.extra.as_deref()
827 }
828 #[doc(hidden)]
829 fn client_id(&self) -> Option<i32> {
830 self.client_id
831 }
832}
833
834impl TDInputMessageContent for InputMessageGame {}
835
836impl InputMessageGame {
837 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
838 Ok(serde_json::from_str(json.as_ref())?)
839 }
840 pub fn builder() -> InputMessageGameBuilder {
841 let mut inner = InputMessageGame::default();
842 inner.extra = Some(Uuid::new_v4().to_string());
843
844 InputMessageGameBuilder { inner }
845 }
846
847 pub fn bot_user_id(&self) -> i64 {
848 self.bot_user_id
849 }
850
851 pub fn game_short_name(&self) -> &String {
852 &self.game_short_name
853 }
854}
855
856#[doc(hidden)]
857pub struct InputMessageGameBuilder {
858 inner: InputMessageGame,
859}
860
861#[deprecated]
862pub type RTDInputMessageGameBuilder = InputMessageGameBuilder;
863
864impl InputMessageGameBuilder {
865 pub fn build(&self) -> InputMessageGame {
866 self.inner.clone()
867 }
868
869 pub fn bot_user_id(&mut self, bot_user_id: i64) -> &mut Self {
870 self.inner.bot_user_id = bot_user_id;
871 self
872 }
873
874 pub fn game_short_name<T: AsRef<str>>(&mut self, game_short_name: T) -> &mut Self {
875 self.inner.game_short_name = game_short_name.as_ref().to_string();
876 self
877 }
878}
879
880impl AsRef<InputMessageGame> for InputMessageGame {
881 fn as_ref(&self) -> &InputMessageGame {
882 self
883 }
884}
885
886impl AsRef<InputMessageGame> for InputMessageGameBuilder {
887 fn as_ref(&self) -> &InputMessageGame {
888 &self.inner
889 }
890}
891
892#[derive(Debug, Clone, Default, Serialize, Deserialize)]
894pub struct InputMessageInvoice {
895 #[doc(hidden)]
896 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
897 extra: Option<String>,
898 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
899 client_id: Option<i32>,
900 invoice: Invoice,
902 #[serde(default)]
905 title: String,
906 #[serde(default)]
909 description: String,
910 #[serde(default)]
913 photo_url: String,
914 #[serde(default)]
917 photo_size: i32,
918 #[serde(default)]
921 photo_width: i32,
922 #[serde(default)]
925 photo_height: i32,
926 #[serde(default)]
929 payload: String,
930 #[serde(default)]
933 provider_token: String,
934 #[serde(default)]
937 provider_data: String,
938 #[serde(default)]
941 start_parameter: String,
942}
943
944impl RObject for InputMessageInvoice {
945 #[doc(hidden)]
946 fn extra(&self) -> Option<&str> {
947 self.extra.as_deref()
948 }
949 #[doc(hidden)]
950 fn client_id(&self) -> Option<i32> {
951 self.client_id
952 }
953}
954
955impl TDInputMessageContent for InputMessageInvoice {}
956
957impl InputMessageInvoice {
958 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
959 Ok(serde_json::from_str(json.as_ref())?)
960 }
961 pub fn builder() -> InputMessageInvoiceBuilder {
962 let mut inner = InputMessageInvoice::default();
963 inner.extra = Some(Uuid::new_v4().to_string());
964
965 InputMessageInvoiceBuilder { inner }
966 }
967
968 pub fn invoice(&self) -> &Invoice {
969 &self.invoice
970 }
971
972 pub fn title(&self) -> &String {
973 &self.title
974 }
975
976 pub fn description(&self) -> &String {
977 &self.description
978 }
979
980 pub fn photo_url(&self) -> &String {
981 &self.photo_url
982 }
983
984 pub fn photo_size(&self) -> i32 {
985 self.photo_size
986 }
987
988 pub fn photo_width(&self) -> i32 {
989 self.photo_width
990 }
991
992 pub fn photo_height(&self) -> i32 {
993 self.photo_height
994 }
995
996 pub fn payload(&self) -> &String {
997 &self.payload
998 }
999
1000 pub fn provider_token(&self) -> &String {
1001 &self.provider_token
1002 }
1003
1004 pub fn provider_data(&self) -> &String {
1005 &self.provider_data
1006 }
1007
1008 pub fn start_parameter(&self) -> &String {
1009 &self.start_parameter
1010 }
1011}
1012
1013#[doc(hidden)]
1014pub struct InputMessageInvoiceBuilder {
1015 inner: InputMessageInvoice,
1016}
1017
1018#[deprecated]
1019pub type RTDInputMessageInvoiceBuilder = InputMessageInvoiceBuilder;
1020
1021impl InputMessageInvoiceBuilder {
1022 pub fn build(&self) -> InputMessageInvoice {
1023 self.inner.clone()
1024 }
1025
1026 pub fn invoice<T: AsRef<Invoice>>(&mut self, invoice: T) -> &mut Self {
1027 self.inner.invoice = invoice.as_ref().clone();
1028 self
1029 }
1030
1031 pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
1032 self.inner.title = title.as_ref().to_string();
1033 self
1034 }
1035
1036 pub fn description<T: AsRef<str>>(&mut self, description: T) -> &mut Self {
1037 self.inner.description = description.as_ref().to_string();
1038 self
1039 }
1040
1041 pub fn photo_url<T: AsRef<str>>(&mut self, photo_url: T) -> &mut Self {
1042 self.inner.photo_url = photo_url.as_ref().to_string();
1043 self
1044 }
1045
1046 pub fn photo_size(&mut self, photo_size: i32) -> &mut Self {
1047 self.inner.photo_size = photo_size;
1048 self
1049 }
1050
1051 pub fn photo_width(&mut self, photo_width: i32) -> &mut Self {
1052 self.inner.photo_width = photo_width;
1053 self
1054 }
1055
1056 pub fn photo_height(&mut self, photo_height: i32) -> &mut Self {
1057 self.inner.photo_height = photo_height;
1058 self
1059 }
1060
1061 pub fn payload<T: AsRef<str>>(&mut self, payload: T) -> &mut Self {
1062 self.inner.payload = payload.as_ref().to_string();
1063 self
1064 }
1065
1066 pub fn provider_token<T: AsRef<str>>(&mut self, provider_token: T) -> &mut Self {
1067 self.inner.provider_token = provider_token.as_ref().to_string();
1068 self
1069 }
1070
1071 pub fn provider_data<T: AsRef<str>>(&mut self, provider_data: T) -> &mut Self {
1072 self.inner.provider_data = provider_data.as_ref().to_string();
1073 self
1074 }
1075
1076 pub fn start_parameter<T: AsRef<str>>(&mut self, start_parameter: T) -> &mut Self {
1077 self.inner.start_parameter = start_parameter.as_ref().to_string();
1078 self
1079 }
1080}
1081
1082impl AsRef<InputMessageInvoice> for InputMessageInvoice {
1083 fn as_ref(&self) -> &InputMessageInvoice {
1084 self
1085 }
1086}
1087
1088impl AsRef<InputMessageInvoice> for InputMessageInvoiceBuilder {
1089 fn as_ref(&self) -> &InputMessageInvoice {
1090 &self.inner
1091 }
1092}
1093
1094#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1096pub struct InputMessageLocation {
1097 #[doc(hidden)]
1098 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1099 extra: Option<String>,
1100 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1101 client_id: Option<i32>,
1102 location: Location,
1104 #[serde(default)]
1107 live_period: i32,
1108 #[serde(default)]
1111 heading: i32,
1112 #[serde(default)]
1115 proximity_alert_radius: i32,
1116}
1117
1118impl RObject for InputMessageLocation {
1119 #[doc(hidden)]
1120 fn extra(&self) -> Option<&str> {
1121 self.extra.as_deref()
1122 }
1123 #[doc(hidden)]
1124 fn client_id(&self) -> Option<i32> {
1125 self.client_id
1126 }
1127}
1128
1129impl TDInputMessageContent for InputMessageLocation {}
1130
1131impl InputMessageLocation {
1132 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1133 Ok(serde_json::from_str(json.as_ref())?)
1134 }
1135 pub fn builder() -> InputMessageLocationBuilder {
1136 let mut inner = InputMessageLocation::default();
1137 inner.extra = Some(Uuid::new_v4().to_string());
1138
1139 InputMessageLocationBuilder { inner }
1140 }
1141
1142 pub fn location(&self) -> &Location {
1143 &self.location
1144 }
1145
1146 pub fn live_period(&self) -> i32 {
1147 self.live_period
1148 }
1149
1150 pub fn heading(&self) -> i32 {
1151 self.heading
1152 }
1153
1154 pub fn proximity_alert_radius(&self) -> i32 {
1155 self.proximity_alert_radius
1156 }
1157}
1158
1159#[doc(hidden)]
1160pub struct InputMessageLocationBuilder {
1161 inner: InputMessageLocation,
1162}
1163
1164#[deprecated]
1165pub type RTDInputMessageLocationBuilder = InputMessageLocationBuilder;
1166
1167impl InputMessageLocationBuilder {
1168 pub fn build(&self) -> InputMessageLocation {
1169 self.inner.clone()
1170 }
1171
1172 pub fn location<T: AsRef<Location>>(&mut self, location: T) -> &mut Self {
1173 self.inner.location = location.as_ref().clone();
1174 self
1175 }
1176
1177 pub fn live_period(&mut self, live_period: i32) -> &mut Self {
1178 self.inner.live_period = live_period;
1179 self
1180 }
1181
1182 pub fn heading(&mut self, heading: i32) -> &mut Self {
1183 self.inner.heading = heading;
1184 self
1185 }
1186
1187 pub fn proximity_alert_radius(&mut self, proximity_alert_radius: i32) -> &mut Self {
1188 self.inner.proximity_alert_radius = proximity_alert_radius;
1189 self
1190 }
1191}
1192
1193impl AsRef<InputMessageLocation> for InputMessageLocation {
1194 fn as_ref(&self) -> &InputMessageLocation {
1195 self
1196 }
1197}
1198
1199impl AsRef<InputMessageLocation> for InputMessageLocationBuilder {
1200 fn as_ref(&self) -> &InputMessageLocation {
1201 &self.inner
1202 }
1203}
1204
1205#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1207pub struct InputMessagePhoto {
1208 #[doc(hidden)]
1209 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1210 extra: Option<String>,
1211 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1212 client_id: Option<i32>,
1213 #[serde(skip_serializing_if = "InputFile::_is_default")]
1216 photo: InputFile,
1217 thumbnail: InputThumbnail,
1219 #[serde(default)]
1222 added_sticker_file_ids: Vec<i32>,
1223 #[serde(default)]
1226 width: i32,
1227 #[serde(default)]
1230 height: i32,
1231 caption: FormattedText,
1233 #[serde(default)]
1236 ttl: i32,
1237}
1238
1239impl RObject for InputMessagePhoto {
1240 #[doc(hidden)]
1241 fn extra(&self) -> Option<&str> {
1242 self.extra.as_deref()
1243 }
1244 #[doc(hidden)]
1245 fn client_id(&self) -> Option<i32> {
1246 self.client_id
1247 }
1248}
1249
1250impl TDInputMessageContent for InputMessagePhoto {}
1251
1252impl InputMessagePhoto {
1253 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1254 Ok(serde_json::from_str(json.as_ref())?)
1255 }
1256 pub fn builder() -> InputMessagePhotoBuilder {
1257 let mut inner = InputMessagePhoto::default();
1258 inner.extra = Some(Uuid::new_v4().to_string());
1259
1260 InputMessagePhotoBuilder { inner }
1261 }
1262
1263 pub fn photo(&self) -> &InputFile {
1264 &self.photo
1265 }
1266
1267 pub fn thumbnail(&self) -> &InputThumbnail {
1268 &self.thumbnail
1269 }
1270
1271 pub fn added_sticker_file_ids(&self) -> &Vec<i32> {
1272 &self.added_sticker_file_ids
1273 }
1274
1275 pub fn width(&self) -> i32 {
1276 self.width
1277 }
1278
1279 pub fn height(&self) -> i32 {
1280 self.height
1281 }
1282
1283 pub fn caption(&self) -> &FormattedText {
1284 &self.caption
1285 }
1286
1287 pub fn ttl(&self) -> i32 {
1288 self.ttl
1289 }
1290}
1291
1292#[doc(hidden)]
1293pub struct InputMessagePhotoBuilder {
1294 inner: InputMessagePhoto,
1295}
1296
1297#[deprecated]
1298pub type RTDInputMessagePhotoBuilder = InputMessagePhotoBuilder;
1299
1300impl InputMessagePhotoBuilder {
1301 pub fn build(&self) -> InputMessagePhoto {
1302 self.inner.clone()
1303 }
1304
1305 pub fn photo<T: AsRef<InputFile>>(&mut self, photo: T) -> &mut Self {
1306 self.inner.photo = photo.as_ref().clone();
1307 self
1308 }
1309
1310 pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1311 self.inner.thumbnail = thumbnail.as_ref().clone();
1312 self
1313 }
1314
1315 pub fn added_sticker_file_ids(&mut self, added_sticker_file_ids: Vec<i32>) -> &mut Self {
1316 self.inner.added_sticker_file_ids = added_sticker_file_ids;
1317 self
1318 }
1319
1320 pub fn width(&mut self, width: i32) -> &mut Self {
1321 self.inner.width = width;
1322 self
1323 }
1324
1325 pub fn height(&mut self, height: i32) -> &mut Self {
1326 self.inner.height = height;
1327 self
1328 }
1329
1330 pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
1331 self.inner.caption = caption.as_ref().clone();
1332 self
1333 }
1334
1335 pub fn ttl(&mut self, ttl: i32) -> &mut Self {
1336 self.inner.ttl = ttl;
1337 self
1338 }
1339}
1340
1341impl AsRef<InputMessagePhoto> for InputMessagePhoto {
1342 fn as_ref(&self) -> &InputMessagePhoto {
1343 self
1344 }
1345}
1346
1347impl AsRef<InputMessagePhoto> for InputMessagePhotoBuilder {
1348 fn as_ref(&self) -> &InputMessagePhoto {
1349 &self.inner
1350 }
1351}
1352
1353#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1355pub struct InputMessagePoll {
1356 #[doc(hidden)]
1357 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1358 extra: Option<String>,
1359 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1360 client_id: Option<i32>,
1361 #[serde(default)]
1364 question: String,
1365 #[serde(default)]
1368 options: Vec<String>,
1369 #[serde(default)]
1372 is_anonymous: bool,
1373 #[serde(rename(serialize = "type", deserialize = "type"))]
1376 #[serde(skip_serializing_if = "PollType::_is_default")]
1377 type_: PollType,
1378 #[serde(default)]
1381 open_period: i32,
1382 #[serde(default)]
1385 close_date: i32,
1386 #[serde(default)]
1389 is_closed: bool,
1390}
1391
1392impl RObject for InputMessagePoll {
1393 #[doc(hidden)]
1394 fn extra(&self) -> Option<&str> {
1395 self.extra.as_deref()
1396 }
1397 #[doc(hidden)]
1398 fn client_id(&self) -> Option<i32> {
1399 self.client_id
1400 }
1401}
1402
1403impl TDInputMessageContent for InputMessagePoll {}
1404
1405impl InputMessagePoll {
1406 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1407 Ok(serde_json::from_str(json.as_ref())?)
1408 }
1409 pub fn builder() -> InputMessagePollBuilder {
1410 let mut inner = InputMessagePoll::default();
1411 inner.extra = Some(Uuid::new_v4().to_string());
1412
1413 InputMessagePollBuilder { inner }
1414 }
1415
1416 pub fn question(&self) -> &String {
1417 &self.question
1418 }
1419
1420 pub fn options(&self) -> &Vec<String> {
1421 &self.options
1422 }
1423
1424 pub fn is_anonymous(&self) -> bool {
1425 self.is_anonymous
1426 }
1427
1428 pub fn type_(&self) -> &PollType {
1429 &self.type_
1430 }
1431
1432 pub fn open_period(&self) -> i32 {
1433 self.open_period
1434 }
1435
1436 pub fn close_date(&self) -> i32 {
1437 self.close_date
1438 }
1439
1440 pub fn is_closed(&self) -> bool {
1441 self.is_closed
1442 }
1443}
1444
1445#[doc(hidden)]
1446pub struct InputMessagePollBuilder {
1447 inner: InputMessagePoll,
1448}
1449
1450#[deprecated]
1451pub type RTDInputMessagePollBuilder = InputMessagePollBuilder;
1452
1453impl InputMessagePollBuilder {
1454 pub fn build(&self) -> InputMessagePoll {
1455 self.inner.clone()
1456 }
1457
1458 pub fn question<T: AsRef<str>>(&mut self, question: T) -> &mut Self {
1459 self.inner.question = question.as_ref().to_string();
1460 self
1461 }
1462
1463 pub fn options(&mut self, options: Vec<String>) -> &mut Self {
1464 self.inner.options = options;
1465 self
1466 }
1467
1468 pub fn is_anonymous(&mut self, is_anonymous: bool) -> &mut Self {
1469 self.inner.is_anonymous = is_anonymous;
1470 self
1471 }
1472
1473 pub fn type_<T: AsRef<PollType>>(&mut self, type_: T) -> &mut Self {
1474 self.inner.type_ = type_.as_ref().clone();
1475 self
1476 }
1477
1478 pub fn open_period(&mut self, open_period: i32) -> &mut Self {
1479 self.inner.open_period = open_period;
1480 self
1481 }
1482
1483 pub fn close_date(&mut self, close_date: i32) -> &mut Self {
1484 self.inner.close_date = close_date;
1485 self
1486 }
1487
1488 pub fn is_closed(&mut self, is_closed: bool) -> &mut Self {
1489 self.inner.is_closed = is_closed;
1490 self
1491 }
1492}
1493
1494impl AsRef<InputMessagePoll> for InputMessagePoll {
1495 fn as_ref(&self) -> &InputMessagePoll {
1496 self
1497 }
1498}
1499
1500impl AsRef<InputMessagePoll> for InputMessagePollBuilder {
1501 fn as_ref(&self) -> &InputMessagePoll {
1502 &self.inner
1503 }
1504}
1505
1506#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1508pub struct InputMessageSticker {
1509 #[doc(hidden)]
1510 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1511 extra: Option<String>,
1512 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1513 client_id: Option<i32>,
1514 #[serde(skip_serializing_if = "InputFile::_is_default")]
1517 sticker: InputFile,
1518 thumbnail: InputThumbnail,
1520 #[serde(default)]
1523 width: i32,
1524 #[serde(default)]
1527 height: i32,
1528 #[serde(default)]
1531 emoji: String,
1532}
1533
1534impl RObject for InputMessageSticker {
1535 #[doc(hidden)]
1536 fn extra(&self) -> Option<&str> {
1537 self.extra.as_deref()
1538 }
1539 #[doc(hidden)]
1540 fn client_id(&self) -> Option<i32> {
1541 self.client_id
1542 }
1543}
1544
1545impl TDInputMessageContent for InputMessageSticker {}
1546
1547impl InputMessageSticker {
1548 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1549 Ok(serde_json::from_str(json.as_ref())?)
1550 }
1551 pub fn builder() -> InputMessageStickerBuilder {
1552 let mut inner = InputMessageSticker::default();
1553 inner.extra = Some(Uuid::new_v4().to_string());
1554
1555 InputMessageStickerBuilder { inner }
1556 }
1557
1558 pub fn sticker(&self) -> &InputFile {
1559 &self.sticker
1560 }
1561
1562 pub fn thumbnail(&self) -> &InputThumbnail {
1563 &self.thumbnail
1564 }
1565
1566 pub fn width(&self) -> i32 {
1567 self.width
1568 }
1569
1570 pub fn height(&self) -> i32 {
1571 self.height
1572 }
1573
1574 pub fn emoji(&self) -> &String {
1575 &self.emoji
1576 }
1577}
1578
1579#[doc(hidden)]
1580pub struct InputMessageStickerBuilder {
1581 inner: InputMessageSticker,
1582}
1583
1584#[deprecated]
1585pub type RTDInputMessageStickerBuilder = InputMessageStickerBuilder;
1586
1587impl InputMessageStickerBuilder {
1588 pub fn build(&self) -> InputMessageSticker {
1589 self.inner.clone()
1590 }
1591
1592 pub fn sticker<T: AsRef<InputFile>>(&mut self, sticker: T) -> &mut Self {
1593 self.inner.sticker = sticker.as_ref().clone();
1594 self
1595 }
1596
1597 pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1598 self.inner.thumbnail = thumbnail.as_ref().clone();
1599 self
1600 }
1601
1602 pub fn width(&mut self, width: i32) -> &mut Self {
1603 self.inner.width = width;
1604 self
1605 }
1606
1607 pub fn height(&mut self, height: i32) -> &mut Self {
1608 self.inner.height = height;
1609 self
1610 }
1611
1612 pub fn emoji<T: AsRef<str>>(&mut self, emoji: T) -> &mut Self {
1613 self.inner.emoji = emoji.as_ref().to_string();
1614 self
1615 }
1616}
1617
1618impl AsRef<InputMessageSticker> for InputMessageSticker {
1619 fn as_ref(&self) -> &InputMessageSticker {
1620 self
1621 }
1622}
1623
1624impl AsRef<InputMessageSticker> for InputMessageStickerBuilder {
1625 fn as_ref(&self) -> &InputMessageSticker {
1626 &self.inner
1627 }
1628}
1629
1630#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1632pub struct InputMessageText {
1633 #[doc(hidden)]
1634 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1635 extra: Option<String>,
1636 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1637 client_id: Option<i32>,
1638 text: FormattedText,
1640 #[serde(default)]
1643 disable_web_page_preview: bool,
1644 #[serde(default)]
1647 clear_draft: bool,
1648}
1649
1650impl RObject for InputMessageText {
1651 #[doc(hidden)]
1652 fn extra(&self) -> Option<&str> {
1653 self.extra.as_deref()
1654 }
1655 #[doc(hidden)]
1656 fn client_id(&self) -> Option<i32> {
1657 self.client_id
1658 }
1659}
1660
1661impl TDInputMessageContent for InputMessageText {}
1662
1663impl InputMessageText {
1664 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1665 Ok(serde_json::from_str(json.as_ref())?)
1666 }
1667 pub fn builder() -> InputMessageTextBuilder {
1668 let mut inner = InputMessageText::default();
1669 inner.extra = Some(Uuid::new_v4().to_string());
1670
1671 InputMessageTextBuilder { inner }
1672 }
1673
1674 pub fn text(&self) -> &FormattedText {
1675 &self.text
1676 }
1677
1678 pub fn disable_web_page_preview(&self) -> bool {
1679 self.disable_web_page_preview
1680 }
1681
1682 pub fn clear_draft(&self) -> bool {
1683 self.clear_draft
1684 }
1685}
1686
1687#[doc(hidden)]
1688pub struct InputMessageTextBuilder {
1689 inner: InputMessageText,
1690}
1691
1692#[deprecated]
1693pub type RTDInputMessageTextBuilder = InputMessageTextBuilder;
1694
1695impl InputMessageTextBuilder {
1696 pub fn build(&self) -> InputMessageText {
1697 self.inner.clone()
1698 }
1699
1700 pub fn text<T: AsRef<FormattedText>>(&mut self, text: T) -> &mut Self {
1701 self.inner.text = text.as_ref().clone();
1702 self
1703 }
1704
1705 pub fn disable_web_page_preview(&mut self, disable_web_page_preview: bool) -> &mut Self {
1706 self.inner.disable_web_page_preview = disable_web_page_preview;
1707 self
1708 }
1709
1710 pub fn clear_draft(&mut self, clear_draft: bool) -> &mut Self {
1711 self.inner.clear_draft = clear_draft;
1712 self
1713 }
1714}
1715
1716impl AsRef<InputMessageText> for InputMessageText {
1717 fn as_ref(&self) -> &InputMessageText {
1718 self
1719 }
1720}
1721
1722impl AsRef<InputMessageText> for InputMessageTextBuilder {
1723 fn as_ref(&self) -> &InputMessageText {
1724 &self.inner
1725 }
1726}
1727
1728#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1730pub struct InputMessageVenue {
1731 #[doc(hidden)]
1732 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1733 extra: Option<String>,
1734 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1735 client_id: Option<i32>,
1736 venue: Venue,
1738}
1739
1740impl RObject for InputMessageVenue {
1741 #[doc(hidden)]
1742 fn extra(&self) -> Option<&str> {
1743 self.extra.as_deref()
1744 }
1745 #[doc(hidden)]
1746 fn client_id(&self) -> Option<i32> {
1747 self.client_id
1748 }
1749}
1750
1751impl TDInputMessageContent for InputMessageVenue {}
1752
1753impl InputMessageVenue {
1754 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1755 Ok(serde_json::from_str(json.as_ref())?)
1756 }
1757 pub fn builder() -> InputMessageVenueBuilder {
1758 let mut inner = InputMessageVenue::default();
1759 inner.extra = Some(Uuid::new_v4().to_string());
1760
1761 InputMessageVenueBuilder { inner }
1762 }
1763
1764 pub fn venue(&self) -> &Venue {
1765 &self.venue
1766 }
1767}
1768
1769#[doc(hidden)]
1770pub struct InputMessageVenueBuilder {
1771 inner: InputMessageVenue,
1772}
1773
1774#[deprecated]
1775pub type RTDInputMessageVenueBuilder = InputMessageVenueBuilder;
1776
1777impl InputMessageVenueBuilder {
1778 pub fn build(&self) -> InputMessageVenue {
1779 self.inner.clone()
1780 }
1781
1782 pub fn venue<T: AsRef<Venue>>(&mut self, venue: T) -> &mut Self {
1783 self.inner.venue = venue.as_ref().clone();
1784 self
1785 }
1786}
1787
1788impl AsRef<InputMessageVenue> for InputMessageVenue {
1789 fn as_ref(&self) -> &InputMessageVenue {
1790 self
1791 }
1792}
1793
1794impl AsRef<InputMessageVenue> for InputMessageVenueBuilder {
1795 fn as_ref(&self) -> &InputMessageVenue {
1796 &self.inner
1797 }
1798}
1799
1800#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1802pub struct InputMessageVideo {
1803 #[doc(hidden)]
1804 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1805 extra: Option<String>,
1806 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1807 client_id: Option<i32>,
1808 #[serde(skip_serializing_if = "InputFile::_is_default")]
1811 video: InputFile,
1812 thumbnail: InputThumbnail,
1814 #[serde(default)]
1817 added_sticker_file_ids: Vec<i32>,
1818 #[serde(default)]
1821 duration: i32,
1822 #[serde(default)]
1825 width: i32,
1826 #[serde(default)]
1829 height: i32,
1830 #[serde(default)]
1833 supports_streaming: bool,
1834 caption: FormattedText,
1836 #[serde(default)]
1839 ttl: i32,
1840}
1841
1842impl RObject for InputMessageVideo {
1843 #[doc(hidden)]
1844 fn extra(&self) -> Option<&str> {
1845 self.extra.as_deref()
1846 }
1847 #[doc(hidden)]
1848 fn client_id(&self) -> Option<i32> {
1849 self.client_id
1850 }
1851}
1852
1853impl TDInputMessageContent for InputMessageVideo {}
1854
1855impl InputMessageVideo {
1856 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1857 Ok(serde_json::from_str(json.as_ref())?)
1858 }
1859 pub fn builder() -> InputMessageVideoBuilder {
1860 let mut inner = InputMessageVideo::default();
1861 inner.extra = Some(Uuid::new_v4().to_string());
1862
1863 InputMessageVideoBuilder { inner }
1864 }
1865
1866 pub fn video(&self) -> &InputFile {
1867 &self.video
1868 }
1869
1870 pub fn thumbnail(&self) -> &InputThumbnail {
1871 &self.thumbnail
1872 }
1873
1874 pub fn added_sticker_file_ids(&self) -> &Vec<i32> {
1875 &self.added_sticker_file_ids
1876 }
1877
1878 pub fn duration(&self) -> i32 {
1879 self.duration
1880 }
1881
1882 pub fn width(&self) -> i32 {
1883 self.width
1884 }
1885
1886 pub fn height(&self) -> i32 {
1887 self.height
1888 }
1889
1890 pub fn supports_streaming(&self) -> bool {
1891 self.supports_streaming
1892 }
1893
1894 pub fn caption(&self) -> &FormattedText {
1895 &self.caption
1896 }
1897
1898 pub fn ttl(&self) -> i32 {
1899 self.ttl
1900 }
1901}
1902
1903#[doc(hidden)]
1904pub struct InputMessageVideoBuilder {
1905 inner: InputMessageVideo,
1906}
1907
1908#[deprecated]
1909pub type RTDInputMessageVideoBuilder = InputMessageVideoBuilder;
1910
1911impl InputMessageVideoBuilder {
1912 pub fn build(&self) -> InputMessageVideo {
1913 self.inner.clone()
1914 }
1915
1916 pub fn video<T: AsRef<InputFile>>(&mut self, video: T) -> &mut Self {
1917 self.inner.video = video.as_ref().clone();
1918 self
1919 }
1920
1921 pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
1922 self.inner.thumbnail = thumbnail.as_ref().clone();
1923 self
1924 }
1925
1926 pub fn added_sticker_file_ids(&mut self, added_sticker_file_ids: Vec<i32>) -> &mut Self {
1927 self.inner.added_sticker_file_ids = added_sticker_file_ids;
1928 self
1929 }
1930
1931 pub fn duration(&mut self, duration: i32) -> &mut Self {
1932 self.inner.duration = duration;
1933 self
1934 }
1935
1936 pub fn width(&mut self, width: i32) -> &mut Self {
1937 self.inner.width = width;
1938 self
1939 }
1940
1941 pub fn height(&mut self, height: i32) -> &mut Self {
1942 self.inner.height = height;
1943 self
1944 }
1945
1946 pub fn supports_streaming(&mut self, supports_streaming: bool) -> &mut Self {
1947 self.inner.supports_streaming = supports_streaming;
1948 self
1949 }
1950
1951 pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
1952 self.inner.caption = caption.as_ref().clone();
1953 self
1954 }
1955
1956 pub fn ttl(&mut self, ttl: i32) -> &mut Self {
1957 self.inner.ttl = ttl;
1958 self
1959 }
1960}
1961
1962impl AsRef<InputMessageVideo> for InputMessageVideo {
1963 fn as_ref(&self) -> &InputMessageVideo {
1964 self
1965 }
1966}
1967
1968impl AsRef<InputMessageVideo> for InputMessageVideoBuilder {
1969 fn as_ref(&self) -> &InputMessageVideo {
1970 &self.inner
1971 }
1972}
1973
1974#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1976pub struct InputMessageVideoNote {
1977 #[doc(hidden)]
1978 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1979 extra: Option<String>,
1980 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1981 client_id: Option<i32>,
1982 #[serde(skip_serializing_if = "InputFile::_is_default")]
1985 video_note: InputFile,
1986 thumbnail: InputThumbnail,
1988 #[serde(default)]
1991 duration: i32,
1992 #[serde(default)]
1995 length: i32,
1996}
1997
1998impl RObject for InputMessageVideoNote {
1999 #[doc(hidden)]
2000 fn extra(&self) -> Option<&str> {
2001 self.extra.as_deref()
2002 }
2003 #[doc(hidden)]
2004 fn client_id(&self) -> Option<i32> {
2005 self.client_id
2006 }
2007}
2008
2009impl TDInputMessageContent for InputMessageVideoNote {}
2010
2011impl InputMessageVideoNote {
2012 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2013 Ok(serde_json::from_str(json.as_ref())?)
2014 }
2015 pub fn builder() -> InputMessageVideoNoteBuilder {
2016 let mut inner = InputMessageVideoNote::default();
2017 inner.extra = Some(Uuid::new_v4().to_string());
2018
2019 InputMessageVideoNoteBuilder { inner }
2020 }
2021
2022 pub fn video_note(&self) -> &InputFile {
2023 &self.video_note
2024 }
2025
2026 pub fn thumbnail(&self) -> &InputThumbnail {
2027 &self.thumbnail
2028 }
2029
2030 pub fn duration(&self) -> i32 {
2031 self.duration
2032 }
2033
2034 pub fn length(&self) -> i32 {
2035 self.length
2036 }
2037}
2038
2039#[doc(hidden)]
2040pub struct InputMessageVideoNoteBuilder {
2041 inner: InputMessageVideoNote,
2042}
2043
2044#[deprecated]
2045pub type RTDInputMessageVideoNoteBuilder = InputMessageVideoNoteBuilder;
2046
2047impl InputMessageVideoNoteBuilder {
2048 pub fn build(&self) -> InputMessageVideoNote {
2049 self.inner.clone()
2050 }
2051
2052 pub fn video_note<T: AsRef<InputFile>>(&mut self, video_note: T) -> &mut Self {
2053 self.inner.video_note = video_note.as_ref().clone();
2054 self
2055 }
2056
2057 pub fn thumbnail<T: AsRef<InputThumbnail>>(&mut self, thumbnail: T) -> &mut Self {
2058 self.inner.thumbnail = thumbnail.as_ref().clone();
2059 self
2060 }
2061
2062 pub fn duration(&mut self, duration: i32) -> &mut Self {
2063 self.inner.duration = duration;
2064 self
2065 }
2066
2067 pub fn length(&mut self, length: i32) -> &mut Self {
2068 self.inner.length = length;
2069 self
2070 }
2071}
2072
2073impl AsRef<InputMessageVideoNote> for InputMessageVideoNote {
2074 fn as_ref(&self) -> &InputMessageVideoNote {
2075 self
2076 }
2077}
2078
2079impl AsRef<InputMessageVideoNote> for InputMessageVideoNoteBuilder {
2080 fn as_ref(&self) -> &InputMessageVideoNote {
2081 &self.inner
2082 }
2083}
2084
2085#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2087pub struct InputMessageVoiceNote {
2088 #[doc(hidden)]
2089 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2090 extra: Option<String>,
2091 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2092 client_id: Option<i32>,
2093 #[serde(skip_serializing_if = "InputFile::_is_default")]
2096 voice_note: InputFile,
2097 #[serde(default)]
2100 duration: i32,
2101 #[serde(default)]
2104 waveform: String,
2105 caption: FormattedText,
2107}
2108
2109impl RObject for InputMessageVoiceNote {
2110 #[doc(hidden)]
2111 fn extra(&self) -> Option<&str> {
2112 self.extra.as_deref()
2113 }
2114 #[doc(hidden)]
2115 fn client_id(&self) -> Option<i32> {
2116 self.client_id
2117 }
2118}
2119
2120impl TDInputMessageContent for InputMessageVoiceNote {}
2121
2122impl InputMessageVoiceNote {
2123 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2124 Ok(serde_json::from_str(json.as_ref())?)
2125 }
2126 pub fn builder() -> InputMessageVoiceNoteBuilder {
2127 let mut inner = InputMessageVoiceNote::default();
2128 inner.extra = Some(Uuid::new_v4().to_string());
2129
2130 InputMessageVoiceNoteBuilder { inner }
2131 }
2132
2133 pub fn voice_note(&self) -> &InputFile {
2134 &self.voice_note
2135 }
2136
2137 pub fn duration(&self) -> i32 {
2138 self.duration
2139 }
2140
2141 pub fn waveform(&self) -> &String {
2142 &self.waveform
2143 }
2144
2145 pub fn caption(&self) -> &FormattedText {
2146 &self.caption
2147 }
2148}
2149
2150#[doc(hidden)]
2151pub struct InputMessageVoiceNoteBuilder {
2152 inner: InputMessageVoiceNote,
2153}
2154
2155#[deprecated]
2156pub type RTDInputMessageVoiceNoteBuilder = InputMessageVoiceNoteBuilder;
2157
2158impl InputMessageVoiceNoteBuilder {
2159 pub fn build(&self) -> InputMessageVoiceNote {
2160 self.inner.clone()
2161 }
2162
2163 pub fn voice_note<T: AsRef<InputFile>>(&mut self, voice_note: T) -> &mut Self {
2164 self.inner.voice_note = voice_note.as_ref().clone();
2165 self
2166 }
2167
2168 pub fn duration(&mut self, duration: i32) -> &mut Self {
2169 self.inner.duration = duration;
2170 self
2171 }
2172
2173 pub fn waveform<T: AsRef<str>>(&mut self, waveform: T) -> &mut Self {
2174 self.inner.waveform = waveform.as_ref().to_string();
2175 self
2176 }
2177
2178 pub fn caption<T: AsRef<FormattedText>>(&mut self, caption: T) -> &mut Self {
2179 self.inner.caption = caption.as_ref().clone();
2180 self
2181 }
2182}
2183
2184impl AsRef<InputMessageVoiceNote> for InputMessageVoiceNote {
2185 fn as_ref(&self) -> &InputMessageVoiceNote {
2186 self
2187 }
2188}
2189
2190impl AsRef<InputMessageVoiceNote> for InputMessageVoiceNoteBuilder {
2191 fn as_ref(&self) -> &InputMessageVoiceNote {
2192 &self.inner
2193 }
2194}