aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
diff options
context:
space:
mode:
authorGravatar Brett Spradling <bspradling@godaddy.com> 2021-05-16 07:54:31 -0700
committerGravatar Brett Spradling <bspradling@godaddy.com> 2021-05-16 22:17:54 -0700
commit2abfa7ef1e5ec11de44ec2c59fb0f0980c6e4908 (patch)
tree1d16229bad209fa9acbcbfc595672999df6d688e /src/models.rs
parente1005f715bde3fb260d97a1a08e3e1de358471d6 (diff)
downloadnotion-2abfa7ef1e5ec11de44ec2c59fb0f0980c6e4908.tar.gz
notion-2abfa7ef1e5ec11de44ec2c59fb0f0980c6e4908.tar.zst
notion-2abfa7ef1e5ec11de44ec2c59fb0f0980c6e4908.zip
generic block
Diffstat (limited to 'src/models.rs')
-rw-r--r--src/models.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/models.rs b/src/models.rs
index ba98094..142a6da 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -168,17 +168,38 @@ impl Display for BlockId {
}
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
+#[serde(rename_all = "snake_case")]
+pub enum BlockType {
+ Paragraph,
+ Heading1,
+ Heading2,
+ Heading3,
+ BulletedListItem,
+ NumberedListItem,
+ ToDo,
+ Toggle,
+ ChildPage,
+ Unsupported
+}
+
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct Block {
id: BlockId,
+ r#type: BlockType,
created_time: DateTime<Utc>,
last_edited_time: DateTime<Utc>,
has_children: bool,
}
-#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
+
+#[derive(Eq, Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(tag = "object")]
#[serde(rename_all = "snake_case")]
pub enum Object {
+ Block {
+ #[serde(flatten)]
+ block: Block
+ },
Database {
#[serde(flatten)]
database: Database,
@@ -195,7 +216,6 @@ pub enum Object {
#[serde(flatten)]
user: User,
},
- Block {},
}
impl Object {