feat: added captions, plain_text() method for RichText
fix: disabled certain properties that caused problems during parsing
This commit is contained in:
parent
43e5fc6005
commit
c13ee32911
1 changed files with 15 additions and 1 deletions
16
src/lib.rs
16
src/lib.rs
|
|
@ -1114,7 +1114,7 @@ pub struct QueryResponse<T> {
|
|||
pub has_more: Option<bool>,
|
||||
pub next_cursor: Option<String>,
|
||||
pub results: Vec<T>,
|
||||
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<Vec<RichText>>,
|
||||
},
|
||||
|
||||
#[serde(other)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue