Skip to content

Commit a29e793

Browse files
add support for database list API 📢
1 parent 4b0975f commit a29e793

File tree

5 files changed

+573
-5
lines changed

5 files changed

+573
-5
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Threading.Tasks;
2+
3+
namespace Notion.Client
4+
{
5+
public interface IDatabaseClient
6+
{
7+
Task<PaginatedList<Database>> ListAsync();
8+
9+
}
10+
11+
public class DatabaseClient : IDatabaseClient
12+
{
13+
private readonly IRestClient _client;
14+
15+
public DatabaseClient(IRestClient client)
16+
{
17+
_client = client;
18+
}
19+
20+
public async Task<PaginatedList<Database>> ListAsync()
21+
{
22+
try
23+
{
24+
return await _client.GetAsync<PaginatedList<Database>>("databases");
25+
}
26+
catch (System.Exception e)
27+
{
28+
// Todo: Throw Custom Exception
29+
return null;
30+
}
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)