From 82e8aff5e9c12080219b8ea267c128a831775956 Mon Sep 17 00:00:00 2001 From: Ivy Pierlot Date: Tue, 13 Aug 2024 10:31:32 +1000 Subject: add new props (#66) --- src/models/mod.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/models/mod.rs') 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, pub properties: HashMap, } +#[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 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, pub parent: Parent, } -- cgit v1.2.3