Skip to content

Commit 97b6562

Browse files
Merge pull request #337 from notion-dotnet/335-setup-jetbrain-resharper-tools-for-enforcing-code-styling
Setup JetBrains ReSharper tools for enforcing code styling 🔥
2 parents ab0148c + e740f75 commit 97b6562

File tree

165 files changed

+3038
-2780
lines changed

Some content is hidden

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

165 files changed

+3038
-2780
lines changed

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"jetbrains.resharper.globaltools": {
6+
"version": "2022.2.3",
7+
"commands": [
8+
"jb"
9+
]
10+
}
11+
}
12+
}

.editorconfig

Lines changed: 237 additions & 18 deletions
Large diffs are not rendered by default.
Lines changed: 96 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,140 @@
1-
using System;
2-
3-
namespace Notion.Client
1+
namespace Notion.Client
42
{
53
public static class ApiEndpoints
64
{
75
public static class DatabasesApiUrls
86
{
9-
public static string Retrieve(string databaseId) => $"/v1/databases/{databaseId}";
10-
public static string List() => "/v1/databases";
11-
public static string Query(string databaseId) => $"/v1/databases/{databaseId}/query";
127
public static string Create => "/v1/databases";
13-
public static string Update(string databaseId) => $"/v1/databases/{databaseId}";
8+
9+
public static string Retrieve(string databaseId)
10+
{
11+
return $"/v1/databases/{databaseId}";
12+
}
13+
14+
public static string List()
15+
{
16+
return "/v1/databases";
17+
}
18+
19+
public static string Query(string databaseId)
20+
{
21+
return $"/v1/databases/{databaseId}/query";
22+
}
23+
24+
public static string Update(string databaseId)
25+
{
26+
return $"/v1/databases/{databaseId}";
27+
}
1428
}
1529

1630
public static class UsersApiUrls
1731
{
18-
public static string Retrieve(string userId) => $"/v1/users/{userId}";
19-
public static string List() => "/v1/users";
32+
public static string Retrieve(string userId)
33+
{
34+
return $"/v1/users/{userId}";
35+
}
36+
37+
public static string List()
38+
{
39+
return "/v1/users";
40+
}
2041

2142
/// <summary>
22-
/// Get the <see cref="uri string"/> for retrieve your token's bot user.
43+
/// Get the <see cref="uri string" /> for retrieve your token's bot user.
2344
/// </summary>
24-
/// <returns>Returns a <see cref="uri string"/> retrieve your token's bot user.</returns>
25-
public static string Me() => "/v1/users/me";
45+
/// <returns>Returns a <see cref="uri string" /> retrieve your token's bot user.</returns>
46+
public static string Me()
47+
{
48+
return "/v1/users/me";
49+
}
2650
}
2751

2852
public static class BlocksApiUrls
2953
{
30-
public static string Retrieve(string blockId) => $"/v1/blocks/{blockId}";
31-
public static string Update(string blockId) => $"/v1/blocks/{blockId}";
54+
public static string Retrieve(string blockId)
55+
{
56+
return $"/v1/blocks/{blockId}";
57+
}
58+
59+
public static string Update(string blockId)
60+
{
61+
return $"/v1/blocks/{blockId}";
62+
}
3263

3364
/// <summary>
34-
/// Get the <see cref="uri string"/> for deleting a block.
65+
/// Get the <see cref="uri string" /> for deleting a block.
3566
/// </summary>
3667
/// <param name="blockId">Identifier for a Notion block</param>
37-
/// <returns>Returns a <see cref="uri string"/> for deleting a block.</returns>
38-
public static string Delete(string blockId) => $"/v1/blocks/{blockId}";
68+
/// <returns>Returns a <see cref="uri string" /> for deleting a block.</returns>
69+
public static string Delete(string blockId)
70+
{
71+
return $"/v1/blocks/{blockId}";
72+
}
73+
74+
public static string RetrieveChildren(string blockId)
75+
{
76+
return $"/v1/blocks/{blockId}/children";
77+
}
3978

40-
public static string RetrieveChildren(string blockId) => $"/v1/blocks/{blockId}/children";
41-
public static string AppendChildren(string blockId) => $"/v1/blocks/{blockId}/children";
79+
public static string AppendChildren(string blockId)
80+
{
81+
return $"/v1/blocks/{blockId}/children";
82+
}
4283
}
4384

4485
public static class PagesApiUrls
4586
{
46-
public static string Create() => $"/v1/pages";
47-
public static string Retrieve(string pageId) => $"/v1/pages/{pageId}";
48-
public static string Update(string pageId) => $"/v1/pages/{pageId}";
49-
public static string UpdateProperties(string pageId) => $"/v1/pages/{pageId}";
87+
public static string Create()
88+
{
89+
return "/v1/pages";
90+
}
91+
92+
public static string Retrieve(string pageId)
93+
{
94+
return $"/v1/pages/{pageId}";
95+
}
96+
97+
public static string Update(string pageId)
98+
{
99+
return $"/v1/pages/{pageId}";
100+
}
101+
102+
public static string UpdateProperties(string pageId)
103+
{
104+
return $"/v1/pages/{pageId}";
105+
}
50106

51107
/// <summary>
52-
/// Get the <see cref="uri string"/> for retrieve page property item
108+
/// Get the <see cref="uri string" /> for retrieve page property item
53109
/// </summary>
54110
/// <param name="pageId">Identifier for a Notion Page</param>
55111
/// <param name="propertyId">Identifier for a Notion Property</param>
56112
/// <returns></returns>
57-
public static string RetrievePropertyItem(string pageId, string propertyId) => $"/v1/pages/{pageId}/properties/{propertyId}";
113+
public static string RetrievePropertyItem(string pageId, string propertyId)
114+
{
115+
return $"/v1/pages/{pageId}/properties/{propertyId}";
116+
}
58117
}
59118

60119
public static class SearchApiUrls
61120
{
62-
public static string Search() => "/v1/search";
121+
public static string Search()
122+
{
123+
return "/v1/search";
124+
}
63125
}
64126

65127
public static class CommentsApiUrls
66128
{
67-
public static string Retrieve() => "/v1/comments";
129+
public static string Retrieve()
130+
{
131+
return "/v1/comments";
132+
}
68133

69-
public static string Create() => "/v1/comments";
134+
public static string Create()
135+
{
136+
return "/v1/comments";
137+
}
70138
}
71139
}
72140
}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ public BlocksClient(IRestClient client)
1414
_client = client;
1515
}
1616

