aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
diff options
context:
space:
mode:
authorGravatar Brett Spradling <bspradling@godaddy.com> 2021-05-16 22:59:08 -0700
committerGravatar Brett Spradling <bspradling@godaddy.com> 2021-05-16 23:04:09 -0700
commitc33ac6632869048d1b904ef3891fd54ab2cf70f2 (patch)
tree5419fa9913179537a8c9a8cd67a4555e3b65d3ee /src/models.rs
parentadf612dc81fbfe347c3dd67ebcfb23eab9dbdff5 (diff)
downloadnotion-feature/block-children.tar.gz
notion-feature/block-children.tar.zst
notion-feature/block-children.zip
Diffstat (limited to 'src/models.rs')
-rw-r--r--src/models.rs56
1 files changed, 39 insertions, 17 deletions
diff --git a/src/models.rs b/src/models.rs
index 9f2cd14..8f4cd17 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -147,7 +147,7 @@ pub enum BlockType {
ToDo,
Toggle,
ChildPage,
- Unsupported
+ Unsupported,
}
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
@@ -188,21 +188,21 @@ pub enum Block {
Paragraph {
#[serde(flatten)]
common: BlockCommon,
- paragraph: TextAndChildren
+ paragraph: TextAndChildren,
},
- #[serde(rename="heading_1")]
+ #[serde(rename = "heading_1")]
Heading1 {
#[serde(flatten)]
common: BlockCommon,
heading_1: Text,
},
- #[serde(rename="heading_2")]
+ #[serde(rename = "heading_2")]
Heading2 {
#[serde(flatten)]
common: BlockCommon,
heading_2: Text,
},
- #[serde(rename="heading_3")]
+ #[serde(rename = "heading_3")]
Heading3 {
#[serde(flatten)]
common: BlockCommon,
@@ -233,7 +233,7 @@ pub enum Block {
common: BlockCommon,
child_page: ChildPageFields,
},
- Unsupported {}
+ Unsupported {},
}
impl Identifiable for Block {
@@ -241,18 +241,40 @@ impl Identifiable for Block {
fn id(&self) -> &Self::Type {
match self {
- Block::Paragraph { common, paragraph: _ } => &common.id,
- Block::Heading1 { common, heading_1: _} => &common.id,
- Block::Heading2 { common, heading_2: _} => &common.id,
- Block::Heading3 { common, heading_3: _} => &common.id,
- Block::BulletedListItem { common, bulleted_list_item: _} => &common.id,
- Block::NumberedListItem { common, numbered_list_item: _} => &common.id,
+ Block::Paragraph {
+ common,
+ paragraph: _,
+ } => &common.id,
+ Block::Heading1 {
+ common,
+ heading_1: _,
+ } => &common.id,
+ Block::Heading2 {
+ common,
+ heading_2: _,
+ } => &common.id,
+ Block::Heading3 {
+ common,
+ heading_3: _,
+ } => &common.id,
+ Block::BulletedListItem {
+ common,
+ bulleted_list_item: _,
+ } => &common.id,
+ Block::NumberedListItem {
+ common,
+ numbered_list_item: _,
+ } => &common.id,
Block::ToDo { common, to_do: _ } => &common.id,
- Block::Toggle { common, toggle: _} => &common.id,
- Block::ChildPage { common, child_page: _} => &common.id,
- Block::Unsupported {} => { panic!("Trying to reference identifier for unsupported block!") }
+ Block::Toggle { common, toggle: _ } => &common.id,
+ Block::ChildPage {
+ common,
+ child_page: _,
+ } => &common.id,
+ Block::Unsupported {} => {
+ panic!("Trying to reference identifier for unsupported block!")
+ }
}
-
}
}
@@ -270,7 +292,7 @@ impl Identifiable for Page {
pub enum Object {
Block {
#[serde(flatten)]
- block: Block
+ block: Block,
},
Database {
#[serde(flatten)]