aboutsummaryrefslogtreecommitdiff
path: root/src/models/text.rs
diff options
context:
space:
mode:
authorGravatar Jake Swenson <jake@jakeswenson.com> 2021-05-15 09:23:32 -0700
committerGravatar Jake Swenson <jake@jakeswenson.com> 2021-05-15 09:23:32 -0700
commitd18843ab949e803e25c48f514b4e25244477c731 (patch)
tree7330e16f6228b990cee0ad58c74fafeaeaaa59c8 /src/models/text.rs
parentd11ac3c9ba709eb4a0691224601088252e49b61d (diff)
downloadnotion-d18843ab949e803e25c48f514b4e25244477c731.tar.gz
notion-d18843ab949e803e25c48f514b4e25244477c731.tar.zst
notion-d18843ab949e803e25c48f514b4e25244477c731.zip
pages
Diffstat (limited to 'src/models/text.rs')
-rw-r--r--src/models/text.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/models/text.rs b/src/models/text.rs
index 0baf183..a10007d 100644
--- a/src/models/text.rs
+++ b/src/models/text.rs
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
-#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Copy, Clone)]
#[serde(rename_all = "snake_case")]
pub enum TextColor {
Default,
@@ -26,23 +26,23 @@ pub enum TextColor {
/// Rich text annotations
/// See https://developers.notion.com/reference/rich-text#annotations
-#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
struct Annotations {
- bold: bool,
- code: bool,
- color: TextColor,
- italic: bool,
- strikethrough: bool,
- underline: bool,
+ bold: Option<bool>,
+ code: Option<bool>,
+ color: Option<TextColor>,
+ italic: Option<bool>,
+ strikethrough: Option<bool>,
+ underline: Option<bool>,
}
/// Properties common on all rich text objects
/// See https://developers.notion.com/reference/rich-text#all-rich-text
-#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct RichTextCommon {
plain_text: String,
href: Option<String>,
- annotations: Annotations,
+ annotations: Option<Annotations>,
}
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
@@ -50,13 +50,17 @@ pub struct Link {
url: String,
}
-#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct Text {
content: String,
link: Option<String>,
}
-#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
+/// Rich text objects contain data for displaying formatted text, mentions, and equations.
+/// A rich text object also contains annotations for style information.
+/// Arrays of rich text objects are used within property objects and property
+/// value objects to create what a user sees as a single text value in Notion.
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum RichText {