Skip to content

Commit a298ec8

Browse files
committed
fix: Unique Id property parsing
1 parent c4b52ee commit a298ec8

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

Src/Notion.Client/Models/PropertyValue/PropertyValue.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace Notion.Client
2929
[JsonSubtypes.KnownSubTypeAttribute(typeof(StatusPropertyValue), PropertyValueType.Status)]
3030
[JsonSubtypes.KnownSubTypeAttribute(typeof(TitlePropertyValue), PropertyValueType.Title)]
3131
[JsonSubtypes.KnownSubTypeAttribute(typeof(UrlPropertyValue), PropertyValueType.Url)]
32+
[JsonSubtypes.KnownSubTypeAttribute(typeof(UniqueIdPropertyValue), PropertyValueType.UniqueId)]
3233
[SuppressMessage("ReSharper", "UnusedMember.Global")]
3334
[SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")]
3435
public class PropertyValue

Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public enum PropertyValueType
7070
LastEditedBy,
7171

7272
[EnumMember(Value = "status")]
73-
Status
73+
Status,
74+
75+
[EnumMember(Value = "unique_id")]
76+
UniqueId,
7477
}
7578
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace Notion.Client
5+
{
6+
/// <summary>
7+
/// Unique Id property value object.
8+
/// </summary>
9+
public class UniqueIdPropertyValue : PropertyValue
10+
{
11+
public override PropertyValueType Type => PropertyValueType.UniqueId;
12+
13+
/// <summary>
14+
/// Unique Id property of database item
15+
/// </summary>
16+
[JsonProperty("unique_id")]
17+
public UniqueIdValue UniqueId { get; set; }
18+
}
19+
20+
public class UniqueIdValue
21+
{
22+
[JsonProperty("prefix")]
23+
public string Prefix { get; set; }
24+
25+
[JsonProperty("number")]
26+
public double? Number { get; set; }
27+
}
28+
}
29+

0 commit comments

Comments
 (0)