1use crate::errors::Result;
2use crate::types::*;
3use uuid::Uuid;
4
5use std::fmt::Debug;
6
7pub trait TDPageBlock: Debug + RObject {}
9
10#[derive(Debug, Clone, Deserialize, Serialize, Default)]
12#[serde(tag = "@type")]
13pub enum PageBlock {
14 #[doc(hidden)]
15 #[default]
16 _Default,
17 #[serde(rename = "pageBlockAnchor")]
19 Anchor(PageBlockAnchor),
20 #[serde(rename = "pageBlockAnimation")]
22 Animation(PageBlockAnimation),
23 #[serde(rename = "pageBlockAudio")]
25 Audio(PageBlockAudio),
26 #[serde(rename = "pageBlockAuthorDate")]
28 AuthorDate(PageBlockAuthorDate),
29 #[serde(rename = "pageBlockBlockQuote")]
31 BlockQuote(PageBlockBlockQuote),
32 #[serde(rename = "pageBlockChatLink")]
34 ChatLink(Box<PageBlockChatLink>),
35 #[serde(rename = "pageBlockCollage")]
37 Collage(PageBlockCollage),
38 #[serde(rename = "pageBlockCover")]
40 Cover(PageBlockCover),
41 #[serde(rename = "pageBlockDetails")]
43 Details(PageBlockDetails),
44 #[serde(rename = "pageBlockDivider")]
46 Divider(PageBlockDivider),
47 #[serde(rename = "pageBlockEmbedded")]
49 Embedded(PageBlockEmbedded),
50 #[serde(rename = "pageBlockEmbeddedPost")]
52 EmbeddedPost(PageBlockEmbeddedPost),
53 #[serde(rename = "pageBlockFooter")]
55 Footer(PageBlockFooter),
56 #[serde(rename = "pageBlockHeader")]
58 Header(PageBlockHeader),
59 #[serde(rename = "pageBlockKicker")]
61 Kicker(PageBlockKicker),
62 #[serde(rename = "pageBlockList")]
64 List(PageBlockList),
65 #[serde(rename = "pageBlockMap")]
67 Map(PageBlockMap),
68 #[serde(rename = "pageBlockParagraph")]
70 Paragraph(PageBlockParagraph),
71 #[serde(rename = "pageBlockPhoto")]
73 Photo(PageBlockPhoto),
74 #[serde(rename = "pageBlockPreformatted")]
76 Preformatted(PageBlockPreformatted),
77 #[serde(rename = "pageBlockPullQuote")]
79 PullQuote(PageBlockPullQuote),
80 #[serde(rename = "pageBlockRelatedArticles")]
82 RelatedArticles(PageBlockRelatedArticles),
83 #[serde(rename = "pageBlockSlideshow")]
85 Slideshow(PageBlockSlideshow),
86 #[serde(rename = "pageBlockSubheader")]
88 Subheader(PageBlockSubheader),
89 #[serde(rename = "pageBlockSubtitle")]
91 Subtitle(PageBlockSubtitle),
92 #[serde(rename = "pageBlockTable")]
94 Table(PageBlockTable),
95 #[serde(rename = "pageBlockTitle")]
97 Title(PageBlockTitle),
98 #[serde(rename = "pageBlockVideo")]
100 Video(PageBlockVideo),
101 #[serde(rename = "pageBlockVoiceNote")]
103 VoiceNote(PageBlockVoiceNote),
104}
105
106impl RObject for PageBlock {
107 #[doc(hidden)]
108 fn extra(&self) -> Option<&str> {
109 match self {
110 PageBlock::Anchor(t) => t.extra(),
111 PageBlock::Animation(t) => t.extra(),
112 PageBlock::Audio(t) => t.extra(),
113 PageBlock::AuthorDate(t) => t.extra(),
114 PageBlock::BlockQuote(t) => t.extra(),
115 PageBlock::ChatLink(t) => t.extra(),
116 PageBlock::Collage(t) => t.extra(),
117 PageBlock::Cover(t) => t.extra(),
118 PageBlock::Details(t) => t.extra(),
119 PageBlock::Divider(t) => t.extra(),
120 PageBlock::Embedded(t) => t.extra(),
121 PageBlock::EmbeddedPost(t) => t.extra(),
122 PageBlock::Footer(t) => t.extra(),
123 PageBlock::Header(t) => t.extra(),
124 PageBlock::Kicker(t) => t.extra(),
125 PageBlock::List(t) => t.extra(),
126 PageBlock::Map(t) => t.extra(),
127 PageBlock::Paragraph(t) => t.extra(),
128 PageBlock::Photo(t) => t.extra(),
129 PageBlock::Preformatted(t) => t.extra(),
130 PageBlock::PullQuote(t) => t.extra(),
131 PageBlock::RelatedArticles(t) => t.extra(),
132 PageBlock::Slideshow(t) => t.extra(),
133 PageBlock::Subheader(t) => t.extra(),
134 PageBlock::Subtitle(t) => t.extra(),
135 PageBlock::Table(t) => t.extra(),
136 PageBlock::Title(t) => t.extra(),
137 PageBlock::Video(t) => t.extra(),
138 PageBlock::VoiceNote(t) => t.extra(),
139
140 _ => None,
141 }
142 }
143 #[doc(hidden)]
144 fn client_id(&self) -> Option<i32> {
145 match self {
146 PageBlock::Anchor(t) => t.client_id(),
147 PageBlock::Animation(t) => t.client_id(),
148 PageBlock::Audio(t) => t.client_id(),
149 PageBlock::AuthorDate(t) => t.client_id(),
150 PageBlock::BlockQuote(t) => t.client_id(),
151 PageBlock::ChatLink(t) => t.client_id(),
152 PageBlock::Collage(t) => t.client_id(),
153 PageBlock::Cover(t) => t.client_id(),
154 PageBlock::Details(t) => t.client_id(),
155 PageBlock::Divider(t) => t.client_id(),
156 PageBlock::Embedded(t) => t.client_id(),
157 PageBlock::EmbeddedPost(t) => t.client_id(),
158 PageBlock::Footer(t) => t.client_id(),
159 PageBlock::Header(t) => t.client_id(),
160 PageBlock::Kicker(t) => t.client_id(),
161 PageBlock::List(t) => t.client_id(),
162 PageBlock::Map(t) => t.client_id(),
163 PageBlock::Paragraph(t) => t.client_id(),
164 PageBlock::Photo(t) => t.client_id(),
165 PageBlock::Preformatted(t) => t.client_id(),
166 PageBlock::PullQuote(t) => t.client_id(),
167 PageBlock::RelatedArticles(t) => t.client_id(),
168 PageBlock::Slideshow(t) => t.client_id(),
169 PageBlock::Subheader(t) => t.client_id(),
170 PageBlock::Subtitle(t) => t.client_id(),
171 PageBlock::Table(t) => t.client_id(),
172 PageBlock::Title(t) => t.client_id(),
173 PageBlock::Video(t) => t.client_id(),
174 PageBlock::VoiceNote(t) => t.client_id(),
175
176 _ => None,
177 }
178 }
179}
180
181impl PageBlock {
182 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
183 Ok(serde_json::from_str(json.as_ref())?)
184 }
185 #[doc(hidden)]
186 pub fn _is_default(&self) -> bool {
187 matches!(self, PageBlock::_Default)
188 }
189}
190
191impl AsRef<PageBlock> for PageBlock {
192 fn as_ref(&self) -> &PageBlock {
193 self
194 }
195}
196
197#[derive(Debug, Clone, Default, Serialize, Deserialize)]
199pub struct PageBlockAnchor {
200 #[doc(hidden)]
201 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
202 extra: Option<String>,
203 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
204 client_id: Option<i32>,
205 #[serde(default)]
208 name: String,
209}
210
211impl RObject for PageBlockAnchor {
212 #[doc(hidden)]
213 fn extra(&self) -> Option<&str> {
214 self.extra.as_deref()
215 }
216 #[doc(hidden)]
217 fn client_id(&self) -> Option<i32> {
218 self.client_id
219 }
220}
221
222impl TDPageBlock for PageBlockAnchor {}
223
224impl PageBlockAnchor {
225 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
226 Ok(serde_json::from_str(json.as_ref())?)
227 }
228 pub fn builder() -> PageBlockAnchorBuilder {
229 let mut inner = PageBlockAnchor::default();
230 inner.extra = Some(Uuid::new_v4().to_string());
231
232 PageBlockAnchorBuilder { inner }
233 }
234
235 pub fn name(&self) -> &String {
236 &self.name
237 }
238}
239
240#[doc(hidden)]
241pub struct PageBlockAnchorBuilder {
242 inner: PageBlockAnchor,
243}
244
245#[deprecated]
246pub type RTDPageBlockAnchorBuilder = PageBlockAnchorBuilder;
247
248impl PageBlockAnchorBuilder {
249 pub fn build(&self) -> PageBlockAnchor {
250 self.inner.clone()
251 }
252
253 pub fn name<T: AsRef<str>>(&mut self, name: T) -> &mut Self {
254 self.inner.name = name.as_ref().to_string();
255 self
256 }
257}
258
259impl AsRef<PageBlockAnchor> for PageBlockAnchor {
260 fn as_ref(&self) -> &PageBlockAnchor {
261 self
262 }
263}
264
265impl AsRef<PageBlockAnchor> for PageBlockAnchorBuilder {
266 fn as_ref(&self) -> &PageBlockAnchor {
267 &self.inner
268 }
269}
270
271#[derive(Debug, Clone, Default, Serialize, Deserialize)]
273pub struct PageBlockAnimation {
274 #[doc(hidden)]
275 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
276 extra: Option<String>,
277 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
278 client_id: Option<i32>,
279 animation: Option<Animation>,
281 caption: PageBlockCaption,
283 #[serde(default)]
286 need_autoplay: bool,
287}
288
289impl RObject for PageBlockAnimation {
290 #[doc(hidden)]
291 fn extra(&self) -> Option<&str> {
292 self.extra.as_deref()
293 }
294 #[doc(hidden)]
295 fn client_id(&self) -> Option<i32> {
296 self.client_id
297 }
298}
299
300impl TDPageBlock for PageBlockAnimation {}
301
302impl PageBlockAnimation {
303 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
304 Ok(serde_json::from_str(json.as_ref())?)
305 }
306 pub fn builder() -> PageBlockAnimationBuilder {
307 let mut inner = PageBlockAnimation::default();
308 inner.extra = Some(Uuid::new_v4().to_string());
309
310 PageBlockAnimationBuilder { inner }
311 }
312
313 pub fn animation(&self) -> &Option<Animation> {
314 &self.animation
315 }
316
317 pub fn caption(&self) -> &PageBlockCaption {
318 &self.caption
319 }
320
321 pub fn need_autoplay(&self) -> bool {
322 self.need_autoplay
323 }
324}
325
326#[doc(hidden)]
327pub struct PageBlockAnimationBuilder {
328 inner: PageBlockAnimation,
329}
330
331#[deprecated]
332pub type RTDPageBlockAnimationBuilder = PageBlockAnimationBuilder;
333
334impl PageBlockAnimationBuilder {
335 pub fn build(&self) -> PageBlockAnimation {
336 self.inner.clone()
337 }
338
339 pub fn animation<T: AsRef<Animation>>(&mut self, animation: T) -> &mut Self {
340 self.inner.animation = Some(animation.as_ref().clone());
341 self
342 }
343
344 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
345 self.inner.caption = caption.as_ref().clone();
346 self
347 }
348
349 pub fn need_autoplay(&mut self, need_autoplay: bool) -> &mut Self {
350 self.inner.need_autoplay = need_autoplay;
351 self
352 }
353}
354
355impl AsRef<PageBlockAnimation> for PageBlockAnimation {
356 fn as_ref(&self) -> &PageBlockAnimation {
357 self
358 }
359}
360
361impl AsRef<PageBlockAnimation> for PageBlockAnimationBuilder {
362 fn as_ref(&self) -> &PageBlockAnimation {
363 &self.inner
364 }
365}
366
367#[derive(Debug, Clone, Default, Serialize, Deserialize)]
369pub struct PageBlockAudio {
370 #[doc(hidden)]
371 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
372 extra: Option<String>,
373 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
374 client_id: Option<i32>,
375 audio: Option<Audio>,
377 caption: PageBlockCaption,
379}
380
381impl RObject for PageBlockAudio {
382 #[doc(hidden)]
383 fn extra(&self) -> Option<&str> {
384 self.extra.as_deref()
385 }
386 #[doc(hidden)]
387 fn client_id(&self) -> Option<i32> {
388 self.client_id
389 }
390}
391
392impl TDPageBlock for PageBlockAudio {}
393
394impl PageBlockAudio {
395 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
396 Ok(serde_json::from_str(json.as_ref())?)
397 }
398 pub fn builder() -> PageBlockAudioBuilder {
399 let mut inner = PageBlockAudio::default();
400 inner.extra = Some(Uuid::new_v4().to_string());
401
402 PageBlockAudioBuilder { inner }
403 }
404
405 pub fn audio(&self) -> &Option<Audio> {
406 &self.audio
407 }
408
409 pub fn caption(&self) -> &PageBlockCaption {
410 &self.caption
411 }
412}
413
414#[doc(hidden)]
415pub struct PageBlockAudioBuilder {
416 inner: PageBlockAudio,
417}
418
419#[deprecated]
420pub type RTDPageBlockAudioBuilder = PageBlockAudioBuilder;
421
422impl PageBlockAudioBuilder {
423 pub fn build(&self) -> PageBlockAudio {
424 self.inner.clone()
425 }
426
427 pub fn audio<T: AsRef<Audio>>(&mut self, audio: T) -> &mut Self {
428 self.inner.audio = Some(audio.as_ref().clone());
429 self
430 }
431
432 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
433 self.inner.caption = caption.as_ref().clone();
434 self
435 }
436}
437
438impl AsRef<PageBlockAudio> for PageBlockAudio {
439 fn as_ref(&self) -> &PageBlockAudio {
440 self
441 }
442}
443
444impl AsRef<PageBlockAudio> for PageBlockAudioBuilder {
445 fn as_ref(&self) -> &PageBlockAudio {
446 &self.inner
447 }
448}
449
450#[derive(Debug, Clone, Default, Serialize, Deserialize)]
452pub struct PageBlockAuthorDate {
453 #[doc(hidden)]
454 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
455 extra: Option<String>,
456 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
457 client_id: Option<i32>,
458 #[serde(skip_serializing_if = "RichText::_is_default")]
461 author: RichText,
462 #[serde(default)]
465 publish_date: i32,
466}
467
468impl RObject for PageBlockAuthorDate {
469 #[doc(hidden)]
470 fn extra(&self) -> Option<&str> {
471 self.extra.as_deref()
472 }
473 #[doc(hidden)]
474 fn client_id(&self) -> Option<i32> {
475 self.client_id
476 }
477}
478
479impl TDPageBlock for PageBlockAuthorDate {}
480
481impl PageBlockAuthorDate {
482 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
483 Ok(serde_json::from_str(json.as_ref())?)
484 }
485 pub fn builder() -> PageBlockAuthorDateBuilder {
486 let mut inner = PageBlockAuthorDate::default();
487 inner.extra = Some(Uuid::new_v4().to_string());
488
489 PageBlockAuthorDateBuilder { inner }
490 }
491
492 pub fn author(&self) -> &RichText {
493 &self.author
494 }
495
496 pub fn publish_date(&self) -> i32 {
497 self.publish_date
498 }
499}
500
501#[doc(hidden)]
502pub struct PageBlockAuthorDateBuilder {
503 inner: PageBlockAuthorDate,
504}
505
506#[deprecated]
507pub type RTDPageBlockAuthorDateBuilder = PageBlockAuthorDateBuilder;
508
509impl PageBlockAuthorDateBuilder {
510 pub fn build(&self) -> PageBlockAuthorDate {
511 self.inner.clone()
512 }
513
514 pub fn author<T: AsRef<RichText>>(&mut self, author: T) -> &mut Self {
515 self.inner.author = author.as_ref().clone();
516 self
517 }
518
519 pub fn publish_date(&mut self, publish_date: i32) -> &mut Self {
520 self.inner.publish_date = publish_date;
521 self
522 }
523}
524
525impl AsRef<PageBlockAuthorDate> for PageBlockAuthorDate {
526 fn as_ref(&self) -> &PageBlockAuthorDate {
527 self
528 }
529}
530
531impl AsRef<PageBlockAuthorDate> for PageBlockAuthorDateBuilder {
532 fn as_ref(&self) -> &PageBlockAuthorDate {
533 &self.inner
534 }
535}
536
537#[derive(Debug, Clone, Default, Serialize, Deserialize)]
539pub struct PageBlockBlockQuote {
540 #[doc(hidden)]
541 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
542 extra: Option<String>,
543 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
544 client_id: Option<i32>,
545 #[serde(skip_serializing_if = "RichText::_is_default")]
548 text: RichText,
549 #[serde(skip_serializing_if = "RichText::_is_default")]
552 credit: RichText,
553}
554
555impl RObject for PageBlockBlockQuote {
556 #[doc(hidden)]
557 fn extra(&self) -> Option<&str> {
558 self.extra.as_deref()
559 }
560 #[doc(hidden)]
561 fn client_id(&self) -> Option<i32> {
562 self.client_id
563 }
564}
565
566impl TDPageBlock for PageBlockBlockQuote {}
567
568impl PageBlockBlockQuote {
569 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
570 Ok(serde_json::from_str(json.as_ref())?)
571 }
572 pub fn builder() -> PageBlockBlockQuoteBuilder {
573 let mut inner = PageBlockBlockQuote::default();
574 inner.extra = Some(Uuid::new_v4().to_string());
575
576 PageBlockBlockQuoteBuilder { inner }
577 }
578
579 pub fn text(&self) -> &RichText {
580 &self.text
581 }
582
583 pub fn credit(&self) -> &RichText {
584 &self.credit
585 }
586}
587
588#[doc(hidden)]
589pub struct PageBlockBlockQuoteBuilder {
590 inner: PageBlockBlockQuote,
591}
592
593#[deprecated]
594pub type RTDPageBlockBlockQuoteBuilder = PageBlockBlockQuoteBuilder;
595
596impl PageBlockBlockQuoteBuilder {
597 pub fn build(&self) -> PageBlockBlockQuote {
598 self.inner.clone()
599 }
600
601 pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
602 self.inner.text = text.as_ref().clone();
603 self
604 }
605
606 pub fn credit<T: AsRef<RichText>>(&mut self, credit: T) -> &mut Self {
607 self.inner.credit = credit.as_ref().clone();
608 self
609 }
610}
611
612impl AsRef<PageBlockBlockQuote> for PageBlockBlockQuote {
613 fn as_ref(&self) -> &PageBlockBlockQuote {
614 self
615 }
616}
617
618impl AsRef<PageBlockBlockQuote> for PageBlockBlockQuoteBuilder {
619 fn as_ref(&self) -> &PageBlockBlockQuote {
620 &self.inner
621 }
622}
623
624#[derive(Debug, Clone, Default, Serialize, Deserialize)]
626pub struct PageBlockChatLink {
627 #[doc(hidden)]
628 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
629 extra: Option<String>,
630 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
631 client_id: Option<i32>,
632 #[serde(default)]
635 title: String,
636 photo: Option<ChatPhotoInfo>,
638 #[serde(default)]
641 username: String,
642}
643
644impl RObject for PageBlockChatLink {
645 #[doc(hidden)]
646 fn extra(&self) -> Option<&str> {
647 self.extra.as_deref()
648 }
649 #[doc(hidden)]
650 fn client_id(&self) -> Option<i32> {
651 self.client_id
652 }
653}
654
655impl TDPageBlock for PageBlockChatLink {}
656
657impl PageBlockChatLink {
658 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
659 Ok(serde_json::from_str(json.as_ref())?)
660 }
661 pub fn builder() -> PageBlockChatLinkBuilder {
662 let mut inner = PageBlockChatLink::default();
663 inner.extra = Some(Uuid::new_v4().to_string());
664
665 PageBlockChatLinkBuilder { inner }
666 }
667
668 pub fn title(&self) -> &String {
669 &self.title
670 }
671
672 pub fn photo(&self) -> &Option<ChatPhotoInfo> {
673 &self.photo
674 }
675
676 pub fn username(&self) -> &String {
677 &self.username
678 }
679}
680
681#[doc(hidden)]
682pub struct PageBlockChatLinkBuilder {
683 inner: PageBlockChatLink,
684}
685
686#[deprecated]
687pub type RTDPageBlockChatLinkBuilder = PageBlockChatLinkBuilder;
688
689impl PageBlockChatLinkBuilder {
690 pub fn build(&self) -> PageBlockChatLink {
691 self.inner.clone()
692 }
693
694 pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
695 self.inner.title = title.as_ref().to_string();
696 self
697 }
698
699 pub fn photo<T: AsRef<ChatPhotoInfo>>(&mut self, photo: T) -> &mut Self {
700 self.inner.photo = Some(photo.as_ref().clone());
701 self
702 }
703
704 pub fn username<T: AsRef<str>>(&mut self, username: T) -> &mut Self {
705 self.inner.username = username.as_ref().to_string();
706 self
707 }
708}
709
710impl AsRef<PageBlockChatLink> for PageBlockChatLink {
711 fn as_ref(&self) -> &PageBlockChatLink {
712 self
713 }
714}
715
716impl AsRef<PageBlockChatLink> for PageBlockChatLinkBuilder {
717 fn as_ref(&self) -> &PageBlockChatLink {
718 &self.inner
719 }
720}
721
722#[derive(Debug, Clone, Default, Serialize, Deserialize)]
724pub struct PageBlockCollage {
725 #[doc(hidden)]
726 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
727 extra: Option<String>,
728 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
729 client_id: Option<i32>,
730 #[serde(default)]
733 page_blocks: Vec<PageBlock>,
734 caption: PageBlockCaption,
736}
737
738impl RObject for PageBlockCollage {
739 #[doc(hidden)]
740 fn extra(&self) -> Option<&str> {
741 self.extra.as_deref()
742 }
743 #[doc(hidden)]
744 fn client_id(&self) -> Option<i32> {
745 self.client_id
746 }
747}
748
749impl TDPageBlock for PageBlockCollage {}
750
751impl PageBlockCollage {
752 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
753 Ok(serde_json::from_str(json.as_ref())?)
754 }
755 pub fn builder() -> PageBlockCollageBuilder {
756 let mut inner = PageBlockCollage::default();
757 inner.extra = Some(Uuid::new_v4().to_string());
758
759 PageBlockCollageBuilder { inner }
760 }
761
762 pub fn page_blocks(&self) -> &Vec<PageBlock> {
763 &self.page_blocks
764 }
765
766 pub fn caption(&self) -> &PageBlockCaption {
767 &self.caption
768 }
769}
770
771#[doc(hidden)]
772pub struct PageBlockCollageBuilder {
773 inner: PageBlockCollage,
774}
775
776#[deprecated]
777pub type RTDPageBlockCollageBuilder = PageBlockCollageBuilder;
778
779impl PageBlockCollageBuilder {
780 pub fn build(&self) -> PageBlockCollage {
781 self.inner.clone()
782 }
783
784 pub fn page_blocks(&mut self, page_blocks: Vec<PageBlock>) -> &mut Self {
785 self.inner.page_blocks = page_blocks;
786 self
787 }
788
789 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
790 self.inner.caption = caption.as_ref().clone();
791 self
792 }
793}
794
795impl AsRef<PageBlockCollage> for PageBlockCollage {
796 fn as_ref(&self) -> &PageBlockCollage {
797 self
798 }
799}
800
801impl AsRef<PageBlockCollage> for PageBlockCollageBuilder {
802 fn as_ref(&self) -> &PageBlockCollage {
803 &self.inner
804 }
805}
806
807#[derive(Debug, Clone, Default, Serialize, Deserialize)]
809pub struct PageBlockCover {
810 #[doc(hidden)]
811 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
812 extra: Option<String>,
813 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
814 client_id: Option<i32>,
815 #[serde(skip_serializing_if = "PageBlock::_is_default")]
818 cover: Box<PageBlock>,
819}
820
821impl RObject for PageBlockCover {
822 #[doc(hidden)]
823 fn extra(&self) -> Option<&str> {
824 self.extra.as_deref()
825 }
826 #[doc(hidden)]
827 fn client_id(&self) -> Option<i32> {
828 self.client_id
829 }
830}
831
832impl TDPageBlock for PageBlockCover {}
833
834impl PageBlockCover {
835 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
836 Ok(serde_json::from_str(json.as_ref())?)
837 }
838 pub fn builder() -> PageBlockCoverBuilder {
839 let mut inner = PageBlockCover::default();
840 inner.extra = Some(Uuid::new_v4().to_string());
841
842 PageBlockCoverBuilder { inner }
843 }
844
845 pub fn cover(&self) -> &Box<PageBlock> {
846 &self.cover
847 }
848}
849
850#[doc(hidden)]
851pub struct PageBlockCoverBuilder {
852 inner: PageBlockCover,
853}
854
855#[deprecated]
856pub type RTDPageBlockCoverBuilder = PageBlockCoverBuilder;
857
858impl PageBlockCoverBuilder {
859 pub fn build(&self) -> PageBlockCover {
860 self.inner.clone()
861 }
862
863 pub fn cover<T: AsRef<Box<PageBlock>>>(&mut self, cover: T) -> &mut Self {
864 self.inner.cover = cover.as_ref().clone();
865 self
866 }
867}
868
869impl AsRef<PageBlockCover> for PageBlockCover {
870 fn as_ref(&self) -> &PageBlockCover {
871 self
872 }
873}
874
875impl AsRef<PageBlockCover> for PageBlockCoverBuilder {
876 fn as_ref(&self) -> &PageBlockCover {
877 &self.inner
878 }
879}
880
881#[derive(Debug, Clone, Default, Serialize, Deserialize)]
883pub struct PageBlockDetails {
884 #[doc(hidden)]
885 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
886 extra: Option<String>,
887 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
888 client_id: Option<i32>,
889 #[serde(skip_serializing_if = "RichText::_is_default")]
892 header: RichText,
893 #[serde(default)]
896 page_blocks: Vec<PageBlock>,
897 #[serde(default)]
900 is_open: bool,
901}
902
903impl RObject for PageBlockDetails {
904 #[doc(hidden)]
905 fn extra(&self) -> Option<&str> {
906 self.extra.as_deref()
907 }
908 #[doc(hidden)]
909 fn client_id(&self) -> Option<i32> {
910 self.client_id
911 }
912}
913
914impl TDPageBlock for PageBlockDetails {}
915
916impl PageBlockDetails {
917 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
918 Ok(serde_json::from_str(json.as_ref())?)
919 }
920 pub fn builder() -> PageBlockDetailsBuilder {
921 let mut inner = PageBlockDetails::default();
922 inner.extra = Some(Uuid::new_v4().to_string());
923
924 PageBlockDetailsBuilder { inner }
925 }
926
927 pub fn header(&self) -> &RichText {
928 &self.header
929 }
930
931 pub fn page_blocks(&self) -> &Vec<PageBlock> {
932 &self.page_blocks
933 }
934
935 pub fn is_open(&self) -> bool {
936 self.is_open
937 }
938}
939
940#[doc(hidden)]
941pub struct PageBlockDetailsBuilder {
942 inner: PageBlockDetails,
943}
944
945#[deprecated]
946pub type RTDPageBlockDetailsBuilder = PageBlockDetailsBuilder;
947
948impl PageBlockDetailsBuilder {
949 pub fn build(&self) -> PageBlockDetails {
950 self.inner.clone()
951 }
952
953 pub fn header<T: AsRef<RichText>>(&mut self, header: T) -> &mut Self {
954 self.inner.header = header.as_ref().clone();
955 self
956 }
957
958 pub fn page_blocks(&mut self, page_blocks: Vec<PageBlock>) -> &mut Self {
959 self.inner.page_blocks = page_blocks;
960 self
961 }
962
963 pub fn is_open(&mut self, is_open: bool) -> &mut Self {
964 self.inner.is_open = is_open;
965 self
966 }
967}
968
969impl AsRef<PageBlockDetails> for PageBlockDetails {
970 fn as_ref(&self) -> &PageBlockDetails {
971 self
972 }
973}
974
975impl AsRef<PageBlockDetails> for PageBlockDetailsBuilder {
976 fn as_ref(&self) -> &PageBlockDetails {
977 &self.inner
978 }
979}
980
981#[derive(Debug, Clone, Default, Serialize, Deserialize)]
983pub struct PageBlockDivider {
984 #[doc(hidden)]
985 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
986 extra: Option<String>,
987 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
988 client_id: Option<i32>,
989}
990
991impl RObject for PageBlockDivider {
992 #[doc(hidden)]
993 fn extra(&self) -> Option<&str> {
994 self.extra.as_deref()
995 }
996 #[doc(hidden)]
997 fn client_id(&self) -> Option<i32> {
998 self.client_id
999 }
1000}
1001
1002impl TDPageBlock for PageBlockDivider {}
1003
1004impl PageBlockDivider {
1005 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1006 Ok(serde_json::from_str(json.as_ref())?)
1007 }
1008 pub fn builder() -> PageBlockDividerBuilder {
1009 let mut inner = PageBlockDivider::default();
1010 inner.extra = Some(Uuid::new_v4().to_string());
1011
1012 PageBlockDividerBuilder { inner }
1013 }
1014}
1015
1016#[doc(hidden)]
1017pub struct PageBlockDividerBuilder {
1018 inner: PageBlockDivider,
1019}
1020
1021#[deprecated]
1022pub type RTDPageBlockDividerBuilder = PageBlockDividerBuilder;
1023
1024impl PageBlockDividerBuilder {
1025 pub fn build(&self) -> PageBlockDivider {
1026 self.inner.clone()
1027 }
1028}
1029
1030impl AsRef<PageBlockDivider> for PageBlockDivider {
1031 fn as_ref(&self) -> &PageBlockDivider {
1032 self
1033 }
1034}
1035
1036impl AsRef<PageBlockDivider> for PageBlockDividerBuilder {
1037 fn as_ref(&self) -> &PageBlockDivider {
1038 &self.inner
1039 }
1040}
1041
1042#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1044pub struct PageBlockEmbedded {
1045 #[doc(hidden)]
1046 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1047 extra: Option<String>,
1048 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1049 client_id: Option<i32>,
1050 #[serde(default)]
1053 url: String,
1054 #[serde(default)]
1057 html: String,
1058 poster_photo: Option<Photo>,
1060 #[serde(default)]
1063 width: i32,
1064 #[serde(default)]
1067 height: i32,
1068 caption: PageBlockCaption,
1070 #[serde(default)]
1073 is_full_width: bool,
1074 #[serde(default)]
1077 allow_scrolling: bool,
1078}
1079
1080impl RObject for PageBlockEmbedded {
1081 #[doc(hidden)]
1082 fn extra(&self) -> Option<&str> {
1083 self.extra.as_deref()
1084 }
1085 #[doc(hidden)]
1086 fn client_id(&self) -> Option<i32> {
1087 self.client_id
1088 }
1089}
1090
1091impl TDPageBlock for PageBlockEmbedded {}
1092
1093impl PageBlockEmbedded {
1094 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1095 Ok(serde_json::from_str(json.as_ref())?)
1096 }
1097 pub fn builder() -> PageBlockEmbeddedBuilder {
1098 let mut inner = PageBlockEmbedded::default();
1099 inner.extra = Some(Uuid::new_v4().to_string());
1100
1101 PageBlockEmbeddedBuilder { inner }
1102 }
1103
1104 pub fn url(&self) -> &String {
1105 &self.url
1106 }
1107
1108 pub fn html(&self) -> &String {
1109 &self.html
1110 }
1111
1112 pub fn poster_photo(&self) -> &Option<Photo> {
1113 &self.poster_photo
1114 }
1115
1116 pub fn width(&self) -> i32 {
1117 self.width
1118 }
1119
1120 pub fn height(&self) -> i32 {
1121 self.height
1122 }
1123
1124 pub fn caption(&self) -> &PageBlockCaption {
1125 &self.caption
1126 }
1127
1128 pub fn is_full_width(&self) -> bool {
1129 self.is_full_width
1130 }
1131
1132 pub fn allow_scrolling(&self) -> bool {
1133 self.allow_scrolling
1134 }
1135}
1136
1137#[doc(hidden)]
1138pub struct PageBlockEmbeddedBuilder {
1139 inner: PageBlockEmbedded,
1140}
1141
1142#[deprecated]
1143pub type RTDPageBlockEmbeddedBuilder = PageBlockEmbeddedBuilder;
1144
1145impl PageBlockEmbeddedBuilder {
1146 pub fn build(&self) -> PageBlockEmbedded {
1147 self.inner.clone()
1148 }
1149
1150 pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
1151 self.inner.url = url.as_ref().to_string();
1152 self
1153 }
1154
1155 pub fn html<T: AsRef<str>>(&mut self, html: T) -> &mut Self {
1156 self.inner.html = html.as_ref().to_string();
1157 self
1158 }
1159
1160 pub fn poster_photo<T: AsRef<Photo>>(&mut self, poster_photo: T) -> &mut Self {
1161 self.inner.poster_photo = Some(poster_photo.as_ref().clone());
1162 self
1163 }
1164
1165 pub fn width(&mut self, width: i32) -> &mut Self {
1166 self.inner.width = width;
1167 self
1168 }
1169
1170 pub fn height(&mut self, height: i32) -> &mut Self {
1171 self.inner.height = height;
1172 self
1173 }
1174
1175 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
1176 self.inner.caption = caption.as_ref().clone();
1177 self
1178 }
1179
1180 pub fn is_full_width(&mut self, is_full_width: bool) -> &mut Self {
1181 self.inner.is_full_width = is_full_width;
1182 self
1183 }
1184
1185 pub fn allow_scrolling(&mut self, allow_scrolling: bool) -> &mut Self {
1186 self.inner.allow_scrolling = allow_scrolling;
1187 self
1188 }
1189}
1190
1191impl AsRef<PageBlockEmbedded> for PageBlockEmbedded {
1192 fn as_ref(&self) -> &PageBlockEmbedded {
1193 self
1194 }
1195}
1196
1197impl AsRef<PageBlockEmbedded> for PageBlockEmbeddedBuilder {
1198 fn as_ref(&self) -> &PageBlockEmbedded {
1199 &self.inner
1200 }
1201}
1202
1203#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1205pub struct PageBlockEmbeddedPost {
1206 #[doc(hidden)]
1207 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1208 extra: Option<String>,
1209 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1210 client_id: Option<i32>,
1211 #[serde(default)]
1214 url: String,
1215 #[serde(default)]
1218 author: String,
1219 author_photo: Option<Photo>,
1221 #[serde(default)]
1224 date: i32,
1225 #[serde(default)]
1228 page_blocks: Vec<PageBlock>,
1229 caption: PageBlockCaption,
1231}
1232
1233impl RObject for PageBlockEmbeddedPost {
1234 #[doc(hidden)]
1235 fn extra(&self) -> Option<&str> {
1236 self.extra.as_deref()
1237 }
1238 #[doc(hidden)]
1239 fn client_id(&self) -> Option<i32> {
1240 self.client_id
1241 }
1242}
1243
1244impl TDPageBlock for PageBlockEmbeddedPost {}
1245
1246impl PageBlockEmbeddedPost {
1247 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1248 Ok(serde_json::from_str(json.as_ref())?)
1249 }
1250 pub fn builder() -> PageBlockEmbeddedPostBuilder {
1251 let mut inner = PageBlockEmbeddedPost::default();
1252 inner.extra = Some(Uuid::new_v4().to_string());
1253
1254 PageBlockEmbeddedPostBuilder { inner }
1255 }
1256
1257 pub fn url(&self) -> &String {
1258 &self.url
1259 }
1260
1261 pub fn author(&self) -> &String {
1262 &self.author
1263 }
1264
1265 pub fn author_photo(&self) -> &Option<Photo> {
1266 &self.author_photo
1267 }
1268
1269 pub fn date(&self) -> i32 {
1270 self.date
1271 }
1272
1273 pub fn page_blocks(&self) -> &Vec<PageBlock> {
1274 &self.page_blocks
1275 }
1276
1277 pub fn caption(&self) -> &PageBlockCaption {
1278 &self.caption
1279 }
1280}
1281
1282#[doc(hidden)]
1283pub struct PageBlockEmbeddedPostBuilder {
1284 inner: PageBlockEmbeddedPost,
1285}
1286
1287#[deprecated]
1288pub type RTDPageBlockEmbeddedPostBuilder = PageBlockEmbeddedPostBuilder;
1289
1290impl PageBlockEmbeddedPostBuilder {
1291 pub fn build(&self) -> PageBlockEmbeddedPost {
1292 self.inner.clone()
1293 }
1294
1295 pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
1296 self.inner.url = url.as_ref().to_string();
1297 self
1298 }
1299
1300 pub fn author<T: AsRef<str>>(&mut self, author: T) -> &mut Self {
1301 self.inner.author = author.as_ref().to_string();
1302 self
1303 }
1304
1305 pub fn author_photo<T: AsRef<Photo>>(&mut self, author_photo: T) -> &mut Self {
1306 self.inner.author_photo = Some(author_photo.as_ref().clone());
1307 self
1308 }
1309
1310 pub fn date(&mut self, date: i32) -> &mut Self {
1311 self.inner.date = date;
1312 self
1313 }
1314
1315 pub fn page_blocks(&mut self, page_blocks: Vec<PageBlock>) -> &mut Self {
1316 self.inner.page_blocks = page_blocks;
1317 self
1318 }
1319
1320 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
1321 self.inner.caption = caption.as_ref().clone();
1322 self
1323 }
1324}
1325
1326impl AsRef<PageBlockEmbeddedPost> for PageBlockEmbeddedPost {
1327 fn as_ref(&self) -> &PageBlockEmbeddedPost {
1328 self
1329 }
1330}
1331
1332impl AsRef<PageBlockEmbeddedPost> for PageBlockEmbeddedPostBuilder {
1333 fn as_ref(&self) -> &PageBlockEmbeddedPost {
1334 &self.inner
1335 }
1336}
1337
1338#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1340pub struct PageBlockFooter {
1341 #[doc(hidden)]
1342 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1343 extra: Option<String>,
1344 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1345 client_id: Option<i32>,
1346 #[serde(skip_serializing_if = "RichText::_is_default")]
1349 footer: RichText,
1350}
1351
1352impl RObject for PageBlockFooter {
1353 #[doc(hidden)]
1354 fn extra(&self) -> Option<&str> {
1355 self.extra.as_deref()
1356 }
1357 #[doc(hidden)]
1358 fn client_id(&self) -> Option<i32> {
1359 self.client_id
1360 }
1361}
1362
1363impl TDPageBlock for PageBlockFooter {}
1364
1365impl PageBlockFooter {
1366 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1367 Ok(serde_json::from_str(json.as_ref())?)
1368 }
1369 pub fn builder() -> PageBlockFooterBuilder {
1370 let mut inner = PageBlockFooter::default();
1371 inner.extra = Some(Uuid::new_v4().to_string());
1372
1373 PageBlockFooterBuilder { inner }
1374 }
1375
1376 pub fn footer(&self) -> &RichText {
1377 &self.footer
1378 }
1379}
1380
1381#[doc(hidden)]
1382pub struct PageBlockFooterBuilder {
1383 inner: PageBlockFooter,
1384}
1385
1386#[deprecated]
1387pub type RTDPageBlockFooterBuilder = PageBlockFooterBuilder;
1388
1389impl PageBlockFooterBuilder {
1390 pub fn build(&self) -> PageBlockFooter {
1391 self.inner.clone()
1392 }
1393
1394 pub fn footer<T: AsRef<RichText>>(&mut self, footer: T) -> &mut Self {
1395 self.inner.footer = footer.as_ref().clone();
1396 self
1397 }
1398}
1399
1400impl AsRef<PageBlockFooter> for PageBlockFooter {
1401 fn as_ref(&self) -> &PageBlockFooter {
1402 self
1403 }
1404}
1405
1406impl AsRef<PageBlockFooter> for PageBlockFooterBuilder {
1407 fn as_ref(&self) -> &PageBlockFooter {
1408 &self.inner
1409 }
1410}
1411
1412#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1414pub struct PageBlockHeader {
1415 #[doc(hidden)]
1416 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1417 extra: Option<String>,
1418 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1419 client_id: Option<i32>,
1420 #[serde(skip_serializing_if = "RichText::_is_default")]
1423 header: RichText,
1424}
1425
1426impl RObject for PageBlockHeader {
1427 #[doc(hidden)]
1428 fn extra(&self) -> Option<&str> {
1429 self.extra.as_deref()
1430 }
1431 #[doc(hidden)]
1432 fn client_id(&self) -> Option<i32> {
1433 self.client_id
1434 }
1435}
1436
1437impl TDPageBlock for PageBlockHeader {}
1438
1439impl PageBlockHeader {
1440 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1441 Ok(serde_json::from_str(json.as_ref())?)
1442 }
1443 pub fn builder() -> PageBlockHeaderBuilder {
1444 let mut inner = PageBlockHeader::default();
1445 inner.extra = Some(Uuid::new_v4().to_string());
1446
1447 PageBlockHeaderBuilder { inner }
1448 }
1449
1450 pub fn header(&self) -> &RichText {
1451 &self.header
1452 }
1453}
1454
1455#[doc(hidden)]
1456pub struct PageBlockHeaderBuilder {
1457 inner: PageBlockHeader,
1458}
1459
1460#[deprecated]
1461pub type RTDPageBlockHeaderBuilder = PageBlockHeaderBuilder;
1462
1463impl PageBlockHeaderBuilder {
1464 pub fn build(&self) -> PageBlockHeader {
1465 self.inner.clone()
1466 }
1467
1468 pub fn header<T: AsRef<RichText>>(&mut self, header: T) -> &mut Self {
1469 self.inner.header = header.as_ref().clone();
1470 self
1471 }
1472}
1473
1474impl AsRef<PageBlockHeader> for PageBlockHeader {
1475 fn as_ref(&self) -> &PageBlockHeader {
1476 self
1477 }
1478}
1479
1480impl AsRef<PageBlockHeader> for PageBlockHeaderBuilder {
1481 fn as_ref(&self) -> &PageBlockHeader {
1482 &self.inner
1483 }
1484}
1485
1486#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1488pub struct PageBlockKicker {
1489 #[doc(hidden)]
1490 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1491 extra: Option<String>,
1492 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1493 client_id: Option<i32>,
1494 #[serde(skip_serializing_if = "RichText::_is_default")]
1497 kicker: RichText,
1498}
1499
1500impl RObject for PageBlockKicker {
1501 #[doc(hidden)]
1502 fn extra(&self) -> Option<&str> {
1503 self.extra.as_deref()
1504 }
1505 #[doc(hidden)]
1506 fn client_id(&self) -> Option<i32> {
1507 self.client_id
1508 }
1509}
1510
1511impl TDPageBlock for PageBlockKicker {}
1512
1513impl PageBlockKicker {
1514 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1515 Ok(serde_json::from_str(json.as_ref())?)
1516 }
1517 pub fn builder() -> PageBlockKickerBuilder {
1518 let mut inner = PageBlockKicker::default();
1519 inner.extra = Some(Uuid::new_v4().to_string());
1520
1521 PageBlockKickerBuilder { inner }
1522 }
1523
1524 pub fn kicker(&self) -> &RichText {
1525 &self.kicker
1526 }
1527}
1528
1529#[doc(hidden)]
1530pub struct PageBlockKickerBuilder {
1531 inner: PageBlockKicker,
1532}
1533
1534#[deprecated]
1535pub type RTDPageBlockKickerBuilder = PageBlockKickerBuilder;
1536
1537impl PageBlockKickerBuilder {
1538 pub fn build(&self) -> PageBlockKicker {
1539 self.inner.clone()
1540 }
1541
1542 pub fn kicker<T: AsRef<RichText>>(&mut self, kicker: T) -> &mut Self {
1543 self.inner.kicker = kicker.as_ref().clone();
1544 self
1545 }
1546}
1547
1548impl AsRef<PageBlockKicker> for PageBlockKicker {
1549 fn as_ref(&self) -> &PageBlockKicker {
1550 self
1551 }
1552}
1553
1554impl AsRef<PageBlockKicker> for PageBlockKickerBuilder {
1555 fn as_ref(&self) -> &PageBlockKicker {
1556 &self.inner
1557 }
1558}
1559
1560#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1562pub struct PageBlockList {
1563 #[doc(hidden)]
1564 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1565 extra: Option<String>,
1566 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1567 client_id: Option<i32>,
1568 #[serde(default)]
1571 items: Vec<PageBlockListItem>,
1572}
1573
1574impl RObject for PageBlockList {
1575 #[doc(hidden)]
1576 fn extra(&self) -> Option<&str> {
1577 self.extra.as_deref()
1578 }
1579 #[doc(hidden)]
1580 fn client_id(&self) -> Option<i32> {
1581 self.client_id
1582 }
1583}
1584
1585impl TDPageBlock for PageBlockList {}
1586
1587impl PageBlockList {
1588 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1589 Ok(serde_json::from_str(json.as_ref())?)
1590 }
1591 pub fn builder() -> PageBlockListBuilder {
1592 let mut inner = PageBlockList::default();
1593 inner.extra = Some(Uuid::new_v4().to_string());
1594
1595 PageBlockListBuilder { inner }
1596 }
1597
1598 pub fn items(&self) -> &Vec<PageBlockListItem> {
1599 &self.items
1600 }
1601}
1602
1603#[doc(hidden)]
1604pub struct PageBlockListBuilder {
1605 inner: PageBlockList,
1606}
1607
1608#[deprecated]
1609pub type RTDPageBlockListBuilder = PageBlockListBuilder;
1610
1611impl PageBlockListBuilder {
1612 pub fn build(&self) -> PageBlockList {
1613 self.inner.clone()
1614 }
1615
1616 pub fn items(&mut self, items: Vec<PageBlockListItem>) -> &mut Self {
1617 self.inner.items = items;
1618 self
1619 }
1620}
1621
1622impl AsRef<PageBlockList> for PageBlockList {
1623 fn as_ref(&self) -> &PageBlockList {
1624 self
1625 }
1626}
1627
1628impl AsRef<PageBlockList> for PageBlockListBuilder {
1629 fn as_ref(&self) -> &PageBlockList {
1630 &self.inner
1631 }
1632}
1633
1634#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1636pub struct PageBlockMap {
1637 #[doc(hidden)]
1638 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1639 extra: Option<String>,
1640 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1641 client_id: Option<i32>,
1642 location: Location,
1644 #[serde(default)]
1647 zoom: i32,
1648 #[serde(default)]
1651 width: i32,
1652 #[serde(default)]
1655 height: i32,
1656 caption: PageBlockCaption,
1658}
1659
1660impl RObject for PageBlockMap {
1661 #[doc(hidden)]
1662 fn extra(&self) -> Option<&str> {
1663 self.extra.as_deref()
1664 }
1665 #[doc(hidden)]
1666 fn client_id(&self) -> Option<i32> {
1667 self.client_id
1668 }
1669}
1670
1671impl TDPageBlock for PageBlockMap {}
1672
1673impl PageBlockMap {
1674 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1675 Ok(serde_json::from_str(json.as_ref())?)
1676 }
1677 pub fn builder() -> PageBlockMapBuilder {
1678 let mut inner = PageBlockMap::default();
1679 inner.extra = Some(Uuid::new_v4().to_string());
1680
1681 PageBlockMapBuilder { inner }
1682 }
1683
1684 pub fn location(&self) -> &Location {
1685 &self.location
1686 }
1687
1688 pub fn zoom(&self) -> i32 {
1689 self.zoom
1690 }
1691
1692 pub fn width(&self) -> i32 {
1693 self.width
1694 }
1695
1696 pub fn height(&self) -> i32 {
1697 self.height
1698 }
1699
1700 pub fn caption(&self) -> &PageBlockCaption {
1701 &self.caption
1702 }
1703}
1704
1705#[doc(hidden)]
1706pub struct PageBlockMapBuilder {
1707 inner: PageBlockMap,
1708}
1709
1710#[deprecated]
1711pub type RTDPageBlockMapBuilder = PageBlockMapBuilder;
1712
1713impl PageBlockMapBuilder {
1714 pub fn build(&self) -> PageBlockMap {
1715 self.inner.clone()
1716 }
1717
1718 pub fn location<T: AsRef<Location>>(&mut self, location: T) -> &mut Self {
1719 self.inner.location = location.as_ref().clone();
1720 self
1721 }
1722
1723 pub fn zoom(&mut self, zoom: i32) -> &mut Self {
1724 self.inner.zoom = zoom;
1725 self
1726 }
1727
1728 pub fn width(&mut self, width: i32) -> &mut Self {
1729 self.inner.width = width;
1730 self
1731 }
1732
1733 pub fn height(&mut self, height: i32) -> &mut Self {
1734 self.inner.height = height;
1735 self
1736 }
1737
1738 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
1739 self.inner.caption = caption.as_ref().clone();
1740 self
1741 }
1742}
1743
1744impl AsRef<PageBlockMap> for PageBlockMap {
1745 fn as_ref(&self) -> &PageBlockMap {
1746 self
1747 }
1748}
1749
1750impl AsRef<PageBlockMap> for PageBlockMapBuilder {
1751 fn as_ref(&self) -> &PageBlockMap {
1752 &self.inner
1753 }
1754}
1755
1756#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1758pub struct PageBlockParagraph {
1759 #[doc(hidden)]
1760 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1761 extra: Option<String>,
1762 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1763 client_id: Option<i32>,
1764 #[serde(skip_serializing_if = "RichText::_is_default")]
1767 text: RichText,
1768}
1769
1770impl RObject for PageBlockParagraph {
1771 #[doc(hidden)]
1772 fn extra(&self) -> Option<&str> {
1773 self.extra.as_deref()
1774 }
1775 #[doc(hidden)]
1776 fn client_id(&self) -> Option<i32> {
1777 self.client_id
1778 }
1779}
1780
1781impl TDPageBlock for PageBlockParagraph {}
1782
1783impl PageBlockParagraph {
1784 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1785 Ok(serde_json::from_str(json.as_ref())?)
1786 }
1787 pub fn builder() -> PageBlockParagraphBuilder {
1788 let mut inner = PageBlockParagraph::default();
1789 inner.extra = Some(Uuid::new_v4().to_string());
1790
1791 PageBlockParagraphBuilder { inner }
1792 }
1793
1794 pub fn text(&self) -> &RichText {
1795 &self.text
1796 }
1797}
1798
1799#[doc(hidden)]
1800pub struct PageBlockParagraphBuilder {
1801 inner: PageBlockParagraph,
1802}
1803
1804#[deprecated]
1805pub type RTDPageBlockParagraphBuilder = PageBlockParagraphBuilder;
1806
1807impl PageBlockParagraphBuilder {
1808 pub fn build(&self) -> PageBlockParagraph {
1809 self.inner.clone()
1810 }
1811
1812 pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
1813 self.inner.text = text.as_ref().clone();
1814 self
1815 }
1816}
1817
1818impl AsRef<PageBlockParagraph> for PageBlockParagraph {
1819 fn as_ref(&self) -> &PageBlockParagraph {
1820 self
1821 }
1822}
1823
1824impl AsRef<PageBlockParagraph> for PageBlockParagraphBuilder {
1825 fn as_ref(&self) -> &PageBlockParagraph {
1826 &self.inner
1827 }
1828}
1829
1830#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1832pub struct PageBlockPhoto {
1833 #[doc(hidden)]
1834 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1835 extra: Option<String>,
1836 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1837 client_id: Option<i32>,
1838 photo: Option<Photo>,
1840 caption: PageBlockCaption,
1842 #[serde(default)]
1845 url: String,
1846}
1847
1848impl RObject for PageBlockPhoto {
1849 #[doc(hidden)]
1850 fn extra(&self) -> Option<&str> {
1851 self.extra.as_deref()
1852 }
1853 #[doc(hidden)]
1854 fn client_id(&self) -> Option<i32> {
1855 self.client_id
1856 }
1857}
1858
1859impl TDPageBlock for PageBlockPhoto {}
1860
1861impl PageBlockPhoto {
1862 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1863 Ok(serde_json::from_str(json.as_ref())?)
1864 }
1865 pub fn builder() -> PageBlockPhotoBuilder {
1866 let mut inner = PageBlockPhoto::default();
1867 inner.extra = Some(Uuid::new_v4().to_string());
1868
1869 PageBlockPhotoBuilder { inner }
1870 }
1871
1872 pub fn photo(&self) -> &Option<Photo> {
1873 &self.photo
1874 }
1875
1876 pub fn caption(&self) -> &PageBlockCaption {
1877 &self.caption
1878 }
1879
1880 pub fn url(&self) -> &String {
1881 &self.url
1882 }
1883}
1884
1885#[doc(hidden)]
1886pub struct PageBlockPhotoBuilder {
1887 inner: PageBlockPhoto,
1888}
1889
1890#[deprecated]
1891pub type RTDPageBlockPhotoBuilder = PageBlockPhotoBuilder;
1892
1893impl PageBlockPhotoBuilder {
1894 pub fn build(&self) -> PageBlockPhoto {
1895 self.inner.clone()
1896 }
1897
1898 pub fn photo<T: AsRef<Photo>>(&mut self, photo: T) -> &mut Self {
1899 self.inner.photo = Some(photo.as_ref().clone());
1900 self
1901 }
1902
1903 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
1904 self.inner.caption = caption.as_ref().clone();
1905 self
1906 }
1907
1908 pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
1909 self.inner.url = url.as_ref().to_string();
1910 self
1911 }
1912}
1913
1914impl AsRef<PageBlockPhoto> for PageBlockPhoto {
1915 fn as_ref(&self) -> &PageBlockPhoto {
1916 self
1917 }
1918}
1919
1920impl AsRef<PageBlockPhoto> for PageBlockPhotoBuilder {
1921 fn as_ref(&self) -> &PageBlockPhoto {
1922 &self.inner
1923 }
1924}
1925
1926#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1928pub struct PageBlockPreformatted {
1929 #[doc(hidden)]
1930 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
1931 extra: Option<String>,
1932 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
1933 client_id: Option<i32>,
1934 #[serde(skip_serializing_if = "RichText::_is_default")]
1937 text: RichText,
1938 #[serde(default)]
1941 language: String,
1942}
1943
1944impl RObject for PageBlockPreformatted {
1945 #[doc(hidden)]
1946 fn extra(&self) -> Option<&str> {
1947 self.extra.as_deref()
1948 }
1949 #[doc(hidden)]
1950 fn client_id(&self) -> Option<i32> {
1951 self.client_id
1952 }
1953}
1954
1955impl TDPageBlock for PageBlockPreformatted {}
1956
1957impl PageBlockPreformatted {
1958 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
1959 Ok(serde_json::from_str(json.as_ref())?)
1960 }
1961 pub fn builder() -> PageBlockPreformattedBuilder {
1962 let mut inner = PageBlockPreformatted::default();
1963 inner.extra = Some(Uuid::new_v4().to_string());
1964
1965 PageBlockPreformattedBuilder { inner }
1966 }
1967
1968 pub fn text(&self) -> &RichText {
1969 &self.text
1970 }
1971
1972 pub fn language(&self) -> &String {
1973 &self.language
1974 }
1975}
1976
1977#[doc(hidden)]
1978pub struct PageBlockPreformattedBuilder {
1979 inner: PageBlockPreformatted,
1980}
1981
1982#[deprecated]
1983pub type RTDPageBlockPreformattedBuilder = PageBlockPreformattedBuilder;
1984
1985impl PageBlockPreformattedBuilder {
1986 pub fn build(&self) -> PageBlockPreformatted {
1987 self.inner.clone()
1988 }
1989
1990 pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
1991 self.inner.text = text.as_ref().clone();
1992 self
1993 }
1994
1995 pub fn language<T: AsRef<str>>(&mut self, language: T) -> &mut Self {
1996 self.inner.language = language.as_ref().to_string();
1997 self
1998 }
1999}
2000
2001impl AsRef<PageBlockPreformatted> for PageBlockPreformatted {
2002 fn as_ref(&self) -> &PageBlockPreformatted {
2003 self
2004 }
2005}
2006
2007impl AsRef<PageBlockPreformatted> for PageBlockPreformattedBuilder {
2008 fn as_ref(&self) -> &PageBlockPreformatted {
2009 &self.inner
2010 }
2011}
2012
2013#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2015pub struct PageBlockPullQuote {
2016 #[doc(hidden)]
2017 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2018 extra: Option<String>,
2019 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2020 client_id: Option<i32>,
2021 #[serde(skip_serializing_if = "RichText::_is_default")]
2024 text: RichText,
2025 #[serde(skip_serializing_if = "RichText::_is_default")]
2028 credit: RichText,
2029}
2030
2031impl RObject for PageBlockPullQuote {
2032 #[doc(hidden)]
2033 fn extra(&self) -> Option<&str> {
2034 self.extra.as_deref()
2035 }
2036 #[doc(hidden)]
2037 fn client_id(&self) -> Option<i32> {
2038 self.client_id
2039 }
2040}
2041
2042impl TDPageBlock for PageBlockPullQuote {}
2043
2044impl PageBlockPullQuote {
2045 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2046 Ok(serde_json::from_str(json.as_ref())?)
2047 }
2048 pub fn builder() -> PageBlockPullQuoteBuilder {
2049 let mut inner = PageBlockPullQuote::default();
2050 inner.extra = Some(Uuid::new_v4().to_string());
2051
2052 PageBlockPullQuoteBuilder { inner }
2053 }
2054
2055 pub fn text(&self) -> &RichText {
2056 &self.text
2057 }
2058
2059 pub fn credit(&self) -> &RichText {
2060 &self.credit
2061 }
2062}
2063
2064#[doc(hidden)]
2065pub struct PageBlockPullQuoteBuilder {
2066 inner: PageBlockPullQuote,
2067}
2068
2069#[deprecated]
2070pub type RTDPageBlockPullQuoteBuilder = PageBlockPullQuoteBuilder;
2071
2072impl PageBlockPullQuoteBuilder {
2073 pub fn build(&self) -> PageBlockPullQuote {
2074 self.inner.clone()
2075 }
2076
2077 pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
2078 self.inner.text = text.as_ref().clone();
2079 self
2080 }
2081
2082 pub fn credit<T: AsRef<RichText>>(&mut self, credit: T) -> &mut Self {
2083 self.inner.credit = credit.as_ref().clone();
2084 self
2085 }
2086}
2087
2088impl AsRef<PageBlockPullQuote> for PageBlockPullQuote {
2089 fn as_ref(&self) -> &PageBlockPullQuote {
2090 self
2091 }
2092}
2093
2094impl AsRef<PageBlockPullQuote> for PageBlockPullQuoteBuilder {
2095 fn as_ref(&self) -> &PageBlockPullQuote {
2096 &self.inner
2097 }
2098}
2099
2100#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2102pub struct PageBlockRelatedArticles {
2103 #[doc(hidden)]
2104 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2105 extra: Option<String>,
2106 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2107 client_id: Option<i32>,
2108 #[serde(skip_serializing_if = "RichText::_is_default")]
2111 header: RichText,
2112 #[serde(default)]
2115 articles: Vec<PageBlockRelatedArticle>,
2116}
2117
2118impl RObject for PageBlockRelatedArticles {
2119 #[doc(hidden)]
2120 fn extra(&self) -> Option<&str> {
2121 self.extra.as_deref()
2122 }
2123 #[doc(hidden)]
2124 fn client_id(&self) -> Option<i32> {
2125 self.client_id
2126 }
2127}
2128
2129impl TDPageBlock for PageBlockRelatedArticles {}
2130
2131impl PageBlockRelatedArticles {
2132 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2133 Ok(serde_json::from_str(json.as_ref())?)
2134 }
2135 pub fn builder() -> PageBlockRelatedArticlesBuilder {
2136 let mut inner = PageBlockRelatedArticles::default();
2137 inner.extra = Some(Uuid::new_v4().to_string());
2138
2139 PageBlockRelatedArticlesBuilder { inner }
2140 }
2141
2142 pub fn header(&self) -> &RichText {
2143 &self.header
2144 }
2145
2146 pub fn articles(&self) -> &Vec<PageBlockRelatedArticle> {
2147 &self.articles
2148 }
2149}
2150
2151#[doc(hidden)]
2152pub struct PageBlockRelatedArticlesBuilder {
2153 inner: PageBlockRelatedArticles,
2154}
2155
2156#[deprecated]
2157pub type RTDPageBlockRelatedArticlesBuilder = PageBlockRelatedArticlesBuilder;
2158
2159impl PageBlockRelatedArticlesBuilder {
2160 pub fn build(&self) -> PageBlockRelatedArticles {
2161 self.inner.clone()
2162 }
2163
2164 pub fn header<T: AsRef<RichText>>(&mut self, header: T) -> &mut Self {
2165 self.inner.header = header.as_ref().clone();
2166 self
2167 }
2168
2169 pub fn articles(&mut self, articles: Vec<PageBlockRelatedArticle>) -> &mut Self {
2170 self.inner.articles = articles;
2171 self
2172 }
2173}
2174
2175impl AsRef<PageBlockRelatedArticles> for PageBlockRelatedArticles {
2176 fn as_ref(&self) -> &PageBlockRelatedArticles {
2177 self
2178 }
2179}
2180
2181impl AsRef<PageBlockRelatedArticles> for PageBlockRelatedArticlesBuilder {
2182 fn as_ref(&self) -> &PageBlockRelatedArticles {
2183 &self.inner
2184 }
2185}
2186
2187#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2189pub struct PageBlockSlideshow {
2190 #[doc(hidden)]
2191 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2192 extra: Option<String>,
2193 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2194 client_id: Option<i32>,
2195 #[serde(default)]
2198 page_blocks: Vec<PageBlock>,
2199 caption: PageBlockCaption,
2201}
2202
2203impl RObject for PageBlockSlideshow {
2204 #[doc(hidden)]
2205 fn extra(&self) -> Option<&str> {
2206 self.extra.as_deref()
2207 }
2208 #[doc(hidden)]
2209 fn client_id(&self) -> Option<i32> {
2210 self.client_id
2211 }
2212}
2213
2214impl TDPageBlock for PageBlockSlideshow {}
2215
2216impl PageBlockSlideshow {
2217 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2218 Ok(serde_json::from_str(json.as_ref())?)
2219 }
2220 pub fn builder() -> PageBlockSlideshowBuilder {
2221 let mut inner = PageBlockSlideshow::default();
2222 inner.extra = Some(Uuid::new_v4().to_string());
2223
2224 PageBlockSlideshowBuilder { inner }
2225 }
2226
2227 pub fn page_blocks(&self) -> &Vec<PageBlock> {
2228 &self.page_blocks
2229 }
2230
2231 pub fn caption(&self) -> &PageBlockCaption {
2232 &self.caption
2233 }
2234}
2235
2236#[doc(hidden)]
2237pub struct PageBlockSlideshowBuilder {
2238 inner: PageBlockSlideshow,
2239}
2240
2241#[deprecated]
2242pub type RTDPageBlockSlideshowBuilder = PageBlockSlideshowBuilder;
2243
2244impl PageBlockSlideshowBuilder {
2245 pub fn build(&self) -> PageBlockSlideshow {
2246 self.inner.clone()
2247 }
2248
2249 pub fn page_blocks(&mut self, page_blocks: Vec<PageBlock>) -> &mut Self {
2250 self.inner.page_blocks = page_blocks;
2251 self
2252 }
2253
2254 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
2255 self.inner.caption = caption.as_ref().clone();
2256 self
2257 }
2258}
2259
2260impl AsRef<PageBlockSlideshow> for PageBlockSlideshow {
2261 fn as_ref(&self) -> &PageBlockSlideshow {
2262 self
2263 }
2264}
2265
2266impl AsRef<PageBlockSlideshow> for PageBlockSlideshowBuilder {
2267 fn as_ref(&self) -> &PageBlockSlideshow {
2268 &self.inner
2269 }
2270}
2271
2272#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2274pub struct PageBlockSubheader {
2275 #[doc(hidden)]
2276 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2277 extra: Option<String>,
2278 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2279 client_id: Option<i32>,
2280 #[serde(skip_serializing_if = "RichText::_is_default")]
2283 subheader: RichText,
2284}
2285
2286impl RObject for PageBlockSubheader {
2287 #[doc(hidden)]
2288 fn extra(&self) -> Option<&str> {
2289 self.extra.as_deref()
2290 }
2291 #[doc(hidden)]
2292 fn client_id(&self) -> Option<i32> {
2293 self.client_id
2294 }
2295}
2296
2297impl TDPageBlock for PageBlockSubheader {}
2298
2299impl PageBlockSubheader {
2300 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2301 Ok(serde_json::from_str(json.as_ref())?)
2302 }
2303 pub fn builder() -> PageBlockSubheaderBuilder {
2304 let mut inner = PageBlockSubheader::default();
2305 inner.extra = Some(Uuid::new_v4().to_string());
2306
2307 PageBlockSubheaderBuilder { inner }
2308 }
2309
2310 pub fn subheader(&self) -> &RichText {
2311 &self.subheader
2312 }
2313}
2314
2315#[doc(hidden)]
2316pub struct PageBlockSubheaderBuilder {
2317 inner: PageBlockSubheader,
2318}
2319
2320#[deprecated]
2321pub type RTDPageBlockSubheaderBuilder = PageBlockSubheaderBuilder;
2322
2323impl PageBlockSubheaderBuilder {
2324 pub fn build(&self) -> PageBlockSubheader {
2325 self.inner.clone()
2326 }
2327
2328 pub fn subheader<T: AsRef<RichText>>(&mut self, subheader: T) -> &mut Self {
2329 self.inner.subheader = subheader.as_ref().clone();
2330 self
2331 }
2332}
2333
2334impl AsRef<PageBlockSubheader> for PageBlockSubheader {
2335 fn as_ref(&self) -> &PageBlockSubheader {
2336 self
2337 }
2338}
2339
2340impl AsRef<PageBlockSubheader> for PageBlockSubheaderBuilder {
2341 fn as_ref(&self) -> &PageBlockSubheader {
2342 &self.inner
2343 }
2344}
2345
2346#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2348pub struct PageBlockSubtitle {
2349 #[doc(hidden)]
2350 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2351 extra: Option<String>,
2352 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2353 client_id: Option<i32>,
2354 #[serde(skip_serializing_if = "RichText::_is_default")]
2357 subtitle: RichText,
2358}
2359
2360impl RObject for PageBlockSubtitle {
2361 #[doc(hidden)]
2362 fn extra(&self) -> Option<&str> {
2363 self.extra.as_deref()
2364 }
2365 #[doc(hidden)]
2366 fn client_id(&self) -> Option<i32> {
2367 self.client_id
2368 }
2369}
2370
2371impl TDPageBlock for PageBlockSubtitle {}
2372
2373impl PageBlockSubtitle {
2374 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2375 Ok(serde_json::from_str(json.as_ref())?)
2376 }
2377 pub fn builder() -> PageBlockSubtitleBuilder {
2378 let mut inner = PageBlockSubtitle::default();
2379 inner.extra = Some(Uuid::new_v4().to_string());
2380
2381 PageBlockSubtitleBuilder { inner }
2382 }
2383
2384 pub fn subtitle(&self) -> &RichText {
2385 &self.subtitle
2386 }
2387}
2388
2389#[doc(hidden)]
2390pub struct PageBlockSubtitleBuilder {
2391 inner: PageBlockSubtitle,
2392}
2393
2394#[deprecated]
2395pub type RTDPageBlockSubtitleBuilder = PageBlockSubtitleBuilder;
2396
2397impl PageBlockSubtitleBuilder {
2398 pub fn build(&self) -> PageBlockSubtitle {
2399 self.inner.clone()
2400 }
2401
2402 pub fn subtitle<T: AsRef<RichText>>(&mut self, subtitle: T) -> &mut Self {
2403 self.inner.subtitle = subtitle.as_ref().clone();
2404 self
2405 }
2406}
2407
2408impl AsRef<PageBlockSubtitle> for PageBlockSubtitle {
2409 fn as_ref(&self) -> &PageBlockSubtitle {
2410 self
2411 }
2412}
2413
2414impl AsRef<PageBlockSubtitle> for PageBlockSubtitleBuilder {
2415 fn as_ref(&self) -> &PageBlockSubtitle {
2416 &self.inner
2417 }
2418}
2419
2420#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2422pub struct PageBlockTable {
2423 #[doc(hidden)]
2424 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2425 extra: Option<String>,
2426 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2427 client_id: Option<i32>,
2428 #[serde(skip_serializing_if = "RichText::_is_default")]
2431 caption: RichText,
2432 #[serde(default)]
2435 cells: Vec<Vec<PageBlockTableCell>>,
2436 #[serde(default)]
2439 is_bordered: bool,
2440 #[serde(default)]
2443 is_striped: bool,
2444}
2445
2446impl RObject for PageBlockTable {
2447 #[doc(hidden)]
2448 fn extra(&self) -> Option<&str> {
2449 self.extra.as_deref()
2450 }
2451 #[doc(hidden)]
2452 fn client_id(&self) -> Option<i32> {
2453 self.client_id
2454 }
2455}
2456
2457impl TDPageBlock for PageBlockTable {}
2458
2459impl PageBlockTable {
2460 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2461 Ok(serde_json::from_str(json.as_ref())?)
2462 }
2463 pub fn builder() -> PageBlockTableBuilder {
2464 let mut inner = PageBlockTable::default();
2465 inner.extra = Some(Uuid::new_v4().to_string());
2466
2467 PageBlockTableBuilder { inner }
2468 }
2469
2470 pub fn caption(&self) -> &RichText {
2471 &self.caption
2472 }
2473
2474 pub fn cells(&self) -> &Vec<Vec<PageBlockTableCell>> {
2475 &self.cells
2476 }
2477
2478 pub fn is_bordered(&self) -> bool {
2479 self.is_bordered
2480 }
2481
2482 pub fn is_striped(&self) -> bool {
2483 self.is_striped
2484 }
2485}
2486
2487#[doc(hidden)]
2488pub struct PageBlockTableBuilder {
2489 inner: PageBlockTable,
2490}
2491
2492#[deprecated]
2493pub type RTDPageBlockTableBuilder = PageBlockTableBuilder;
2494
2495impl PageBlockTableBuilder {
2496 pub fn build(&self) -> PageBlockTable {
2497 self.inner.clone()
2498 }
2499
2500 pub fn caption<T: AsRef<RichText>>(&mut self, caption: T) -> &mut Self {
2501 self.inner.caption = caption.as_ref().clone();
2502 self
2503 }
2504
2505 pub fn cells(&mut self, cells: Vec<Vec<PageBlockTableCell>>) -> &mut Self {
2506 self.inner.cells = cells;
2507 self
2508 }
2509
2510 pub fn is_bordered(&mut self, is_bordered: bool) -> &mut Self {
2511 self.inner.is_bordered = is_bordered;
2512 self
2513 }
2514
2515 pub fn is_striped(&mut self, is_striped: bool) -> &mut Self {
2516 self.inner.is_striped = is_striped;
2517 self
2518 }
2519}
2520
2521impl AsRef<PageBlockTable> for PageBlockTable {
2522 fn as_ref(&self) -> &PageBlockTable {
2523 self
2524 }
2525}
2526
2527impl AsRef<PageBlockTable> for PageBlockTableBuilder {
2528 fn as_ref(&self) -> &PageBlockTable {
2529 &self.inner
2530 }
2531}
2532
2533#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2535pub struct PageBlockTitle {
2536 #[doc(hidden)]
2537 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2538 extra: Option<String>,
2539 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2540 client_id: Option<i32>,
2541 #[serde(skip_serializing_if = "RichText::_is_default")]
2544 title: RichText,
2545}
2546
2547impl RObject for PageBlockTitle {
2548 #[doc(hidden)]
2549 fn extra(&self) -> Option<&str> {
2550 self.extra.as_deref()
2551 }
2552 #[doc(hidden)]
2553 fn client_id(&self) -> Option<i32> {
2554 self.client_id
2555 }
2556}
2557
2558impl TDPageBlock for PageBlockTitle {}
2559
2560impl PageBlockTitle {
2561 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2562 Ok(serde_json::from_str(json.as_ref())?)
2563 }
2564 pub fn builder() -> PageBlockTitleBuilder {
2565 let mut inner = PageBlockTitle::default();
2566 inner.extra = Some(Uuid::new_v4().to_string());
2567
2568 PageBlockTitleBuilder { inner }
2569 }
2570
2571 pub fn title(&self) -> &RichText {
2572 &self.title
2573 }
2574}
2575
2576#[doc(hidden)]
2577pub struct PageBlockTitleBuilder {
2578 inner: PageBlockTitle,
2579}
2580
2581#[deprecated]
2582pub type RTDPageBlockTitleBuilder = PageBlockTitleBuilder;
2583
2584impl PageBlockTitleBuilder {
2585 pub fn build(&self) -> PageBlockTitle {
2586 self.inner.clone()
2587 }
2588
2589 pub fn title<T: AsRef<RichText>>(&mut self, title: T) -> &mut Self {
2590 self.inner.title = title.as_ref().clone();
2591 self
2592 }
2593}
2594
2595impl AsRef<PageBlockTitle> for PageBlockTitle {
2596 fn as_ref(&self) -> &PageBlockTitle {
2597 self
2598 }
2599}
2600
2601impl AsRef<PageBlockTitle> for PageBlockTitleBuilder {
2602 fn as_ref(&self) -> &PageBlockTitle {
2603 &self.inner
2604 }
2605}
2606
2607#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2609pub struct PageBlockVideo {
2610 #[doc(hidden)]
2611 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2612 extra: Option<String>,
2613 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2614 client_id: Option<i32>,
2615 video: Option<Video>,
2617 caption: PageBlockCaption,
2619 #[serde(default)]
2622 need_autoplay: bool,
2623 #[serde(default)]
2626 is_looped: bool,
2627}
2628
2629impl RObject for PageBlockVideo {
2630 #[doc(hidden)]
2631 fn extra(&self) -> Option<&str> {
2632 self.extra.as_deref()
2633 }
2634 #[doc(hidden)]
2635 fn client_id(&self) -> Option<i32> {
2636 self.client_id
2637 }
2638}
2639
2640impl TDPageBlock for PageBlockVideo {}
2641
2642impl PageBlockVideo {
2643 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2644 Ok(serde_json::from_str(json.as_ref())?)
2645 }
2646 pub fn builder() -> PageBlockVideoBuilder {
2647 let mut inner = PageBlockVideo::default();
2648 inner.extra = Some(Uuid::new_v4().to_string());
2649
2650 PageBlockVideoBuilder { inner }
2651 }
2652
2653 pub fn video(&self) -> &Option<Video> {
2654 &self.video
2655 }
2656
2657 pub fn caption(&self) -> &PageBlockCaption {
2658 &self.caption
2659 }
2660
2661 pub fn need_autoplay(&self) -> bool {
2662 self.need_autoplay
2663 }
2664
2665 pub fn is_looped(&self) -> bool {
2666 self.is_looped
2667 }
2668}
2669
2670#[doc(hidden)]
2671pub struct PageBlockVideoBuilder {
2672 inner: PageBlockVideo,
2673}
2674
2675#[deprecated]
2676pub type RTDPageBlockVideoBuilder = PageBlockVideoBuilder;
2677
2678impl PageBlockVideoBuilder {
2679 pub fn build(&self) -> PageBlockVideo {
2680 self.inner.clone()
2681 }
2682
2683 pub fn video<T: AsRef<Video>>(&mut self, video: T) -> &mut Self {
2684 self.inner.video = Some(video.as_ref().clone());
2685 self
2686 }
2687
2688 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
2689 self.inner.caption = caption.as_ref().clone();
2690 self
2691 }
2692
2693 pub fn need_autoplay(&mut self, need_autoplay: bool) -> &mut Self {
2694 self.inner.need_autoplay = need_autoplay;
2695 self
2696 }
2697
2698 pub fn is_looped(&mut self, is_looped: bool) -> &mut Self {
2699 self.inner.is_looped = is_looped;
2700 self
2701 }
2702}
2703
2704impl AsRef<PageBlockVideo> for PageBlockVideo {
2705 fn as_ref(&self) -> &PageBlockVideo {
2706 self
2707 }
2708}
2709
2710impl AsRef<PageBlockVideo> for PageBlockVideoBuilder {
2711 fn as_ref(&self) -> &PageBlockVideo {
2712 &self.inner
2713 }
2714}
2715
2716#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2718pub struct PageBlockVoiceNote {
2719 #[doc(hidden)]
2720 #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
2721 extra: Option<String>,
2722 #[serde(rename(serialize = "@client_id", deserialize = "@client_id"))]
2723 client_id: Option<i32>,
2724 voice_note: Option<VoiceNote>,
2726 caption: PageBlockCaption,
2728}
2729
2730impl RObject for PageBlockVoiceNote {
2731 #[doc(hidden)]
2732 fn extra(&self) -> Option<&str> {
2733 self.extra.as_deref()
2734 }
2735 #[doc(hidden)]
2736 fn client_id(&self) -> Option<i32> {
2737 self.client_id
2738 }
2739}
2740
2741impl TDPageBlock for PageBlockVoiceNote {}
2742
2743impl PageBlockVoiceNote {
2744 pub fn from_json<S: AsRef<str>>(json: S) -> Result<Self> {
2745 Ok(serde_json::from_str(json.as_ref())?)
2746 }
2747 pub fn builder() -> PageBlockVoiceNoteBuilder {
2748 let mut inner = PageBlockVoiceNote::default();
2749 inner.extra = Some(Uuid::new_v4().to_string());
2750
2751 PageBlockVoiceNoteBuilder { inner }
2752 }
2753
2754 pub fn voice_note(&self) -> &Option<VoiceNote> {
2755 &self.voice_note
2756 }
2757
2758 pub fn caption(&self) -> &PageBlockCaption {
2759 &self.caption
2760 }
2761}
2762
2763#[doc(hidden)]
2764pub struct PageBlockVoiceNoteBuilder {
2765 inner: PageBlockVoiceNote,
2766}
2767
2768#[deprecated]
2769pub type RTDPageBlockVoiceNoteBuilder = PageBlockVoiceNoteBuilder;
2770
2771impl PageBlockVoiceNoteBuilder {
2772 pub fn build(&self) -> PageBlockVoiceNote {
2773 self.inner.clone()
2774 }
2775
2776 pub fn voice_note<T: AsRef<VoiceNote>>(&mut self, voice_note: T) -> &mut Self {
2777 self.inner.voice_note = Some(voice_note.as_ref().clone());
2778 self
2779 }
2780
2781 pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
2782 self.inner.caption = caption.as_ref().clone();
2783 self
2784 }
2785}
2786
2787impl AsRef<PageBlockVoiceNote> for PageBlockVoiceNote {
2788 fn as_ref(&self) -> &PageBlockVoiceNote {
2789 self
2790 }
2791}
2792
2793impl AsRef<PageBlockVoiceNote> for PageBlockVoiceNoteBuilder {
2794 fn as_ref(&self) -> &PageBlockVoiceNote {
2795 &self.inner
2796 }
2797}