17-
public async Task<PaginatedList<IBlock>> RetrieveChildrenAsync(string blockId, BlocksRetrieveChildrenParameters parameters = null)
17+
public async Task<PaginatedList<IBlock>> RetrieveChildrenAsync(
18+
string blockId,
19+
BlocksRetrieveChildrenParameters parameters = null)
1820
{
1921
if (string.IsNullOrWhiteSpace(blockId))
2022
{
@@ -25,16 +27,18 @@ public async Task<PaginatedList<IBlock>> RetrieveChildrenAsync(string blockId, B
2527

2628
var queryParameters = (IBlocksRetrieveChildrenQueryParameters)parameters;
2729

28-
var queryParams = new Dictionary<string, string>()
30+
var queryParams = new Dictionary<string, string>
2931
{
30-
{ "start_cursor", queryParameters?.StartCursor?.ToString() },
32+
{ "start_cursor", queryParameters?.StartCursor },
3133
{ "page_size", queryParameters?.PageSize?.ToString() }
3234
};
3335

3436
return await _client.GetAsync<PaginatedList<IBlock>>(url, queryParams);
3537
}
3638

37-
public async Task<PaginatedList<IBlock>> AppendChildrenAsync(string blockId, BlocksAppendChildrenParameters parameters = null)
39+
public async Task<PaginatedList<IBlock>> AppendChildrenAsync(
40+
string blockId,
41+
BlocksAppendChildrenParameters parameters = null)
3842
{
3943
if (string.IsNullOrWhiteSpace(blockId))
4044
{

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,36 @@ namespace Notion.Client
55
public interface IBlocksClient
66
{
77
/// <summary>
8-
/// Retrieves a Block object using the ID specified.
8+
/// Retrieves a Block object using the ID specified.
99
/// </summary>
1010
/// <param name="blockId"></param>
1111
/// <returns>Block</returns>
1212
Task<IBlock> RetrieveAsync(string blockId);
1313

1414
/// <summary>
15-
/// Updates the content for the specified block_id based on the block type.
15+
/// Updates the content for the specified block_id based on the block type.
1616
/// </summary>
1717
/// <param name="blockId"></param>
1818
/// <param name="updateBlock"></param>
1919
/// <returns>Block</returns>
2020
Task<IBlock> UpdateAsync(string blockId, IUpdateBlock updateBlock);
2121

22-
Task<PaginatedList<IBlock>> RetrieveChildrenAsync(string blockId, BlocksRetrieveChildrenParameters parameters = null);
22+
Task<PaginatedList<IBlock>> RetrieveChildrenAsync(
23+
string blockId,
24+
BlocksRetrieveChildrenParameters parameters = null);
2325

2426
/// <summary>
25-
/// Creates and appends new children blocks to the parent block_id specified.
27+
/// Creates and appends new children blocks to the parent block_id specified.
2628
/// </summary>
2729
/// <param name="blockId">Identifier for a block</param>
2830
/// <param name="parameters"></param>
2931
/// <returns>A paginated list of newly created first level children block objects.</returns>
30-
Task<PaginatedList<IBlock>> AppendChildrenAsync(string blockId, BlocksAppendChildrenParameters parameters = null);
32+
Task<PaginatedList<IBlock>> AppendChildrenAsync(
33+
string blockId,
34+
BlocksAppendChildrenParameters parameters = null);
3135

3236
/// <summary>
33-
/// Sets a Block object, including page blocks, to archived: true using the ID specified.
37+
/// Sets a Block object, including page blocks, to archived: true using the ID specified.
3438
/// </summary>
3539
/// <param name="blockId">Identifier for a Notion block</param>
3640
Task DeleteAsync(string blockId);

Src/Notion.Client/Api/Blocks/RequestParams/BlocksRetrieveChildrenParameters.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
public class BlocksRetrieveChildrenParameters : IBlocksRetrieveChildrenQueryParameters
44
{
55
public string StartCursor { get; set; }
6+
67
public int? PageSize { get; set; }
78
}
89
}

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/AudioUpdateBlock.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Collections.Generic;
2-
using Newtonsoft.Json;
1+
using Newtonsoft.Json;
32

43
namespace Notion.Client
54
{

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BookmarkUpdateBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ namespace Notion.Client
55
{
66
public class BookmarkUpdateBlock : IUpdateBlock
77
{
8-
public bool Archived { get; set; }
9-
108
[JsonProperty("bookmark")]
119
public Info Bookmark { get; set; }
1210

11+
public bool Archived { get; set; }
12+
1313
public class Info
1414
{
1515
[JsonProperty("url")]

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BreadcrumbUpdateBlock.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ namespace Notion.Client
44
{
55
public class BreadcrumbUpdateBlock : IUpdateBlock
66
{
7-
public bool Archived { get; set; }
7+
public BreadcrumbUpdateBlock()
8+
{
9+
Breadcrumb = new Info();
10+
}
811

912
[JsonProperty("breadcrumb")]
1013
public Info Breadcrumb { get; set; }
1114

12-
public class Info
13-
{
14-
}
15+
public bool Archived { get; set; }
1516

16-
public BreadcrumbUpdateBlock()
17+
public class Info
1718
{
18-
Breadcrumb = new Info();
1919
}
2020
}
2121
}

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/DividerUpdateBlock.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ namespace Notion.Client
44
{
55
public class DividerUpdateBlock : IUpdateBlock
66
{
7-
public bool Archived { get; set; }
7+
public DividerUpdateBlock()
8+
{
9+
Divider = new Info();
10+
}
811

912
[JsonProperty("divider")]
1013
public Info Divider { get; set; }
1114

12-
public class Info
13-
{
14-
}
15+
public bool Archived { get; set; }
1516

16-
public DividerUpdateBlock()
17+
public class Info
1718
{
18-
Divider = new Info();
1919
}
2020
}
2121
}

0 commit comments

Comments
 (0)