Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Src/Notion.Client/Models/Database/Properties/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Notion.Client
[JsonSubtypes.KnownSubType(typeof(RichTextProperty), PropertyType.RichText)]
[JsonSubtypes.KnownSubType(typeof(RollupProperty), PropertyType.Rollup)]
[JsonSubtypes.KnownSubType(typeof(SelectProperty), PropertyType.Select)]
[JsonSubtypes.KnownSubType(typeof(StatusProperty), PropertyType.Status)]
[JsonSubtypes.KnownSubType(typeof(TitleProperty), PropertyType.Title)]
[JsonSubtypes.KnownSubType(typeof(UrlProperty), PropertyType.Url)]
public class Property
Expand Down
5 changes: 4 additions & 1 deletion Src/Notion.Client/Models/Database/Properties/PropertyType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public enum PropertyType
LastEditedBy,

[EnumMember(Value = "last_edited_time")]
LastEditedTime
LastEditedTime,

[EnumMember(Value = "status")]
Status,
}
}
13 changes: 13 additions & 0 deletions Src/Notion.Client/Models/Database/Properties/StatusProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class StatusProperty : Property
{
public override PropertyType Type => PropertyType.Status;

[JsonProperty("status")]
public Dictionary<string, object> Status { get; set; }
}
}
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 @@ -25,6 +25,7 @@ namespace Notion.Client
[JsonSubtypes.KnownSubType(typeof(RichTextPropertyValue), PropertyValueType.RichText)]
[JsonSubtypes.KnownSubType(typeof(RollupPropertyValue), PropertyValueType.Rollup)]
[JsonSubtypes.KnownSubType(typeof(SelectPropertyValue), PropertyValueType.Select)]
[JsonSubtypes.KnownSubType(typeof(StatusPropertyValue), PropertyValueType.Status)]
[JsonSubtypes.KnownSubType(typeof(TitlePropertyValue), PropertyValueType.Title)]
[JsonSubtypes.KnownSubType(typeof(UrlPropertyValue), PropertyValueType.Url)]
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 @@ -65,6 +65,9 @@ public enum PropertyValueType
LastEditedTime,

[EnumMember(Value = "last_edited_by")]
LastEditedBy
LastEditedBy,

[EnumMember(Value = "status")]
Status,
}
}
72 changes: 72 additions & 0 deletions Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Notion.Client
{
/// <summary>
/// Status property value objects contain page status
/// </summary>
public class StatusPropertyValue : PropertyValue
{
public override PropertyValueType Type => PropertyValueType.Status;

[JsonProperty("status")]
public Data Status { get; set; }

public class Data
{
/// <summary>
/// ID of the option.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// Name of the option as it appears in Notion.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }

/// <summary>
/// Color of the option.
/// </summary>
[JsonProperty("color")]
[JsonConverter(typeof(StringEnumConverter))]
public Color Color { get; set; }
}

public enum Color
{
[EnumMember(Value = "default")]
Default,

[EnumMember(Value = "gray")]
Gray,

[EnumMember(Value = "brown")]
Brown,

[EnumMember(Value = "orange")]
Orange,

[EnumMember(Value = "yellow")]
Yellow,

[EnumMember(Value = "green")]
Green,

[EnumMember(Value = "blue")]
Blue,

[EnumMember(Value = "purple")]
Purple,

[EnumMember(Value = "pink")]
Pink,

[EnumMember(Value = "red")]
Red,
}
}
}