diff --git a/Src/Notion.Client/Models/Database/Properties/Property.cs b/Src/Notion.Client/Models/Database/Properties/Property.cs index 163b7ef0..fa0dac50 100644 --- a/Src/Notion.Client/Models/Database/Properties/Property.cs +++ b/Src/Notion.Client/Models/Database/Properties/Property.cs @@ -25,6 +25,7 @@ namespace Notion.Client [JsonSubtypes.KnownSubTypeAttribute(typeof(StatusProperty), PropertyType.Status)] [JsonSubtypes.KnownSubTypeAttribute(typeof(TitleProperty), PropertyType.Title)] [JsonSubtypes.KnownSubTypeAttribute(typeof(UrlProperty), PropertyType.Url)] + [JsonSubtypes.KnownSubTypeAttribute(typeof(UniqueIdProperty), PropertyType.UniqueId)] public class Property { [JsonProperty("id")] diff --git a/Src/Notion.Client/Models/Database/Properties/PropertyType.cs b/Src/Notion.Client/Models/Database/Properties/PropertyType.cs index e4db339a..1d53b2a8 100644 --- a/Src/Notion.Client/Models/Database/Properties/PropertyType.cs +++ b/Src/Notion.Client/Models/Database/Properties/PropertyType.cs @@ -67,6 +67,9 @@ public enum PropertyType LastEditedTime, [EnumMember(Value = "status")] - Status + Status, + + [EnumMember(Value = "unique_id")] + UniqueId, } } diff --git a/Src/Notion.Client/Models/Database/Properties/UniqueIdProperty.cs b/Src/Notion.Client/Models/Database/Properties/UniqueIdProperty.cs new file mode 100644 index 00000000..8b56b462 --- /dev/null +++ b/Src/Notion.Client/Models/Database/Properties/UniqueIdProperty.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class UniqueIdProperty : Property + { + public override PropertyType Type => PropertyType.UniqueId; + + [JsonProperty("unique_id")] + public Dictionary UniqueId { get; set; } + } +} + diff --git a/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs index c423be82..5f7a6b05 100644 --- a/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs @@ -29,6 +29,7 @@ namespace Notion.Client [JsonSubtypes.KnownSubTypeAttribute(typeof(StatusPropertyValue), PropertyValueType.Status)] [JsonSubtypes.KnownSubTypeAttribute(typeof(TitlePropertyValue), PropertyValueType.Title)] [JsonSubtypes.KnownSubTypeAttribute(typeof(UrlPropertyValue), PropertyValueType.Url)] + [JsonSubtypes.KnownSubTypeAttribute(typeof(UniqueIdPropertyValue), PropertyValueType.UniqueId)] [SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class PropertyValue diff --git a/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs b/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs index 96ddaf77..ca6759c0 100644 --- a/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs +++ b/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs @@ -70,6 +70,9 @@ public enum PropertyValueType LastEditedBy, [EnumMember(Value = "status")] - Status + Status, + + [EnumMember(Value = "unique_id")] + UniqueId, } } diff --git a/Src/Notion.Client/Models/PropertyValue/UniqueIdPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/UniqueIdPropertyValue.cs new file mode 100644 index 00000000..716d9cce --- /dev/null +++ b/Src/Notion.Client/Models/PropertyValue/UniqueIdPropertyValue.cs @@ -0,0 +1,29 @@ +using System; +using Newtonsoft.Json; + +namespace Notion.Client +{ + /// + /// Unique Id property value object. + /// + public class UniqueIdPropertyValue : PropertyValue + { + public override PropertyValueType Type => PropertyValueType.UniqueId; + + /// + /// Unique Id property of database item + /// + [JsonProperty("unique_id")] + public UniqueIdValue UniqueId { get; set; } + } + + public class UniqueIdValue + { + [JsonProperty("prefix")] + public string Prefix { get; set; } + + [JsonProperty("number")] + public double? Number { get; set; } + } +} + diff --git a/Test/Notion.UnitTests/PropertyTests.cs b/Test/Notion.UnitTests/PropertyTests.cs index 07949131..fc748413 100644 --- a/Test/Notion.UnitTests/PropertyTests.cs +++ b/Test/Notion.UnitTests/PropertyTests.cs @@ -26,6 +26,7 @@ public class PropertyTests [InlineData(typeof(SelectProperty), PropertyType.Select)] [InlineData(typeof(TitleProperty), PropertyType.Title)] [InlineData(typeof(UrlProperty), PropertyType.Url)] + [InlineData(typeof(UniqueIdProperty), PropertyType.UniqueId)] public void TestPropertyType(Type type, PropertyType expectedPropertyType) { var typeInstance = (Property)Activator.CreateInstance(type); @@ -54,6 +55,7 @@ public void TestPropertyType(Type type, PropertyType expectedPropertyType) [InlineData(typeof(SelectProperty), "select")] [InlineData(typeof(TitleProperty), "title")] [InlineData(typeof(UrlProperty), "url")] + [InlineData(typeof(UniqueIdProperty), "unique_id")] public void TestPropertyTypeText(Type type, string expectedPropertyType) { var typeInstance = (Property)Activator.CreateInstance(type);