aboutsummaryrefslogtreecommitdiff
path: root/src/models/mod.rs
diff options
context:
space:
mode:
authorGravatar Ivy Pierlot <ivyp@outlook.com.au> 2024-08-13 10:31:32 +1000
committerGravatar GitHub <noreply@github.com> 2024-08-12 17:31:32 -0700
commit82e8aff5e9c12080219b8ea267c128a831775956 (patch)
treea28fa158e4f5d1029941a60a5b972be6075538b7 /src/models/mod.rs
parent1ba9846bad1d5c927e0d7658a59097992ef56b60 (diff)
downloadnotion-82e8aff5e9c12080219b8ea267c128a831775956.tar.gz
notion-82e8aff5e9c12080219b8ea267c128a831775956.tar.zst
notion-82e8aff5e9c12080219b8ea267c128a831775956.zip
add new props (#66)
Diffstat (limited to 'src/models/mod.rs')
-rw-r--r--src/models/mod.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/models/mod.rs b/src/models/mod.rs
index 795accd..be920fe 100644
--- a/src/models/mod.rs
+++ b/src/models/mod.rs
@@ -11,11 +11,13 @@ pub mod users;
use crate::models::properties::{PropertyConfiguration, PropertyValue};
use crate::models::text::RichText;
use crate::Error;
+use block::ExternalFileObject;
use serde::{Deserialize, Serialize};
+use serde_json::Value;
use std::collections::HashMap;
use crate::ids::{AsIdentifier, DatabaseId, PageId};
-use crate::models::block::{Block, CreateBlock};
+use crate::models::block::{Block, CreateBlock, FileObject};
use crate::models::error::ErrorResponse;
use crate::models::paging::PagingCursor;
use crate::models::users::User;
@@ -48,9 +50,26 @@ pub struct Database {
//
// value object
// A Property object.
+ pub icon: Option<IconObject>,
pub properties: HashMap<String, PropertyConfiguration>,
}
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
+#[serde(tag = "type")]
+#[serde(rename_all = "snake_case")]
+pub enum IconObject {
+ File {
+ #[serde(flatten)]
+ file: FileObject,
+ },
+ External {
+ external: ExternalFileObject,
+ },
+ Emoji {
+ emoji: String,
+ },
+}
+
impl AsIdentifier<DatabaseId> for Database {
fn as_id(&self) -> &DatabaseId {
&self.id
@@ -200,6 +219,7 @@ pub struct Page {
/// The archived status of the page.
pub archived: bool,
pub properties: Properties,
+ pub icon: Option<IconObject>,
pub parent: Parent,
}