Skip to content

Commit

Permalink
Merge pull request #158 from notion-dotnet/feature/157-mark-list-data…
Browse files Browse the repository at this point in the history
…base-enpoint-deprecated

Mark database list endpoint obsolete with warning 🗑️
  • Loading branch information
KoditkarVedant authored Oct 2, 2021
2 parents 7ec3c20 + 2a96fc5 commit 0b43508
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var complexFiler = new CompoundFilter(
- [x] Create a database
- [x] Update database
- [x] Retrieve a database
- [x] List databases
- [x] List databases (Deprecated: use Search API instead)
- [x] Pages
- [x] Retrieve a page
- [x] Create a page
Expand Down
4 changes: 3 additions & 1 deletion Src/Notion.Client/Api/Databases/DatabasesClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using static Notion.Client.ApiEndpoints;

Expand All @@ -18,6 +19,7 @@ public async Task<Database> RetrieveAsync(string databaseId)
return await _client.GetAsync<Database>(DatabasesApiUrls.Retrieve(databaseId));
}

[Obsolete("This endpoint is no longer recommended, use Search instead. This endpoint will only return explicitly shared pages, while search will also return child pages within explicitly shared pages. This endpoint's results cannot be filtered, while search can be used to match on page title.", false)]
public async Task<PaginatedList<Database>> ListAsync(DatabasesListParameters databasesListParameters = null)
{
var databasesListQueryParmaters = (IDatabasesListQueryParmaters)databasesListParameters;
Expand Down
10 changes: 9 additions & 1 deletion Src/Notion.Client/Api/Databases/IDatabasesClient.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;

namespace Notion.Client
{
public interface IDatabasesClient
{
Task<Database> RetrieveAsync(string databaseId);
Task<PaginatedList<Page>> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters);

/// <summary>
/// List all Databases shared with the authenticated integration.
/// </summary>
/// <param name="databasesListParameters">database list request parameters.</param>
/// <returns>PaginatedList of databases.</returns>
[Obsolete("This endpoint is no longer recommended, use Search instead. This endpoint will only return explicitly shared pages, while search will also return child pages within explicitly shared pages. This endpoint's results cannot be filtered, while search can be used to match on page title.", false)]
Task<PaginatedList<Database>> ListAsync(DatabasesListParameters databasesListParameters = null);

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Test/Notion.UnitTests/DatabasesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public DatabasesClientTests()
}

[Fact]
[Obsolete]
public async Task ListDatabasesAsync()
{
var path = ApiEndpoints.DatabasesApiUrls.List();
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var complexFiler = new CompoundFilter(
- [x] Create a database
- [x] Update database
- [x] Retrieve a database
- [x] List databases
- [x] List databases (Deprecated: use Search API instead)
- [x] Pages
- [x] Retrieve a page
- [x] Create a page
Expand Down

0 comments on commit 0b43508

Please sign in to comment.