From c13ee32911ab0bbab2fee261bbd6e071e602eb05 Mon Sep 17 00:00:00 2001 From: Bram Dingelstad Date: Sat, 15 Mar 2025 22:16:17 +0100 Subject: [PATCH] feat: added captions, plain_text() method for RichText fix: disabled certain properties that caused problems during parsing --- src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a20b378..800e700 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1114,7 +1114,7 @@ pub struct QueryResponse { pub has_more: Option, pub next_cursor: Option, pub results: Vec, - pub page_or_database: Value, + // pub page_or_database: Value, } #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] @@ -1501,6 +1501,19 @@ pub enum RichText { Unsupported, } +impl RichText { + pub fn plain_text(&self) -> String { + use RichText::*; + match self { + Text { plain_text, .. } | Mention { plain_text, .. } | Equation { plain_text, .. } => { + plain_text + } + Unsupported => "", + } + .to_string() + } +} + #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct Text { pub content: String, @@ -1687,6 +1700,7 @@ pub enum File { }, External { external: ExternalFile, + caption: Option>, }, #[serde(other)]