File tree 3 files changed +54
-2
lines changed
Models/Database/Properties
Test/Notion.IntegrationTests
3 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public class SelectOption
36
36
/// </summary>
37
37
[ JsonProperty ( "color" ) ]
38
38
[ JsonConverter ( typeof ( StringEnumConverter ) ) ]
39
- public Color Color { get ; set ; }
39
+ public Color ? Color { get ; set ; }
40
40
}
41
41
42
42
public enum Color
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
3
3
<PropertyGroup >
4
- <VersionPrefix >2.0 .1-preview</VersionPrefix >
4
+ <VersionPrefix >2.2 .1-preview</VersionPrefix >
5
5
<TargetFramework >netstandard2.0</TargetFramework >
6
6
<LangVersion >7.3</LangVersion >
7
7
Original file line number Diff line number Diff line change @@ -54,5 +54,57 @@ public async Task CreateAsync_CreatesANewPage()
54
54
Archived = true
55
55
} ) ;
56
56
}
57
+
58
+ [ Fact ]
59
+ public async Task Bug_unable_to_create_page_with_select_property ( )
60
+ {
61
+ var options = new ClientOptions
62
+ {
63
+ AuthToken = Environment . GetEnvironmentVariable ( "NOTION_AUTH_TOKEN" )
64
+ } ;
65
+
66
+ INotionClient _client = new NotionClient ( options ) ;
67
+
68
+ PagesCreateParameters pagesCreateParameters = PagesCreateParametersBuilder . Create ( new DatabaseParentInput
69
+ {
70
+ DatabaseId = "f86f2262-0751-40f2-8f63-e3f7a3c39fcb"
71
+ } )
72
+ . AddProperty ( "Name" , new TitlePropertyValue
73
+ {
74
+ Title = new List < RichTextBase >
75
+ {
76
+ new RichTextText
77
+ {
78
+ Text = new Text
79
+ {
80
+ Content = "Test Page Title"
81
+ }
82
+ }
83
+ }
84
+ } )
85
+ . AddProperty ( "TestSelect" , new SelectPropertyValue
86
+ {
87
+ Select = new SelectOption
88
+ {
89
+ Id = "dfbfbe65-6f67-4876-9f75-699124334d06"
90
+ }
91
+ } )
92
+ . Build ( ) ;
93
+
94
+ var page = await _client . Pages . CreateAsync ( pagesCreateParameters ) ;
95
+
96
+ page . Should ( ) . NotBeNull ( ) ;
97
+ page . Parent . Should ( ) . BeOfType < DatabaseParent > ( ) . Which
98
+ . DatabaseId . Should ( ) . Be ( "f86f2262-0751-40f2-8f63-e3f7a3c39fcb" ) ;
99
+
100
+ page . Properties . Should ( ) . ContainKey ( "Name" ) ;
101
+ page . Properties [ "Name" ] . Should ( ) . BeOfType < TitlePropertyValue > ( ) . Which
102
+ . Title . First ( ) . PlainText . Should ( ) . Be ( "Test Page Title" ) ;
103
+
104
+ await _client . Pages . UpdateAsync ( page . Id , new PagesUpdateParameters
105
+ {
106
+ Archived = true
107
+ } ) ;
108
+ }
57
109
}
58
110
}
You can’t perform that action at this time.
0 commit comments