feat: made unrecognized enum values default to a "Unsupported" value

This commit is contained in:
Bram Dingelstad 2024-11-17 14:28:31 +01:00
parent ec6c8c789a
commit cb2295e780

View file

@ -691,6 +691,9 @@ pub enum CodeLanguage {
YAML,
#[serde(rename = "java/c/c++/c#")]
JavaCCppCSharp,
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
@ -1200,10 +1203,21 @@ where
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum Formula {
Boolean { boolean: Option<bool> },
Date { date: Option<Date> },
Number { number: Option<f32> },
String { string: Option<String> },
Boolean {
boolean: Option<bool>,
},
Date {
date: Option<Date>,
},
Number {
number: Option<f32>,
},
String {
string: Option<String>,
},
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
@ -1257,6 +1271,9 @@ pub enum RichText {
href: Option<String>,
annotations: Annotations,
},
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
@ -1269,11 +1286,24 @@ pub struct Text {
#[serde(tag = "type")]
#[serde(rename_all = "lowercase")]
pub enum Mention {
Database { database: PartialDatabase },
Date { date: Date },
LinkPreview { link_preview: LinkPreview },
Page { page: PartialPage },
User { user: PartialUser },
Database {
database: PartialDatabase,
},
Date {
date: Date,
},
LinkPreview {
link_preview: LinkPreview,
},
Page {
page: PartialPage,
},
User {
user: PartialUser,
},
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
@ -1399,33 +1429,60 @@ pub enum Color {
PurpleBackground,
PinkBackground,
RedBackground,
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
pub enum Parent {
PageId { page_id: String },
DatabaseId { database_id: String },
BlockId { block_id: String },
PageId {
page_id: String,
},
DatabaseId {
database_id: String,
},
BlockId {
block_id: String,
},
Workspace,
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(tag = "type")]
#[serde(rename_all = "lowercase")]
pub enum File {
File { file: NotionFile },
External { external: ExternalFile },
File {
file: NotionFile,
},
External {
external: ExternalFile,
},
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(tag = "type")]
#[serde(rename_all = "lowercase")]
pub enum Icon {
Emoji { emoji: String },
File { file: NotionFile },
External { external: ExternalFile },
Emoji {
emoji: String,
},
File {
file: NotionFile,
},
External {
external: ExternalFile,
},
#[serde(other)]
Unsupported,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
@ -1446,4 +1503,7 @@ pub enum DatabaseFormulaType {
Date,
Number,
String,
#[serde(other)]
Unsupported,
}