Skip to content

Commit c855a67

Browse files
Merge pull request #20 from notion-dotnet/fix-code-factor-issues
Fix code factor issues ♻️
2 parents 79c3e7a + c712513 commit c855a67

File tree

92 files changed

+1490
-1217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1490
-1217
lines changed

Src/Notion.Client/Api/Blocks/BlocksAppendChildrenParameters.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

Src/Notion.Client/Api/Blocks/BlocksClient.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66
namespace Notion.Client
77
{
8-
public interface IBlocksClient
9-
{
10-
Task<PaginatedList<BlockBase>> RetrieveChildrenAsync(string blockId, BlocksRetrieveChildrenParameters parameters = null);
11-
Task<BlockBase> AppendChildrenAsync(string blockId, BlocksAppendChildrenParameters parameters = null);
12-
}
13-
148
public class BlocksClient : IBlocksClient
159
{
1610
private readonly IRestClient _client;
@@ -20,7 +14,7 @@ public BlocksClient(IRestClient client)
2014
_client = client;
2115
}
2216

23-
public async Task<PaginatedList<BlockBase>> RetrieveChildrenAsync(string blockId, BlocksRetrieveChildrenParameters parameters = null)
17+
public async Task<PaginatedList<Block>> RetrieveChildrenAsync(string blockId, BlocksRetrieveChildrenParameters parameters = null)
2418
{
2519
if (string.IsNullOrWhiteSpace(blockId))
2620
{
@@ -37,10 +31,10 @@ public async Task<PaginatedList<BlockBase>> RetrieveChildrenAsync(string blockId
3731
{ "page_size", queryParameters?.PageSize?.ToString() }
3832
};
3933

40-
return await _client.GetAsync<PaginatedList<BlockBase>>(url, queryParams);
34+
return await _client.GetAsync<PaginatedList<Block>>(url, queryParams);
4135
}
4236

43-
public async Task<BlockBase> AppendChildrenAsync(string blockId, BlocksAppendChildrenParameters parameters = null)
37+
public async Task<Block> AppendChildrenAsync(string blockId, BlocksAppendChildrenParameters parameters = null)
4438
{
4539
if (string.IsNullOrWhiteSpace(blockId))
4640
{
@@ -51,7 +45,7 @@ public async Task<BlockBase> AppendChildrenAsync(string blockId, BlocksAppendChi
5145

5246
var body = (IBlocksAppendChildrenBodyParameters)parameters;
5347

54-
return await _client.PatchAsync<BlockBase>(url, body);
48+
return await _client.PatchAsync<Block>(url, body);
5549
}
5650
}
57-
}
51+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Threading.Tasks;
2+
3+
namespace Notion.Client
4+
{
5+
public interface IBlocksClient
6+
{
7+
Task<PaginatedList<Block>> RetrieveChildrenAsync(string blockId, BlocksRetrieveChildrenParameters parameters = null);
8+
Task<Block> AppendChildrenAsync(string blockId, BlocksAppendChildrenParameters parameters = null);
9+
}
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections.Generic;
2+
3+
namespace Notion.Client
4+
{
5+
public class BlocksAppendChildrenParameters : IBlocksAppendChildrenBodyParameters
6+
{
7+
public IEnumerable<Block> Children { get; set; }
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
namespace Notion.Client
22
{
3-
public interface IBlocksRetrieveChildrenQueryParameters : IPaginationParameters
4-
{
5-
}
6-
73
public class BlocksRetrieveChildrenParameters : IBlocksRetrieveChildrenQueryParameters
84
{
95
public string StartCursor { get; set; }
106
public string PageSize { get; set; }
117
}
12-
}
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Collections.Generic;
2+
3+
namespace Notion.Client
4+
{
5+
// TODO: need an input version of Block
6+
public interface IBlocksAppendChildrenBodyParameters
7+
{
8+
IEnumerable<Block> Children { get; set; }
9+
}
10+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Notion.Client
2+
{
3+
public interface IBlocksRetrieveChildrenQueryParameters : IPaginationParameters
4+
{
5+
}
6+
}

Src/Notion.Client/Api/Databases/DatabasesClient.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Threading.Tasks;
43
using static Notion.Client.ApiEndpoints;
54

65
namespace Notion.Client
76
{
8-
public interface IDatabasesClient
9-
{
10-
Task<Database> RetrieveAsync(string databaseId);
11-
Task<PaginatedList<Page>> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters);
12-
Task<PaginatedList<Database>> ListAsync(DatabasesListParameters databasesListParameters = null);
13-
}
14-
157
public class DatabasesClient : IDatabasesClient
168
{
179
private readonly IRestClient _client;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Threading.Tasks;
2+
3+
namespace Notion.Client
4+
{
5+
public interface IDatabasesClient
6+
{
7+
Task<Database> RetrieveAsync(string databaseId);
8+
Task<PaginatedList<Page>> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters);
9+
Task<PaginatedList<Database>> ListAsync(DatabasesListParameters databasesListParameters = null);
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Notion.Client
2+
{
3+
public class DatabasesListParameters : IDatabasesListQueryParmaters
4+
{
5+
public string StartCursor { get; set; }
6+
public string PageSize { get; set; }
7+
}
8+
}

0 commit comments

Comments
 (0)