aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/models.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/models.rs b/src/models.rs
index 0007cfb..dd886ac 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -229,6 +229,12 @@ pub struct ChildPageFields {
}
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
+pub struct CodeFields {
+ pub text: Vec<RichText>,
+ pub language: String,
+}
+
+#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum Block {
@@ -280,6 +286,11 @@ pub enum Block {
common: BlockCommon,
child_page: ChildPageFields,
},
+ Code {
+ #[serde(flatten)]
+ common: BlockCommon,
+ code: CodeFields,
+ },
#[serde(other)]
Unsupported,
}
@@ -296,7 +307,8 @@ impl AsIdentifier<BlockId> for Block {
| NumberedListItem { common, .. }
| ToDo { common, .. }
| Toggle { common, .. }
- | ChildPage { common, .. } => &common.id,
+ | ChildPage { common, .. }
+ | Code { common, .. } => &common.id,
Unsupported {} => {
panic!("Trying to reference identifier for unsupported block!")
}