aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
diff options
context:
space:
mode:
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 {