Skip to content

Commit 5b06684

Browse files
Move more classes into separate files 🚚
1 parent 54d1cc6 commit 5b06684

14 files changed

+99
-75
lines changed

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

Lines changed: 1 addition & 7 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<Block>> RetrieveChildrenAsync(string blockId, BlocksRetrieveChildrenParameters parameters = null);
11-
Task<Block> AppendChildrenAsync(string blockId, BlocksAppendChildrenParameters parameters = null);
12-
}
13-
148
public class BlocksClient : IBlocksClient
159
{
1610
private readonly IRestClient _client;
@@ -54,4 +48,4 @@ public async Task<Block> AppendChildrenAsync(string blockId, BlocksAppendChildre
5448
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+
}

Src/Notion.Client/Api/Blocks/BlocksAppendChildrenParameters.cs renamed to Src/Notion.Client/Api/Blocks/RequestParams/BlocksAppendChildrenParameters.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22

33
namespace Notion.Client
44
{
5-
// TODO: need an input version of Block
6-
public interface IBlocksAppendChildrenBodyParameters
7-
{
8-
IEnumerable<Block> Children { get; set; }
9-
}
10-
115
public class BlocksAppendChildrenParameters : IBlocksAppendChildrenBodyParameters
126
{
137
public IEnumerable<Block> Children { get; set; }
148
}
15-
}
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace Notion.Client
4+
{
5+
public enum Direction
6+
{
7+
[EnumMember(Value = null)]
8+
Unknown,
9+
10+
[EnumMember(Value = "ascending")]
11+
Ascending,
12+
13+
[EnumMember(Value = "descending")]
14+
Descending
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
3+
4+
namespace Notion.Client
5+
{
6+
public class Sort
7+
{
8+
public string Property { get; set; }
9+
10+
[JsonConverter(typeof(StringEnumConverter))]
11+
public Timestamp Timestamp { get; set; }
12+
13+
[JsonConverter(typeof(StringEnumConverter))]
14+
public Direction Direction { get; set; }
15+
}
16+
}

0 commit comments

Comments
 (0)