From f83606e3c7c26bae1e97698145e460cd4b9356f6 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Wed, 13 Jul 2022 16:12:57 +0530 Subject: [PATCH 1/2] Removed list database endpoint --- .../Api/Databases/DatabasesClient.cs | 18 +----------- .../Api/Databases/IDatabasesClient.cs | 11 +------- Test/Notion.UnitTests/DatabasesClientTests.cs | 28 ------------------- 3 files changed, 2 insertions(+), 55 deletions(-) diff --git a/Src/Notion.Client/Api/Databases/DatabasesClient.cs b/Src/Notion.Client/Api/Databases/DatabasesClient.cs index ee546aef..2ab17a8b 100644 --- a/Src/Notion.Client/Api/Databases/DatabasesClient.cs +++ b/Src/Notion.Client/Api/Databases/DatabasesClient.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; +using System.Threading.Tasks; using static Notion.Client.ApiEndpoints; namespace Notion.Client @@ -19,20 +17,6 @@ public async Task RetrieveAsync(string databaseId) return await _client.GetAsync(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> ListAsync(DatabasesListParameters databasesListParameters = null) - { - var databasesListQueryParmaters = (IDatabasesListQueryParmaters)databasesListParameters; - - var queryParams = new Dictionary() - { - { "start_cursor", databasesListQueryParmaters?.StartCursor }, - { "page_size", databasesListQueryParmaters?.PageSize?.ToString() } - }; - - return await _client.GetAsync>(DatabasesApiUrls.List(), queryParams); - } - public async Task> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters) { var body = (IDatabaseQueryBodyParameters)databasesQueryParameters; diff --git a/Src/Notion.Client/Api/Databases/IDatabasesClient.cs b/Src/Notion.Client/Api/Databases/IDatabasesClient.cs index c339e4da..2b2c2746 100644 --- a/Src/Notion.Client/Api/Databases/IDatabasesClient.cs +++ b/Src/Notion.Client/Api/Databases/IDatabasesClient.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; namespace Notion.Client { @@ -8,14 +7,6 @@ public interface IDatabasesClient Task RetrieveAsync(string databaseId); Task> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters); - /// - /// List all Databases shared with the authenticated integration. - /// - /// database list request parameters. - /// PaginatedList of databases. - [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> ListAsync(DatabasesListParameters databasesListParameters = null); - /// /// Creates a database as a subpage in the specified parent page, with the specified properties schema. /// diff --git a/Test/Notion.UnitTests/DatabasesClientTests.cs b/Test/Notion.UnitTests/DatabasesClientTests.cs index 8462b42d..b87fdd5e 100644 --- a/Test/Notion.UnitTests/DatabasesClientTests.cs +++ b/Test/Notion.UnitTests/DatabasesClientTests.cs @@ -18,34 +18,6 @@ public DatabasesClientTests() _client = new DatabasesClient(new RestClient(ClientOptions)); } - [Fact] - [Obsolete] - public async Task ListDatabasesAsync() - { - var path = ApiEndpoints.DatabasesApiUrls.List(); - var jsonData = await File.ReadAllTextAsync("data/databases/DatabasesListResponse.json"); - - Server.Given(CreateGetRequestBuilder(path)) - .RespondWith( - Response.Create() - .WithStatusCode(200) - .WithBody(jsonData) - ); - - var databases = await _client.ListAsync(); - - databases.Results.Should().HaveCount(3); - - foreach (var database in databases.Results) - { - database.Parent.Should().BeAssignableTo(); - foreach (var property in database.Properties) - { - property.Key.Should().Be(property.Value.Name); - } - } - } - [Fact] public async Task QueryAsync() { From 1172c4f8870b87f6fad5ff8e32f424f740457fb9 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Wed, 13 Jul 2022 16:16:30 +0530 Subject: [PATCH 2/2] =?UTF-8?q?updated=20document=20=F0=9F=93=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - docs/README.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 29cc826b..7e552e88 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,6 @@ var complexFiler = new CompoundFilter( - [x] Create a database - [x] Update database - [x] Retrieve a database - - [x] List databases (Deprecated: use Search API instead) - [x] Pages - [x] Retrieve a page - [x] Create a page diff --git a/docs/README.md b/docs/README.md index 5ece487d..14a21997 100644 --- a/docs/README.md +++ b/docs/README.md @@ -80,7 +80,6 @@ var complexFiler = new CompoundFilter( - [x] Create a database - [x] Update database - [x] Retrieve a database - - [x] List databases (Deprecated: use Search API instead) - [x] Pages - [x] Retrieve a page - [x] Create a page