8000 Removed List database endpoint support by KoditkarVedant · Pull Request #270 · notion-dotnet/notion-sdk-net · GitHub
[go: up one dir, main page]

Skip to content

Removed List database endpoint support #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

8000 Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 1 addition & 17 deletions Src/Notion.Client/Api/Databases/DatabasesClient.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,20 +17,6 @@ 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;

var queryParams = new Dictionary<string, string>()
{
{ "start_cursor", databasesListQueryParmaters?.StartCursor },
{ "page_size", databasesListQueryParmaters?.PageSize?.ToString() }
};

return await _client.GetAsync<PaginatedList<Database>>(DatabasesApiUrls.List(), queryParams);
}

public async Task<PaginatedList<Page>> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters)
{
var body = (IDatabaseQueryBodyParameters)databasesQueryParameters;
Expand Down
11 changes: 1 addition & 10 deletions Src/Notion.Client/Api/Databases/IDatabasesClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;

namespace Notion.Client
{
Expand All @@ -8,14 +7,6 @@ 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>
/// Creates a database as a subpage in the specified parent page, with the specified properties schema.
/// </summary>
Expand Down
28 changes: 0 additions & 28 deletions Test/Notion.UnitTests/DatabasesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IDatabaseParent>();
foreach (var property in database.Properties)
{
property.Key.Should().Be(property.Value.Name);
}
}
}

[Fact]
public async Task QueryAsync()
{
Expand Down
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
0