File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1+ using System ;
12using System . Collections . Generic ;
23using System . Threading . Tasks ;
34
45namespace Notion . Client
56{
67 public interface IDatabaseClient
78 {
9+ Task < Database > RetrieveAsync ( string databaseId ) ;
810 Task < PaginatedList < Database > > ListAsync ( DatabasesListParameters databasesListParameters = null ) ;
911 }
1012
@@ -17,6 +19,19 @@ public DatabaseClient(IRestClient client)
1719 _client = client ;
1820 }
1921
22+ public async Task < Database > RetrieveAsync ( string databaseId )
23+ {
24+ try
25+ {
26+ return await _client . GetAsync < Database > ( $ "databases/{ databaseId } ") ;
27+ }
28+ catch ( Exception e )
29+ {
30+ // Todo: Throw Custom Exception
31+ return null ;
32+ }
33+ }
34+
2035 public async Task < PaginatedList < Database > > ListAsync ( DatabasesListParameters databasesListParameters = null )
2136 {
2237 try
@@ -29,7 +44,7 @@ public async Task<PaginatedList<Database>> ListAsync(DatabasesListParameters dat
2944
3045 return await _client . GetAsync < PaginatedList < Database > > ( "databases" , queryParams ) ;
3146 }
32- catch ( System . Exception e )
47+ catch ( Exception e )
3348 {
3449 // Todo: Throw Custom Exception
3550 return null ;
Original file line number Diff line number Diff line change @@ -24,5 +24,13 @@ public async Task ListDatabasesAsync()
2424 var databasesList = await _client . ListAsync ( ) ;
2525 Assert . NotNull ( databasesList ) ;
2626 }
27+
28+ [ Fact ( Skip = "Internal Testing Purpose" ) ]
29+ public async Task RetrieveDatabaseAsync ( )
30+ {
31+ var databaseId = "" ;
32+ var database = await _client . RetrieveAsync ( databaseId ) ;
33+ Assert . NotNull ( database ) ;
34+ }
2735 }
2836}
You can’t perform that action at this time.
0 commit comments