feat: implemented missing data types
This commit is contained in:
parent
43a48f6655
commit
5df6d0f7d9
1 changed files with 118 additions and 15 deletions
133
src/lib.rs
133
src/lib.rs
|
|
@ -801,7 +801,7 @@ pub enum DatabaseProperty {
|
|||
Relation {
|
||||
id: String,
|
||||
name: String,
|
||||
// relation: Relation,
|
||||
relation: DatabaseRelation,
|
||||
},
|
||||
RichText {
|
||||
id: String,
|
||||
|
|
@ -810,7 +810,11 @@ pub enum DatabaseProperty {
|
|||
Rollup {
|
||||
id: String,
|
||||
name: String,
|
||||
// TODO: Implement Rollup
|
||||
function: RollupFunction,
|
||||
relation_property_id: String,
|
||||
relation_property_name: String,
|
||||
rollup_property_id: String,
|
||||
rollup_property_name: String,
|
||||
},
|
||||
Select {
|
||||
id: String,
|
||||
|
|
@ -820,7 +824,7 @@ pub enum DatabaseProperty {
|
|||
Status {
|
||||
id: String,
|
||||
name: String,
|
||||
// TODO: Implement Status
|
||||
options: DatabaseSelectOptions,
|
||||
},
|
||||
Title {
|
||||
id: String,
|
||||
|
|
@ -927,16 +931,101 @@ where
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub struct Number {
|
||||
// TODO: Implement NumberFormat
|
||||
// pub format: NumberFormat
|
||||
pub format: NumberFormat,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub enum NumberFormat {
|
||||
ArgentinePeso,
|
||||
Baht,
|
||||
AustralianDollar,
|
||||
CanadianDollar,
|
||||
ChileanPeso,
|
||||
ColombianPeso,
|
||||
DanishKrone,
|
||||
Dirham,
|
||||
Dollar,
|
||||
Euro,
|
||||
Forint,
|
||||
Franc,
|
||||
HongKongDollar,
|
||||
Koruna,
|
||||
Krona,
|
||||
Leu,
|
||||
Lira,
|
||||
MexicanPeso,
|
||||
NewTaiwanDollar,
|
||||
NewZealandDollar,
|
||||
NorwegianKrone,
|
||||
Number,
|
||||
NumberWithCommas,
|
||||
Percent,
|
||||
PhilippinePeso,
|
||||
Pound,
|
||||
PeruvianSol,
|
||||
Rand,
|
||||
Real,
|
||||
Ringgit,
|
||||
Riyal,
|
||||
Ruble,
|
||||
Rupee,
|
||||
Rupiah,
|
||||
Shekel,
|
||||
SingaporeDollar,
|
||||
UruguayanPeso,
|
||||
Yen,
|
||||
Yuan,
|
||||
Won,
|
||||
Zloty,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub struct DatabaseRelation {
|
||||
database_id: String,
|
||||
synced_property_name: String,
|
||||
synced_property_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub struct Relation {
|
||||
// #[serde(alias = "database_id")]
|
||||
// id: String,
|
||||
// synced_property_name: String,
|
||||
// synced_property_id: String,
|
||||
id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub enum RollupFunction {
|
||||
Average,
|
||||
Checked,
|
||||
CountPerGroup,
|
||||
Count,
|
||||
CountValues,
|
||||
DateRange,
|
||||
EarliestDate,
|
||||
Empty,
|
||||
LatestDate,
|
||||
Max,
|
||||
Median,
|
||||
Min,
|
||||
NotEmpty,
|
||||
PercentChecked,
|
||||
PercentEmpty,
|
||||
PercentNotEmpty,
|
||||
PercentPerGroup,
|
||||
PercentUnchecked,
|
||||
Range,
|
||||
Unchecked,
|
||||
Unique,
|
||||
ShowOriginal,
|
||||
ShowUnique,
|
||||
Sum,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub enum RollupValue {
|
||||
Array,
|
||||
Date,
|
||||
Incomplete,
|
||||
Number,
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
// TODO: Paginate all possible responses
|
||||
|
|
@ -1022,7 +1111,8 @@ pub enum Property {
|
|||
},
|
||||
LastEditedBy {
|
||||
id: String,
|
||||
}, // TODO: Implement LastEditedBy
|
||||
last_edited_by: User,
|
||||
},
|
||||
LastEditedTime {
|
||||
id: String,
|
||||
last_edited_time: DateValue,
|
||||
|
|
@ -1047,18 +1137,23 @@ pub enum Property {
|
|||
},
|
||||
Relation {
|
||||
id: String,
|
||||
// relation: Vec<Relation>,
|
||||
has_more: bool,
|
||||
relation: Vec<Relation>,
|
||||
},
|
||||
Rollup {
|
||||
id: String,
|
||||
}, // TODO: Implement Rollup
|
||||
function: RollupFunction,
|
||||
// TODO: This will not parse properly and needs custom deserializer code
|
||||
value: RollupValue,
|
||||
},
|
||||
RichText {
|
||||
id: String,
|
||||
rich_text: Vec<RichText>,
|
||||
},
|
||||
Status {
|
||||
id: String,
|
||||
}, // TODO: Implement Status
|
||||
status: SelectOption,
|
||||
},
|
||||
Title {
|
||||
id: String,
|
||||
title: Vec<RichText>,
|
||||
|
|
@ -1068,7 +1163,10 @@ pub enum Property {
|
|||
url: Option<String>,
|
||||
},
|
||||
Verification {
|
||||
id: String, // TODO: Implement
|
||||
id: String,
|
||||
state: VerificationState,
|
||||
verified_by: Option<User>,
|
||||
date: Option<Date>,
|
||||
},
|
||||
UniqueId {
|
||||
id: String,
|
||||
|
|
@ -1191,6 +1289,11 @@ where
|
|||
})
|
||||
.collect::<HashMap<String, Property>>())
|
||||
}
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub enum VerificationState {
|
||||
Verified,
|
||||
Unverified,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(tag = "type")]
|
||||
|
|
@ -1355,7 +1458,7 @@ pub struct PartialBlock {
|
|||
pub struct Date {
|
||||
pub start: DateValue,
|
||||
pub end: Option<DateValue>,
|
||||
// TODO: Implement for setting
|
||||
// TODO: Implement for updating with timezone in the future?
|
||||
pub time_zone: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue