aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
diff options
context:
space:
mode:
authorGravatar Brett Spradling <bspradling@godaddy.com> 2021-05-15 23:55:19 -0700
committerGravatar Brett Spradling <bspradling@godaddy.com> 2021-05-16 22:17:54 -0700
commite1005f715bde3fb260d97a1a08e3e1de358471d6 (patch)
treee4d8baeb42d9fd74699aec99c9804aa67571f4db /src/models.rs
parenta2dc79a5079d6286ebd148cf25a00e5dd013efdc (diff)
downloadnotion-e1005f715bde3fb260d97a1a08e3e1de358471d6.tar.gz
notion-e1005f715bde3fb260d97a1a08e3e1de358471d6.tar.zst
notion-e1005f715bde3fb260d97a1a08e3e1de358471d6.zip
wip
Diffstat (limited to 'src/models.rs')
-rw-r--r--src/models.rs39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/models.rs b/src/models.rs
index f0909d9..ba98094 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -135,8 +135,45 @@ pub struct Page {
parent: Parent,
}
+impl Identifiable for String {
+ type Type = String;
+
+ fn id(&self) -> &Self::Type {
+ self
+ }
+}
+
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Hash, Clone)]
+#[serde(transparent)]
+pub struct BlockId(String);
+
+impl BlockId {
+ pub fn id(&self) -> &str {
+ &self.0
+ }
+}
+
+impl Identifiable for BlockId {
+ type Type = BlockId;
+
+ fn id(&self) -> &Self::Type {
+ self
+ }
+}
+
+impl Display for BlockId {
+ fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+ self.0.fmt(f)
+ }
+}
+
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
-pub struct Block {}
+pub struct Block {
+ id: BlockId,
+ created_time: DateTime<Utc>,
+ last_edited_time: DateTime<Utc>,
+ has_children: bool,
+}
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
#[serde(tag = "object")]