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
3131 return await _client . GetAsync < PaginatedList < Database > > ( DatabasesApiUrls . List ( ) , queryParams ) ;
3232 }
3333
34- public async Task < PaginatedList < RetrievedPage > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters )
34+ public async Task < PaginatedList < Page > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters )
3535 {
3636 var body = ( IDatabaseQueryBodyParameters ) databasesQueryParameters ;
3737
38- return await _client . PostAsync < PaginatedList < RetrievedPage > > ( DatabasesApiUrls . Query ( databaseId ) , body ) ;
38+ return await _client . PostAsync < PaginatedList < Page > > ( DatabasesApiUrls . Query ( databaseId ) , body ) ;
3939 }
4040 }
4141}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ namespace Notion.Client
55 public interface IDatabasesClient
66 {
77 Task < Database > RetrieveAsync ( string databaseId ) ;
8- Task < PaginatedList < RetrievedPage > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters ) ;
8+ Task < PaginatedList < Page > > QueryAsync ( string databaseId , DatabasesQueryParameters databasesQueryParameters ) ;
99 Task < PaginatedList < Database > > ListAsync ( DatabasesListParameters databasesListParameters = null ) ;
1010 }
1111}
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ namespace Notion.Client
55{
66 public interface IPagesClient
77 {
8- Task < RetrievedPage > CreateAsync ( CreatedPage page ) ;
9- Task < RetrievedPage > RetrieveAsync ( string pageId ) ;
8+ Task < Page > CreateAsync ( NewPage page ) ;
9+ Task < Page > RetrieveAsync ( string pageId ) ;
1010
11- Task < RetrievedPage > UpdatePropertiesAsync (
11+ Task < Page > UpdatePropertiesAsync (
1212 string pageId ,
1313 IDictionary < string , PropertyValue > updatedProperties
1414 ) ;
Original file line number Diff line number Diff line change @@ -13,25 +13,25 @@ public PagesClient(IRestClient client)
1313 _client = client ;
1414 }
1515
16- public async Task < RetrievedPage > CreateAsync ( CreatedPage page )
16+ public async Task < Page > CreateAsync ( NewPage page )
1717 {
18- return await _client . PostAsync < RetrievedPage > ( PagesApiUrls . Create ( ) , page ) ;
18+ return await _client . PostAsync < Page > ( PagesApiUrls . Create ( ) , page ) ;
1919 }
2020
21- public async Task < RetrievedPage > RetrieveAsync ( string pageId )
21+ public async Task < Page > RetrieveAsync ( string pageId )
2222 {
2323 var url = PagesApiUrls . Retrieve ( pageId ) ;
24- return await _client . GetAsync < RetrievedPage > ( url ) ;
24+ return await _client . GetAsync < Page > ( url ) ;
2525 }
2626
27- public async Task < RetrievedPage > UpdatePropertiesAsync (
27+ public async Task < Page > UpdatePropertiesAsync (
2828 string pageId ,
2929 IDictionary < string , PropertyValue > updatedProperties )
3030 {
3131 var url = PagesApiUrls . UpdateProperties ( pageId ) ;
3232 var body = new UpdatePropertiesParameters { Properties = updatedProperties } ;
3333
34- return await _client . PatchAsync < RetrievedPage > ( url , body ) ;
34+ return await _client . PatchAsync < Page > ( url , body ) ;
3535 }
3636
3737 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 44
55namespace Notion . Client
66{
7- public class RetrievedPage
7+ public class Page
88 {
99 public string Object => "page" ;
1010 public string Id { get ; set ; }
You can’t perform that action at this time.
0 commit comments