diff options
author | 2024-08-13 10:31:32 +1000 | |
---|---|---|
committer | 2024-08-12 17:31:32 -0700 | |
commit | 82e8aff5e9c12080219b8ea267c128a831775956 (patch) | |
tree | a28fa158e4f5d1029941a60a5b972be6075538b7 /src/models/mod.rs | |
parent | 1ba9846bad1d5c927e0d7658a59097992ef56b60 (diff) | |
download | notion-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.rs | 22 |
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, } |