use crate::errors::*;
use crate::types::*;
use uuid::Uuid;
use serde::de::{Deserialize, Deserializer};
use std::fmt::Debug;
pub trait TDPageBlock: Debug + RObject {}
#[derive(Debug, Clone, Serialize)]
#[serde(untagged)]
pub enum PageBlock {
#[doc(hidden)]
_Default(()),
Anchor(PageBlockAnchor),
Animation(PageBlockAnimation),
Audio(PageBlockAudio),
AuthorDate(PageBlockAuthorDate),
BlockQuote(PageBlockBlockQuote),
ButtonRow(PageBlockButtonRow),
ChatLink(PageBlockChatLink),
Collage(PageBlockCollage),
Cover(PageBlockCover),
Details(PageBlockDetails),
Divider(PageBlockDivider),
Document(PageBlockDocument),
Embedded(PageBlockEmbedded),
EmbeddedPost(PageBlockEmbeddedPost),
ExpandableBlockQuote(PageBlockExpandableBlockQuote),
Footer(PageBlockFooter),
Header(PageBlockHeader),
Kicker(PageBlockKicker),
List(PageBlockList),
Map(PageBlockMap),
MathematicalExpression(PageBlockMathematicalExpression),
Paragraph(PageBlockParagraph),
Photo(PageBlockPhoto),
Preformatted(PageBlockPreformatted),
PullQuote(PageBlockPullQuote),
RelatedArticles(PageBlockRelatedArticles),
SectionHeading(PageBlockSectionHeading),
Slideshow(PageBlockSlideshow),
Subheader(PageBlockSubheader),
Subtitle(PageBlockSubtitle),
Table(PageBlockTable),
Thinking(PageBlockThinking),
Title(PageBlockTitle),
Unsupported(PageBlockUnsupported),
Video(PageBlockVideo),
VoiceNote(PageBlockVoiceNote),
}
impl Default for PageBlock {
fn default() -> Self {
PageBlock::_Default(())
}
}
impl<'de> Deserialize<'de> for PageBlock {
fn deserialize<D>(deserializer: D) -> Result<PageBlock, D::Error>
where
D: Deserializer<'de>,
{
use serde::de::Error;
rtd_enum_deserialize!(
PageBlock,
(pageBlockAnchor, Anchor);
(pageBlockAnimation, Animation);
(pageBlockAudio, Audio);
(pageBlockAuthorDate, AuthorDate);
(pageBlockBlockQuote, BlockQuote);
(pageBlockButtonRow, ButtonRow);
(pageBlockChatLink, ChatLink);
(pageBlockCollage, Collage);
(pageBlockCover, Cover);
(pageBlockDetails, Details);
(pageBlockDivider, Divider);
(pageBlockDocument, Document);
(pageBlockEmbedded, Embedded);
(pageBlockEmbeddedPost, EmbeddedPost);
(pageBlockExpandableBlockQuote, ExpandableBlockQuote);
(pageBlockFooter, Footer);
(pageBlockHeader, Header);
(pageBlockKicker, Kicker);
(pageBlockList, List);
(pageBlockMap, Map);
(pageBlockMathematicalExpression, MathematicalExpression);
(pageBlockParagraph, Paragraph);
(pageBlockPhoto, Photo);
(pageBlockPreformatted, Preformatted);
(pageBlockPullQuote, PullQuote);
(pageBlockRelatedArticles, RelatedArticles);
(pageBlockSectionHeading, SectionHeading);
(pageBlockSlideshow, Slideshow);
(pageBlockSubheader, Subheader);
(pageBlockSubtitle, Subtitle);
(pageBlockTable, Table);
(pageBlockThinking, Thinking);
(pageBlockTitle, Title);
(pageBlockUnsupported, Unsupported);
(pageBlockVideo, Video);
(pageBlockVoiceNote, VoiceNote);
)(deserializer)
}
}
impl RObject for PageBlock {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
match self {
PageBlock::Anchor(t) => t.td_name(),
PageBlock::Animation(t) => t.td_name(),
PageBlock::Audio(t) => t.td_name(),
PageBlock::AuthorDate(t) => t.td_name(),
PageBlock::BlockQuote(t) => t.td_name(),
PageBlock::ButtonRow(t) => t.td_name(),
PageBlock::ChatLink(t) => t.td_name(),
PageBlock::Collage(t) => t.td_name(),
PageBlock::Cover(t) => t.td_name(),
PageBlock::Details(t) => t.td_name(),
PageBlock::Divider(t) => t.td_name(),
PageBlock::Document(t) => t.td_name(),
PageBlock::Embedded(t) => t.td_name(),
PageBlock::EmbeddedPost(t) => t.td_name(),
PageBlock::ExpandableBlockQuote(t) => t.td_name(),
PageBlock::Footer(t) => t.td_name(),
PageBlock::Header(t) => t.td_name(),
PageBlock::Kicker(t) => t.td_name(),
PageBlock::List(t) => t.td_name(),
PageBlock::Map(t) => t.td_name(),
PageBlock::MathematicalExpression(t) => t.td_name(),
PageBlock::Paragraph(t) => t.td_name(),
PageBlock::Photo(t) => t.td_name(),
PageBlock::Preformatted(t) => t.td_name(),
PageBlock::PullQuote(t) => t.td_name(),
PageBlock::RelatedArticles(t) => t.td_name(),
PageBlock::SectionHeading(t) => t.td_name(),
PageBlock::Slideshow(t) => t.td_name(),
PageBlock::Subheader(t) => t.td_name(),
PageBlock::Subtitle(t) => t.td_name(),
PageBlock::Table(t) => t.td_name(),
PageBlock::Thinking(t) => t.td_name(),
PageBlock::Title(t) => t.td_name(),
PageBlock::Unsupported(t) => t.td_name(),
PageBlock::Video(t) => t.td_name(),
PageBlock::VoiceNote(t) => t.td_name(),
_ => "-1",
}
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
match self {
PageBlock::Anchor(t) => t.extra(),
PageBlock::Animation(t) => t.extra(),
PageBlock::Audio(t) => t.extra(),
PageBlock::AuthorDate(t) => t.extra(),
PageBlock::BlockQuote(t) => t.extra(),
PageBlock::ButtonRow(t) => t.extra(),
PageBlock::ChatLink(t) => t.extra(),
PageBlock::Collage(t) => t.extra(),
PageBlock::Cover(t) => t.extra(),
PageBlock::Details(t) => t.extra(),
PageBlock::Divider(t) => t.extra(),
PageBlock::Document(t) => t.extra(),
PageBlock::Embedded(t) => t.extra(),
PageBlock::EmbeddedPost(t) => t.extra(),
PageBlock::ExpandableBlockQuote(t) => t.extra(),
PageBlock::Footer(t) => t.extra(),
PageBlock::Header(t) => t.extra(),
PageBlock::Kicker(t) => t.extra(),
PageBlock::List(t) => t.extra(),
PageBlock::Map(t) => t.extra(),
PageBlock::MathematicalExpression(t) => t.extra(),
PageBlock::Paragraph(t) => t.extra(),
PageBlock::Photo(t) => t.extra(),
PageBlock::Preformatted(t) => t.extra(),
PageBlock::PullQuote(t) => t.extra(),
PageBlock::RelatedArticles(t) => t.extra(),
PageBlock::SectionHeading(t) => t.extra(),
PageBlock::Slideshow(t) => t.extra(),
PageBlock::Subheader(t) => t.extra(),
PageBlock::Subtitle(t) => t.extra(),
PageBlock::Table(t) => t.extra(),
PageBlock::Thinking(t) => t.extra(),
PageBlock::Title(t) => t.extra(),
PageBlock::Unsupported(t) => t.extra(),
PageBlock::Video(t) => t.extra(),
PageBlock::VoiceNote(t) => t.extra(),
_ => None,
}
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl PageBlock {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
#[doc(hidden)]
pub fn _is_default(&self) -> bool {
matches!(self, PageBlock::_Default(_))
}
pub fn is_anchor(&self) -> bool {
matches!(self, PageBlock::Anchor(_))
}
pub fn is_animation(&self) -> bool {
matches!(self, PageBlock::Animation(_))
}
pub fn is_audio(&self) -> bool {
matches!(self, PageBlock::Audio(_))
}
pub fn is_author_date(&self) -> bool {
matches!(self, PageBlock::AuthorDate(_))
}
pub fn is_block_quote(&self) -> bool {
matches!(self, PageBlock::BlockQuote(_))
}
pub fn is_button_row(&self) -> bool {
matches!(self, PageBlock::ButtonRow(_))
}
pub fn is_chat_link(&self) -> bool {
matches!(self, PageBlock::ChatLink(_))
}
pub fn is_collage(&self) -> bool {
matches!(self, PageBlock::Collage(_))
}
pub fn is_cover(&self) -> bool {
matches!(self, PageBlock::Cover(_))
}
pub fn is_details(&self) -> bool {
matches!(self, PageBlock::Details(_))
}
pub fn is_divider(&self) -> bool {
matches!(self, PageBlock::Divider(_))
}
pub fn is_document(&self) -> bool {
matches!(self, PageBlock::Document(_))
}
pub fn is_embedded(&self) -> bool {
matches!(self, PageBlock::Embedded(_))
}
pub fn is_embedded_post(&self) -> bool {
matches!(self, PageBlock::EmbeddedPost(_))
}
pub fn is_expandable_block_quote(&self) -> bool {
matches!(self, PageBlock::ExpandableBlockQuote(_))
}
pub fn is_footer(&self) -> bool {
matches!(self, PageBlock::Footer(_))
}
pub fn is_header(&self) -> bool {
matches!(self, PageBlock::Header(_))
}
pub fn is_kicker(&self) -> bool {
matches!(self, PageBlock::Kicker(_))
}
pub fn is_list(&self) -> bool {
matches!(self, PageBlock::List(_))
}
pub fn is_map(&self) -> bool {
matches!(self, PageBlock::Map(_))
}
pub fn is_mathematical_expression(&self) -> bool {
matches!(self, PageBlock::MathematicalExpression(_))
}
pub fn is_paragraph(&self) -> bool {
matches!(self, PageBlock::Paragraph(_))
}
pub fn is_photo(&self) -> bool {
matches!(self, PageBlock::Photo(_))
}
pub fn is_preformatted(&self) -> bool {
matches!(self, PageBlock::Preformatted(_))
}
pub fn is_pull_quote(&self) -> bool {
matches!(self, PageBlock::PullQuote(_))
}
pub fn is_related_articles(&self) -> bool {
matches!(self, PageBlock::RelatedArticles(_))
}
pub fn is_section_heading(&self) -> bool {
matches!(self, PageBlock::SectionHeading(_))
}
pub fn is_slideshow(&self) -> bool {
matches!(self, PageBlock::Slideshow(_))
}
pub fn is_subheader(&self) -> bool {
matches!(self, PageBlock::Subheader(_))
}
pub fn is_subtitle(&self) -> bool {
matches!(self, PageBlock::Subtitle(_))
}
pub fn is_table(&self) -> bool {
matches!(self, PageBlock::Table(_))
}
pub fn is_thinking(&self) -> bool {
matches!(self, PageBlock::Thinking(_))
}
pub fn is_title(&self) -> bool {
matches!(self, PageBlock::Title(_))
}
pub fn is_unsupported(&self) -> bool {
matches!(self, PageBlock::Unsupported(_))
}
pub fn is_video(&self) -> bool {
matches!(self, PageBlock::Video(_))
}
pub fn is_voice_note(&self) -> bool {
matches!(self, PageBlock::VoiceNote(_))
}
pub fn on_anchor<F: FnOnce(&PageBlockAnchor)>(&self, fnc: F) -> &Self {
if let PageBlock::Anchor(t) = self {
fnc(t)
};
self
}
pub fn on_animation<F: FnOnce(&PageBlockAnimation)>(&self, fnc: F) -> &Self {
if let PageBlock::Animation(t) = self {
fnc(t)
};
self
}
pub fn on_audio<F: FnOnce(&PageBlockAudio)>(&self, fnc: F) -> &Self {
if let PageBlock::Audio(t) = self {
fnc(t)
};
self
}
pub fn on_author_date<F: FnOnce(&PageBlockAuthorDate)>(&self, fnc: F) -> &Self {
if let PageBlock::AuthorDate(t) = self {
fnc(t)
};
self
}
pub fn on_block_quote<F: FnOnce(&PageBlockBlockQuote)>(&self, fnc: F) -> &Self {
if let PageBlock::BlockQuote(t) = self {
fnc(t)
};
self
}
pub fn on_button_row<F: FnOnce(&PageBlockButtonRow)>(&self, fnc: F) -> &Self {
if let PageBlock::ButtonRow(t) = self {
fnc(t)
};
self
}
pub fn on_chat_link<F: FnOnce(&PageBlockChatLink)>(&self, fnc: F) -> &Self {
if let PageBlock::ChatLink(t) = self {
fnc(t)
};
self
}
pub fn on_collage<F: FnOnce(&PageBlockCollage)>(&self, fnc: F) -> &Self {
if let PageBlock::Collage(t) = self {
fnc(t)
};
self
}
pub fn on_cover<F: FnOnce(&PageBlockCover)>(&self, fnc: F) -> &Self {
if let PageBlock::Cover(t) = self {
fnc(t)
};
self
}
pub fn on_details<F: FnOnce(&PageBlockDetails)>(&self, fnc: F) -> &Self {
if let PageBlock::Details(t) = self {
fnc(t)
};
self
}
pub fn on_divider<F: FnOnce(&PageBlockDivider)>(&self, fnc: F) -> &Self {
if let PageBlock::Divider(t) = self {
fnc(t)
};
self
}
pub fn on_document<F: FnOnce(&PageBlockDocument)>(&self, fnc: F) -> &Self {
if let PageBlock::Document(t) = self {
fnc(t)
};
self
}
pub fn on_embedded<F: FnOnce(&PageBlockEmbedded)>(&self, fnc: F) -> &Self {
if let PageBlock::Embedded(t) = self {
fnc(t)
};
self
}
pub fn on_embedded_post<F: FnOnce(&PageBlockEmbeddedPost)>(&self, fnc: F) -> &Self {
if let PageBlock::EmbeddedPost(t) = self {
fnc(t)
};
self
}
pub fn on_expandable_block_quote<F: FnOnce(&PageBlockExpandableBlockQuote)>(
&self,
fnc: F,
) -> &Self {
if let PageBlock::ExpandableBlockQuote(t) = self {
fnc(t)
};
self
}
pub fn on_footer<F: FnOnce(&PageBlockFooter)>(&self, fnc: F) -> &Self {
if let PageBlock::Footer(t) = self {
fnc(t)
};
self
}
pub fn on_header<F: FnOnce(&PageBlockHeader)>(&self, fnc: F) -> &Self {
if let PageBlock::Header(t) = self {
fnc(t)
};
self
}
pub fn on_kicker<F: FnOnce(&PageBlockKicker)>(&self, fnc: F) -> &Self {
if let PageBlock::Kicker(t) = self {
fnc(t)
};
self
}
pub fn on_list<F: FnOnce(&PageBlockList)>(&self, fnc: F) -> &Self {
if let PageBlock::List(t) = self {
fnc(t)
};
self
}
pub fn on_map<F: FnOnce(&PageBlockMap)>(&self, fnc: F) -> &Self {
if let PageBlock::Map(t) = self {
fnc(t)
};
self
}
pub fn on_mathematical_expression<F: FnOnce(&PageBlockMathematicalExpression)>(
&self,
fnc: F,
) -> &Self {
if let PageBlock::MathematicalExpression(t) = self {
fnc(t)
};
self
}
pub fn on_paragraph<F: FnOnce(&PageBlockParagraph)>(&self, fnc: F) -> &Self {
if let PageBlock::Paragraph(t) = self {
fnc(t)
};
self
}
pub fn on_photo<F: FnOnce(&PageBlockPhoto)>(&self, fnc: F) -> &Self {
if let PageBlock::Photo(t) = self {
fnc(t)
};
self
}
pub fn on_preformatted<F: FnOnce(&PageBlockPreformatted)>(&self, fnc: F) -> &Self {
if let PageBlock::Preformatted(t) = self {
fnc(t)
};
self
}
pub fn on_pull_quote<F: FnOnce(&PageBlockPullQuote)>(&self, fnc: F) -> &Self {
if let PageBlock::PullQuote(t) = self {
fnc(t)
};
self
}
pub fn on_related_articles<F: FnOnce(&PageBlockRelatedArticles)>(&self, fnc: F) -> &Self {
if let PageBlock::RelatedArticles(t) = self {
fnc(t)
};
self
}
pub fn on_section_heading<F: FnOnce(&PageBlockSectionHeading)>(&self, fnc: F) -> &Self {
if let PageBlock::SectionHeading(t) = self {
fnc(t)
};
self
}
pub fn on_slideshow<F: FnOnce(&PageBlockSlideshow)>(&self, fnc: F) -> &Self {
if let PageBlock::Slideshow(t) = self {
fnc(t)
};
self
}
pub fn on_subheader<F: FnOnce(&PageBlockSubheader)>(&self, fnc: F) -> &Self {
if let PageBlock::Subheader(t) = self {
fnc(t)
};
self
}
pub fn on_subtitle<F: FnOnce(&PageBlockSubtitle)>(&self, fnc: F) -> &Self {
if let PageBlock::Subtitle(t) = self {
fnc(t)
};
self
}
pub fn on_table<F: FnOnce(&PageBlockTable)>(&self, fnc: F) -> &Self {
if let PageBlock::Table(t) = self {
fnc(t)
};
self
}
pub fn on_thinking<F: FnOnce(&PageBlockThinking)>(&self, fnc: F) -> &Self {
if let PageBlock::Thinking(t) = self {
fnc(t)
};
self
}
pub fn on_title<F: FnOnce(&PageBlockTitle)>(&self, fnc: F) -> &Self {
if let PageBlock::Title(t) = self {
fnc(t)
};
self
}
pub fn on_unsupported<F: FnOnce(&PageBlockUnsupported)>(&self, fnc: F) -> &Self {
if let PageBlock::Unsupported(t) = self {
fnc(t)
};
self
}
pub fn on_video<F: FnOnce(&PageBlockVideo)>(&self, fnc: F) -> &Self {
if let PageBlock::Video(t) = self {
fnc(t)
};
self
}
pub fn on_voice_note<F: FnOnce(&PageBlockVoiceNote)>(&self, fnc: F) -> &Self {
if let PageBlock::VoiceNote(t) = self {
fnc(t)
};
self
}
pub fn as_anchor(&self) -> Option<&PageBlockAnchor> {
if let PageBlock::Anchor(t) = self {
return Some(t);
}
None
}
pub fn as_animation(&self) -> Option<&PageBlockAnimation> {
if let PageBlock::Animation(t) = self {
return Some(t);
}
None
}
pub fn as_audio(&self) -> Option<&PageBlockAudio> {
if let PageBlock::Audio(t) = self {
return Some(t);
}
None
}
pub fn as_author_date(&self) -> Option<&PageBlockAuthorDate> {
if let PageBlock::AuthorDate(t) = self {
return Some(t);
}
None
}
pub fn as_block_quote(&self) -> Option<&PageBlockBlockQuote> {
if let PageBlock::BlockQuote(t) = self {
return Some(t);
}
None
}
pub fn as_button_row(&self) -> Option<&PageBlockButtonRow> {
if let PageBlock::ButtonRow(t) = self {
return Some(t);
}
None
}
pub fn as_chat_link(&self) -> Option<&PageBlockChatLink> {
if let PageBlock::ChatLink(t) = self {
return Some(t);
}
None
}
pub fn as_collage(&self) -> Option<&PageBlockCollage> {
if let PageBlock::Collage(t) = self {
return Some(t);
}
None
}
pub fn as_cover(&self) -> Option<&PageBlockCover> {
if let PageBlock::Cover(t) = self {
return Some(t);
}
None
}
pub fn as_details(&self) -> Option<&PageBlockDetails> {
if let PageBlock::Details(t) = self {
return Some(t);
}
None
}
pub fn as_divider(&self) -> Option<&PageBlockDivider> {
if let PageBlock::Divider(t) = self {
return Some(t);
}
None
}
pub fn as_document(&self) -> Option<&PageBlockDocument> {
if let PageBlock::Document(t) = self {
return Some(t);
}
None
}
pub fn as_embedded(&self) -> Option<&PageBlockEmbedded> {
if let PageBlock::Embedded(t) = self {
return Some(t);
}
None
}
pub fn as_embedded_post(&self) -> Option<&PageBlockEmbeddedPost> {
if let PageBlock::EmbeddedPost(t) = self {
return Some(t);
}
None
}
pub fn as_expandable_block_quote(&self) -> Option<&PageBlockExpandableBlockQuote> {
if let PageBlock::ExpandableBlockQuote(t) = self {
return Some(t);
}
None
}
pub fn as_footer(&self) -> Option<&PageBlockFooter> {
if let PageBlock::Footer(t) = self {
return Some(t);
}
None
}
pub fn as_header(&self) -> Option<&PageBlockHeader> {
if let PageBlock::Header(t) = self {
return Some(t);
}
None
}
pub fn as_kicker(&self) -> Option<&PageBlockKicker> {
if let PageBlock::Kicker(t) = self {
return Some(t);
}
None
}
pub fn as_list(&self) -> Option<&PageBlockList> {
if let PageBlock::List(t) = self {
return Some(t);
}
None
}
pub fn as_map(&self) -> Option<&PageBlockMap> {
if let PageBlock::Map(t) = self {
return Some(t);
}
None
}
pub fn as_mathematical_expression(&self) -> Option<&PageBlockMathematicalExpression> {
if let PageBlock::MathematicalExpression(t) = self {
return Some(t);
}
None
}
pub fn as_paragraph(&self) -> Option<&PageBlockParagraph> {
if let PageBlock::Paragraph(t) = self {
return Some(t);
}
None
}
pub fn as_photo(&self) -> Option<&PageBlockPhoto> {
if let PageBlock::Photo(t) = self {
return Some(t);
}
None
}
pub fn as_preformatted(&self) -> Option<&PageBlockPreformatted> {
if let PageBlock::Preformatted(t) = self {
return Some(t);
}
None
}
pub fn as_pull_quote(&self) -> Option<&PageBlockPullQuote> {
if let PageBlock::PullQuote(t) = self {
return Some(t);
}
None
}
pub fn as_related_articles(&self) -> Option<&PageBlockRelatedArticles> {
if let PageBlock::RelatedArticles(t) = self {
return Some(t);
}
None
}
pub fn as_section_heading(&self) -> Option<&PageBlockSectionHeading> {
if let PageBlock::SectionHeading(t) = self {
return Some(t);
}
None
}
pub fn as_slideshow(&self) -> Option<&PageBlockSlideshow> {
if let PageBlock::Slideshow(t) = self {
return Some(t);
}
None
}
pub fn as_subheader(&self) -> Option<&PageBlockSubheader> {
if let PageBlock::Subheader(t) = self {
return Some(t);
}
None
}
pub fn as_subtitle(&self) -> Option<&PageBlockSubtitle> {
if let PageBlock::Subtitle(t) = self {
return Some(t);
}
None
}
pub fn as_table(&self) -> Option<&PageBlockTable> {
if let PageBlock::Table(t) = self {
return Some(t);
}
None
}
pub fn as_thinking(&self) -> Option<&PageBlockThinking> {
if let PageBlock::Thinking(t) = self {
return Some(t);
}
None
}
pub fn as_title(&self) -> Option<&PageBlockTitle> {
if let PageBlock::Title(t) = self {
return Some(t);
}
None
}
pub fn as_unsupported(&self) -> Option<&PageBlockUnsupported> {
if let PageBlock::Unsupported(t) = self {
return Some(t);
}
None
}
pub fn as_video(&self) -> Option<&PageBlockVideo> {
if let PageBlock::Video(t) = self {
return Some(t);
}
None
}
pub fn as_voice_note(&self) -> Option<&PageBlockVoiceNote> {
if let PageBlock::VoiceNote(t) = self {
return Some(t);
}
None
}
pub fn anchor<T: AsRef<PageBlockAnchor>>(t: T) -> Self {
PageBlock::Anchor(t.as_ref().clone())
}
pub fn animation<T: AsRef<PageBlockAnimation>>(t: T) -> Self {
PageBlock::Animation(t.as_ref().clone())
}
pub fn audio<T: AsRef<PageBlockAudio>>(t: T) -> Self {
PageBlock::Audio(t.as_ref().clone())
}
pub fn author_date<T: AsRef<PageBlockAuthorDate>>(t: T) -> Self {
PageBlock::AuthorDate(t.as_ref().clone())
}
pub fn block_quote<T: AsRef<PageBlockBlockQuote>>(t: T) -> Self {
PageBlock::BlockQuote(t.as_ref().clone())
}
pub fn button_row<T: AsRef<PageBlockButtonRow>>(t: T) -> Self {
PageBlock::ButtonRow(t.as_ref().clone())
}
pub fn chat_link<T: AsRef<PageBlockChatLink>>(t: T) -> Self {
PageBlock::ChatLink(t.as_ref().clone())
}
pub fn collage<T: AsRef<PageBlockCollage>>(t: T) -> Self {
PageBlock::Collage(t.as_ref().clone())
}
pub fn cover<T: AsRef<PageBlockCover>>(t: T) -> Self {
PageBlock::Cover(t.as_ref().clone())
}
pub fn details<T: AsRef<PageBlockDetails>>(t: T) -> Self {
PageBlock::Details(t.as_ref().clone())
}
pub fn divider<T: AsRef<PageBlockDivider>>(t: T) -> Self {
PageBlock::Divider(t.as_ref().clone())
}
pub fn document<T: AsRef<PageBlockDocument>>(t: T) -> Self {
PageBlock::Document(t.as_ref().clone())
}
pub fn embedded<T: AsRef<PageBlockEmbedded>>(t: T) -> Self {
PageBlock::Embedded(t.as_ref().clone())
}
pub fn embedded_post<T: AsRef<PageBlockEmbeddedPost>>(t: T) -> Self {
PageBlock::EmbeddedPost(t.as_ref().clone())
}
pub fn expandable_block_quote<T: AsRef<PageBlockExpandableBlockQuote>>(t: T) -> Self {
PageBlock::ExpandableBlockQuote(t.as_ref().clone())
}
pub fn footer<T: AsRef<PageBlockFooter>>(t: T) -> Self {
PageBlock::Footer(t.as_ref().clone())
}
pub fn header<T: AsRef<PageBlockHeader>>(t: T) -> Self {
PageBlock::Header(t.as_ref().clone())
}
pub fn kicker<T: AsRef<PageBlockKicker>>(t: T) -> Self {
PageBlock::Kicker(t.as_ref().clone())
}
pub fn list<T: AsRef<PageBlockList>>(t: T) -> Self {
PageBlock::List(t.as_ref().clone())
}
pub fn map<T: AsRef<PageBlockMap>>(t: T) -> Self {
PageBlock::Map(t.as_ref().clone())
}
pub fn mathematical_expression<T: AsRef<PageBlockMathematicalExpression>>(t: T) -> Self {
PageBlock::MathematicalExpression(t.as_ref().clone())
}
pub fn paragraph<T: AsRef<PageBlockParagraph>>(t: T) -> Self {
PageBlock::Paragraph(t.as_ref().clone())
}
pub fn photo<T: AsRef<PageBlockPhoto>>(t: T) -> Self {
PageBlock::Photo(t.as_ref().clone())
}
pub fn preformatted<T: AsRef<PageBlockPreformatted>>(t: T) -> Self {
PageBlock::Preformatted(t.as_ref().clone())
}
pub fn pull_quote<T: AsRef<PageBlockPullQuote>>(t: T) -> Self {
PageBlock::PullQuote(t.as_ref().clone())
}
pub fn related_articles<T: AsRef<PageBlockRelatedArticles>>(t: T) -> Self {
PageBlock::RelatedArticles(t.as_ref().clone())
}
pub fn section_heading<T: AsRef<PageBlockSectionHeading>>(t: T) -> Self {
PageBlock::SectionHeading(t.as_ref().clone())
}
pub fn slideshow<T: AsRef<PageBlockSlideshow>>(t: T) -> Self {
PageBlock::Slideshow(t.as_ref().clone())
}
pub fn subheader<T: AsRef<PageBlockSubheader>>(t: T) -> Self {
PageBlock::Subheader(t.as_ref().clone())
}
pub fn subtitle<T: AsRef<PageBlockSubtitle>>(t: T) -> Self {
PageBlock::Subtitle(t.as_ref().clone())
}
pub fn table<T: AsRef<PageBlockTable>>(t: T) -> Self {
PageBlock::Table(t.as_ref().clone())
}
pub fn thinking<T: AsRef<PageBlockThinking>>(t: T) -> Self {
PageBlock::Thinking(t.as_ref().clone())
}
pub fn title<T: AsRef<PageBlockTitle>>(t: T) -> Self {
PageBlock::Title(t.as_ref().clone())
}
pub fn unsupported<T: AsRef<PageBlockUnsupported>>(t: T) -> Self {
PageBlock::Unsupported(t.as_ref().clone())
}
pub fn video<T: AsRef<PageBlockVideo>>(t: T) -> Self {
PageBlock::Video(t.as_ref().clone())
}
pub fn voice_note<T: AsRef<PageBlockVoiceNote>>(t: T) -> Self {
PageBlock::VoiceNote(t.as_ref().clone())
}
}
impl AsRef<PageBlock> for PageBlock {
fn as_ref(&self) -> &PageBlock {
self
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockAnchor {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
name: String,
}
impl RObject for PageBlockAnchor {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockAnchor"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockAnchor {}
impl PageBlockAnchor {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockAnchorBuilder {
let inner = PageBlockAnchor {
td_name: "pageBlockAnchor".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockAnchorBuilder { inner }
}
pub fn name(&self) -> &String {
&self.name
}
}
#[doc(hidden)]
pub struct RTDPageBlockAnchorBuilder {
inner: PageBlockAnchor,
}
impl RTDPageBlockAnchorBuilder {
pub fn build(&self) -> PageBlockAnchor {
self.inner.clone()
}
pub fn name<T: AsRef<str>>(&mut self, name: T) -> &mut Self {
self.inner.name = name.as_ref().to_string();
self
}
}
impl AsRef<PageBlockAnchor> for PageBlockAnchor {
fn as_ref(&self) -> &PageBlockAnchor {
self
}
}
impl AsRef<PageBlockAnchor> for RTDPageBlockAnchorBuilder {
fn as_ref(&self) -> &PageBlockAnchor {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockAnimation {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
animation: Option<Animation>,
caption: Option<PageBlockCaption>,
need_autoplay: bool,
has_spoiler: bool,
}
impl RObject for PageBlockAnimation {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockAnimation"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockAnimation {}
impl PageBlockAnimation {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockAnimationBuilder {
let inner = PageBlockAnimation {
td_name: "pageBlockAnimation".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockAnimationBuilder { inner }
}
pub fn animation(&self) -> &Option<Animation> {
&self.animation
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
pub fn need_autoplay(&self) -> bool {
self.need_autoplay
}
pub fn has_spoiler(&self) -> bool {
self.has_spoiler
}
}
#[doc(hidden)]
pub struct RTDPageBlockAnimationBuilder {
inner: PageBlockAnimation,
}
impl RTDPageBlockAnimationBuilder {
pub fn build(&self) -> PageBlockAnimation {
self.inner.clone()
}
pub fn animation<T: AsRef<Animation>>(&mut self, animation: T) -> &mut Self {
self.inner.animation = Some(animation.as_ref().clone());
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
pub fn need_autoplay(&mut self, need_autoplay: bool) -> &mut Self {
self.inner.need_autoplay = need_autoplay;
self
}
pub fn has_spoiler(&mut self, has_spoiler: bool) -> &mut Self {
self.inner.has_spoiler = has_spoiler;
self
}
}
impl AsRef<PageBlockAnimation> for PageBlockAnimation {
fn as_ref(&self) -> &PageBlockAnimation {
self
}
}
impl AsRef<PageBlockAnimation> for RTDPageBlockAnimationBuilder {
fn as_ref(&self) -> &PageBlockAnimation {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockAudio {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
audio: Audio,
caption: Option<PageBlockCaption>,
}
impl RObject for PageBlockAudio {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockAudio"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockAudio {}
impl PageBlockAudio {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockAudioBuilder {
let inner = PageBlockAudio {
td_name: "pageBlockAudio".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockAudioBuilder { inner }
}
pub fn audio(&self) -> &Audio {
&self.audio
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
}
#[doc(hidden)]
pub struct RTDPageBlockAudioBuilder {
inner: PageBlockAudio,
}
impl RTDPageBlockAudioBuilder {
pub fn build(&self) -> PageBlockAudio {
self.inner.clone()
}
pub fn audio<T: AsRef<Audio>>(&mut self, audio: T) -> &mut Self {
self.inner.audio = audio.as_ref().clone();
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
}
impl AsRef<PageBlockAudio> for PageBlockAudio {
fn as_ref(&self) -> &PageBlockAudio {
self
}
}
impl AsRef<PageBlockAudio> for RTDPageBlockAudioBuilder {
fn as_ref(&self) -> &PageBlockAudio {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockAuthorDate {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
author: RichText,
publish_date: i64,
}
impl RObject for PageBlockAuthorDate {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockAuthorDate"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockAuthorDate {}
impl PageBlockAuthorDate {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockAuthorDateBuilder {
let inner = PageBlockAuthorDate {
td_name: "pageBlockAuthorDate".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockAuthorDateBuilder { inner }
}
pub fn author(&self) -> &RichText {
&self.author
}
pub fn publish_date(&self) -> i64 {
self.publish_date
}
}
#[doc(hidden)]
pub struct RTDPageBlockAuthorDateBuilder {
inner: PageBlockAuthorDate,
}
impl RTDPageBlockAuthorDateBuilder {
pub fn build(&self) -> PageBlockAuthorDate {
self.inner.clone()
}
pub fn author<T: AsRef<RichText>>(&mut self, author: T) -> &mut Self {
self.inner.author = author.as_ref().clone();
self
}
pub fn publish_date(&mut self, publish_date: i64) -> &mut Self {
self.inner.publish_date = publish_date;
self
}
}
impl AsRef<PageBlockAuthorDate> for PageBlockAuthorDate {
fn as_ref(&self) -> &PageBlockAuthorDate {
self
}
}
impl AsRef<PageBlockAuthorDate> for RTDPageBlockAuthorDateBuilder {
fn as_ref(&self) -> &PageBlockAuthorDate {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockBlockQuote {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
blocks: Vec<PageBlock>,
credit: Option<RichText>,
}
impl RObject for PageBlockBlockQuote {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockBlockQuote"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockBlockQuote {}
impl PageBlockBlockQuote {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockBlockQuoteBuilder {
let inner = PageBlockBlockQuote {
td_name: "pageBlockBlockQuote".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockBlockQuoteBuilder { inner }
}
pub fn blocks(&self) -> &Vec<PageBlock> {
&self.blocks
}
pub fn credit(&self) -> &Option<RichText> {
&self.credit
}
}
#[doc(hidden)]
pub struct RTDPageBlockBlockQuoteBuilder {
inner: PageBlockBlockQuote,
}
impl RTDPageBlockBlockQuoteBuilder {
pub fn build(&self) -> PageBlockBlockQuote {
self.inner.clone()
}
pub fn blocks(&mut self, blocks: Vec<PageBlock>) -> &mut Self {
self.inner.blocks = blocks;
self
}
pub fn credit<T: AsRef<RichText>>(&mut self, credit: T) -> &mut Self {
self.inner.credit = Some(credit.as_ref().clone());
self
}
}
impl AsRef<PageBlockBlockQuote> for PageBlockBlockQuote {
fn as_ref(&self) -> &PageBlockBlockQuote {
self
}
}
impl AsRef<PageBlockBlockQuote> for RTDPageBlockBlockQuoteBuilder {
fn as_ref(&self) -> &PageBlockBlockQuote {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockButtonRow {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
buttons: Vec<InlineButton>,
align: Option<PageBlockHorizontalAlignment>,
}
impl RObject for PageBlockButtonRow {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockButtonRow"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockButtonRow {}
impl PageBlockButtonRow {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockButtonRowBuilder {
let inner = PageBlockButtonRow {
td_name: "pageBlockButtonRow".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockButtonRowBuilder { inner }
}
pub fn buttons(&self) -> &Vec<InlineButton> {
&self.buttons
}
pub fn align(&self) -> &Option<PageBlockHorizontalAlignment> {
&self.align
}
}
#[doc(hidden)]
pub struct RTDPageBlockButtonRowBuilder {
inner: PageBlockButtonRow,
}
impl RTDPageBlockButtonRowBuilder {
pub fn build(&self) -> PageBlockButtonRow {
self.inner.clone()
}
pub fn buttons(&mut self, buttons: Vec<InlineButton>) -> &mut Self {
self.inner.buttons = buttons;
self
}
pub fn align<T: AsRef<PageBlockHorizontalAlignment>>(&mut self, align: T) -> &mut Self {
self.inner.align = Some(align.as_ref().clone());
self
}
}
impl AsRef<PageBlockButtonRow> for PageBlockButtonRow {
fn as_ref(&self) -> &PageBlockButtonRow {
self
}
}
impl AsRef<PageBlockButtonRow> for RTDPageBlockButtonRowBuilder {
fn as_ref(&self) -> &PageBlockButtonRow {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockChatLink {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
title: String,
photo: Option<ChatPhotoInfo>,
accent_color_id: i64,
username: String,
}
impl RObject for PageBlockChatLink {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockChatLink"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockChatLink {}
impl PageBlockChatLink {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockChatLinkBuilder {
let inner = PageBlockChatLink {
td_name: "pageBlockChatLink".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockChatLinkBuilder { inner }
}
pub fn title(&self) -> &String {
&self.title
}
pub fn photo(&self) -> &Option<ChatPhotoInfo> {
&self.photo
}
pub fn accent_color_id(&self) -> i64 {
self.accent_color_id
}
pub fn username(&self) -> &String {
&self.username
}
}
#[doc(hidden)]
pub struct RTDPageBlockChatLinkBuilder {
inner: PageBlockChatLink,
}
impl RTDPageBlockChatLinkBuilder {
pub fn build(&self) -> PageBlockChatLink {
self.inner.clone()
}
pub fn title<T: AsRef<str>>(&mut self, title: T) -> &mut Self {
self.inner.title = title.as_ref().to_string();
self
}
pub fn photo<T: AsRef<ChatPhotoInfo>>(&mut self, photo: T) -> &mut Self {
self.inner.photo = Some(photo.as_ref().clone());
self
}
pub fn accent_color_id(&mut self, accent_color_id: i64) -> &mut Self {
self.inner.accent_color_id = accent_color_id;
self
}
pub fn username<T: AsRef<str>>(&mut self, username: T) -> &mut Self {
self.inner.username = username.as_ref().to_string();
self
}
}
impl AsRef<PageBlockChatLink> for PageBlockChatLink {
fn as_ref(&self) -> &PageBlockChatLink {
self
}
}
impl AsRef<PageBlockChatLink> for RTDPageBlockChatLinkBuilder {
fn as_ref(&self) -> &PageBlockChatLink {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockCollage {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
blocks: Vec<PageBlock>,
caption: Option<PageBlockCaption>,
}
impl RObject for PageBlockCollage {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockCollage"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockCollage {}
impl PageBlockCollage {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockCollageBuilder {
let inner = PageBlockCollage {
td_name: "pageBlockCollage".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockCollageBuilder { inner }
}
pub fn blocks(&self) -> &Vec<PageBlock> {
&self.blocks
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
}
#[doc(hidden)]
pub struct RTDPageBlockCollageBuilder {
inner: PageBlockCollage,
}
impl RTDPageBlockCollageBuilder {
pub fn build(&self) -> PageBlockCollage {
self.inner.clone()
}
pub fn blocks(&mut self, blocks: Vec<PageBlock>) -> &mut Self {
self.inner.blocks = blocks;
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
}
impl AsRef<PageBlockCollage> for PageBlockCollage {
fn as_ref(&self) -> &PageBlockCollage {
self
}
}
impl AsRef<PageBlockCollage> for RTDPageBlockCollageBuilder {
fn as_ref(&self) -> &PageBlockCollage {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockCover {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
cover: Box<PageBlock>,
}
impl RObject for PageBlockCover {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockCover"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockCover {}
impl PageBlockCover {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockCoverBuilder {
let inner = PageBlockCover {
td_name: "pageBlockCover".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockCoverBuilder { inner }
}
pub fn cover(&self) -> &Box<PageBlock> {
&self.cover
}
}
#[doc(hidden)]
pub struct RTDPageBlockCoverBuilder {
inner: PageBlockCover,
}
impl RTDPageBlockCoverBuilder {
pub fn build(&self) -> PageBlockCover {
self.inner.clone()
}
pub fn cover<T: AsRef<Box<PageBlock>>>(&mut self, cover: T) -> &mut Self {
self.inner.cover = cover.as_ref().clone();
self
}
}
impl AsRef<PageBlockCover> for PageBlockCover {
fn as_ref(&self) -> &PageBlockCover {
self
}
}
impl AsRef<PageBlockCover> for RTDPageBlockCoverBuilder {
fn as_ref(&self) -> &PageBlockCover {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockDetails {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
header: RichText,
blocks: Vec<PageBlock>,
is_open: bool,
}
impl RObject for PageBlockDetails {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockDetails"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockDetails {}
impl PageBlockDetails {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockDetailsBuilder {
let inner = PageBlockDetails {
td_name: "pageBlockDetails".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockDetailsBuilder { inner }
}
pub fn header(&self) -> &RichText {
&self.header
}
pub fn blocks(&self) -> &Vec<PageBlock> {
&self.blocks
}
pub fn is_open(&self) -> bool {
self.is_open
}
}
#[doc(hidden)]
pub struct RTDPageBlockDetailsBuilder {
inner: PageBlockDetails,
}
impl RTDPageBlockDetailsBuilder {
pub fn build(&self) -> PageBlockDetails {
self.inner.clone()
}
pub fn header<T: AsRef<RichText>>(&mut self, header: T) -> &mut Self {
self.inner.header = header.as_ref().clone();
self
}
pub fn blocks(&mut self, blocks: Vec<PageBlock>) -> &mut Self {
self.inner.blocks = blocks;
self
}
pub fn is_open(&mut self, is_open: bool) -> &mut Self {
self.inner.is_open = is_open;
self
}
}
impl AsRef<PageBlockDetails> for PageBlockDetails {
fn as_ref(&self) -> &PageBlockDetails {
self
}
}
impl AsRef<PageBlockDetails> for RTDPageBlockDetailsBuilder {
fn as_ref(&self) -> &PageBlockDetails {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockDivider {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
}
impl RObject for PageBlockDivider {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockDivider"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockDivider {}
impl PageBlockDivider {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockDividerBuilder {
let inner = PageBlockDivider {
td_name: "pageBlockDivider".to_string(),
extra: Some(Uuid::new_v4().to_string()),
};
RTDPageBlockDividerBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDPageBlockDividerBuilder {
inner: PageBlockDivider,
}
impl RTDPageBlockDividerBuilder {
pub fn build(&self) -> PageBlockDivider {
self.inner.clone()
}
}
impl AsRef<PageBlockDivider> for PageBlockDivider {
fn as_ref(&self) -> &PageBlockDivider {
self
}
}
impl AsRef<PageBlockDivider> for RTDPageBlockDividerBuilder {
fn as_ref(&self) -> &PageBlockDivider {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockDocument {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
document: Document,
caption: Option<PageBlockCaption>,
}
impl RObject for PageBlockDocument {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockDocument"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockDocument {}
impl PageBlockDocument {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockDocumentBuilder {
let inner = PageBlockDocument {
td_name: "pageBlockDocument".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockDocumentBuilder { inner }
}
pub fn document(&self) -> &Document {
&self.document
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
}
#[doc(hidden)]
pub struct RTDPageBlockDocumentBuilder {
inner: PageBlockDocument,
}
impl RTDPageBlockDocumentBuilder {
pub fn build(&self) -> PageBlockDocument {
self.inner.clone()
}
pub fn document<T: AsRef<Document>>(&mut self, document: T) -> &mut Self {
self.inner.document = document.as_ref().clone();
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
}
impl AsRef<PageBlockDocument> for PageBlockDocument {
fn as_ref(&self) -> &PageBlockDocument {
self
}
}
impl AsRef<PageBlockDocument> for RTDPageBlockDocumentBuilder {
fn as_ref(&self) -> &PageBlockDocument {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockEmbedded {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
url: String,
html: String,
poster_photo: Option<Photo>,
width: i64,
height: i64,
caption: Option<PageBlockCaption>,
is_full_width: bool,
allow_scrolling: bool,
}
impl RObject for PageBlockEmbedded {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockEmbedded"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockEmbedded {}
impl PageBlockEmbedded {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockEmbeddedBuilder {
let inner = PageBlockEmbedded {
td_name: "pageBlockEmbedded".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockEmbeddedBuilder { inner }
}
pub fn url(&self) -> &String {
&self.url
}
pub fn html(&self) -> &String {
&self.html
}
pub fn poster_photo(&self) -> &Option<Photo> {
&self.poster_photo
}
pub fn width(&self) -> i64 {
self.width
}
pub fn height(&self) -> i64 {
self.height
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
pub fn is_full_width(&self) -> bool {
self.is_full_width
}
pub fn allow_scrolling(&self) -> bool {
self.allow_scrolling
}
}
#[doc(hidden)]
pub struct RTDPageBlockEmbeddedBuilder {
inner: PageBlockEmbedded,
}
impl RTDPageBlockEmbeddedBuilder {
pub fn build(&self) -> PageBlockEmbedded {
self.inner.clone()
}
pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
self.inner.url = url.as_ref().to_string();
self
}
pub fn html<T: AsRef<str>>(&mut self, html: T) -> &mut Self {
self.inner.html = html.as_ref().to_string();
self
}
pub fn poster_photo<T: AsRef<Photo>>(&mut self, poster_photo: T) -> &mut Self {
self.inner.poster_photo = Some(poster_photo.as_ref().clone());
self
}
pub fn width(&mut self, width: i64) -> &mut Self {
self.inner.width = width;
self
}
pub fn height(&mut self, height: i64) -> &mut Self {
self.inner.height = height;
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
pub fn is_full_width(&mut self, is_full_width: bool) -> &mut Self {
self.inner.is_full_width = is_full_width;
self
}
pub fn allow_scrolling(&mut self, allow_scrolling: bool) -> &mut Self {
self.inner.allow_scrolling = allow_scrolling;
self
}
}
impl AsRef<PageBlockEmbedded> for PageBlockEmbedded {
fn as_ref(&self) -> &PageBlockEmbedded {
self
}
}
impl AsRef<PageBlockEmbedded> for RTDPageBlockEmbeddedBuilder {
fn as_ref(&self) -> &PageBlockEmbedded {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockEmbeddedPost {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
url: String,
author: String,
author_photo: Option<Photo>,
date: i64,
blocks: Vec<PageBlock>,
caption: Option<PageBlockCaption>,
}
impl RObject for PageBlockEmbeddedPost {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockEmbeddedPost"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockEmbeddedPost {}
impl PageBlockEmbeddedPost {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockEmbeddedPostBuilder {
let inner = PageBlockEmbeddedPost {
td_name: "pageBlockEmbeddedPost".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockEmbeddedPostBuilder { inner }
}
pub fn url(&self) -> &String {
&self.url
}
pub fn author(&self) -> &String {
&self.author
}
pub fn author_photo(&self) -> &Option<Photo> {
&self.author_photo
}
pub fn date(&self) -> i64 {
self.date
}
pub fn blocks(&self) -> &Vec<PageBlock> {
&self.blocks
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
}
#[doc(hidden)]
pub struct RTDPageBlockEmbeddedPostBuilder {
inner: PageBlockEmbeddedPost,
}
impl RTDPageBlockEmbeddedPostBuilder {
pub fn build(&self) -> PageBlockEmbeddedPost {
self.inner.clone()
}
pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
self.inner.url = url.as_ref().to_string();
self
}
pub fn author<T: AsRef<str>>(&mut self, author: T) -> &mut Self {
self.inner.author = author.as_ref().to_string();
self
}
pub fn author_photo<T: AsRef<Photo>>(&mut self, author_photo: T) -> &mut Self {
self.inner.author_photo = Some(author_photo.as_ref().clone());
self
}
pub fn date(&mut self, date: i64) -> &mut Self {
self.inner.date = date;
self
}
pub fn blocks(&mut self, blocks: Vec<PageBlock>) -> &mut Self {
self.inner.blocks = blocks;
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
}
impl AsRef<PageBlockEmbeddedPost> for PageBlockEmbeddedPost {
fn as_ref(&self) -> &PageBlockEmbeddedPost {
self
}
}
impl AsRef<PageBlockEmbeddedPost> for RTDPageBlockEmbeddedPostBuilder {
fn as_ref(&self) -> &PageBlockEmbeddedPost {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockExpandableBlockQuote {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
text: RichText,
credit: Option<RichText>,
}
impl RObject for PageBlockExpandableBlockQuote {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockExpandableBlockQuote"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockExpandableBlockQuote {}
impl PageBlockExpandableBlockQuote {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockExpandableBlockQuoteBuilder {
let inner = PageBlockExpandableBlockQuote {
td_name: "pageBlockExpandableBlockQuote".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockExpandableBlockQuoteBuilder { inner }
}
pub fn text(&self) -> &RichText {
&self.text
}
pub fn credit(&self) -> &Option<RichText> {
&self.credit
}
}
#[doc(hidden)]
pub struct RTDPageBlockExpandableBlockQuoteBuilder {
inner: PageBlockExpandableBlockQuote,
}
impl RTDPageBlockExpandableBlockQuoteBuilder {
pub fn build(&self) -> PageBlockExpandableBlockQuote {
self.inner.clone()
}
pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
self.inner.text = text.as_ref().clone();
self
}
pub fn credit<T: AsRef<RichText>>(&mut self, credit: T) -> &mut Self {
self.inner.credit = Some(credit.as_ref().clone());
self
}
}
impl AsRef<PageBlockExpandableBlockQuote> for PageBlockExpandableBlockQuote {
fn as_ref(&self) -> &PageBlockExpandableBlockQuote {
self
}
}
impl AsRef<PageBlockExpandableBlockQuote> for RTDPageBlockExpandableBlockQuoteBuilder {
fn as_ref(&self) -> &PageBlockExpandableBlockQuote {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockFooter {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
footer: RichText,
}
impl RObject for PageBlockFooter {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockFooter"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockFooter {}
impl PageBlockFooter {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockFooterBuilder {
let inner = PageBlockFooter {
td_name: "pageBlockFooter".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockFooterBuilder { inner }
}
pub fn footer(&self) -> &RichText {
&self.footer
}
}
#[doc(hidden)]
pub struct RTDPageBlockFooterBuilder {
inner: PageBlockFooter,
}
impl RTDPageBlockFooterBuilder {
pub fn build(&self) -> PageBlockFooter {
self.inner.clone()
}
pub fn footer<T: AsRef<RichText>>(&mut self, footer: T) -> &mut Self {
self.inner.footer = footer.as_ref().clone();
self
}
}
impl AsRef<PageBlockFooter> for PageBlockFooter {
fn as_ref(&self) -> &PageBlockFooter {
self
}
}
impl AsRef<PageBlockFooter> for RTDPageBlockFooterBuilder {
fn as_ref(&self) -> &PageBlockFooter {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockHeader {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
header: RichText,
}
impl RObject for PageBlockHeader {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockHeader"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockHeader {}
impl PageBlockHeader {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockHeaderBuilder {
let inner = PageBlockHeader {
td_name: "pageBlockHeader".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockHeaderBuilder { inner }
}
pub fn header(&self) -> &RichText {
&self.header
}
}
#[doc(hidden)]
pub struct RTDPageBlockHeaderBuilder {
inner: PageBlockHeader,
}
impl RTDPageBlockHeaderBuilder {
pub fn build(&self) -> PageBlockHeader {
self.inner.clone()
}
pub fn header<T: AsRef<RichText>>(&mut self, header: T) -> &mut Self {
self.inner.header = header.as_ref().clone();
self
}
}
impl AsRef<PageBlockHeader> for PageBlockHeader {
fn as_ref(&self) -> &PageBlockHeader {
self
}
}
impl AsRef<PageBlockHeader> for RTDPageBlockHeaderBuilder {
fn as_ref(&self) -> &PageBlockHeader {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockKicker {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
kicker: RichText,
}
impl RObject for PageBlockKicker {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockKicker"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockKicker {}
impl PageBlockKicker {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockKickerBuilder {
let inner = PageBlockKicker {
td_name: "pageBlockKicker".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockKickerBuilder { inner }
}
pub fn kicker(&self) -> &RichText {
&self.kicker
}
}
#[doc(hidden)]
pub struct RTDPageBlockKickerBuilder {
inner: PageBlockKicker,
}
impl RTDPageBlockKickerBuilder {
pub fn build(&self) -> PageBlockKicker {
self.inner.clone()
}
pub fn kicker<T: AsRef<RichText>>(&mut self, kicker: T) -> &mut Self {
self.inner.kicker = kicker.as_ref().clone();
self
}
}
impl AsRef<PageBlockKicker> for PageBlockKicker {
fn as_ref(&self) -> &PageBlockKicker {
self
}
}
impl AsRef<PageBlockKicker> for RTDPageBlockKickerBuilder {
fn as_ref(&self) -> &PageBlockKicker {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockList {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
items: Vec<PageBlockListItem>,
}
impl RObject for PageBlockList {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockList"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockList {}
impl PageBlockList {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockListBuilder {
let inner = PageBlockList {
td_name: "pageBlockList".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockListBuilder { inner }
}
pub fn items(&self) -> &Vec<PageBlockListItem> {
&self.items
}
}
#[doc(hidden)]
pub struct RTDPageBlockListBuilder {
inner: PageBlockList,
}
impl RTDPageBlockListBuilder {
pub fn build(&self) -> PageBlockList {
self.inner.clone()
}
pub fn items(&mut self, items: Vec<PageBlockListItem>) -> &mut Self {
self.inner.items = items;
self
}
}
impl AsRef<PageBlockList> for PageBlockList {
fn as_ref(&self) -> &PageBlockList {
self
}
}
impl AsRef<PageBlockList> for RTDPageBlockListBuilder {
fn as_ref(&self) -> &PageBlockList {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockMap {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
location: Location,
zoom: i64,
width: i64,
height: i64,
caption: Option<PageBlockCaption>,
}
impl RObject for PageBlockMap {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockMap"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockMap {}
impl PageBlockMap {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockMapBuilder {
let inner = PageBlockMap {
td_name: "pageBlockMap".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockMapBuilder { inner }
}
pub fn location(&self) -> &Location {
&self.location
}
pub fn zoom(&self) -> i64 {
self.zoom
}
pub fn width(&self) -> i64 {
self.width
}
pub fn height(&self) -> i64 {
self.height
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
}
#[doc(hidden)]
pub struct RTDPageBlockMapBuilder {
inner: PageBlockMap,
}
impl RTDPageBlockMapBuilder {
pub fn build(&self) -> PageBlockMap {
self.inner.clone()
}
pub fn location<T: AsRef<Location>>(&mut self, location: T) -> &mut Self {
self.inner.location = location.as_ref().clone();
self
}
pub fn zoom(&mut self, zoom: i64) -> &mut Self {
self.inner.zoom = zoom;
self
}
pub fn width(&mut self, width: i64) -> &mut Self {
self.inner.width = width;
self
}
pub fn height(&mut self, height: i64) -> &mut Self {
self.inner.height = height;
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
}
impl AsRef<PageBlockMap> for PageBlockMap {
fn as_ref(&self) -> &PageBlockMap {
self
}
}
impl AsRef<PageBlockMap> for RTDPageBlockMapBuilder {
fn as_ref(&self) -> &PageBlockMap {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockMathematicalExpression {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
expression: String,
}
impl RObject for PageBlockMathematicalExpression {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockMathematicalExpression"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockMathematicalExpression {}
impl PageBlockMathematicalExpression {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockMathematicalExpressionBuilder {
let inner = PageBlockMathematicalExpression {
td_name: "pageBlockMathematicalExpression".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockMathematicalExpressionBuilder { inner }
}
pub fn expression(&self) -> &String {
&self.expression
}
}
#[doc(hidden)]
pub struct RTDPageBlockMathematicalExpressionBuilder {
inner: PageBlockMathematicalExpression,
}
impl RTDPageBlockMathematicalExpressionBuilder {
pub fn build(&self) -> PageBlockMathematicalExpression {
self.inner.clone()
}
pub fn expression<T: AsRef<str>>(&mut self, expression: T) -> &mut Self {
self.inner.expression = expression.as_ref().to_string();
self
}
}
impl AsRef<PageBlockMathematicalExpression> for PageBlockMathematicalExpression {
fn as_ref(&self) -> &PageBlockMathematicalExpression {
self
}
}
impl AsRef<PageBlockMathematicalExpression> for RTDPageBlockMathematicalExpressionBuilder {
fn as_ref(&self) -> &PageBlockMathematicalExpression {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockParagraph {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
text: RichText,
}
impl RObject for PageBlockParagraph {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockParagraph"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockParagraph {}
impl PageBlockParagraph {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockParagraphBuilder {
let inner = PageBlockParagraph {
td_name: "pageBlockParagraph".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockParagraphBuilder { inner }
}
pub fn text(&self) -> &RichText {
&self.text
}
}
#[doc(hidden)]
pub struct RTDPageBlockParagraphBuilder {
inner: PageBlockParagraph,
}
impl RTDPageBlockParagraphBuilder {
pub fn build(&self) -> PageBlockParagraph {
self.inner.clone()
}
pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
self.inner.text = text.as_ref().clone();
self
}
}
impl AsRef<PageBlockParagraph> for PageBlockParagraph {
fn as_ref(&self) -> &PageBlockParagraph {
self
}
}
impl AsRef<PageBlockParagraph> for RTDPageBlockParagraphBuilder {
fn as_ref(&self) -> &PageBlockParagraph {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockPhoto {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
photo: Option<Photo>,
caption: Option<PageBlockCaption>,
url: String,
has_spoiler: bool,
}
impl RObject for PageBlockPhoto {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockPhoto"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockPhoto {}
impl PageBlockPhoto {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockPhotoBuilder {
let inner = PageBlockPhoto {
td_name: "pageBlockPhoto".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockPhotoBuilder { inner }
}
pub fn photo(&self) -> &Option<Photo> {
&self.photo
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
pub fn url(&self) -> &String {
&self.url
}
pub fn has_spoiler(&self) -> bool {
self.has_spoiler
}
}
#[doc(hidden)]
pub struct RTDPageBlockPhotoBuilder {
inner: PageBlockPhoto,
}
impl RTDPageBlockPhotoBuilder {
pub fn build(&self) -> PageBlockPhoto {
self.inner.clone()
}
pub fn photo<T: AsRef<Photo>>(&mut self, photo: T) -> &mut Self {
self.inner.photo = Some(photo.as_ref().clone());
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
self.inner.url = url.as_ref().to_string();
self
}
pub fn has_spoiler(&mut self, has_spoiler: bool) -> &mut Self {
self.inner.has_spoiler = has_spoiler;
self
}
}
impl AsRef<PageBlockPhoto> for PageBlockPhoto {
fn as_ref(&self) -> &PageBlockPhoto {
self
}
}
impl AsRef<PageBlockPhoto> for RTDPageBlockPhotoBuilder {
fn as_ref(&self) -> &PageBlockPhoto {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockPreformatted {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
text: RichText,
language: String,
}
impl RObject for PageBlockPreformatted {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockPreformatted"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockPreformatted {}
impl PageBlockPreformatted {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockPreformattedBuilder {
let inner = PageBlockPreformatted {
td_name: "pageBlockPreformatted".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockPreformattedBuilder { inner }
}
pub fn text(&self) -> &RichText {
&self.text
}
pub fn language(&self) -> &String {
&self.language
}
}
#[doc(hidden)]
pub struct RTDPageBlockPreformattedBuilder {
inner: PageBlockPreformatted,
}
impl RTDPageBlockPreformattedBuilder {
pub fn build(&self) -> PageBlockPreformatted {
self.inner.clone()
}
pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
self.inner.text = text.as_ref().clone();
self
}
pub fn language<T: AsRef<str>>(&mut self, language: T) -> &mut Self {
self.inner.language = language.as_ref().to_string();
self
}
}
impl AsRef<PageBlockPreformatted> for PageBlockPreformatted {
fn as_ref(&self) -> &PageBlockPreformatted {
self
}
}
impl AsRef<PageBlockPreformatted> for RTDPageBlockPreformattedBuilder {
fn as_ref(&self) -> &PageBlockPreformatted {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockPullQuote {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
text: RichText,
credit: Option<RichText>,
}
impl RObject for PageBlockPullQuote {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockPullQuote"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockPullQuote {}
impl PageBlockPullQuote {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockPullQuoteBuilder {
let inner = PageBlockPullQuote {
td_name: "pageBlockPullQuote".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockPullQuoteBuilder { inner }
}
pub fn text(&self) -> &RichText {
&self.text
}
pub fn credit(&self) -> &Option<RichText> {
&self.credit
}
}
#[doc(hidden)]
pub struct RTDPageBlockPullQuoteBuilder {
inner: PageBlockPullQuote,
}
impl RTDPageBlockPullQuoteBuilder {
pub fn build(&self) -> PageBlockPullQuote {
self.inner.clone()
}
pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
self.inner.text = text.as_ref().clone();
self
}
pub fn credit<T: AsRef<RichText>>(&mut self, credit: T) -> &mut Self {
self.inner.credit = Some(credit.as_ref().clone());
self
}
}
impl AsRef<PageBlockPullQuote> for PageBlockPullQuote {
fn as_ref(&self) -> &PageBlockPullQuote {
self
}
}
impl AsRef<PageBlockPullQuote> for RTDPageBlockPullQuoteBuilder {
fn as_ref(&self) -> &PageBlockPullQuote {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockRelatedArticles {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
header: RichText,
articles: Vec<PageBlockRelatedArticle>,
}
impl RObject for PageBlockRelatedArticles {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockRelatedArticles"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockRelatedArticles {}
impl PageBlockRelatedArticles {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockRelatedArticlesBuilder {
let inner = PageBlockRelatedArticles {
td_name: "pageBlockRelatedArticles".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockRelatedArticlesBuilder { inner }
}
pub fn header(&self) -> &RichText {
&self.header
}
pub fn articles(&self) -> &Vec<PageBlockRelatedArticle> {
&self.articles
}
}
#[doc(hidden)]
pub struct RTDPageBlockRelatedArticlesBuilder {
inner: PageBlockRelatedArticles,
}
impl RTDPageBlockRelatedArticlesBuilder {
pub fn build(&self) -> PageBlockRelatedArticles {
self.inner.clone()
}
pub fn header<T: AsRef<RichText>>(&mut self, header: T) -> &mut Self {
self.inner.header = header.as_ref().clone();
self
}
pub fn articles(&mut self, articles: Vec<PageBlockRelatedArticle>) -> &mut Self {
self.inner.articles = articles;
self
}
}
impl AsRef<PageBlockRelatedArticles> for PageBlockRelatedArticles {
fn as_ref(&self) -> &PageBlockRelatedArticles {
self
}
}
impl AsRef<PageBlockRelatedArticles> for RTDPageBlockRelatedArticlesBuilder {
fn as_ref(&self) -> &PageBlockRelatedArticles {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockSectionHeading {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
text: RichText,
size: i64,
}
impl RObject for PageBlockSectionHeading {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockSectionHeading"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockSectionHeading {}
impl PageBlockSectionHeading {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockSectionHeadingBuilder {
let inner = PageBlockSectionHeading {
td_name: "pageBlockSectionHeading".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockSectionHeadingBuilder { inner }
}
pub fn text(&self) -> &RichText {
&self.text
}
pub fn size(&self) -> i64 {
self.size
}
}
#[doc(hidden)]
pub struct RTDPageBlockSectionHeadingBuilder {
inner: PageBlockSectionHeading,
}
impl RTDPageBlockSectionHeadingBuilder {
pub fn build(&self) -> PageBlockSectionHeading {
self.inner.clone()
}
pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
self.inner.text = text.as_ref().clone();
self
}
pub fn size(&mut self, size: i64) -> &mut Self {
self.inner.size = size;
self
}
}
impl AsRef<PageBlockSectionHeading> for PageBlockSectionHeading {
fn as_ref(&self) -> &PageBlockSectionHeading {
self
}
}
impl AsRef<PageBlockSectionHeading> for RTDPageBlockSectionHeadingBuilder {
fn as_ref(&self) -> &PageBlockSectionHeading {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockSlideshow {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
blocks: Vec<PageBlock>,
caption: Option<PageBlockCaption>,
}
impl RObject for PageBlockSlideshow {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockSlideshow"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockSlideshow {}
impl PageBlockSlideshow {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockSlideshowBuilder {
let inner = PageBlockSlideshow {
td_name: "pageBlockSlideshow".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockSlideshowBuilder { inner }
}
pub fn blocks(&self) -> &Vec<PageBlock> {
&self.blocks
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
}
#[doc(hidden)]
pub struct RTDPageBlockSlideshowBuilder {
inner: PageBlockSlideshow,
}
impl RTDPageBlockSlideshowBuilder {
pub fn build(&self) -> PageBlockSlideshow {
self.inner.clone()
}
pub fn blocks(&mut self, blocks: Vec<PageBlock>) -> &mut Self {
self.inner.blocks = blocks;
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
}
impl AsRef<PageBlockSlideshow> for PageBlockSlideshow {
fn as_ref(&self) -> &PageBlockSlideshow {
self
}
}
impl AsRef<PageBlockSlideshow> for RTDPageBlockSlideshowBuilder {
fn as_ref(&self) -> &PageBlockSlideshow {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockSubheader {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
subheader: RichText,
}
impl RObject for PageBlockSubheader {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockSubheader"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockSubheader {}
impl PageBlockSubheader {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockSubheaderBuilder {
let inner = PageBlockSubheader {
td_name: "pageBlockSubheader".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockSubheaderBuilder { inner }
}
pub fn subheader(&self) -> &RichText {
&self.subheader
}
}
#[doc(hidden)]
pub struct RTDPageBlockSubheaderBuilder {
inner: PageBlockSubheader,
}
impl RTDPageBlockSubheaderBuilder {
pub fn build(&self) -> PageBlockSubheader {
self.inner.clone()
}
pub fn subheader<T: AsRef<RichText>>(&mut self, subheader: T) -> &mut Self {
self.inner.subheader = subheader.as_ref().clone();
self
}
}
impl AsRef<PageBlockSubheader> for PageBlockSubheader {
fn as_ref(&self) -> &PageBlockSubheader {
self
}
}
impl AsRef<PageBlockSubheader> for RTDPageBlockSubheaderBuilder {
fn as_ref(&self) -> &PageBlockSubheader {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockSubtitle {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
subtitle: RichText,
}
impl RObject for PageBlockSubtitle {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockSubtitle"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockSubtitle {}
impl PageBlockSubtitle {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockSubtitleBuilder {
let inner = PageBlockSubtitle {
td_name: "pageBlockSubtitle".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockSubtitleBuilder { inner }
}
pub fn subtitle(&self) -> &RichText {
&self.subtitle
}
}
#[doc(hidden)]
pub struct RTDPageBlockSubtitleBuilder {
inner: PageBlockSubtitle,
}
impl RTDPageBlockSubtitleBuilder {
pub fn build(&self) -> PageBlockSubtitle {
self.inner.clone()
}
pub fn subtitle<T: AsRef<RichText>>(&mut self, subtitle: T) -> &mut Self {
self.inner.subtitle = subtitle.as_ref().clone();
self
}
}
impl AsRef<PageBlockSubtitle> for PageBlockSubtitle {
fn as_ref(&self) -> &PageBlockSubtitle {
self
}
}
impl AsRef<PageBlockSubtitle> for RTDPageBlockSubtitleBuilder {
fn as_ref(&self) -> &PageBlockSubtitle {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockTable {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
caption: Option<RichText>,
cells: Vec<Vec<PageBlockTableCell>>,
is_bordered: bool,
is_striped: bool,
is_compact: bool,
}
impl RObject for PageBlockTable {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockTable"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockTable {}
impl PageBlockTable {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockTableBuilder {
let inner = PageBlockTable {
td_name: "pageBlockTable".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockTableBuilder { inner }
}
pub fn caption(&self) -> &Option<RichText> {
&self.caption
}
pub fn cells(&self) -> &Vec<Vec<PageBlockTableCell>> {
&self.cells
}
pub fn is_bordered(&self) -> bool {
self.is_bordered
}
pub fn is_striped(&self) -> bool {
self.is_striped
}
pub fn is_compact(&self) -> bool {
self.is_compact
}
}
#[doc(hidden)]
pub struct RTDPageBlockTableBuilder {
inner: PageBlockTable,
}
impl RTDPageBlockTableBuilder {
pub fn build(&self) -> PageBlockTable {
self.inner.clone()
}
pub fn caption<T: AsRef<RichText>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
pub fn cells(&mut self, cells: Vec<Vec<PageBlockTableCell>>) -> &mut Self {
self.inner.cells = cells;
self
}
pub fn is_bordered(&mut self, is_bordered: bool) -> &mut Self {
self.inner.is_bordered = is_bordered;
self
}
pub fn is_striped(&mut self, is_striped: bool) -> &mut Self {
self.inner.is_striped = is_striped;
self
}
pub fn is_compact(&mut self, is_compact: bool) -> &mut Self {
self.inner.is_compact = is_compact;
self
}
}
impl AsRef<PageBlockTable> for PageBlockTable {
fn as_ref(&self) -> &PageBlockTable {
self
}
}
impl AsRef<PageBlockTable> for RTDPageBlockTableBuilder {
fn as_ref(&self) -> &PageBlockTable {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockThinking {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
text: RichText,
}
impl RObject for PageBlockThinking {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockThinking"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockThinking {}
impl PageBlockThinking {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockThinkingBuilder {
let inner = PageBlockThinking {
td_name: "pageBlockThinking".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockThinkingBuilder { inner }
}
pub fn text(&self) -> &RichText {
&self.text
}
}
#[doc(hidden)]
pub struct RTDPageBlockThinkingBuilder {
inner: PageBlockThinking,
}
impl RTDPageBlockThinkingBuilder {
pub fn build(&self) -> PageBlockThinking {
self.inner.clone()
}
pub fn text<T: AsRef<RichText>>(&mut self, text: T) -> &mut Self {
self.inner.text = text.as_ref().clone();
self
}
}
impl AsRef<PageBlockThinking> for PageBlockThinking {
fn as_ref(&self) -> &PageBlockThinking {
self
}
}
impl AsRef<PageBlockThinking> for RTDPageBlockThinkingBuilder {
fn as_ref(&self) -> &PageBlockThinking {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockTitle {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
title: RichText,
}
impl RObject for PageBlockTitle {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockTitle"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockTitle {}
impl PageBlockTitle {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockTitleBuilder {
let inner = PageBlockTitle {
td_name: "pageBlockTitle".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockTitleBuilder { inner }
}
pub fn title(&self) -> &RichText {
&self.title
}
}
#[doc(hidden)]
pub struct RTDPageBlockTitleBuilder {
inner: PageBlockTitle,
}
impl RTDPageBlockTitleBuilder {
pub fn build(&self) -> PageBlockTitle {
self.inner.clone()
}
pub fn title<T: AsRef<RichText>>(&mut self, title: T) -> &mut Self {
self.inner.title = title.as_ref().clone();
self
}
}
impl AsRef<PageBlockTitle> for PageBlockTitle {
fn as_ref(&self) -> &PageBlockTitle {
self
}
}
impl AsRef<PageBlockTitle> for RTDPageBlockTitleBuilder {
fn as_ref(&self) -> &PageBlockTitle {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockUnsupported {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
}
impl RObject for PageBlockUnsupported {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockUnsupported"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockUnsupported {}
impl PageBlockUnsupported {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockUnsupportedBuilder {
let inner = PageBlockUnsupported {
td_name: "pageBlockUnsupported".to_string(),
extra: Some(Uuid::new_v4().to_string()),
};
RTDPageBlockUnsupportedBuilder { inner }
}
}
#[doc(hidden)]
pub struct RTDPageBlockUnsupportedBuilder {
inner: PageBlockUnsupported,
}
impl RTDPageBlockUnsupportedBuilder {
pub fn build(&self) -> PageBlockUnsupported {
self.inner.clone()
}
}
impl AsRef<PageBlockUnsupported> for PageBlockUnsupported {
fn as_ref(&self) -> &PageBlockUnsupported {
self
}
}
impl AsRef<PageBlockUnsupported> for RTDPageBlockUnsupportedBuilder {
fn as_ref(&self) -> &PageBlockUnsupported {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockVideo {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
video: Option<Video>,
caption: Option<PageBlockCaption>,
need_autoplay: bool,
is_looped: bool,
has_spoiler: bool,
}
impl RObject for PageBlockVideo {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockVideo"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockVideo {}
impl PageBlockVideo {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockVideoBuilder {
let inner = PageBlockVideo {
td_name: "pageBlockVideo".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockVideoBuilder { inner }
}
pub fn video(&self) -> &Option<Video> {
&self.video
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
pub fn need_autoplay(&self) -> bool {
self.need_autoplay
}
pub fn is_looped(&self) -> bool {
self.is_looped
}
pub fn has_spoiler(&self) -> bool {
self.has_spoiler
}
}
#[doc(hidden)]
pub struct RTDPageBlockVideoBuilder {
inner: PageBlockVideo,
}
impl RTDPageBlockVideoBuilder {
pub fn build(&self) -> PageBlockVideo {
self.inner.clone()
}
pub fn video<T: AsRef<Video>>(&mut self, video: T) -> &mut Self {
self.inner.video = Some(video.as_ref().clone());
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
pub fn need_autoplay(&mut self, need_autoplay: bool) -> &mut Self {
self.inner.need_autoplay = need_autoplay;
self
}
pub fn is_looped(&mut self, is_looped: bool) -> &mut Self {
self.inner.is_looped = is_looped;
self
}
pub fn has_spoiler(&mut self, has_spoiler: bool) -> &mut Self {
self.inner.has_spoiler = has_spoiler;
self
}
}
impl AsRef<PageBlockVideo> for PageBlockVideo {
fn as_ref(&self) -> &PageBlockVideo {
self
}
}
impl AsRef<PageBlockVideo> for RTDPageBlockVideoBuilder {
fn as_ref(&self) -> &PageBlockVideo {
&self.inner
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PageBlockVoiceNote {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
voice_note: VoiceNote,
caption: Option<PageBlockCaption>,
}
impl RObject for PageBlockVoiceNote {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"pageBlockVoiceNote"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl TDPageBlock for PageBlockVoiceNote {}
impl PageBlockVoiceNote {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDPageBlockVoiceNoteBuilder {
let inner = PageBlockVoiceNote {
td_name: "pageBlockVoiceNote".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDPageBlockVoiceNoteBuilder { inner }
}
pub fn voice_note(&self) -> &VoiceNote {
&self.voice_note
}
pub fn caption(&self) -> &Option<PageBlockCaption> {
&self.caption
}
}
#[doc(hidden)]
pub struct RTDPageBlockVoiceNoteBuilder {
inner: PageBlockVoiceNote,
}
impl RTDPageBlockVoiceNoteBuilder {
pub fn build(&self) -> PageBlockVoiceNote {
self.inner.clone()
}
pub fn voice_note<T: AsRef<VoiceNote>>(&mut self, voice_note: T) -> &mut Self {
self.inner.voice_note = voice_note.as_ref().clone();
self
}
pub fn caption<T: AsRef<PageBlockCaption>>(&mut self, caption: T) -> &mut Self {
self.inner.caption = Some(caption.as_ref().clone());
self
}
}
impl AsRef<PageBlockVoiceNote> for PageBlockVoiceNote {
fn as_ref(&self) -> &PageBlockVoiceNote {
self
}
}
impl AsRef<PageBlockVoiceNote> for RTDPageBlockVoiceNoteBuilder {
fn as_ref(&self) -> &PageBlockVoiceNote {
&self.inner
}
}