Skip to content

Commit

Permalink
Merge branch 'notion-version-2022-02-22' of github.com:notion-dotnet/…
Browse files Browse the repository at this point in the history
…notion-sdk-net into notion-version-2022-02-22
  • Loading branch information
KoditkarVedant committed Jul 16, 2022
2 parents f309683 + f0b7ad2 commit c934d05
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 57 deletions.
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 comments on commit c934d05

Please sign in to comment.