File tree Expand file tree Collapse file tree 7 files changed +59
-50
lines changed Expand file tree Collapse file tree 7 files changed +59
-50
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,11 @@ public async Task<PaginatedList<Database>> ListAsync(DatabasesListParameters dat
31
31
return await _client . GetAsync < PaginatedList < Database > > ( DatabasesApiUrls . List ( ) , queryParams ) ;
32
32
}
33
33
34
- public async Task < PaginatedList < RetrievedPage > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters )
34
+ public async Task < PaginatedList < Page > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters )
35
35
{
36
36
var body = ( IDatabaseQueryBodyParameters ) databasesQueryParameters ;
37
37
38
- return await _client . PostAsync < PaginatedList < RetrievedPage > > ( DatabasesApiUrls . Query ( databaseId ) , body ) ;
38
+ return await _client . PostAsync < PaginatedList < Page > > ( DatabasesApiUrls . Query ( databaseId ) , body ) ;
39
39
}
40
40
}
41
41
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ namespace Notion.Client
5
5
public interface IDatabasesClient
6
6
{
7
7
Task < Database > RetrieveAsync ( string databaseId ) ;
8
- Task < PaginatedList < RetrievedPage > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters ) ;
8
+ Task < PaginatedList < Page > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters ) ;
9
9
Task < PaginatedList < Database > > ListAsync ( DatabasesListParameters databasesListParameters = null ) ;
10
10
}
11
11
}
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ namespace Notion.Client
5
5
{
6
6
public interface IPagesClient
7
7
{
8
- Task < RetrievedPage > CreateAsync ( CreatedPage page ) ;
9
- Task < RetrievedPage > RetrieveAsync ( string pageId ) ;
8
+ Task < Page > CreateAsync ( NewPage page ) ;
9
+ Task < Page > RetrieveAsync ( string pageId ) ;
10
10
11
- Task < RetrievedPage > UpdatePropertiesAsync (
11
+ Task < Page > UpdatePropertiesAsync (
12
12
string pageId ,
13
13
IDictionary < string , PropertyValue > updatedProperties
14
14
) ;
Original file line number Diff line number Diff line change @@ -13,25 +13,25 @@ public PagesClient(IRestClient client)
13
13
_client = client ;
14
14
}
15
15
16
- public async Task < RetrievedPage > CreateAsync ( CreatedPage page )
16
+ public async Task < Page > CreateAsync ( NewPage page )
17
17
{
18
- return await _client . PostAsync < RetrievedPage > ( PagesApiUrls . Create ( ) , page ) ;
18
+ return await _client . PostAsync < Page > ( PagesApiUrls . Create ( ) , page ) ;
19
19
}
20
20
21
- public async Task < RetrievedPage > RetrieveAsync ( string pageId )
21
+ public async Task < Page > RetrieveAsync ( string pageId )
22
22
{
23
23
var url = PagesApiUrls . Retrieve ( pageId ) ;
24
- return await _client . GetAsync < RetrievedPage > ( url ) ;
24
+ return await _client . GetAsync < Page > ( url ) ;
25
25
}
26
26
27
- public async Task < RetrievedPage > UpdatePropertiesAsync (
27
+ public async Task < Page > UpdatePropertiesAsync (
28
28
string pageId ,
29
29
IDictionary < string , PropertyValue > updatedProperties )
30
30
{
31
31
var url = PagesApiUrls . UpdateProperties ( pageId ) ;
32
32
var body = new UpdatePropertiesParameters { Properties = updatedProperties } ;
33
33
34
- return await _client . PatchAsync < RetrievedPage > ( url , body ) ;
34
+ return await _client . PatchAsync < Page > ( url , body ) ;
35
35
}
36
36
37
37
private class UpdatePropertiesParameters
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ using System . Collections . Generic ;
2
+
3
+ namespace Notion . Client
4
+ {
5
+ public class NewPage
6
+ {
7
+
8
+ /// <summary>
9
+ /// Constructor without arguments: added for class initializations using class literals.
10
+ /// </summary>
11
+ public NewPage ( )
12
+ {
13
+ Properties = new Dictionary < string , PropertyValue > ( ) ;
14
+ Children = new List < Block > ( ) ;
15
+ }
16
+
17
+ /// <summary>
18
+ /// Constructor that adds required <c>Parent</c> property. Used when you don't want to
19
+ /// assign properties in separate operations.
20
+ /// </summary>
21
+ public NewPage ( Parent parent )
22
+ {
23
+ Parent = parent ;
24
+ Properties = new Dictionary < string , PropertyValue > ( ) ;
25
+ Children = new List < Block > ( ) ;
26
+ }
27
+
28
+ public Parent Parent { get ; set ; }
29
+
30
+ public Dictionary < string , PropertyValue > Properties { get ; set ; }
31
+
32
+ public List < Block > Children { get ; set ; }
33
+
34
+ public NewPage AddProperty ( string nameOrId , PropertyValue value )
35
+ {
36
+ Properties [ nameOrId ] = value ;
37
+ return this ;
38
+ }
39
+
40
+ public NewPage AddPageContent ( Block block )
41
+ {
42
+ Children . Add ( block ) ;
43
+ return this ;
44
+ }
45
+ }
46
+ }
Original file line number Diff line number Diff line change 4
4
5
5
namespace Notion . Client
6
6
{
7
- public class RetrievedPage
7
+ public class Page
8
8
{
9
9
public string Object => "page" ;
10
10
public string Id { get ; set ; }
You can’t perform that action at this time.
0 commit comments