File tree Expand file tree Collapse file tree 9 files changed +30
-15
lines changed
Expand file tree Collapse file tree 9 files changed +30
-15
lines changed Original file line number Diff line number Diff line change 11using JsonSubTypes ;
22using Newtonsoft . Json ;
3- using Newtonsoft . Json . Converters ;
43
54namespace Notion . Client
65{
76 [ JsonConverter ( typeof ( JsonSubtypes ) , "type" ) ]
87 [ JsonSubtypes . KnownSubType ( typeof ( DatabaseParent ) , ParentType . DatabaseId ) ]
98 [ JsonSubtypes . KnownSubType ( typeof ( PageParent ) , ParentType . PageId ) ]
109 [ JsonSubtypes . KnownSubType ( typeof ( WorkspaceParent ) , ParentType . Workspace ) ]
11- public class Parent
10+ public interface IPageParent : IParent
1211 {
13- [ JsonConverter ( typeof ( StringEnumConverter ) ) ]
14- public ParentType Type { get ; set ; }
1512 }
1613}
Original file line number Diff line number Diff line change @@ -17,14 +17,14 @@ public NewPage()
1717 /// Constructor that adds required <c>Parent</c> property. Used when you don't want to
1818 /// assign properties in separate operations.
1919 /// </summary>
20- public NewPage ( Parent parent )
20+ public NewPage ( IPageParent parent )
2121 {
2222 Parent = parent ;
2323 Properties = new Dictionary < string , PropertyValue > ( ) ;
2424 Children = new List < Block > ( ) ;
2525 }
2626
27- public Parent Parent { get ; set ; }
27+ public IPageParent Parent { get ; set ; }
2828
2929 public Dictionary < string , PropertyValue > Properties { get ; set ; }
3030
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ namespace Notion.Client
77 public class Page : IObject
88 {
99 public ObjectType Object => ObjectType . Page ;
10+
1011 public string Id { get ; set ; }
11- public Parent Parent { get ; set ; }
12+
13+ public IPageParent Parent { get ; set ; }
1214
1315 [ JsonProperty ( "created_time" ) ]
1416 public DateTime CreatedTime { get ; set ; }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22
33namespace Notion . Client
44{
5- public class DatabaseParent : Parent
5+ public class DatabaseParent : IPageParent
66 {
7+ public ParentType Type { get ; set ; }
8+
79 [ JsonProperty ( "database_id" ) ]
810 public string DatabaseId { get ; set ; }
911 }
Original file line number Diff line number Diff line change 1+ using Newtonsoft . Json ;
2+ using Newtonsoft . Json . Converters ;
3+
4+ namespace Notion . Client
5+ {
6+ public interface IParent
7+ {
8+ [ JsonConverter ( typeof ( StringEnumConverter ) ) ]
9+ ParentType Type { get ; set ; }
10+ }
11+ }
Original file line number Diff line number Diff line change 22
33namespace Notion . Client
44{
5- public class PageParent : Parent
5+ public class PageParent : IPageParent
66 {
77 [ JsonProperty ( "page_id" ) ]
88 public string PageId { get ; set ; }
9+ public ParentType Type { get ; set ; }
910 }
1011}
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ public enum ParentType
1212
1313 [ EnumMember ( Value = "page_id" ) ]
1414 PageId ,
15+
1516 [ EnumMember ( Value = "workspace" ) ]
1617 Workspace
1718 }
Original file line number Diff line number Diff line change 1+ namespace Notion . Client
2+ {
3+ public class WorkspaceParent : IPageParent
4+ {
5+ public ParentType Type { get ; set ; }
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments