1use std::collections::BTreeMap;
2
3use monostate::MustBe;
4use serde::{Deserialize, Serialize};
5
6use crate::misc::{Icon, NotionFile, Property};
7use crate::object::{Object, ObjectCommon};
8
9#[derive(Serialize, Deserialize, Debug, Clone)]
13pub struct Page {
14 object: MustBe!("page"),
15
16 #[serde(flatten)]
17 pub obj: ObjectCommon,
18
19 pub properties: BTreeMap<String, Property>,
20 pub url: String,
21
22 pub public_url: Option<String>,
23 pub icon: Option<Icon>,
24 pub cover: Option<NotionFile>,
25}
26
27impl Object for Page {
28 fn id(&self) -> &str {
29 &self.obj.id
30 }
31
32 fn object_type(&self) -> crate::object::ObjectType {
33 crate::object::ObjectType::Page
34 }
35}