Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Unique Id property parsing
  • Loading branch information
RandomUser14 committed Jul 17, 2023
commit a298ec89837f3f786de6e41640d1ef74d6db100e
1 change: 1 addition & 0 deletions Src/Notion.Client/Models/PropertyValue/PropertyValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public enum PropertyValueType
LastEditedBy,

[EnumMember(Value = "status")]
Status
Status,

[EnumMember(Value = "unique_id")]
UniqueId,
}
}
29 changes: 29 additions & 0 deletions Src/Notion.Client/Models/PropertyValue/UniqueIdPropertyValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using Newtonsoft.Json;

namespace Notion.Client
{
/// <summary>
/// Unique Id property value object.
/// </summary>
public class UniqueIdPropertyValue : PropertyValue
{
public override PropertyValueType Type => PropertyValueType.UniqueId;

/// <summary>
/// Unique Id property of database item
/// </summary>
[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; }
}
}