From 4aba36c0a554e2b37b086717864fa9ae3292aec0 Mon Sep 17 00:00:00 2001 From: AusCyberman Date: Sun, 8 Jan 2023 03:40:51 +1100 Subject: Fixed properties docs and added Status (#46) Make rollup function in line with rollup page in documentation --- src/models/properties.rs | 102 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/models/properties.rs b/src/models/properties.rs index 467f750..fcead03 100644 --- a/src/models/properties.rs +++ b/src/models/properties.rs @@ -65,6 +65,22 @@ pub struct Select { pub options: Vec, } +#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] +pub struct StatusGroupOption { + pub name: String, + pub id: SelectOptionId, + pub color: Color, + pub option_ids: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] +pub struct Status { + /// Sorted list of options available for this property. + pub options: Vec, + /// Sorted list of groups available for this property. + pub groups: Vec, +} + #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct Formula { /// Formula to evaluate for this property @@ -87,23 +103,35 @@ pub struct Relation { pub synced_property_id: Option, } +/// The function used to roll up the values of the relation property. +/// #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Copy, Clone)] #[serde(rename_all = "snake_case")] pub enum RollupFunction { - CountAll, - CountValues, - CountUniqueValues, - CountEmpty, - CountNotEmpty, - PercentEmpty, - PercentNotEmpty, - Sum, Average, + Checked, + Count, + CountPerGroup, + CountValues, + DateRange, + EarliestDate, + Empty, + LatestDate, + Max, Median, Min, - Max, + NotEmpty, + PercentChecked, + PercentEmpty, + PercentNotEmpty, + PercentPerGroup, + PercentUnchecked, Range, ShowOriginal, + ShowUnique, + Sum, + Unchecked, + Unique, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] @@ -143,6 +171,8 @@ pub enum PropertyConfiguration { /// Represents a Select Property /// See Select { id: PropertyId, select: Select }, + /// Represents a Status property + Status { id: PropertyId, status: Status }, /// Represents a Multi-select Property /// See MultiSelect { @@ -250,87 +280,92 @@ pub struct FileReference { #[serde(tag = "type")] #[serde(rename_all = "snake_case")] pub enum PropertyValue { - // + // Title { id: PropertyId, title: Vec, }, - /// + /// #[serde(rename = "rich_text")] Text { id: PropertyId, rich_text: Vec, }, - /// + /// Number { id: PropertyId, number: Option, }, - /// + /// Select { id: PropertyId, select: Option, }, + /// + Status { + id: PropertyId, + status: Option, + }, + /// MultiSelect { id: PropertyId, multi_select: Option>, }, + /// Date { id: PropertyId, date: Option, }, - /// + /// Formula { id: PropertyId, formula: FormulaResultValue, }, - /// + /// /// It is actually an array of relations Relation { id: PropertyId, relation: Option>, }, - /// + /// Rollup { id: PropertyId, rollup: Option, }, - People { - id: PropertyId, - people: Vec, - }, + /// + People { id: PropertyId, people: Vec }, + /// Files { id: PropertyId, files: Option>, }, - Checkbox { - id: PropertyId, - checkbox: bool, - }, - Url { - id: PropertyId, - url: Option, - }, + /// + Checkbox { id: PropertyId, checkbox: bool }, + /// + Url { id: PropertyId, url: Option }, + /// Email { id: PropertyId, email: Option, }, + /// PhoneNumber { id: PropertyId, phone_number: String, }, + /// CreatedTime { id: PropertyId, created_time: DateTime, }, - CreatedBy { - id: PropertyId, - created_by: User, - }, + /// + CreatedBy { id: PropertyId, created_by: User }, + /// LastEditedTime { id: PropertyId, last_edited_time: DateTime, }, + /// LastEditedBy { id: PropertyId, last_edited_by: User, @@ -355,6 +390,9 @@ pub enum RollupPropertyValue { Select { select: Option, }, + Status { + status: Option, + }, MultiSelect { multi_select: Option>, }, -- cgit v1.2.3