From 807707c510ee15a8972a3353ad0d26a37f6cee72 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 2 Oct 2021 05:18:17 +0530 Subject: [PATCH 1/2] Add JsonProperty attribute to request & response model --- .../UpdateBlocks/ParagraphBlock.cs | 5 ++- .../UpdateBlocks/TextContentUpdate.cs | 2 + .../UpdateBlocks/ToDoBlock.cs | 1 + .../UpdateBlocks/ToggleBlock.cs | 5 ++- .../IBlocksAppendChildrenBodyParameters.cs | 2 + .../IDatabasesCreateBodyParameters.cs | 6 +++ .../DatabasesCreateParameters/MentionInput.cs | 13 ++++++- .../PropertySchema/CheckboxPropertySchema.cs | 2 + .../PropertySchema/DatePropertySchema.cs | 2 + .../PropertySchema/EmailPropertySchema.cs | 2 + .../PropertySchema/FilePropertySchema.cs | 2 + .../PropertySchema/FormulaPropertySchema.cs | 5 ++- .../PropertySchema/NumberPropertySchema.cs | 5 ++- .../PropertySchema/PeoplePropertySchema.cs | 2 + .../PropertySchema/SelectOptionSchema.cs | 2 + .../PropertySchema/SelectPropertySchema.cs | 5 ++- .../PropertySchema/TitlePropertySchema.cs | 2 + .../PropertySchema/URLPropertyScheam.cs | 2 + .../RichTextEquationInput.cs | 6 ++- .../RichTextMentionInput.cs | 6 ++- .../RichTextTextInput.cs | 6 ++- .../FormulaUpdatePropertySchema.cs | 2 +- .../IDatabaseQueryBodyParameters.cs | 4 ++ .../Api/Databases/RequestParams/Sort.cs | 3 ++ .../IPagesUpdateBodyParameters.cs | 4 ++ .../RequestParams/PagesUpdateParameters.cs | 2 + .../Parameters/ISearchBodyParameters.cs | 9 ++++- .../Api/Search/Parameters/SearchSort.cs | 2 + Src/Notion.Client/Models/Blocks/Block.cs | 1 + .../Models/Blocks/BulletedListItemBlock.cs | 3 ++ .../Models/Blocks/ChildPageBlock.cs | 1 + .../Models/Blocks/HeadingOneBlock.cs | 1 + .../Models/Blocks/HeadingThreeeBlock.cs | 1 + .../Models/Blocks/HeadingTwoBlock.cs | 1 + .../Models/Blocks/NumberedListItemBlock.cs | 3 ++ .../Models/Blocks/ParagraphBlock.cs | 5 +++ Src/Notion.Client/Models/Blocks/ToDoBlock.cs | 2 + .../Models/Blocks/ToggleBlock.cs | 5 +++ .../Database/Properties/CheckboxProperty.cs | 3 ++ .../Database/Properties/DateProperty.cs | 3 ++ .../Database/Properties/EmailProperty.cs | 3 ++ .../Database/Properties/FilesProperty.cs | 3 ++ .../Database/Properties/FormulaProperty.cs | 6 ++- .../Database/Properties/NumberProperty.cs | 3 ++ .../Database/Properties/PeopleProperty.cs | 3 ++ .../Models/Database/Properties/Property.cs | 3 ++ .../Database/Properties/RelationProperty.cs | 2 + .../Database/Properties/RollupProperty.cs | 1 + .../Database/Properties/SelectProperty.cs | 14 +++++++ .../Database/Properties/TitleProperty.cs | 3 ++ .../Models/Database/Properties/UrlProperty.cs | 3 ++ .../Models/Database/RichText/RichTextBase.cs | 4 ++ .../Database/RichText/RichTextEquation.cs | 7 +++- .../Database/RichText/RichTextMention.cs | 16 +++++++- .../Models/Database/RichText/RichTextText.cs | 12 +++++- Src/Notion.Client/Models/Filters/Checkbox.cs | 1 + Src/Notion.Client/Models/Filters/Date.cs | 1 + Src/Notion.Client/Models/Filters/Files.cs | 1 + Src/Notion.Client/Models/Filters/Filter.cs | 5 +++ Src/Notion.Client/Models/Filters/Formula.cs | 12 +++++- .../Models/Filters/Multiselect.cs | 1 + Src/Notion.Client/Models/Filters/Number.cs | 1 + Src/Notion.Client/Models/Filters/People.cs | 2 + Src/Notion.Client/Models/Filters/Relation.cs | 2 + Src/Notion.Client/Models/Filters/Select.cs | 1 + Src/Notion.Client/Models/Filters/Text.cs | 2 + Src/Notion.Client/Models/IObject.cs | 2 + Src/Notion.Client/Models/Page/Page.cs | 30 +++++++++++++++ Src/Notion.Client/Models/PaginatedList.cs | 2 + .../Models/Parents/DatabaseParent.cs | 6 +++ .../Models/Parents/PageParent.cs | 9 ++++- .../Models/Parents/WorkspaceParent.cs | 3 ++ .../PropertyValue/CheckboxPropertyValue.cs | 8 +++- .../PropertyValue/CreatedByPropertyValue.cs | 6 +++ .../PropertyValue/CreatedTimePropertyValue.cs | 6 +++ .../Models/PropertyValue/DatePropertyValue.cs | 21 ++++++++++ .../PropertyValue/EmailPropertyValue.cs | 11 +++++- .../PropertyValue/FilesPropertyValue.cs | 8 ++++ .../PropertyValue/FormulaPropertyValue.cs | 38 ++++++++++++++++++- .../LastEditedByPropertyValue.cs | 6 +++ .../LastEditedTimePropertyValue.cs | 6 +++ .../PropertyValue/MultiSelectPropertyValue.cs | 6 +++ .../PropertyValue/NumberPropertyValue.cs | 12 +++++- .../PropertyValue/PeoplePropertyValue.cs | 9 +++++ .../PropertyValue/PhoneNumberPropertyValue.cs | 6 +++ .../Models/PropertyValue/PropertyValue.cs | 7 ++++ .../Models/PropertyValue/PropertyValueType.cs | 3 ++ .../PropertyValue/RelationPropertyValue.cs | 5 +++ .../PropertyValue/RichTextPropertyValue.cs | 6 +++ .../PropertyValue/RollupPropertyValue.cs | 26 ++++++++++++- .../PropertyValue/SelectPropertyValue.cs | 9 ++++- .../PropertyValue/TitlePropertyValue.cs | 9 +++++ .../Models/PropertyValue/UrlPropertyValue.cs | 11 +++++- Src/Notion.Client/Models/User.cs | 8 ++++ 94 files changed, 505 insertions(+), 24 deletions(-) diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphBlock.cs index 42d103e6..209c7ea4 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphBlock.cs @@ -1,7 +1,10 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class ParagraphUpdateBlock : IUpdateBlock { + [JsonProperty("paragraph")] public TextContentUpdate Paragraph { get; set; } } } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TextContentUpdate.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TextContentUpdate.cs index b78f8fbf..b0388162 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TextContentUpdate.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TextContentUpdate.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class TextContentUpdate { + [JsonProperty("text")] public IEnumerable Text { get; set; } } } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoBlock.cs index 43b24863..6a58ed12 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoBlock.cs @@ -10,6 +10,7 @@ public class ToDoUpdateBlock : IUpdateBlock public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } [JsonProperty("checked")] diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleBlock.cs index e7027add..b714c916 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleBlock.cs @@ -1,7 +1,10 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class ToggleUpdateBlock : IUpdateBlock { + [JsonProperty("toggle")] public TextContentUpdate Toggle { get; set; } } } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/IBlocksAppendChildrenBodyParameters.cs b/Src/Notion.Client/Api/Blocks/RequestParams/IBlocksAppendChildrenBodyParameters.cs index f024eba9..33b0ca0f 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/IBlocksAppendChildrenBodyParameters.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/IBlocksAppendChildrenBodyParameters.cs @@ -1,10 +1,12 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { // TODO: need an input version of Block public interface IBlocksAppendChildrenBodyParameters { + [JsonProperty("children")] IEnumerable Children { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/IDatabasesCreateBodyParameters.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/IDatabasesCreateBodyParameters.cs index 0218a49a..b0f97061 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/IDatabasesCreateBodyParameters.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/IDatabasesCreateBodyParameters.cs @@ -1,11 +1,17 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public interface IDatabasesCreateBodyParameters { + [JsonProperty("parent")] ParentPageInput Parent { get; set; } + + [JsonProperty("properties")] Dictionary Properties { get; set; } + + [JsonProperty("title")] List Title { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/MentionInput.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/MentionInput.cs index 1324e518..83d1e699 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/MentionInput.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/MentionInput.cs @@ -1,11 +1,22 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class MentionInput { + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("user")] public Person User { get; set; } + + [JsonProperty("page")] public ObjectId Page { get; set; } + + [JsonProperty("database")] public ObjectId Database { get; set; } + + [JsonProperty("date")] public DatePropertyValue Date { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/CheckboxPropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/CheckboxPropertySchema.cs index c6fd7335..fb955a3e 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/CheckboxPropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/CheckboxPropertySchema.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class CheckboxPropertySchema : IPropertySchema { + [JsonProperty("checkbox")] public Dictionary Checkbox { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/DatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/DatePropertySchema.cs index 8042a2d2..1dc37c20 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/DatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/DatePropertySchema.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class DatePropertySchema : IPropertySchema { + [JsonProperty("date")] public Dictionary Date { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/EmailPropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/EmailPropertySchema.cs index dac130f5..6a680c2b 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/EmailPropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/EmailPropertySchema.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class EmailPropertySchema : IPropertySchema { + [JsonProperty("email")] public Dictionary Email { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FilePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FilePropertySchema.cs index 2347a67e..4591a3fc 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FilePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FilePropertySchema.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class FilePropertySchema : IPropertySchema { + [JsonProperty("files")] public Dictionary Files { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FormulaPropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FormulaPropertySchema.cs index e1802d38..97e7cb33 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FormulaPropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/FormulaPropertySchema.cs @@ -1,7 +1,10 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class FormulaPropertySchema : IPropertySchema { + [JsonProperty("formula")] public Formula Formula { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/NumberPropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/NumberPropertySchema.cs index 9d5d652f..dbb7fa28 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/NumberPropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/NumberPropertySchema.cs @@ -1,7 +1,10 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class NumberPropertySchema : IPropertySchema { + [JsonProperty("number")] public Number Number { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/PeoplePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/PeoplePropertySchema.cs index cc3a8409..5293746c 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/PeoplePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/PeoplePropertySchema.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class PeoplePropertySchema : IPropertySchema { + [JsonProperty("people")] public Dictionary People { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectOptionSchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectOptionSchema.cs index b58d7626..c31aef9f 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectOptionSchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectOptionSchema.cs @@ -5,8 +5,10 @@ namespace Notion.Client { public class SelectOptionSchema { + [JsonProperty("name")] public string Name { get; set; } + [JsonProperty("color")] [JsonConverter(typeof(StringEnumConverter))] public Color Color { get; set; } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectPropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectPropertySchema.cs index a582fe71..6e764bf3 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectPropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/SelectPropertySchema.cs @@ -1,7 +1,10 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class SelectPropertySchema : IPropertySchema { + [JsonProperty("select")] public OptionWrapper Select { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/TitlePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/TitlePropertySchema.cs index 2c64db1f..b7fb2f72 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/TitlePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/TitlePropertySchema.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class TitlePropertySchema : IPropertySchema { + [JsonProperty("title")] public Dictionary Title { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/URLPropertyScheam.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/URLPropertyScheam.cs index fdaa5d90..468244d8 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/URLPropertyScheam.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/URLPropertyScheam.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class URLPropertyScheam : IPropertySchema { + [JsonProperty("url")] public Dictionary Url { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextEquationInput.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextEquationInput.cs index 4ca358a1..f86dd803 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextEquationInput.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextEquationInput.cs @@ -1,8 +1,12 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class RichTextEquationInput : RichTextBaseInput { public override RichTextType Type => RichTextType.Equation; + + [JsonProperty("equation")] public Equation Equation { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextMentionInput.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextMentionInput.cs index 0b83f8d6..3e9c914d 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextMentionInput.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextMentionInput.cs @@ -1,8 +1,12 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class RichTextMentionInput : RichTextBaseInput { public override RichTextType Type => RichTextType.Mention; + + [JsonProperty("mention")] public MentionInput Mention { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextTextInput.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextTextInput.cs index 1a54ee30..9f73157f 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextTextInput.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/RichTextTextInput.cs @@ -1,8 +1,12 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class RichTextTextInput : RichTextBaseInput { public override RichTextType Type => RichTextType.Text; + + [JsonProperty("text")] public Text Text { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs index f9084144..158a42bb 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs @@ -4,7 +4,7 @@ namespace Notion.Client { public class FormulaUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema { - [JsonProperty("checkbox")] + [JsonProperty("formula")] public Formula Formula { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/IDatabaseQueryBodyParameters.cs b/Src/Notion.Client/Api/Databases/RequestParams/IDatabaseQueryBodyParameters.cs index a48faa87..4ac46860 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/IDatabaseQueryBodyParameters.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/IDatabaseQueryBodyParameters.cs @@ -1,10 +1,14 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public interface IDatabaseQueryBodyParameters : IPaginationParameters { + [JsonProperty("filter")] Filter Filter { get; set; } + + [JsonProperty("sorts")] List Sorts { get; set; } } } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/Sort.cs b/Src/Notion.Client/Api/Databases/RequestParams/Sort.cs index d8ccc878..f0afc72d 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/Sort.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/Sort.cs @@ -5,11 +5,14 @@ namespace Notion.Client { public class Sort { + [JsonProperty("property")] public string Property { get; set; } + [JsonProperty("timestamp")] [JsonConverter(typeof(StringEnumConverter))] public Timestamp Timestamp { get; set; } + [JsonProperty("direction")] [JsonConverter(typeof(StringEnumConverter))] public Direction Direction { get; set; } } diff --git a/Src/Notion.Client/Api/Pages/RequestParams/IPagesUpdateBodyParameters.cs b/Src/Notion.Client/Api/Pages/RequestParams/IPagesUpdateBodyParameters.cs index 12a8cc12..b37dd1fd 100644 --- a/Src/Notion.Client/Api/Pages/RequestParams/IPagesUpdateBodyParameters.cs +++ b/Src/Notion.Client/Api/Pages/RequestParams/IPagesUpdateBodyParameters.cs @@ -1,10 +1,14 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public interface IPagesUpdateBodyParameters { + [JsonProperty("archived")] bool Archived { get; set; } + + [JsonProperty("properties")] IDictionary Properties { get; set; } } } diff --git a/Src/Notion.Client/Api/Pages/RequestParams/PagesUpdateParameters.cs b/Src/Notion.Client/Api/Pages/RequestParams/PagesUpdateParameters.cs index 4e45cff6..40f06b12 100644 --- a/Src/Notion.Client/Api/Pages/RequestParams/PagesUpdateParameters.cs +++ b/Src/Notion.Client/Api/Pages/RequestParams/PagesUpdateParameters.cs @@ -5,8 +5,10 @@ namespace Notion.Client { public class PagesUpdateParameters : IPagesUpdateBodyParameters { + [JsonProperty("archived")] public bool Archived { get; set; } + [JsonProperty("properties")] public IDictionary Properties { get; set; } [JsonProperty("icon")] diff --git a/Src/Notion.Client/Api/Search/Parameters/ISearchBodyParameters.cs b/Src/Notion.Client/Api/Search/Parameters/ISearchBodyParameters.cs index 2f66aa48..18965000 100644 --- a/Src/Notion.Client/Api/Search/Parameters/ISearchBodyParameters.cs +++ b/Src/Notion.Client/Api/Search/Parameters/ISearchBodyParameters.cs @@ -1,9 +1,16 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public interface ISearchBodyParameters : IPaginationParameters { + [JsonProperty("query")] string Query { get; set; } + + [JsonProperty("sort")] SearchSort Sort { get; set; } + + [JsonProperty("filter")] SearchFilter Filter { get; set; } } } diff --git a/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs b/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs index 5cc4bbfd..fed3f205 100644 --- a/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs +++ b/Src/Notion.Client/Api/Search/Parameters/SearchSort.cs @@ -5,9 +5,11 @@ namespace Notion.Client { public class SearchSort { + [JsonProperty("direction")] [JsonConverter(typeof(StringEnumConverter))] public SearchDirection Direction { get; set; } + [JsonProperty("timestamp")] public string Timestamp { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/Block.cs b/Src/Notion.Client/Models/Blocks/Block.cs index fa821cb1..60f68bf0 100644 --- a/Src/Notion.Client/Models/Blocks/Block.cs +++ b/Src/Notion.Client/Models/Blocks/Block.cs @@ -29,6 +29,7 @@ public class Block : IObject public ObjectType Object => ObjectType.Block; public string Id { get; set; } + [JsonProperty("type")] [JsonConverter(typeof(StringEnumConverter))] public virtual BlockType Type { get; set; } diff --git a/Src/Notion.Client/Models/Blocks/BulletedListItemBlock.cs b/Src/Notion.Client/Models/Blocks/BulletedListItemBlock.cs index 83f31c83..c787da86 100644 --- a/Src/Notion.Client/Models/Blocks/BulletedListItemBlock.cs +++ b/Src/Notion.Client/Models/Blocks/BulletedListItemBlock.cs @@ -12,7 +12,10 @@ public class BulletedListItemBlock : Block public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } + + [JsonProperty("children")] public IEnumerable Children { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/ChildPageBlock.cs b/Src/Notion.Client/Models/Blocks/ChildPageBlock.cs index 66a9489d..9fdc4b7b 100644 --- a/Src/Notion.Client/Models/Blocks/ChildPageBlock.cs +++ b/Src/Notion.Client/Models/Blocks/ChildPageBlock.cs @@ -11,6 +11,7 @@ public class ChildPageBlock : Block public class Info { + [JsonProperty("title")] public string Title { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs b/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs index 7cab0370..2105cefe 100644 --- a/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs +++ b/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs @@ -14,6 +14,7 @@ public class HeadingOneBlock : Block public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs b/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs index d64b57fa..4f1ca0a0 100644 --- a/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs +++ b/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs @@ -14,6 +14,7 @@ public class HeadingThreeeBlock : Block public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs b/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs index 88835f3c..5b07e758 100644 --- a/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs +++ b/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs @@ -14,6 +14,7 @@ public class HeadingTwoBlock : Block public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/NumberedListItemBlock.cs b/Src/Notion.Client/Models/Blocks/NumberedListItemBlock.cs index 27fc29fd..3d233af3 100644 --- a/Src/Notion.Client/Models/Blocks/NumberedListItemBlock.cs +++ b/Src/Notion.Client/Models/Blocks/NumberedListItemBlock.cs @@ -12,7 +12,10 @@ public class NumberedListItemBlock : Block public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } + + [JsonProperty("children")] public IEnumerable Children { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/ParagraphBlock.cs b/Src/Notion.Client/Models/Blocks/ParagraphBlock.cs index 96b4c239..ebce97a7 100644 --- a/Src/Notion.Client/Models/Blocks/ParagraphBlock.cs +++ b/Src/Notion.Client/Models/Blocks/ParagraphBlock.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { @@ -6,11 +7,15 @@ public class ParagraphBlock : Block { public override BlockType Type => BlockType.Paragraph; + [JsonProperty("paragraph")] public Info Paragraph { get; set; } public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } + + [JsonProperty("children")] public IEnumerable Children { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/ToDoBlock.cs b/Src/Notion.Client/Models/Blocks/ToDoBlock.cs index aeff42f2..da6518a2 100644 --- a/Src/Notion.Client/Models/Blocks/ToDoBlock.cs +++ b/Src/Notion.Client/Models/Blocks/ToDoBlock.cs @@ -12,11 +12,13 @@ public class ToDoBlock : Block public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } [JsonProperty("checked")] public bool IsChecked { get; set; } + [JsonProperty("children")] public IEnumerable Children { get; set; } } } diff --git a/Src/Notion.Client/Models/Blocks/ToggleBlock.cs b/Src/Notion.Client/Models/Blocks/ToggleBlock.cs index 6fc6f3df..3da4d6d7 100644 --- a/Src/Notion.Client/Models/Blocks/ToggleBlock.cs +++ b/Src/Notion.Client/Models/Blocks/ToggleBlock.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { @@ -6,11 +7,15 @@ public class ToggleBlock : Block { public override BlockType Type => BlockType.Toggle; + [JsonProperty("toggle")] public Info Toggle { get; set; } public class Info { + [JsonProperty("text")] public IEnumerable Text { get; set; } + + [JsonProperty("children")] public IEnumerable Children { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/CheckboxProperty.cs b/Src/Notion.Client/Models/Database/Properties/CheckboxProperty.cs index ff0e450b..146e6401 100644 --- a/Src/Notion.Client/Models/Database/Properties/CheckboxProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/CheckboxProperty.cs @@ -1,10 +1,13 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class CheckboxProperty : Property { public override PropertyType Type => PropertyType.Checkbox; + + [JsonProperty("checkbox")] public Dictionary Checkbox { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/DateProperty.cs b/Src/Notion.Client/Models/Database/Properties/DateProperty.cs index 942f56c9..03e79c97 100644 --- a/Src/Notion.Client/Models/Database/Properties/DateProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/DateProperty.cs @@ -1,10 +1,13 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class DateProperty : Property { public override PropertyType Type => PropertyType.Date; + + [JsonProperty("date")] public Dictionary Date { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/EmailProperty.cs b/Src/Notion.Client/Models/Database/Properties/EmailProperty.cs index 7c8b596c..defde555 100644 --- a/Src/Notion.Client/Models/Database/Properties/EmailProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/EmailProperty.cs @@ -1,10 +1,13 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class EmailProperty : Property { public override PropertyType Type => PropertyType.Email; + + [JsonProperty("email")] public Dictionary Email { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/FilesProperty.cs b/Src/Notion.Client/Models/Database/Properties/FilesProperty.cs index f52277c9..48ae3475 100644 --- a/Src/Notion.Client/Models/Database/Properties/FilesProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/FilesProperty.cs @@ -1,10 +1,13 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class FilesProperty : Property { public override PropertyType Type => PropertyType.Files; + + [JsonProperty("files")] public Dictionary Files { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/FormulaProperty.cs b/Src/Notion.Client/Models/Database/Properties/FormulaProperty.cs index 184f9be0..82e4a240 100644 --- a/Src/Notion.Client/Models/Database/Properties/FormulaProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/FormulaProperty.cs @@ -1,14 +1,18 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class FormulaProperty : Property { public override PropertyType Type => PropertyType.Formula; + [JsonProperty("formula")] public Formula Formula { get; set; } } public class Formula { + [JsonProperty("expression")] public string Expression { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/NumberProperty.cs b/Src/Notion.Client/Models/Database/Properties/NumberProperty.cs index 1905b2f0..a00d7d9b 100644 --- a/Src/Notion.Client/Models/Database/Properties/NumberProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/NumberProperty.cs @@ -7,11 +7,14 @@ namespace Notion.Client public class NumberProperty : Property { public override PropertyType Type => PropertyType.Number; + + [JsonProperty("number")] public Number Number { get; set; } } public class Number { + [JsonProperty("format")] [JsonConverter(typeof(StringEnumConverter))] public NumberFormat Format { get; set; } } diff --git a/Src/Notion.Client/Models/Database/Properties/PeopleProperty.cs b/Src/Notion.Client/Models/Database/Properties/PeopleProperty.cs index 002ee200..c21d2fbd 100644 --- a/Src/Notion.Client/Models/Database/Properties/PeopleProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/PeopleProperty.cs @@ -1,10 +1,13 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class PeopleProperty : Property { public override PropertyType Type => PropertyType.People; + + [JsonProperty("people")] public Dictionary People { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/Property.cs b/Src/Notion.Client/Models/Database/Properties/Property.cs index 3201cc39..30ecd151 100644 --- a/Src/Notion.Client/Models/Database/Properties/Property.cs +++ b/Src/Notion.Client/Models/Database/Properties/Property.cs @@ -26,11 +26,14 @@ namespace Notion.Client [JsonSubtypes.KnownSubType(typeof(UrlProperty), PropertyType.Url)] public class Property { + [JsonProperty("id")] public string Id { get; set; } + [JsonProperty("type")] [JsonConverter(typeof(StringEnumConverter))] public virtual PropertyType Type { get; set; } + [JsonProperty("name")] public string Name { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/RelationProperty.cs b/Src/Notion.Client/Models/Database/Properties/RelationProperty.cs index 0c595369..8c55bc80 100644 --- a/Src/Notion.Client/Models/Database/Properties/RelationProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/RelationProperty.cs @@ -6,6 +6,8 @@ public class RelationProperty : Property { public override PropertyType Type => PropertyType.Relation; + + [JsonProperty("relation")] public Relation Relation { get; set; } } diff --git a/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs b/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs index b323e55c..fa0c4b92 100644 --- a/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs @@ -8,6 +8,7 @@ public class RollupProperty : Property { public override PropertyType Type => PropertyType.Rollup; + [JsonProperty("rollup")] public Rollup Rollup { get; set; } } diff --git a/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs b/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs index 23d60afc..6d678ae2 100644 --- a/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs @@ -13,14 +13,28 @@ public class SelectProperty : Property public class OptionWrapper { + [JsonProperty("options")] public List Options { get; set; } } public class SelectOption { + /// + /// Name of the option as it appears in Notion. + /// + [JsonProperty("name")] public string Name { get; set; } + + /// + /// ID of the option. + /// + [JsonProperty("id")] public string Id { get; set; } + /// + /// Color of the option. Possible values are: "default", "gray", "brown", "red", "orange", "yellow", "green", "blue", "purple", "pink". Defaults to "default". + /// + [JsonProperty("color")] [JsonConverter(typeof(StringEnumConverter))] public Color Color { get; set; } } diff --git a/Src/Notion.Client/Models/Database/Properties/TitleProperty.cs b/Src/Notion.Client/Models/Database/Properties/TitleProperty.cs index afa4f5e2..2268d0ad 100644 --- a/Src/Notion.Client/Models/Database/Properties/TitleProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/TitleProperty.cs @@ -1,10 +1,13 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class TitleProperty : Property { public override PropertyType Type => PropertyType.Title; + + [JsonProperty("title")] public Dictionary Title { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/Properties/UrlProperty.cs b/Src/Notion.Client/Models/Database/Properties/UrlProperty.cs index 8cade5ef..451ef911 100644 --- a/Src/Notion.Client/Models/Database/Properties/UrlProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/UrlProperty.cs @@ -1,10 +1,13 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { public class UrlProperty : Property { public override PropertyType Type => PropertyType.Url; + + [JsonProperty("url")] public Dictionary Url { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/RichText/RichTextBase.cs b/Src/Notion.Client/Models/Database/RichText/RichTextBase.cs index dd7d6e0a..1c9a7610 100644 --- a/Src/Notion.Client/Models/Database/RichText/RichTextBase.cs +++ b/Src/Notion.Client/Models/Database/RichText/RichTextBase.cs @@ -13,10 +13,13 @@ public class RichTextBase [JsonProperty("plain_text")] public string PlainText { get; set; } + [JsonProperty("href")] public string Href { get; set; } + [JsonProperty("annotations")] public Annotations Annotations { get; set; } + [JsonProperty("type")] [JsonConverter(typeof(StringEnumConverter))] public virtual RichTextType Type { get; set; } } @@ -38,6 +41,7 @@ public class Annotations [JsonProperty("code")] public bool IsCode { get; set; } + [JsonProperty("color")] // color: Color | BackgroundColor public string Color { get; set; } } diff --git a/Src/Notion.Client/Models/Database/RichText/RichTextEquation.cs b/Src/Notion.Client/Models/Database/RichText/RichTextEquation.cs index 76c7a0df..05412cac 100644 --- a/Src/Notion.Client/Models/Database/RichText/RichTextEquation.cs +++ b/Src/Notion.Client/Models/Database/RichText/RichTextEquation.cs @@ -1,13 +1,18 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class RichTextEquation : RichTextBase { public override RichTextType Type => RichTextType.Equation; + + [JsonProperty("equation")] public Equation Equation { get; set; } } public class Equation { + [JsonProperty("expression")] public string Expression { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/RichText/RichTextMention.cs b/Src/Notion.Client/Models/Database/RichText/RichTextMention.cs index 5c6fbe79..02f6beb0 100644 --- a/Src/Notion.Client/Models/Database/RichText/RichTextMention.cs +++ b/Src/Notion.Client/Models/Database/RichText/RichTextMention.cs @@ -1,22 +1,36 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class RichTextMention : RichTextBase { public override RichTextType Type => RichTextType.Mention; + + [JsonProperty("mention")] public Mention Mention { get; set; } } public class Mention { + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("user")] public User User { get; set; } + + [JsonProperty("page")] public ObjectId Page { get; set; } + + [JsonProperty("database")] public ObjectId Database { get; set; } + + [JsonProperty("date")] public DatePropertyValue Date { get; set; } } public class ObjectId { + [JsonProperty("id")] public string Id { get; set; } } } diff --git a/Src/Notion.Client/Models/Database/RichText/RichTextText.cs b/Src/Notion.Client/Models/Database/RichText/RichTextText.cs index 2d2c7b31..52982061 100644 --- a/Src/Notion.Client/Models/Database/RichText/RichTextText.cs +++ b/Src/Notion.Client/Models/Database/RichText/RichTextText.cs @@ -1,20 +1,30 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class RichTextText : RichTextBase { public override RichTextType Type => RichTextType.Text; + + [JsonProperty("text")] public Text Text { get; set; } } public class Text { + [JsonProperty("content")] public string Content { get; set; } + + [JsonProperty("link")] public Link Link { get; set; } } public class Link { + [JsonProperty("type")] public string Type => "url"; + + [JsonProperty("url")] public string Url { get; set; } } } diff --git a/Src/Notion.Client/Models/Filters/Checkbox.cs b/Src/Notion.Client/Models/Filters/Checkbox.cs index 93107bfc..1eb73e2e 100644 --- a/Src/Notion.Client/Models/Filters/Checkbox.cs +++ b/Src/Notion.Client/Models/Filters/Checkbox.cs @@ -5,6 +5,7 @@ namespace Notion.Client { public class CheckboxFilter : SinglePropertyFilter { + [JsonProperty("checkbox")] public Condition Checkbox { get; set; } public CheckboxFilter( diff --git a/Src/Notion.Client/Models/Filters/Date.cs b/Src/Notion.Client/Models/Filters/Date.cs index c6a2d589..44b29fb9 100644 --- a/Src/Notion.Client/Models/Filters/Date.cs +++ b/Src/Notion.Client/Models/Filters/Date.cs @@ -7,6 +7,7 @@ namespace Notion.Client { public class DateFilter : SinglePropertyFilter { + [JsonProperty("date")] public Condition Date { get; set; } public DateFilter( diff --git a/Src/Notion.Client/Models/Filters/Files.cs b/Src/Notion.Client/Models/Filters/Files.cs index af86f915..e20f863d 100644 --- a/Src/Notion.Client/Models/Filters/Files.cs +++ b/Src/Notion.Client/Models/Filters/Files.cs @@ -5,6 +5,7 @@ namespace Notion.Client public class FilesFilter : SinglePropertyFilter { + [JsonProperty("files")] public Condition Files { get; set; } public FilesFilter( diff --git a/Src/Notion.Client/Models/Filters/Filter.cs b/Src/Notion.Client/Models/Filters/Filter.cs index d905d599..61f81f7e 100644 --- a/Src/Notion.Client/Models/Filters/Filter.cs +++ b/Src/Notion.Client/Models/Filters/Filter.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { @@ -9,12 +10,16 @@ public class Filter public class SinglePropertyFilter : Filter { + [JsonProperty("property")] public string Property { get; set; } } public class CompoundFilter : Filter { + [JsonProperty("or")] public List Or { get; set; } + + [JsonProperty("and")] public List And { get; set; } public CompoundFilter(List or = null, List and = null) diff --git a/Src/Notion.Client/Models/Filters/Formula.cs b/Src/Notion.Client/Models/Filters/Formula.cs index afab84d8..82b58cc8 100644 --- a/Src/Notion.Client/Models/Filters/Formula.cs +++ b/Src/Notion.Client/Models/Filters/Formula.cs @@ -1,7 +1,10 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { public class FormulaFilter : SinglePropertyFilter { + [JsonProperty("formula")] public Condition Formula { get; set; } public FormulaFilter( @@ -22,9 +25,16 @@ public FormulaFilter( public class Condition { + [JsonProperty("text")] public TextFilter.Condition Text { get; set; } + + [JsonProperty("checkbox")] public CheckboxFilter.Condition Checkbox { get; set; } + + [JsonProperty("number")] public NumberFilter.Condition Number { get; set; } + + [JsonProperty("date")] public DateFilter.Condition Date { get; set; } public Condition( diff --git a/Src/Notion.Client/Models/Filters/Multiselect.cs b/Src/Notion.Client/Models/Filters/Multiselect.cs index 03ea62b0..bf69d110 100644 --- a/Src/Notion.Client/Models/Filters/Multiselect.cs +++ b/Src/Notion.Client/Models/Filters/Multiselect.cs @@ -26,6 +26,7 @@ public MultiSelectFilter( public class Condition { + [JsonProperty("contains")] public string Contains { get; set; } [JsonProperty("does_not_contain")] diff --git a/Src/Notion.Client/Models/Filters/Number.cs b/Src/Notion.Client/Models/Filters/Number.cs index 15b6158c..9282226a 100644 --- a/Src/Notion.Client/Models/Filters/Number.cs +++ b/Src/Notion.Client/Models/Filters/Number.cs @@ -4,6 +4,7 @@ namespace Notion.Client { public class NumberFilter : SinglePropertyFilter { + [JsonProperty("number")] public Condition Number { get; set; } public NumberFilter( diff --git a/Src/Notion.Client/Models/Filters/People.cs b/Src/Notion.Client/Models/Filters/People.cs index 8b2fcd23..6138e3d2 100644 --- a/Src/Notion.Client/Models/Filters/People.cs +++ b/Src/Notion.Client/Models/Filters/People.cs @@ -4,6 +4,7 @@ namespace Notion.Client { public class PeopleFilter : SinglePropertyFilter { + [JsonProperty("people")] public Condition People { get; set; } public PeopleFilter( @@ -24,6 +25,7 @@ public PeopleFilter( public class Condition { + [JsonProperty("contains")] public string Contains { get; set; } [JsonProperty("does_not_contain")] diff --git a/Src/Notion.Client/Models/Filters/Relation.cs b/Src/Notion.Client/Models/Filters/Relation.cs index 7d34bd7e..26f7214a 100644 --- a/Src/Notion.Client/Models/Filters/Relation.cs +++ b/Src/Notion.Client/Models/Filters/Relation.cs @@ -4,6 +4,7 @@ namespace Notion.Client { public class RelationFilter : SinglePropertyFilter { + [JsonProperty("relation")] public Condition Relation { get; set; } public RelationFilter( @@ -24,6 +25,7 @@ public RelationFilter( public class Condition { + [JsonProperty("contains")] public string Contains { get; set; } [JsonProperty("does_not_contain")] diff --git a/Src/Notion.Client/Models/Filters/Select.cs b/Src/Notion.Client/Models/Filters/Select.cs index b7f29f11..bf246be2 100644 --- a/Src/Notion.Client/Models/Filters/Select.cs +++ b/Src/Notion.Client/Models/Filters/Select.cs @@ -4,6 +4,7 @@ namespace Notion.Client { public class SelectFilter : SinglePropertyFilter { + [JsonProperty("select")] public Condition Select { get; set; } public SelectFilter( diff --git a/Src/Notion.Client/Models/Filters/Text.cs b/Src/Notion.Client/Models/Filters/Text.cs index 0b2d187f..3446e854 100644 --- a/Src/Notion.Client/Models/Filters/Text.cs +++ b/Src/Notion.Client/Models/Filters/Text.cs @@ -4,6 +4,7 @@ namespace Notion.Client { public class TextFilter : SinglePropertyFilter { + [JsonProperty("text")] public Condition Text { get; set; } public TextFilter( @@ -38,6 +39,7 @@ public class Condition [JsonProperty("does_not_equal")] public string DoesNotEqual { get; set; } + [JsonProperty("contains")] public string Contains { get; set; } [JsonProperty("does_not_contain")] diff --git a/Src/Notion.Client/Models/IObject.cs b/Src/Notion.Client/Models/IObject.cs index 73e4b90f..98f50f3f 100644 --- a/Src/Notion.Client/Models/IObject.cs +++ b/Src/Notion.Client/Models/IObject.cs @@ -11,8 +11,10 @@ namespace Notion.Client [JsonSubtypes.KnownSubType(typeof(User), ObjectType.User)] public interface IObject { + [JsonProperty("id")] string Id { get; set; } + [JsonProperty("object")] [JsonConverter(typeof(StringEnumConverter))] ObjectType Object { get; } } diff --git a/Src/Notion.Client/Models/Page/Page.cs b/Src/Notion.Client/Models/Page/Page.cs index e6b4921c..352f9d13 100644 --- a/Src/Notion.Client/Models/Page/Page.cs +++ b/Src/Notion.Client/Models/Page/Page.cs @@ -6,31 +6,61 @@ namespace Notion.Client { public class Page : IObject { + /// + /// Object type + /// public ObjectType Object => ObjectType.Page; + /// + /// Unique identifier of the page. + /// public string Id { get; set; } + /// + /// The parent of this page. Can be a database, page, or workspace. + /// [JsonProperty("parent")] public IPageParent Parent { get; set; } + /// + /// Date and time when this page was created. + /// [JsonProperty("created_time")] public DateTime CreatedTime { get; set; } + /// + /// Date and time when this page was updated. + /// [JsonProperty("last_edited_time")] public DateTime LastEditedTime { get; set; } + /// + /// The archived status of the page. + /// [JsonProperty("archived")] public bool IsArchived { get; set; } + /// + /// Property values of this page. + /// [JsonProperty("properties")] public IDictionary Properties { get; set; } + /// + /// The URL of the Notion page. + /// [JsonProperty("url")] public string Url { get; set; } + /// + /// Page icon. + /// [JsonProperty("icon")] public IPageIcon Icon { get; set; } + /// + /// Page cover image. + /// [JsonProperty("cover")] public FileObject Cover { get; set; } } diff --git a/Src/Notion.Client/Models/PaginatedList.cs b/Src/Notion.Client/Models/PaginatedList.cs index 05881b26..e126125a 100644 --- a/Src/Notion.Client/Models/PaginatedList.cs +++ b/Src/Notion.Client/Models/PaginatedList.cs @@ -14,8 +14,10 @@ public interface IPaginationParameters public class PaginatedList { + [JsonProperty("object")] public const string Object = "list"; + [JsonProperty("results")] public List Results { get; set; } [JsonProperty("has_more")] diff --git a/Src/Notion.Client/Models/Parents/DatabaseParent.cs b/Src/Notion.Client/Models/Parents/DatabaseParent.cs index 6c262b79..c3e028e7 100644 --- a/Src/Notion.Client/Models/Parents/DatabaseParent.cs +++ b/Src/Notion.Client/Models/Parents/DatabaseParent.cs @@ -4,8 +4,14 @@ namespace Notion.Client { public class DatabaseParent : IPageParent { + /// + /// Always "database_id" + /// public ParentType Type { get; set; } + /// + /// The ID of the database that this page belongs to. + /// [JsonProperty("database_id")] public string DatabaseId { get; set; } } diff --git a/Src/Notion.Client/Models/Parents/PageParent.cs b/Src/Notion.Client/Models/Parents/PageParent.cs index 6abd7263..ff185747 100644 --- a/Src/Notion.Client/Models/Parents/PageParent.cs +++ b/Src/Notion.Client/Models/Parents/PageParent.cs @@ -4,8 +4,15 @@ namespace Notion.Client { public class PageParent : IPageParent, IDatabaseParent { + /// + /// Always "page_id". + /// + public ParentType Type { get; set; } + + /// + /// The ID of the page that this page belongs to. + /// [JsonProperty("page_id")] public string PageId { get; set; } - public ParentType Type { get; set; } } } diff --git a/Src/Notion.Client/Models/Parents/WorkspaceParent.cs b/Src/Notion.Client/Models/Parents/WorkspaceParent.cs index c0f0f4cf..fc645b60 100644 --- a/Src/Notion.Client/Models/Parents/WorkspaceParent.cs +++ b/Src/Notion.Client/Models/Parents/WorkspaceParent.cs @@ -2,6 +2,9 @@ { public class WorkspaceParent : IPageParent, IDatabaseParent { + /// + /// Always "workspace". + /// public ParentType Type { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/CheckboxPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/CheckboxPropertyValue.cs index 3d9fb7fa..1f3fec50 100644 --- a/Src/Notion.Client/Models/PropertyValue/CheckboxPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/CheckboxPropertyValue.cs @@ -1,9 +1,15 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { + /// + /// Checkbox property value objects contain a boolean within the checkbox property. + /// public class CheckboxPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Checkbox; + [JsonProperty("checkbox")] public bool Checkbox { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/CreatedByPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/CreatedByPropertyValue.cs index 8e78b564..17fa4ef4 100644 --- a/Src/Notion.Client/Models/PropertyValue/CreatedByPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/CreatedByPropertyValue.cs @@ -2,10 +2,16 @@ namespace Notion.Client { + /// + /// Created by property value object + /// public class CreatedByPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.CreatedBy; + /// + /// Describes the user who created this page. + /// [JsonProperty("created_by")] public User CreatedBy { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/CreatedTimePropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/CreatedTimePropertyValue.cs index 6885f1fe..0b20b2dc 100644 --- a/Src/Notion.Client/Models/PropertyValue/CreatedTimePropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/CreatedTimePropertyValue.cs @@ -2,10 +2,16 @@ namespace Notion.Client { + /// + /// Created time property value object. + /// public class CreatedTimePropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.CreatedTime; + /// + /// The date and time when this page was created. + /// [JsonProperty("created_time")] public string CreatedTime { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/DatePropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/DatePropertyValue.cs index 0fc98859..6182b197 100644 --- a/Src/Notion.Client/Models/PropertyValue/DatePropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/DatePropertyValue.cs @@ -1,16 +1,37 @@ using System; +using Newtonsoft.Json; namespace Notion.Client { + /// + /// Date property value object. + /// public class DatePropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Date; + + /// + /// Date + /// + [JsonProperty("date")] public Date Date { get; set; } } + /// + /// Date value object. + /// public class Date { + /// + /// Start date with optional time. + /// + [JsonProperty("start")] public DateTime? Start { get; set; } + + /// + /// End date with optional time. + /// + [JsonProperty("end")] public DateTime? End { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs index 095f060c..1869fc85 100644 --- a/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/EmailPropertyValue.cs @@ -1,9 +1,18 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { + /// + /// Email property value object. + /// public class EmailPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Email; + /// + /// Describes an email address. + /// + [JsonProperty("email")] public string Email { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/FilesPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/FilesPropertyValue.cs index bd144643..c712379f 100644 --- a/Src/Notion.Client/Models/PropertyValue/FilesPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/FilesPropertyValue.cs @@ -1,11 +1,19 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { + /// + /// File property value object. + /// public class FilesPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Files; + /// + /// Array of File Object with name. + /// + [JsonProperty("files")] public List Files { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/FormulaPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/FormulaPropertyValue.cs index 49ce4c53..e85fd5bd 100644 --- a/Src/Notion.Client/Models/PropertyValue/FormulaPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/FormulaPropertyValue.cs @@ -1,18 +1,54 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { + /// + /// Formula property value object. + /// public class FormulaPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Formula; + /// + /// A formula described in the database's properties. + /// + [JsonProperty("formula")] public FormulaValue Formula { get; set; } } + /// + /// Formula value object. + /// public class FormulaValue { + /// + /// Formula value type + /// + [JsonProperty("type")] public string Type { get; set; } + + /// + /// String formula value. + /// + [JsonProperty("string")] public string String { get; set; } + + /// + /// Number formula value. + /// + [JsonProperty("number")] public double? Number { get; set; } + + /// + /// Boolean formula value. + /// + [JsonProperty("boolean")] public bool? Boolean { get; set; } + + /// + /// Date formula value + /// + [JsonProperty("date")] public Date Date { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/LastEditedByPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/LastEditedByPropertyValue.cs index 56e216a7..b5e26efc 100644 --- a/Src/Notion.Client/Models/PropertyValue/LastEditedByPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/LastEditedByPropertyValue.cs @@ -2,10 +2,16 @@ namespace Notion.Client { + /// + /// Last edited by property value object. + /// public class LastEditedByPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.LastEditedBy; + /// + /// Describes the user who last updated this page. + /// [JsonProperty("last_edited_by")] public User LastEditedBy { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/LastEditedTimePropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/LastEditedTimePropertyValue.cs index cdb192f5..785ac3bc 100644 --- a/Src/Notion.Client/Models/PropertyValue/LastEditedTimePropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/LastEditedTimePropertyValue.cs @@ -2,10 +2,16 @@ namespace Notion.Client { + /// + /// Last edited time property value object. + /// public class LastEditedTimePropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.LastEditedTime; + /// + /// The date and time when this page was last updated. + /// [JsonProperty("last_edited_time")] public string LastEditedTime { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/MultiSelectPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/MultiSelectPropertyValue.cs index 71dc8327..a5ee4f0a 100644 --- a/Src/Notion.Client/Models/PropertyValue/MultiSelectPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/MultiSelectPropertyValue.cs @@ -3,10 +3,16 @@ namespace Notion.Client { + /// + /// Multi-select property value object. + /// public class MultiSelectPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.MultiSelect; + /// + /// An array of multi-select option values. + /// [JsonProperty("multi_select")] public List MultiSelect { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs index 4f95dceb..863d5f1b 100644 --- a/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/NumberPropertyValue.cs @@ -1,8 +1,18 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { + /// + /// Number formula property value object. + /// public class NumberPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Number; + + /// + /// Value of number + /// + [JsonProperty("number")] public double Number { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/PeoplePropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/PeoplePropertyValue.cs index 734368d9..047d33ee 100644 --- a/Src/Notion.Client/Models/PropertyValue/PeoplePropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/PeoplePropertyValue.cs @@ -1,10 +1,19 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { + /// + /// People property value object. + /// public class PeoplePropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.People; + + /// + /// List of users. + /// + [JsonProperty("people")] public List People { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs index d4f4610c..be5e482e 100644 --- a/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/PhoneNumberPropertyValue.cs @@ -2,10 +2,16 @@ namespace Notion.Client { + /// + /// Phone number property value object. + /// public class PhoneNumberPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.PhoneNumber; + /// + /// Phone number value + /// [JsonProperty("phone_number")] public string PhoneNumber { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs index 6c831746..c85ebbdc 100644 --- a/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs @@ -4,6 +4,9 @@ namespace Notion.Client { + /// + /// An object describing the identifier, type, and value of a page property. + /// [JsonConverter(typeof(JsonSubtypes), "type")] [JsonSubtypes.KnownSubType(typeof(CheckboxPropertyValue), PropertyValueType.Checkbox)] [JsonSubtypes.KnownSubType(typeof(CreatedByPropertyValue), PropertyValueType.CreatedBy)] @@ -26,6 +29,10 @@ namespace Notion.Client [JsonSubtypes.KnownSubType(typeof(UrlPropertyValue), PropertyValueType.Url)] public class PropertyValue { + /// + /// Underlying identifier of the property. + /// + [JsonProperty("id")] public string Id { get; set; } [JsonConverter(typeof(StringEnumConverter))] diff --git a/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs b/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs index e34563df..4a4b8189 100644 --- a/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs +++ b/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs @@ -2,6 +2,9 @@ namespace Notion.Client { + /// + /// Types of Property Value + /// public enum PropertyValueType { [EnumMember(Value = null)] diff --git a/Src/Notion.Client/Models/PropertyValue/RelationPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/RelationPropertyValue.cs index e6195a57..3d11a096 100644 --- a/Src/Notion.Client/Models/PropertyValue/RelationPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/RelationPropertyValue.cs @@ -1,7 +1,11 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { + /// + /// Relation property value object. + /// public class RelationPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Relation; @@ -9,6 +13,7 @@ public class RelationPropertyValue : PropertyValue /// /// Array of page references /// + [JsonProperty("relation")] public List Relation { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/RichTextPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/RichTextPropertyValue.cs index ad9b48f3..028ed046 100644 --- a/Src/Notion.Client/Models/PropertyValue/RichTextPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/RichTextPropertyValue.cs @@ -3,10 +3,16 @@ namespace Notion.Client { + /// + /// Rich Text property value object. + /// public class RichTextPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.RichText; + /// + /// List of rich text objects + /// [JsonProperty("rich_text")] public List RichText { get; set; } } diff --git a/Src/Notion.Client/Models/PropertyValue/RollupPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/RollupPropertyValue.cs index d5ef5f53..c6587226 100644 --- a/Src/Notion.Client/Models/PropertyValue/RollupPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/RollupPropertyValue.cs @@ -1,23 +1,47 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { + /// + /// Rollup property value object. + /// public class RollupPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Rollup; + [JsonProperty("rollup")] public RollupValue Rollup { get; set; } } + /// + /// Object containing rollup type-specific data. + /// public class RollupValue { + /// + /// The type of rollup. Possible values are "number", "date", and "array". + /// + [JsonProperty("type")] public string Type { get; set; } + + /// + /// Number rollup property values contain a number + /// + [JsonProperty("number")] public double Number { get; set; } + + /// + /// Date rollup property values contain a date property value. + /// + [JsonProperty("date")] public DatePropertyValue Date { get; set; } /// - /// Array containing the propert value object will not contain value for Id field + /// Array rollup property values contain an array of element objects. + /// Array containing the property value object will not contain value for Id field /// + [JsonProperty("array")] public List Array { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/SelectPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/SelectPropertyValue.cs index d4140d3a..07b2a346 100644 --- a/Src/Notion.Client/Models/PropertyValue/SelectPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/SelectPropertyValue.cs @@ -1,8 +1,15 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { + /// + /// Select property value object. + /// public class SelectPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Select; + + [JsonProperty("select")] public SelectOption Select { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/TitlePropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/TitlePropertyValue.cs index 80e4aa8d..58b7842d 100644 --- a/Src/Notion.Client/Models/PropertyValue/TitlePropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/TitlePropertyValue.cs @@ -1,10 +1,19 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace Notion.Client { + /// + /// Title property value object. + /// public class TitlePropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Title; + + /// + /// An array of rich text objects + /// + [JsonProperty("title")] public List Title { get; set; } } } diff --git a/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs index cf69a78b..08b800e6 100644 --- a/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/UrlPropertyValue.cs @@ -1,9 +1,18 @@ -namespace Notion.Client +using Newtonsoft.Json; + +namespace Notion.Client { + /// + /// URL property value object. + /// public class UrlPropertyValue : PropertyValue { public override PropertyValueType Type => PropertyValueType.Url; + /// + /// Describes a web address + /// + [JsonProperty("url")] public string Url { get; set; } } } diff --git a/Src/Notion.Client/Models/User.cs b/Src/Notion.Client/Models/User.cs index 032f1a88..ce39e822 100644 --- a/Src/Notion.Client/Models/User.cs +++ b/Src/Notion.Client/Models/User.cs @@ -6,18 +6,26 @@ public class User : IObject { public ObjectType Object => ObjectType.User; public string Id { get; set; } + + [JsonProperty("type")] public string Type { get; set; } + + [JsonProperty("name")] public string Name { get; set; } [JsonProperty("avatar_url")] public string AvatarUrl { get; set; } + [JsonProperty("person")] public Person Person { get; set; } + + [JsonProperty("bot")] public Bot Bot { get; set; } } public class Person { + [JsonProperty("email")] public string Email { get; set; } } From f95db70614dd765c976a9fc54d53e9a3e12f3b80 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 2 Oct 2021 05:28:11 +0530 Subject: [PATCH 2/2] Add JsonProperty attribute --- Src/Notion.Client/Models/Database/Properties/RollupProperty.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs b/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs index fa0c4b92..5176dd88 100644 --- a/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/RollupProperty.cs @@ -26,6 +26,7 @@ public class Rollup [JsonProperty("rollup_property_id")] public string RollupPropertyId { get; set; } + [JsonProperty("function")] [JsonConverter(typeof(StringEnumConverter))] public Function Function { get; set; } }