Skip to content

Commit

Permalink
Merge pull request #326 from notion-dotnet/325-add-missing-property-item
Browse files Browse the repository at this point in the history
Add missing property item
  • Loading branch information
KoditkarVedant authored Sep 18, 2022
2 parents ed18e1a + e8404c8 commit dc5cf2c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Src/Notion.Client/Models/PropertyItems/RollupPropertyItem.cs
Original file line number Diff line number Diff line change
@@ -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<Dictionary<string, object>> Array { get; set; }

[JsonProperty("unsupported")] public Dictionary<string, object> Unsupported { get; set; }

[JsonProperty("incomplete")] public Dictionary<string, object> Incomplete { get; set; }
}
}
}
2 changes: 2 additions & 0 deletions Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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")]
Expand All @@ -22,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";
Expand Down
11 changes: 11 additions & 0 deletions Src/Notion.Client/Models/PropertyItems/StatusPropertyItem.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}

0 comments on commit dc5cf2c

Please sign in to comment.