diff options
author | 2021-05-23 10:31:38 -0700 | |
---|---|---|
committer | 2021-05-23 10:31:38 -0700 | |
commit | 9d5b84b88ddc2b7de1bc0f03d9026eb52e8976ac (patch) | |
tree | 735b1031148d4cddfa1a0e01f52b02e23e94f9cb /src/models | |
parent | 4cffa16633f83b6604f7ce3de47d40a29e6a9b54 (diff) | |
download | notion-9d5b84b88ddc2b7de1bc0f03d9026eb52e8976ac.tar.gz notion-9d5b84b88ddc2b7de1bc0f03d9026eb52e8976ac.tar.zst notion-9d5b84b88ddc2b7de1bc0f03d9026eb52e8976ac.zip |
Add initial todo example (#13)
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/search.rs | 9 | ||||
-rw-r--r-- | src/models/text.rs | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/models/search.rs b/src/models/search.rs index 6de3c8a..ffcac1d 100644 --- a/src/models/search.rs +++ b/src/models/search.rs @@ -310,6 +310,15 @@ pub enum NotionSearch { }, } +impl NotionSearch { + pub fn filter_by_databases() -> Self { + Self::Filter { + property: FilterProperty::Object, + value: FilterValue::Database, + } + } +} + impl From<NotionSearch> for SearchRequest { fn from(search: NotionSearch) -> Self { match search { diff --git a/src/models/text.rs b/src/models/text.rs index a10007d..f7ea2b6 100644 --- a/src/models/text.rs +++ b/src/models/text.rs @@ -81,3 +81,14 @@ pub enum RichText { rich_text: RichTextCommon, }, } + +impl RichText { + pub fn plain_text(&self) -> &str { + use RichText::*; + match self { + Text { rich_text, .. } | Mention { rich_text, .. } | Equation { rich_text, .. } => { + &rich_text.plain_text + } + } + } +} |