From 421f407aa3eceb98a3bd5d3b8958f160d497baa9 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sun, 18 Sep 2022 23:45:41 +0530 Subject: [PATCH 1/2] Add StatusPropertyItem --- .../Models/PropertyItems/SimplePropertyItem.cs | 4 +++- .../Models/PropertyItems/StatusPropertyItem.cs | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Src/Notion.Client/Models/PropertyItems/StatusPropertyItem.cs diff --git a/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs b/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs index da753319..baf991bb 100644 --- a/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs +++ b/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs @@ -1,4 +1,5 @@ -using JsonSubTypes; +using System.Collections; +using JsonSubTypes; using Newtonsoft.Json; namespace Notion.Client @@ -8,6 +9,7 @@ namespace Notion.Client [JsonSubtypes.KnownSubType(typeof(UrlPropertyItem), "url")] [JsonSubtypes.KnownSubType(typeof(SelectPropertyItem), "select")] [JsonSubtypes.KnownSubType(typeof(MultiSelectPropertyItem), "multi_select")] + [JsonSubtypes.KnownSubType(typeof(StatusPropertyItem), "status")] [JsonSubtypes.KnownSubType(typeof(DatePropertyItem), "date")] [JsonSubtypes.KnownSubType(typeof(EmailPropertyItem), "email")] [JsonSubtypes.KnownSubType(typeof(PhoneNumberPropertyItem), "phone_number")] diff --git a/Src/Notion.Client/Models/PropertyItems/StatusPropertyItem.cs b/Src/Notion.Client/Models/PropertyItems/StatusPropertyItem.cs new file mode 100644 index 00000000..46e70108 --- /dev/null +++ b/Src/Notion.Client/Models/PropertyItems/StatusPropertyItem.cs @@ -0,0 +1,11 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class StatusPropertyItem : SimplePropertyItem + { + public override string Type => "status"; + + [JsonProperty("status")] public SelectOption Status { get; set; } + } +} From e8404c8cbcdd5d92f9b14974b43b58ac21c4b695 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sun, 18 Sep 2022 23:49:10 +0530 Subject: [PATCH 2/2] Add RollupPropertyItem type --- .../PropertyItems/RollupPropertyItem.cs | 29 +++++++++++++++++++ .../PropertyItems/SimplePropertyItem.cs | 4 +-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 Src/Notion.Client/Models/PropertyItems/RollupPropertyItem.cs diff --git a/Src/Notion.Client/Models/PropertyItems/RollupPropertyItem.cs b/Src/Notion.Client/Models/PropertyItems/RollupPropertyItem.cs new file mode 100644 index 00000000..3df75fd7 --- /dev/null +++ b/Src/Notion.Client/Models/PropertyItems/RollupPropertyItem.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class RollupPropertyItem : SimplePropertyItem + { + public override string Type => "rollup"; + + [JsonProperty("rollup")] public Data Rollup { get; set; } + + public class Data + { + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("function")] public string Function { get; set; } + + [JsonProperty("number")] public double? Number { get; set; } + + [JsonProperty("date")] public Date Date { get; set; } + + [JsonProperty("array")] public IEnumerable> Array { get; set; } + + [JsonProperty("unsupported")] public Dictionary Unsupported { get; set; } + + [JsonProperty("incomplete")] public Dictionary Incomplete { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs b/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs index baf991bb..50d95184 100644 --- a/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs +++ b/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs @@ -1,5 +1,4 @@ -using System.Collections; -using JsonSubTypes; +using JsonSubTypes; using Newtonsoft.Json; namespace Notion.Client @@ -24,6 +23,7 @@ namespace Notion.Client [JsonSubtypes.KnownSubType(typeof(RichTextPropertyItem), "rich_text")] [JsonSubtypes.KnownSubType(typeof(PeoplePropertyItem), "people")] [JsonSubtypes.KnownSubType(typeof(RelationPropertyItem), "relation")] + [JsonSubtypes.KnownSubType(typeof(RollupPropertyItem), "rollup")] public abstract class SimplePropertyItem : IPropertyItemObject { public string Object => "property_item";