From ff578256b9847467b7f6339f6e5984517a0d610f Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 13:29:14 +0530 Subject: [PATCH 1/9] Add helper script to run linter fixer --- package.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 00000000..a32bb1db --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "notion-sdk-net", + "version": "1.0.0", + "main": "index.js", + "repository": "git@github.com:notion-dotnet/notion-sdk-net.git", + "author": "Vedant Koditkar", + "license": "MIT", + "scripts": { + "lint": "dotnet jb cleanupcode --include=\"**/**.cs\" .\\Notion.sln" + } +} From 95a3c7d6ac5528fb8ce14e04b839fc9f74dab4fa Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 13:29:41 +0530 Subject: [PATCH 2/9] Update .gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index dfcfd56f..c6d337c2 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,9 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ + +# Resharper linter +.lint/ + +# Rider +.idea/ From 680aa99a94cf45c9b46edffea13d23ca0ae52fe6 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 13:29:57 +0530 Subject: [PATCH 3/9] Add linter step in CI build workflow --- .github/workflows/ci-build.yml | 13 +++++-------- check.sh | 11 +++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 check.sh diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index c69148e8..378d6a85 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -21,15 +21,12 @@ jobs: - name: Restore dependencies run: dotnet restore - # Format the output of dotnet format - - name: Add dotnet-format problem matcher - uses: xt0rted/dotnet-format-problem-matcher@v1 - # Install dotnet format as a global tool - - name: Install dotnet format - run: | - dotnet tool install --global dotnet-format - dotnet format --verify-no-changes --verbosity diagnostic + - name: Install dotnet tools + run: dotnet tool restore + + - name: Run Linter + run: check.sh - name: Build run: dotnet build --no-restore diff --git a/check.sh b/check.sh new file mode 100644 index 00000000..d6132c92 --- /dev/null +++ b/check.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +dotnet jb inspectcode Notion.sln -f="Text" --no-build --include="**.cs" -o=".lint/CodeWarningResults.txt" + +totalLines=`cat .lint/CodeWarningResults.txt | grep "^.*$" -c` + +if [[ "$totalLines" -gt 1 ]]; then + echo "There are few linter warnings - please fix them before running the pipeline" + cat .lint/CodeWarningResults.txt + exit 1 +fi From 5387196f94728152f9dfa1d0a228f46c2d0140dd Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 13:41:21 +0530 Subject: [PATCH 4/9] Try fixing bash script execution --- .github/workflows/ci-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 378d6a85..6881c42a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -26,7 +26,8 @@ jobs: run: dotnet tool restore - name: Run Linter - run: check.sh + run: ./check.sh + shell: bash - name: Build run: dotnet build --no-restore From 5eccdaff54eba8bd3ff2fd8b36d956581f487f8a Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 13:46:17 +0530 Subject: [PATCH 5/9] Fix .sh file execution permission --- .github/workflows/ci-build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 6881c42a..84faaff0 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -26,7 +26,9 @@ jobs: run: dotnet tool restore - name: Run Linter - run: ./check.sh + run: | + sudo chmod 600 ./check.sh + ./check.sh shell: bash - name: Build From 77fad8f58577dc67970844adc710dc1a7f7ae40a Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 13:48:19 +0530 Subject: [PATCH 6/9] make .sh file executable --- .github/workflows/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 84faaff0..5a50f35b 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -27,7 +27,7 @@ jobs: - name: Run Linter run: | - sudo chmod 600 ./check.sh + sudo chmod +x ./check.sh ./check.sh shell: bash From 451821f4c062cac99808b20fc1efbc1212d57a76 Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 13:53:08 +0530 Subject: [PATCH 7/9] =?UTF-8?q?Move=20CI=20scripts=20under=20.github/=20fo?= =?UTF-8?q?lder=20=F0=9F=9A=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check.sh => .github/scripts/check.sh | 0 .github/workflows/ci-build.yml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename check.sh => .github/scripts/check.sh (100%) diff --git a/check.sh b/.github/scripts/check.sh similarity index 100% rename from check.sh rename to .github/scripts/check.sh diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 5a50f35b..35959b57 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -27,8 +27,8 @@ jobs: - name: Run Linter run: | - sudo chmod +x ./check.sh - ./check.sh + sudo chmod +x ./.github/scripts/check.sh + ./.github/scripts/check.sh shell: bash - name: Build From e7cafc9ee6fe607ce1226f37f4c77a651e214d0f Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 18:21:38 +0530 Subject: [PATCH 8/9] =?UTF-8?q?Fix=20linter=20warnings=20=F0=9F=9A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 184 +----------------- Notion.sln.DotSettings | 5 + Src/Notion.Client/Api/ApiEndpoints.cs | 17 +- .../UpdateBlocks/AudioUpdateBlock.cs | 2 +- .../BulletedListItemUpdateBlock.cs | 2 +- .../UpdateBlocks/CalloutUpdateBlock.cs | 2 +- .../UpdateBlocks/CodeUpdateBlock.cs | 2 +- .../UpdateBlocks/EmbedUpdateBlock.cs | 2 +- .../UpdateBlocks/EquationUpdateBlock.cs | 2 +- .../UpdateBlocks/FileUpdateBlock.cs | 2 +- .../UpdateBlocks/HeadingOneUpdateBlock.cs | 4 +- .../UpdateBlocks/HeadingThreeeUpdateBlock.cs | 4 +- .../UpdateBlocks/HeadingTwoUpdateBlock.cs | 4 +- .../UpdateBlocks/ImageUpdateBlock.cs | 2 +- .../UpdateBlocks/LinkToPageUpdateBlock.cs | 2 +- .../NumberedListItemUpdateBlock.cs | 2 +- .../UpdateBlocks/PDFUpdateBlock.cs | 6 +- .../UpdateBlocks/ParagraphUpdateBlock.cs | 2 +- .../UpdateBlocks/QuoteUpdateBlock.cs | 2 +- .../UpdateBlocks/SyncedBlockUpdateBlock.cs | 2 +- .../UpdateBlocks/TableRowUpdateBlock.cs | 2 +- .../UpdateBlocks/TableUpdateBlock.cs | 2 +- .../UpdateBlocks/TemplateUpdateBlock.cs | 2 +- .../UpdateBlocks/ToDoUpdateBlock.cs | 2 +- .../UpdateBlocks/ToggleUpdateBlock.cs | 2 +- .../UpdateBlocks/VideoUpdateBlock.cs | 2 +- .../Create/Response/CreateCommentResponse.cs | 5 +- .../Api/Comments/ICommentsClient.cs | 9 - .../Api/Comments/Retrieve/CommentsClient.cs | 2 + .../Request/RetrieveCommentsParameters.cs | 5 +- .../PropertySchema/MultiSelectOptionSchema.cs | 5 +- .../RequestParams/DatabasesListParameters.cs | 9 - .../CheckboxUpdatePropertySchema.cs | 2 +- .../CreatedByUpdatePropertySchema.cs | 2 +- .../CreatedTimeUpdatePropertySchema.cs | 2 +- .../DateUpdatePropertySchema.cs | 2 +- .../EmailUpdatePropertySchema.cs | 2 +- .../FilesUpdatePropertySchema.cs | 2 +- .../FormulaUpdatePropertySchema.cs | 2 +- .../LastEditedByUpdatePropertySchema.cs | 2 +- .../LastEditedTimeUpdatePropertySchema.cs | 2 +- .../MultiSelectUpdatePropertySchema.cs | 2 +- .../NumberUpdatePropertySchema.cs | 2 +- .../PeopleUpdatePropertySchema.cs | 2 +- .../PhoneNumberUpdatePropertySchema.cs | 2 +- .../RelationUpdatePropertySchema.cs | 2 +- .../RichTextUpdatePropertySchema.cs | 2 +- .../RollupConfigUpdatePropertySchema.cs | 2 +- .../SelectUpdatePropertySchema.cs | 2 +- .../TitleUpdatePropertySchema.cs | 2 +- .../PropertySchema/URLUpdatePropertySchema.cs | 2 +- .../Api/Databases/RequestParams/Direction.cs | 4 +- .../IDatabasesListQueryParmaters.cs | 6 - .../Api/Databases/RequestParams/Timestamp.cs | 4 +- Src/Notion.Client/Api/Pages/PagesClient.cs | 4 +- .../PagesCreateParametersBuilder.cs | 32 +-- Src/Notion.Client/Api/Search/ISearchClient.cs | 4 +- .../Api/Search/Parameters/SearchDirection.cs | 4 +- .../Api/Search/Parameters/SearchFilter.cs | 5 +- .../Api/Search/Parameters/SearchObjectType.cs | 4 +- Src/Notion.Client/Api/Search/SearchClient.cs | 6 +- Src/Notion.Client/Constants.cs | 6 +- .../DI/ServiceCollectionExtensions.cs | 5 +- .../HttpResponseMessageExtensions.cs | 26 +-- Src/Notion.Client/Logging/Log.cs | 10 +- .../Logging/NotionClientLogging.cs | 11 +- Src/Notion.Client/Models/Blocks/BlockType.cs | 6 +- Src/Notion.Client/Models/Blocks/Color.cs | 4 +- .../Models/Blocks/HeadingOneBlock.cs | 2 + .../Models/Blocks/HeadingThreeeBlock.cs | 2 + .../Models/Blocks/HeadingTwoBlock.cs | 2 + .../Models/Blocks/IColumnChildrenBlock.cs | 2 +- Src/Notion.Client/Models/Blocks/PDFBlock.cs | 4 +- .../Database/Properties/PropertyType.cs | 4 +- .../Database/Properties/SelectProperty.cs | 2 + .../Models/Database/RichText/RichTextType.cs | 4 +- .../Filters/TimestampCreatedTimeFilter.cs | 6 +- .../Filters/TimestampLastEditedTimeFilter.cs | 6 +- Src/Notion.Client/Models/Filters/URLFilter.cs | 4 +- Src/Notion.Client/Models/Parents/IParent.cs | 4 +- .../Models/Parents/ParentType.cs | 4 +- .../Models/PropertyItems/ListPropertyItem.cs | 3 + .../PropertyItems/SimplePropertyItem.cs | 4 +- .../Models/PropertyValue/PropertyValue.cs | 5 +- .../Models/PropertyValue/PropertyValueType.cs | 4 +- .../PropertyValue/StatusPropertyValue.cs | 9 +- Src/Notion.Client/Models/User/PartialUser.cs | 5 +- Src/Notion.Client/NotionAPIErrorCode.cs | 4 +- Src/Notion.Client/NotionApiException.cs | 13 +- Src/Notion.Client/NotionClient.cs | 19 +- Src/Notion.Client/RestClient/IRestClient.cs | 1 - Src/Notion.Client/RestClient/RestClient.cs | 27 ++- Src/Notion.Client/http/QueryHelpers.cs | 2 + .../CommentsClientTests.cs | 7 +- .../IBlocksClientTests.cs | 4 +- .../IPageClientTests.cs | 25 ++- Test/Notion.UnitTests/ApiTestBase.cs | 14 +- Test/Notion.UnitTests/BlocksClientTests.cs | 4 +- Test/Notion.UnitTests/DatabasesClientTests.cs | 183 +++++++++-------- Test/Notion.UnitTests/FilterTests.cs | 24 +-- Test/Notion.UnitTests/PropertyTests.cs | 4 +- 101 files changed, 383 insertions(+), 500 deletions(-) create mode 100644 Notion.sln.DotSettings delete mode 100644 Src/Notion.Client/Api/Databases/RequestParams/DatabasesListParameters.cs delete mode 100644 Src/Notion.Client/Api/Databases/RequestParams/IDatabasesListQueryParmaters.cs diff --git a/.editorconfig b/.editorconfig index 76a523b0..1745f593 100644 --- a/.editorconfig +++ b/.editorconfig @@ -45,179 +45,6 @@ resharper_csharp_use_heuristics_for_body_style=true resharper_csharp_max_initializer_elements_on_line=0 -# Microsoft .NET properties -csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion -csharp_style_var_elsewhere = true:suggestion -csharp_style_var_for_built_in_types = true:suggestion -csharp_style_var_when_type_is_apparent = true:suggestion -dotnet_naming_rule.constants_rule.import_to_resharper = as_predefined -dotnet_naming_rule.constants_rule.resharper_style = AaBb, _ + aaBb -dotnet_naming_rule.constants_rule.severity = suggestion -dotnet_naming_rule.constants_rule.style = upper_camel_case_style -dotnet_naming_rule.constants_rule.symbols = constants_symbols -dotnet_naming_rule.constants_should_be_pascal_case_rule.import_to_resharper = True -dotnet_naming_rule.constants_should_be_pascal_case_rule.resharper_description = constants_should_be_pascal_case -dotnet_naming_rule.constants_should_be_pascal_case_rule.resharper_guid = a0135172-b297-46cb-bb0f-b1f267109d7b -dotnet_naming_rule.constants_should_be_pascal_case_rule.severity = suggestion -dotnet_naming_rule.constants_should_be_pascal_case_rule.style = upper_camel_case_style -dotnet_naming_rule.constants_should_be_pascal_case_rule.symbols = constants_should_be_pascal_case_symbols -dotnet_naming_rule.constants_should_be_pascal_case_rule_1.import_to_resharper = False -dotnet_naming_rule.constants_should_be_pascal_case_rule_1.severity = suggestion -dotnet_naming_rule.constants_should_be_pascal_case_rule_1.style = upper_camel_case_style -dotnet_naming_rule.constants_should_be_pascal_case_rule_1.symbols = constants_should_be_pascal_case_symbols_1 -dotnet_naming_rule.instance_fields_should_be_camel_case_rule.import_to_resharper = True -dotnet_naming_rule.instance_fields_should_be_camel_case_rule.resharper_description = instance_fields_should_be_camel_case -dotnet_naming_rule.instance_fields_should_be_camel_case_rule.resharper_guid = ed8be1d2-8aa4-45a9-a0fe-964e144ccec7 -dotnet_naming_rule.instance_fields_should_be_camel_case_rule.severity = suggestion -dotnet_naming_rule.instance_fields_should_be_camel_case_rule.style = lower_camel_case_style -dotnet_naming_rule.instance_fields_should_be_camel_case_rule.symbols = instance_fields_should_be_camel_case_symbols -dotnet_naming_rule.interfaces_rule.import_to_resharper = as_predefined -dotnet_naming_rule.interfaces_rule.severity = suggestion -dotnet_naming_rule.interfaces_rule.style = upper_camel_case_style -dotnet_naming_rule.interfaces_rule.symbols = interfaces_symbols -dotnet_naming_rule.locals_should_be_camel_case_rule.import_to_resharper = True -dotnet_naming_rule.locals_should_be_camel_case_rule.resharper_description = locals_should_be_camel_case -dotnet_naming_rule.locals_should_be_camel_case_rule.resharper_guid = dd900f14-6d42-4a58-8277-056e5dab89e7 -dotnet_naming_rule.locals_should_be_camel_case_rule.severity = suggestion -dotnet_naming_rule.locals_should_be_camel_case_rule.style = lower_camel_case_style_1 -dotnet_naming_rule.locals_should_be_camel_case_rule.symbols = locals_should_be_camel_case_symbols -dotnet_naming_rule.local_constants_rule.import_to_resharper = as_predefined -dotnet_naming_rule.local_constants_rule.resharper_style = AaBb, aaBb -dotnet_naming_rule.local_constants_rule.severity = suggestion -dotnet_naming_rule.local_constants_rule.style = upper_camel_case_style -dotnet_naming_rule.local_constants_rule.symbols = local_constants_symbols -dotnet_naming_rule.local_functions_should_be_pascal_case_rule.import_to_resharper = True -dotnet_naming_rule.local_functions_should_be_pascal_case_rule.resharper_description = local_functions_should_be_pascal_case -dotnet_naming_rule.local_functions_should_be_pascal_case_rule.resharper_guid = 67e7ac04-3277-4549-b0bb-98cbfad21765 -dotnet_naming_rule.local_functions_should_be_pascal_case_rule.severity = suggestion -dotnet_naming_rule.local_functions_should_be_pascal_case_rule.style = upper_camel_case_style -dotnet_naming_rule.local_functions_should_be_pascal_case_rule.symbols = local_functions_should_be_pascal_case_symbols -dotnet_naming_rule.members_should_be_pascal_case_rule.import_to_resharper = True -dotnet_naming_rule.members_should_be_pascal_case_rule.resharper_description = members_should_be_pascal_case -dotnet_naming_rule.members_should_be_pascal_case_rule.resharper_guid = 605fba47-8912-494e-9e4c-98aeb57fd884 -dotnet_naming_rule.members_should_be_pascal_case_rule.severity = suggestion -dotnet_naming_rule.members_should_be_pascal_case_rule.style = upper_camel_case_style -dotnet_naming_rule.members_should_be_pascal_case_rule.symbols = members_should_be_pascal_case_symbols -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case_rule.import_to_resharper = True -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case_rule.resharper_description = non_private_readonly_fields_should_be_pascal_case -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case_rule.resharper_guid = e8e1b724-94dd-4cbe-9385-85343fea2b41 -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case_rule.severity = suggestion -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case_rule.style = upper_camel_case_style -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case_rule.symbols = non_private_readonly_fields_should_be_pascal_case_symbols -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case_rule.import_to_resharper = True -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case_rule.resharper_description = non_private_static_fields_should_be_pascal_case -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case_rule.resharper_guid = 51051115-1f5e-4eea-aa9d-2eac02e9b082 -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case_rule.severity = suggestion -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case_rule.style = upper_camel_case_style -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case_rule.symbols = non_private_static_fields_should_be_pascal_case_symbols -dotnet_naming_rule.private_constants_rule.import_to_resharper = as_predefined -dotnet_naming_rule.private_constants_rule.resharper_style = AaBb, _ + aaBb -dotnet_naming_rule.private_constants_rule.severity = suggestion -dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style -dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols -dotnet_naming_rule.private_static_fields_rule.import_to_resharper = as_predefined -dotnet_naming_rule.private_static_fields_rule.severity = suggestion -dotnet_naming_rule.private_static_fields_rule.style = s_lower_camel_case_style -dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols -dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = as_predefined -dotnet_naming_rule.private_static_readonly_rule.severity = suggestion -dotnet_naming_rule.private_static_readonly_rule.style = s_lower_camel_case_style -dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols -dotnet_naming_rule.public_fields_rule.import_to_resharper = as_predefined -dotnet_naming_rule.public_fields_rule.severity = suggestion -dotnet_naming_rule.public_fields_rule.style = lower_camel_case_style -dotnet_naming_rule.public_fields_rule.symbols = public_fields_symbols -dotnet_naming_rule.static_fields_should_be_camel_case_rule.import_to_resharper = True -dotnet_naming_rule.static_fields_should_be_camel_case_rule.resharper_description = static_fields_should_be_camel_case -dotnet_naming_rule.static_fields_should_be_camel_case_rule.resharper_guid = f286ec29-34ab-4806-9c8a-586f11eedd52 -dotnet_naming_rule.static_fields_should_be_camel_case_rule.severity = suggestion -dotnet_naming_rule.static_fields_should_be_camel_case_rule.style = s_lower_camel_case_style -dotnet_naming_rule.static_fields_should_be_camel_case_rule.symbols = static_fields_should_be_camel_case_symbols -dotnet_naming_rule.static_readonly_rule.import_to_resharper = as_predefined -dotnet_naming_rule.static_readonly_rule.resharper_style = AaBb, s_ + aaBb -dotnet_naming_rule.static_readonly_rule.severity = suggestion -dotnet_naming_rule.static_readonly_rule.style = upper_camel_case_style -dotnet_naming_rule.static_readonly_rule.symbols = static_readonly_symbols -dotnet_naming_rule.type_parameters_rule.import_to_resharper = as_predefined -dotnet_naming_rule.type_parameters_rule.severity = suggestion -dotnet_naming_rule.type_parameters_rule.style = upper_camel_case_style -dotnet_naming_rule.type_parameters_rule.symbols = type_parameters_symbols -dotnet_naming_style.lower_camel_case_style.capitalization = camel_case -dotnet_naming_style.lower_camel_case_style.required_prefix = _ -dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case -dotnet_naming_style.s_lower_camel_case_style.capitalization = camel_case -dotnet_naming_style.s_lower_camel_case_style.required_prefix = s_ -dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case -dotnet_naming_symbols.constants_should_be_pascal_case_symbols.applicable_accessibilities = local,public,internal,private,protected,protected_internal,private_protected -dotnet_naming_symbols.constants_should_be_pascal_case_symbols.applicable_kinds = local -dotnet_naming_symbols.constants_should_be_pascal_case_symbols.required_modifiers = const -dotnet_naming_symbols.constants_should_be_pascal_case_symbols.resharper_applicable_kinds = constant_field,local_constant -dotnet_naming_symbols.constants_should_be_pascal_case_symbols.resharper_required_modifiers = any -dotnet_naming_symbols.constants_should_be_pascal_case_symbols_1.applicable_accessibilities = local,public,internal,private,protected,protected_internal,private_protected -dotnet_naming_symbols.constants_should_be_pascal_case_symbols_1.applicable_kinds = field -dotnet_naming_symbols.constants_should_be_pascal_case_symbols_1.required_modifiers = const -dotnet_naming_symbols.constants_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected -dotnet_naming_symbols.constants_symbols.applicable_kinds = field -dotnet_naming_symbols.constants_symbols.required_modifiers = const -dotnet_naming_symbols.instance_fields_should_be_camel_case_symbols.applicable_accessibilities = local,public,internal,private,protected,protected_internal,private_protected -dotnet_naming_symbols.instance_fields_should_be_camel_case_symbols.applicable_kinds = field -dotnet_naming_symbols.instance_fields_should_be_camel_case_symbols.resharper_applicable_kinds = any_field -dotnet_naming_symbols.instance_fields_should_be_camel_case_symbols.resharper_required_modifiers = any -dotnet_naming_symbols.interfaces_symbols.applicable_accessibilities = * -dotnet_naming_symbols.interfaces_symbols.applicable_kinds = interface -dotnet_naming_symbols.locals_should_be_camel_case_symbols.applicable_accessibilities = local,public,internal,private,protected,protected_internal,private_protected -dotnet_naming_symbols.locals_should_be_camel_case_symbols.applicable_kinds = parameter,local -dotnet_naming_symbols.locals_should_be_camel_case_symbols.resharper_applicable_kinds = parameter,local -dotnet_naming_symbols.locals_should_be_camel_case_symbols.resharper_required_modifiers = any -dotnet_naming_symbols.local_constants_symbols.applicable_accessibilities = * -dotnet_naming_symbols.local_constants_symbols.applicable_kinds = local -dotnet_naming_symbols.local_constants_symbols.required_modifiers = const -dotnet_naming_symbols.local_functions_should_be_pascal_case_symbols.applicable_accessibilities = local,public,internal,private,protected,protected_internal,private_protected -dotnet_naming_symbols.local_functions_should_be_pascal_case_symbols.applicable_kinds = local_function -dotnet_naming_symbols.local_functions_should_be_pascal_case_symbols.resharper_applicable_kinds = local_function -dotnet_naming_symbols.local_functions_should_be_pascal_case_symbols.resharper_required_modifiers = any -dotnet_naming_symbols.members_should_be_pascal_case_symbols.applicable_accessibilities = local,public,internal,private,protected,protected_internal,private_protected -dotnet_naming_symbols.members_should_be_pascal_case_symbols.applicable_kinds = namespace,class,struct,interface,enum,property,method,field,event,delegate,parameter,type_parameter,local,local_function -dotnet_naming_symbols.members_should_be_pascal_case_symbols.resharper_applicable_kinds = namespace,class,struct,interface,enum,property,method,any_field,event,delegate,parameter,type_parameter,local,local_function -dotnet_naming_symbols.members_should_be_pascal_case_symbols.resharper_required_modifiers = any -dotnet_naming_symbols.non_private_readonly_fields_should_be_pascal_case_symbols.applicable_accessibilities = local,public,internal,protected,protected_internal,private_protected -dotnet_naming_symbols.non_private_readonly_fields_should_be_pascal_case_symbols.applicable_kinds = field -dotnet_naming_symbols.non_private_readonly_fields_should_be_pascal_case_symbols.required_modifiers = readonly -dotnet_naming_symbols.non_private_readonly_fields_should_be_pascal_case_symbols.resharper_applicable_kinds = readonly_field -dotnet_naming_symbols.non_private_readonly_fields_should_be_pascal_case_symbols.resharper_required_modifiers = any -dotnet_naming_symbols.non_private_static_fields_should_be_pascal_case_symbols.applicable_accessibilities = local,public,internal,protected,protected_internal,private_protected -dotnet_naming_symbols.non_private_static_fields_should_be_pascal_case_symbols.applicable_kinds = field -dotnet_naming_symbols.non_private_static_fields_should_be_pascal_case_symbols.required_modifiers = static -dotnet_naming_symbols.non_private_static_fields_should_be_pascal_case_symbols.resharper_applicable_kinds = any_field -dotnet_naming_symbols.non_private_static_fields_should_be_pascal_case_symbols.resharper_required_modifiers = static -dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private -dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field -dotnet_naming_symbols.private_constants_symbols.required_modifiers = const -dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private -dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field -dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static -dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private -dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field -dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static,readonly -dotnet_naming_symbols.public_fields_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected -dotnet_naming_symbols.public_fields_symbols.applicable_kinds = field -dotnet_naming_symbols.static_fields_should_be_camel_case_symbols.applicable_accessibilities = local,public,internal,private,protected,protected_internal,private_protected -dotnet_naming_symbols.static_fields_should_be_camel_case_symbols.applicable_kinds = field -dotnet_naming_symbols.static_fields_should_be_camel_case_symbols.required_modifiers = static -dotnet_naming_symbols.static_fields_should_be_camel_case_symbols.resharper_applicable_kinds = any_field -dotnet_naming_symbols.static_fields_should_be_camel_case_symbols.resharper_required_modifiers = static -dotnet_naming_symbols.static_readonly_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected -dotnet_naming_symbols.static_readonly_symbols.applicable_kinds = field -dotnet_naming_symbols.static_readonly_symbols.required_modifiers = static,readonly -dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = * -dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter -dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none -dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none -dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -dotnet_style_predefined_type_for_member_access = true:suggestion -dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion - # Standard properties insert_final_newline = true # (Please don't specify an indent_size here; that has too many unintended consequences.) @@ -316,7 +143,7 @@ dotnet_naming_symbols.static_fields.applicable_kinds = field dotnet_naming_symbols.static_fields.required_modifiers = static dotnet_naming_style.static_field_style.capitalization = camel_case -dotnet_naming_style.static_field_style.required_prefix = s_ +dotnet_naming_style.static_field_style.required_prefix = _ # Instance fields are camelCase and start with _ dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion @@ -497,3 +324,12 @@ dotnet_diagnostic.ca1822.severity = suggestion indent_style = space indent_size = 4 tab_width = 4 + +[*.cs] +# IDE0130: Namespace does not match folder structure +dotnet_style_namespace_match_folder = false + +# IDE0130: Namespace does not match folder structure +dotnet_diagnostic.IDE0130.severity = silent + +resharper_check_namespace_highlighting=none diff --git a/Notion.sln.DotSettings b/Notion.sln.DotSettings new file mode 100644 index 00000000..833f39db --- /dev/null +++ b/Notion.sln.DotSettings @@ -0,0 +1,5 @@ + + PDF + API + JSON + URL diff --git a/Src/Notion.Client/Api/ApiEndpoints.cs b/Src/Notion.Client/Api/ApiEndpoints.cs index 51dbe7fd..a6434683 100644 --- a/Src/Notion.Client/Api/ApiEndpoints.cs +++ b/Src/Notion.Client/Api/ApiEndpoints.cs @@ -11,11 +11,6 @@ public static string Retrieve(string databaseId) return $"/v1/databases/{databaseId}"; } - public static string List() - { - return "/v1/databases"; - } - public static string Query(string databaseId) { return $"/v1/databases/{databaseId}/query"; @@ -40,9 +35,9 @@ public static string List() } /// - /// Get the for retrieve your token's bot user. + /// Get the Uri for retrieve your token's bot user. /// - /// Returns a retrieve your token's bot user. + /// Returns a Uri retrieve your token's bot user. public static string Me() { return "/v1/users/me"; @@ -62,10 +57,10 @@ public static string Update(string blockId) } /// - /// Get the for deleting a block. + /// Get the Uri for deleting a block. /// /// Identifier for a Notion block - /// Returns a for deleting a block. + /// Returns a Uri for deleting a block. public static string Delete(string blockId) { return $"/v1/blocks/{blockId}"; @@ -105,11 +100,11 @@ public static string UpdateProperties(string pageId) } /// - /// Get the for retrieve page property item + /// Get the Uri for retrieve page property item /// /// Identifier for a Notion Page /// Identifier for a Notion Property - /// + /// Returns a Uri for Retrieve page property item public static string RetrievePropertyItem(string pageId, string propertyId) { return $"/v1/pages/{pageId}/properties/{propertyId}"; diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/AudioUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/AudioUpdateBlock.cs index f341e441..0f4b1acb 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/AudioUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/AudioUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class AudioUpdateBlock : UpdateBlock, IUpdateBlock + public class AudioUpdateBlock : UpdateBlock { [JsonProperty("audio")] public IFileObjectInput Audio { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BulletedListItemUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BulletedListItemUpdateBlock.cs index 9225942f..cb1fa405 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BulletedListItemUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/BulletedListItemUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class BulletedListItemUpdateBlock : UpdateBlock, IUpdateBlock + public class BulletedListItemUpdateBlock : UpdateBlock { [JsonProperty("bulleted_list_item")] public Info BulletedListItem { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CalloutUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CalloutUpdateBlock.cs index f8562ff3..f4489ff8 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CalloutUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CalloutUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class CalloutUpdateBlock : UpdateBlock, IUpdateBlock + public class CalloutUpdateBlock : UpdateBlock { [JsonProperty("callout")] public Info Callout { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CodeUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CodeUpdateBlock.cs index b4fcd6dc..164abb87 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CodeUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/CodeUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class CodeUpdateBlock : UpdateBlock, IUpdateBlock + public class CodeUpdateBlock : UpdateBlock { [JsonProperty("code")] public Info Code { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EmbedUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EmbedUpdateBlock.cs index b0419a23..8dba5a53 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EmbedUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EmbedUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class EmbedUpdateBlock : UpdateBlock, IUpdateBlock + public class EmbedUpdateBlock : UpdateBlock { [JsonProperty("embed")] public Info Embed { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EquationUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EquationUpdateBlock.cs index b7cb0ad9..b809ba7c 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EquationUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/EquationUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class EquationUpdateBlock : UpdateBlock, IUpdateBlock + public class EquationUpdateBlock : UpdateBlock { [JsonProperty("equation")] public Info Equation { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/FileUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/FileUpdateBlock.cs index 30d0dd9c..10208c1a 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/FileUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/FileUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class FileUpdateBlock : UpdateBlock, IUpdateBlock + public class FileUpdateBlock : UpdateBlock { [JsonProperty("file")] public IFileObjectInput File { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingOneUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingOneUpdateBlock.cs index aeb4e087..672c8c85 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingOneUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingOneUpdateBlock.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; namespace Notion.Client { - public class HeadingOneUpdateBlock : UpdateBlock, IUpdateBlock + public class HeadingOneUpdateBlock : UpdateBlock { [JsonProperty("heading_1")] + [SuppressMessage("ReSharper", "InconsistentNaming")] public Info Heading_1 { get; set; } public class Info diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingThreeeUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingThreeeUpdateBlock.cs index 574ea0f0..353d1a98 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingThreeeUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingThreeeUpdateBlock.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; namespace Notion.Client { - public class HeadingThreeeUpdateBlock : UpdateBlock, IUpdateBlock + public class HeadingThreeeUpdateBlock : UpdateBlock { [JsonProperty("heading_3")] + [SuppressMessage("ReSharper", "InconsistentNaming")] public Info Heading_3 { get; set; } public class Info diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingTwoUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingTwoUpdateBlock.cs index 0269a0ce..da1f2833 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingTwoUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/HeadingTwoUpdateBlock.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; namespace Notion.Client { - public class HeadingTwoUpdateBlock : UpdateBlock, IUpdateBlock + public class HeadingTwoUpdateBlock : UpdateBlock { [JsonProperty("heading_2")] + [SuppressMessage("ReSharper", "InconsistentNaming")] public Info Heading_2 { get; set; } public class Info diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ImageUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ImageUpdateBlock.cs index 6679c61b..791198e9 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ImageUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ImageUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class ImageUpdateBlock : UpdateBlock, IUpdateBlock + public class ImageUpdateBlock : UpdateBlock { [JsonProperty("image")] public IFileObjectInput Image { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/LinkToPageUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/LinkToPageUpdateBlock.cs index f6407cd4..69e088c5 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/LinkToPageUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/LinkToPageUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class LinkToPageUpdateBlock : UpdateBlock, IUpdateBlock + public class LinkToPageUpdateBlock : UpdateBlock { [JsonProperty("link_to_page")] public IPageParentInput LinkToPage { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/NumberedListItemUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/NumberedListItemUpdateBlock.cs index c27363d3..11f92394 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/NumberedListItemUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/NumberedListItemUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class NumberedListItemUpdateBlock : UpdateBlock, IUpdateBlock + public class NumberedListItemUpdateBlock : UpdateBlock { [JsonProperty("numbered_list_item")] public Info NumberedListItem { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/PDFUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/PDFUpdateBlock.cs index 8c56b7ff..c6e9ba0e 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/PDFUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/PDFUpdateBlock.cs @@ -1,8 +1,10 @@ -using Newtonsoft.Json; +using System.Diagnostics.CodeAnalysis; +using Newtonsoft.Json; namespace Notion.Client { - public class PDFUpdateBlock : UpdateBlock, IUpdateBlock + [SuppressMessage("ReSharper", "InconsistentNaming")] + public class PDFUpdateBlock : UpdateBlock { [JsonProperty("pdf")] public IFileObjectInput PDF { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphUpdateBlock.cs index 2e49c64a..63aa2724 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ParagraphUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class ParagraphUpdateBlock : UpdateBlock, IUpdateBlock + public class ParagraphUpdateBlock : UpdateBlock { [JsonProperty("paragraph")] public Info Paragraph { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/QuoteUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/QuoteUpdateBlock.cs index fdfd189c..9222112e 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/QuoteUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/QuoteUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class QuoteUpdateBlock : UpdateBlock, IUpdateBlock + public class QuoteUpdateBlock : UpdateBlock { [JsonProperty("quote")] public Info Quote { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/SyncedBlockUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/SyncedBlockUpdateBlock.cs index 9cb234d8..e275f371 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/SyncedBlockUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/SyncedBlockUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class SyncedBlockUpdateBlock : UpdateBlock, IUpdateBlock + public class SyncedBlockUpdateBlock : UpdateBlock { [JsonProperty("synced_block")] public Info SyncedBlock { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableRowUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableRowUpdateBlock.cs index c228de66..143f3e2d 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableRowUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableRowUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class TableRowUpdateBlock : UpdateBlock, IUpdateBlock + public class TableRowUpdateBlock : UpdateBlock { [JsonProperty("table_row")] public Info TableRow { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableUpdateBlock.cs index ef0e8933..7c1f8046 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class TableUpdateBlock : UpdateBlock, IUpdateBlock + public class TableUpdateBlock : UpdateBlock { [JsonProperty("table")] public Info Table { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TemplateUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TemplateUpdateBlock.cs index 62457971..32a393cd 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TemplateUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TemplateUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class TemplateUpdateBlock : UpdateBlock, IUpdateBlock + public class TemplateUpdateBlock : UpdateBlock { [JsonProperty("template")] public Info Template { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoUpdateBlock.cs index f1accfc8..9e244f44 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToDoUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class ToDoUpdateBlock : UpdateBlock, IUpdateBlock + public class ToDoUpdateBlock : UpdateBlock { [JsonProperty("to_do")] public Info ToDo { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleUpdateBlock.cs index b87834d1..3d7e8e87 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/ToggleUpdateBlock.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class ToggleUpdateBlock : UpdateBlock, IUpdateBlock + public class ToggleUpdateBlock : UpdateBlock { [JsonProperty("toggle")] public Info Toggle { get; set; } diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/VideoUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/VideoUpdateBlock.cs index ec28aae3..a317139a 100644 --- a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/VideoUpdateBlock.cs +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/VideoUpdateBlock.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class VideoUpdateBlock : UpdateBlock, IUpdateBlock + public class VideoUpdateBlock : UpdateBlock { [JsonProperty("video")] public IFileObjectInput Video { get; set; } diff --git a/Src/Notion.Client/Api/Comments/Create/Response/CreateCommentResponse.cs b/Src/Notion.Client/Api/Comments/Create/Response/CreateCommentResponse.cs index 39bebd6b..0171d92d 100644 --- a/Src/Notion.Client/Api/Comments/Create/Response/CreateCommentResponse.cs +++ b/Src/Notion.Client/Api/Comments/Create/Response/CreateCommentResponse.cs @@ -1,5 +1,8 @@ -namespace Notion.Client +using System.Diagnostics.CodeAnalysis; + +namespace Notion.Client { + [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] public class CreateCommentResponse : Comment { } diff --git a/Src/Notion.Client/Api/Comments/ICommentsClient.cs b/Src/Notion.Client/Api/Comments/ICommentsClient.cs index 871319da..8ec81348 100644 --- a/Src/Notion.Client/Api/Comments/ICommentsClient.cs +++ b/Src/Notion.Client/Api/Comments/ICommentsClient.cs @@ -4,15 +4,6 @@ namespace Notion.Client { public interface ICommentsClient { - /// - /// Retrieves a list of un-resolved Comment objects from a page or block. - /// - /// Retrieve comments parameters - /// - /// - /// - Task Retrieve(RetrieveCommentsParameters retrieveCommentsParameters); - Task Create(CreateCommentParameters createCommentParameters); } } diff --git a/Src/Notion.Client/Api/Comments/Retrieve/CommentsClient.cs b/Src/Notion.Client/Api/Comments/Retrieve/CommentsClient.cs index cb32978e..eb1546ab 100644 --- a/Src/Notion.Client/Api/Comments/Retrieve/CommentsClient.cs +++ b/Src/Notion.Client/Api/Comments/Retrieve/CommentsClient.cs @@ -1,10 +1,12 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace Notion.Client { public partial class CommentsClient { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public async Task Retrieve(RetrieveCommentsParameters parameters) { var qp = (IRetrieveCommentsQueryParameters)parameters; diff --git a/Src/Notion.Client/Api/Comments/Retrieve/Request/RetrieveCommentsParameters.cs b/Src/Notion.Client/Api/Comments/Retrieve/Request/RetrieveCommentsParameters.cs index d42ec9e7..25d3d54d 100644 --- a/Src/Notion.Client/Api/Comments/Retrieve/Request/RetrieveCommentsParameters.cs +++ b/Src/Notion.Client/Api/Comments/Retrieve/Request/RetrieveCommentsParameters.cs @@ -1,5 +1,8 @@ -namespace Notion.Client +using System.Diagnostics.CodeAnalysis; + +namespace Notion.Client { + [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] public class RetrieveCommentsParameters : IRetrieveCommentsQueryParameters { public string BlockId { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/MultiSelectOptionSchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/MultiSelectOptionSchema.cs index 89fdb0ab..a13d0930 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/MultiSelectOptionSchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/MultiSelectOptionSchema.cs @@ -1,5 +1,8 @@ -namespace Notion.Client +using System.Diagnostics.CodeAnalysis; + +namespace Notion.Client { + [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] public class MultiSelectOptionSchema : SelectOptionSchema { } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesListParameters.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesListParameters.cs deleted file mode 100644 index 922e54fc..00000000 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesListParameters.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Notion.Client -{ - public class DatabasesListParameters : IDatabasesListQueryParmaters - { - public string StartCursor { get; set; } - - public int? PageSize { get; set; } - } -} diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CheckboxUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CheckboxUpdatePropertySchema.cs index a13f2911..a6890d6e 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CheckboxUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CheckboxUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class CheckboxUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class CheckboxUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("checkbox")] public Dictionary Checkbox { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedByUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedByUpdatePropertySchema.cs index 394868db..08a5cf74 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedByUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedByUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class CreatedByUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class CreatedByUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("created_by")] public Dictionary CreatedBy { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedTimeUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedTimeUpdatePropertySchema.cs index dee266f3..8089ecbb 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedTimeUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/CreatedTimeUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class CreatedTimeUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class CreatedTimeUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("created_time")] public Dictionary CreatedTime { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/DateUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/DateUpdatePropertySchema.cs index 0c2b2143..65487dd7 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/DateUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/DateUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class DateUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class DateUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("date")] public Dictionary Date { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/EmailUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/EmailUpdatePropertySchema.cs index 412c9115..5905e68e 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/EmailUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/EmailUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class EmailUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class EmailUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("email")] public Dictionary Email { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FilesUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FilesUpdatePropertySchema.cs index c7b84218..9fb3b531 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FilesUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FilesUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class FilesUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class FilesUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("files")] public Dictionary Files { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs index 158a42bb..40cc398a 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/FormulaUpdatePropertySchema.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class FormulaUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class FormulaUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("formula")] public Formula Formula { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedByUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedByUpdatePropertySchema.cs index 939bc69d..c547538a 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedByUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedByUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class LastEditedByUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class LastEditedByUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("last_edited_by")] public Dictionary LastEditedBy { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedTimeUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedTimeUpdatePropertySchema.cs index f48ddf5a..28c9e55b 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedTimeUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/LastEditedTimeUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class LastEditedTimeUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class LastEditedTimeUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("last_edited_time")] public Dictionary LastEditedTime { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/MultiSelectUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/MultiSelectUpdatePropertySchema.cs index a6b32ad3..0b7b1c0c 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/MultiSelectUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/MultiSelectUpdatePropertySchema.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class MultiSelectUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class MultiSelectUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("multi_select")] public OptionWrapper MultiSelect { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/NumberUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/NumberUpdatePropertySchema.cs index e1f0b734..23f3ea3a 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/NumberUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/NumberUpdatePropertySchema.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class NumberUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class NumberUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("number")] public Number Number { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PeopleUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PeopleUpdatePropertySchema.cs index 6fab728e..41a8892d 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PeopleUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PeopleUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class PeopleUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class PeopleUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("people")] public Dictionary People { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PhoneNumberUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PhoneNumberUpdatePropertySchema.cs index 7813671c..7d01f506 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PhoneNumberUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/PhoneNumberUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class PhoneNumberUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class PhoneNumberUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("phone_number")] public Dictionary PhoneNumber { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs index 2091df91..1565cd4a 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class RelationUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class RelationUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("relation")] public RelationInfo Relation { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RichTextUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RichTextUpdatePropertySchema.cs index 3d6c5ec2..a20ca0ea 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RichTextUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RichTextUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class RichTextUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class RichTextUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("rich_text")] public Dictionary RichText { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RollupConfigUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RollupConfigUpdatePropertySchema.cs index 2f38731b..8ee2d908 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RollupConfigUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RollupConfigUpdatePropertySchema.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class RollupConfigUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class RollupConfigUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("relation_property_name")] public string RelationPropertyName { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/SelectUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/SelectUpdatePropertySchema.cs index b833d0bc..678e452d 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/SelectUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/SelectUpdatePropertySchema.cs @@ -2,7 +2,7 @@ namespace Notion.Client { - public class SelectUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class SelectUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("select")] public OptionWrapper Select { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/TitleUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/TitleUpdatePropertySchema.cs index 1a74085c..54052dfc 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/TitleUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/TitleUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class TitleUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class TitleUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("title")] public Dictionary Title { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/URLUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/URLUpdatePropertySchema.cs index 7aa9c701..f56d6507 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/URLUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/URLUpdatePropertySchema.cs @@ -3,7 +3,7 @@ namespace Notion.Client { - public class UrlUpdatePropertySchema : UpdatePropertySchema, IUpdatePropertySchema + public class UrlUpdatePropertySchema : UpdatePropertySchema { [JsonProperty("url")] public Dictionary Url { get; set; } diff --git a/Src/Notion.Client/Api/Databases/RequestParams/Direction.cs b/Src/Notion.Client/Api/Databases/RequestParams/Direction.cs index c79d501d..059f42b3 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/Direction.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/Direction.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum Direction { [EnumMember(Value = null)] diff --git a/Src/Notion.Client/Api/Databases/RequestParams/IDatabasesListQueryParmaters.cs b/Src/Notion.Client/Api/Databases/RequestParams/IDatabasesListQueryParmaters.cs deleted file mode 100644 index 4432f421..00000000 --- a/Src/Notion.Client/Api/Databases/RequestParams/IDatabasesListQueryParmaters.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Notion.Client -{ - public interface IDatabasesListQueryParmaters : IPaginationParameters - { - } -} diff --git a/Src/Notion.Client/Api/Databases/RequestParams/Timestamp.cs b/Src/Notion.Client/Api/Databases/RequestParams/Timestamp.cs index 334b8c22..df2c69ca 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/Timestamp.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/Timestamp.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum Timestamp { [EnumMember(Value = null)] diff --git a/Src/Notion.Client/Api/Pages/PagesClient.cs b/Src/Notion.Client/Api/Pages/PagesClient.cs index b4a3c58f..91c59a64 100644 --- a/Src/Notion.Client/Api/Pages/PagesClient.cs +++ b/Src/Notion.Client/Api/Pages/PagesClient.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using static Notion.Client.ApiEndpoints; @@ -78,7 +79,7 @@ public async Task UpdateAsync(string pageId, PagesUpdateParameters pagesUp return await _client.PatchAsync(url, body); } - [Obsolete("This method is obsolute. Use UpdateAsync instead. This API will be removed in future release")] + [Obsolete("This method is obsolete. Use UpdateAsync instead. This API will be removed in future release")] public async Task UpdatePropertiesAsync( string pageId, IDictionary updatedProperties) @@ -90,6 +91,7 @@ public async Task UpdatePropertiesAsync( return await _client.PatchAsync(url, body); } + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")] private class UpdatePropertiesParameters { public IDictionary Properties { get; set; } diff --git a/Src/Notion.Client/Api/Pages/RequestParams/PagesCreateParameters/PagesCreateParametersBuilder.cs b/Src/Notion.Client/Api/Pages/RequestParams/PagesCreateParameters/PagesCreateParametersBuilder.cs index 6b263beb..ed85117d 100644 --- a/Src/Notion.Client/Api/Pages/RequestParams/PagesCreateParameters/PagesCreateParametersBuilder.cs +++ b/Src/Notion.Client/Api/Pages/RequestParams/PagesCreateParameters/PagesCreateParametersBuilder.cs @@ -1,14 +1,16 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public class PagesCreateParametersBuilder { - private readonly IList children = new List(); - private readonly Dictionary properties = new(); - private FileObject cover; - private IPageIcon icon; - private IPageParentInput parent; + private readonly IList _children = new List(); + private readonly Dictionary _properties = new(); + private FileObject _cover; + private IPageIcon _icon; + private IPageParentInput _parent; private PagesCreateParametersBuilder() { @@ -16,33 +18,33 @@ private PagesCreateParametersBuilder() public static PagesCreateParametersBuilder Create(IPageParentInput parent) { - return new PagesCreateParametersBuilder { parent = parent }; + return new PagesCreateParametersBuilder { _parent = parent }; } public PagesCreateParametersBuilder AddProperty(string nameOrId, PropertyValue value) { - properties[nameOrId] = value; + _properties[nameOrId] = value; return this; } public PagesCreateParametersBuilder AddPageContent(IBlock block) { - children.Add(block); + _children.Add(block); return this; } public PagesCreateParametersBuilder SetIcon(IPageIcon pageIcon) { - icon = pageIcon; + _icon = pageIcon; return this; } public PagesCreateParametersBuilder SetCover(FileObject pageCover) { - cover = pageCover; + _cover = pageCover; return this; } @@ -51,11 +53,11 @@ public PagesCreateParameters Build() { return new PagesCreateParameters { - Parent = parent, - Properties = properties, - Children = children, - Icon = icon, - Cover = cover + Parent = _parent, + Properties = _properties, + Children = _children, + Icon = _icon, + Cover = _cover }; } } diff --git a/Src/Notion.Client/Api/Search/ISearchClient.cs b/Src/Notion.Client/Api/Search/ISearchClient.cs index 8071db6d..835c14e4 100644 --- a/Src/Notion.Client/Api/Search/ISearchClient.cs +++ b/Src/Notion.Client/Api/Search/ISearchClient.cs @@ -1,7 +1,9 @@ -using System.Threading.Tasks; +using System.Diagnostics.CodeAnalysis; +using System.Threading.Tasks; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMemberInSuper.Global")] public interface ISearchClient { /// diff --git a/Src/Notion.Client/Api/Search/Parameters/SearchDirection.cs b/Src/Notion.Client/Api/Search/Parameters/SearchDirection.cs index fdac0b59..da52b11b 100644 --- a/Src/Notion.Client/Api/Search/Parameters/SearchDirection.cs +++ b/Src/Notion.Client/Api/Search/Parameters/SearchDirection.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum SearchDirection { [EnumMember(Value = "ascending")] diff --git a/Src/Notion.Client/Api/Search/Parameters/SearchFilter.cs b/Src/Notion.Client/Api/Search/Parameters/SearchFilter.cs index dbd5cf5f..b36ca873 100644 --- a/Src/Notion.Client/Api/Search/Parameters/SearchFilter.cs +++ b/Src/Notion.Client/Api/Search/Parameters/SearchFilter.cs @@ -1,8 +1,11 @@ -using Newtonsoft.Json; +using System.Diagnostics.CodeAnalysis; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace Notion.Client { + [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] + [SuppressMessage("ReSharper", "UnusedMember.Global")] public class SearchFilter { [JsonConverter(typeof(StringEnumConverter))] diff --git a/Src/Notion.Client/Api/Search/Parameters/SearchObjectType.cs b/Src/Notion.Client/Api/Search/Parameters/SearchObjectType.cs index 78a012df..e3e6181b 100644 --- a/Src/Notion.Client/Api/Search/Parameters/SearchObjectType.cs +++ b/Src/Notion.Client/Api/Search/Parameters/SearchObjectType.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum SearchObjectType { [EnumMember(Value = "page")] diff --git a/Src/Notion.Client/Api/Search/SearchClient.cs b/Src/Notion.Client/Api/Search/SearchClient.cs index 87de9270..bd73acfc 100644 --- a/Src/Notion.Client/Api/Search/SearchClient.cs +++ b/Src/Notion.Client/Api/Search/SearchClient.cs @@ -5,11 +5,11 @@ namespace Notion.Client { public class SearchClient : ISearchClient { - private readonly IRestClient client; + private readonly IRestClient _client; public SearchClient(IRestClient client) { - this.client = client; + _client = client; } public async Task> SearchAsync(SearchParameters parameters) @@ -18,7 +18,7 @@ public async Task> SearchAsync(SearchParameters parameter var body = (ISearchBodyParameters)parameters; - return await client.PostAsync>(url, body); + return await _client.PostAsync>(url, body); } } } diff --git a/Src/Notion.Client/Constants.cs b/Src/Notion.Client/Constants.cs index 072291e1..779bcb47 100644 --- a/Src/Notion.Client/Constants.cs +++ b/Src/Notion.Client/Constants.cs @@ -4,9 +4,9 @@ namespace Notion.Client { - internal class Constants + internal static class Constants { - internal static string BASE_URL = "https://api.notion.com/"; - internal static string DEFAULT_NOTION_VERSION = "2022-06-28"; + internal const string BaseUrl = "https://api.notion.com/"; + internal const string DefaultNotionVersion = "2022-06-28"; } } diff --git a/Src/Notion.Client/DI/ServiceCollectionExtensions.cs b/Src/Notion.Client/DI/ServiceCollectionExtensions.cs index 866dc92d..9a658077 100644 --- a/Src/Notion.Client/DI/ServiceCollectionExtensions.cs +++ b/Src/Notion.Client/DI/ServiceCollectionExtensions.cs @@ -1,15 +1,18 @@ using System; +using System.Diagnostics.CodeAnalysis; using Notion.Client; namespace Microsoft.Extensions.DependencyInjection { + [SuppressMessage("ReSharper", "UnusedType.Global")] + [SuppressMessage("ReSharper", "UnusedMember.Global")] public static class ServiceCollectionExtensions { public static IServiceCollection AddNotionClient( this IServiceCollection services, Action options) { - services.AddSingleton(sp => + services.AddSingleton(_ => { var clientOptions = new ClientOptions(); options?.Invoke(clientOptions); diff --git a/Src/Notion.Client/Extensions/HttpResponseMessageExtensions.cs b/Src/Notion.Client/Extensions/HttpResponseMessageExtensions.cs index b6a9396d..cc6f9698 100644 --- a/Src/Notion.Client/Extensions/HttpResponseMessageExtensions.cs +++ b/Src/Notion.Client/Extensions/HttpResponseMessageExtensions.cs @@ -11,27 +11,15 @@ internal static async Task ParseStreamAsync( this HttpResponseMessage response, JsonSerializerSettings serializerSettings = null) { - using (var stream = await response.Content.ReadAsStreamAsync()) - { - using (var streamReader = new StreamReader(stream)) - { - using (JsonReader jsonReader = new JsonTextReader(streamReader)) - { - JsonSerializer serializer = null; + using var stream = await response.Content.ReadAsStreamAsync(); + using var streamReader = new StreamReader(stream); + using JsonReader jsonReader = new JsonTextReader(streamReader); - if (serializerSettings == null) - { - serializer = JsonSerializer.CreateDefault(); - } - else - { - serializer = JsonSerializer.Create(serializerSettings); - } + var serializer = serializerSettings == null + ? JsonSerializer.CreateDefault() + : JsonSerializer.Create(serializerSettings); - return serializer.Deserialize(jsonReader); - } - } - } + return serializer.Deserialize(jsonReader); } } } diff --git a/Src/Notion.Client/Logging/Log.cs b/Src/Notion.Client/Logging/Log.cs index 7fda66a5..47beea5e 100644 --- a/Src/Notion.Client/Logging/Log.cs +++ b/Src/Notion.Client/Logging/Log.cs @@ -1,25 +1,27 @@ using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Logging; namespace Notion.Client { internal static class Log { - internal static ILogger logger; + internal static ILogger Logger; internal static void Trace(string message, params object[] args) { - logger?.LogTrace(message, args); + Logger?.LogTrace(message, args); } + [SuppressMessage("ReSharper", "UnusedMember.Global")] internal static void Information(string message, params object[] args) { - logger?.LogInformation(message, args); + Logger?.LogInformation(message, args); } internal static void Error(Exception ex, string message, params object[] args) { - logger?.LogError(ex, message, args); + Logger?.LogError(ex, message, args); } } } diff --git a/Src/Notion.Client/Logging/NotionClientLogging.cs b/Src/Notion.Client/Logging/NotionClientLogging.cs index b77ff15e..07a18514 100644 --- a/Src/Notion.Client/Logging/NotionClientLogging.cs +++ b/Src/Notion.Client/Logging/NotionClientLogging.cs @@ -1,16 +1,19 @@ -using Microsoft.Extensions.Logging; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Logging; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedType.Global")] + [SuppressMessage("ReSharper", "UnusedMember.Global")] public static class NotionClientLogging { - internal static ILoggerFactory factory; + private static ILoggerFactory _factory; public static void ConfigureLogger(ILoggerFactory loggerFactory) { - factory = loggerFactory; + _factory = loggerFactory; - Log.logger = Log.logger == null ? factory?.CreateLogger("Notion.Client") : Log.logger; + Log.Logger = Log.Logger == null ? _factory?.CreateLogger("Notion.Client") : Log.Logger; } } } diff --git a/Src/Notion.Client/Models/Blocks/BlockType.cs b/Src/Notion.Client/Models/Blocks/BlockType.cs index 8a2c626a..92de4b6b 100644 --- a/Src/Notion.Client/Models/Blocks/BlockType.cs +++ b/Src/Notion.Client/Models/Blocks/BlockType.cs @@ -1,4 +1,5 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { @@ -8,12 +9,15 @@ public enum BlockType Paragraph, [EnumMember(Value = "heading_1")] + [SuppressMessage("ReSharper", "InconsistentNaming")] Heading_1, [EnumMember(Value = "heading_2")] + [SuppressMessage("ReSharper", "InconsistentNaming")] Heading_2, [EnumMember(Value = "heading_3")] + [SuppressMessage("ReSharper", "InconsistentNaming")] Heading_3, [EnumMember(Value = "bulleted_list_item")] diff --git a/Src/Notion.Client/Models/Blocks/Color.cs b/Src/Notion.Client/Models/Blocks/Color.cs index ec22b0dc..46e38e2a 100644 --- a/Src/Notion.Client/Models/Blocks/Color.cs +++ b/Src/Notion.Client/Models/Blocks/Color.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum Color { [EnumMember(Value = "default")] diff --git a/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs b/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs index aced5461..b0753122 100644 --- a/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs +++ b/Src/Notion.Client/Models/Blocks/HeadingOneBlock.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -7,6 +8,7 @@ namespace Notion.Client public class HeadingOneBlock : Block, IColumnChildrenBlock, INonColumnBlock { [JsonProperty("heading_1")] + [SuppressMessage("ReSharper", "InconsistentNaming")] public Info Heading_1 { get; set; } public override BlockType Type => BlockType.Heading_1; diff --git a/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs b/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs index 10999e0e..c6abc213 100644 --- a/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs +++ b/Src/Notion.Client/Models/Blocks/HeadingThreeeBlock.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -7,6 +8,7 @@ namespace Notion.Client public class HeadingThreeeBlock : Block, IColumnChildrenBlock, INonColumnBlock { [JsonProperty("heading_3")] + [SuppressMessage("ReSharper", "InconsistentNaming")] public Info Heading_3 { get; set; } public override BlockType Type => BlockType.Heading_3; diff --git a/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs b/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs index 553d56f2..f5ffd7ea 100644 --- a/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs +++ b/Src/Notion.Client/Models/Blocks/HeadingTwoBlock.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -7,6 +8,7 @@ namespace Notion.Client public class HeadingTwoBlock : Block, IColumnChildrenBlock, INonColumnBlock { [JsonProperty("heading_2")] + [SuppressMessage("ReSharper", "InconsistentNaming")] public Info Heading_2 { get; set; } public override BlockType Type => BlockType.Heading_2; diff --git a/Src/Notion.Client/Models/Blocks/IColumnChildrenBlock.cs b/Src/Notion.Client/Models/Blocks/IColumnChildrenBlock.cs index 673bc156..8c1e1446 100644 --- a/Src/Notion.Client/Models/Blocks/IColumnChildrenBlock.cs +++ b/Src/Notion.Client/Models/Blocks/IColumnChildrenBlock.cs @@ -8,7 +8,7 @@ public interface ISyncedBlockChildren : IBlock { } - public interface IColumnChildrenBlock : IBlock, ITemplateChildrendBlock, ISyncedBlockChildren + public interface IColumnChildrenBlock : ITemplateChildrendBlock, ISyncedBlockChildren { } diff --git a/Src/Notion.Client/Models/Blocks/PDFBlock.cs b/Src/Notion.Client/Models/Blocks/PDFBlock.cs index 55e3ce42..6d7486d7 100644 --- a/Src/Notion.Client/Models/Blocks/PDFBlock.cs +++ b/Src/Notion.Client/Models/Blocks/PDFBlock.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json; +using System.Diagnostics.CodeAnalysis; +using Newtonsoft.Json; namespace Notion.Client { + [SuppressMessage("ReSharper", "InconsistentNaming")] public class PDFBlock : Block, IColumnChildrenBlock, INonColumnBlock { [JsonProperty("pdf")] diff --git a/Src/Notion.Client/Models/Database/Properties/PropertyType.cs b/Src/Notion.Client/Models/Database/Properties/PropertyType.cs index 5ca4c7f8..e4db339a 100644 --- a/Src/Notion.Client/Models/Database/Properties/PropertyType.cs +++ b/Src/Notion.Client/Models/Database/Properties/PropertyType.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum PropertyType { [EnumMember(Value = null)] diff --git a/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs b/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs index 9af6397b..f9675443 100644 --- a/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs +++ b/Src/Notion.Client/Models/Database/Properties/SelectProperty.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] public class SelectProperty : Property { public override PropertyType Type => PropertyType.Select; diff --git a/Src/Notion.Client/Models/Database/RichText/RichTextType.cs b/Src/Notion.Client/Models/Database/RichText/RichTextType.cs index 59bc414f..91031138 100644 --- a/Src/Notion.Client/Models/Database/RichText/RichTextType.cs +++ b/Src/Notion.Client/Models/Database/RichText/RichTextType.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum RichTextType { [EnumMember(Value = null)] diff --git a/Src/Notion.Client/Models/Filters/TimestampCreatedTimeFilter.cs b/Src/Notion.Client/Models/Filters/TimestampCreatedTimeFilter.cs index d550817e..80f9dcf4 100644 --- a/Src/Notion.Client/Models/Filters/TimestampCreatedTimeFilter.cs +++ b/Src/Notion.Client/Models/Filters/TimestampCreatedTimeFilter.cs @@ -6,9 +6,6 @@ namespace Notion.Client { public class TimestampCreatedTimeFilter : Filter { - [JsonProperty("timestamp")] - public string Timestamp = "created_time"; - public TimestampCreatedTimeFilter( DateTime? equal = null, DateTime? before = null, @@ -41,6 +38,9 @@ public TimestampCreatedTimeFilter( ); } + [JsonProperty("timestamp")] + public string Timestamp => "created_time"; + [JsonProperty("created_time")] public DateFilter.Condition CreatedTime { get; set; } } diff --git a/Src/Notion.Client/Models/Filters/TimestampLastEditedTimeFilter.cs b/Src/Notion.Client/Models/Filters/TimestampLastEditedTimeFilter.cs index 51a6e39f..695183cc 100644 --- a/Src/Notion.Client/Models/Filters/TimestampLastEditedTimeFilter.cs +++ b/Src/Notion.Client/Models/Filters/TimestampLastEditedTimeFilter.cs @@ -6,9 +6,6 @@ namespace Notion.Client { public class TimestampLastEditedTimeFilter : Filter { - [JsonProperty("timestamp")] - public string Timestamp = "last_modified_time"; - public TimestampLastEditedTimeFilter( DateTime? equal = null, DateTime? before = null, @@ -41,6 +38,9 @@ public TimestampLastEditedTimeFilter( ); } + [JsonProperty("timestamp")] + public string Timestamp => "last_modified_time"; + [JsonProperty("last_edited_time")] public DateFilter.Condition LastEditedTime { get; set; } } diff --git a/Src/Notion.Client/Models/Filters/URLFilter.cs b/Src/Notion.Client/Models/Filters/URLFilter.cs index b2d4c611..7c722832 100644 --- a/Src/Notion.Client/Models/Filters/URLFilter.cs +++ b/Src/Notion.Client/Models/Filters/URLFilter.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json; +using System.Diagnostics.CodeAnalysis; +using Newtonsoft.Json; namespace Notion.Client { + [SuppressMessage("ReSharper", "InconsistentNaming")] public class URLFilter : SinglePropertyFilter { public URLFilter( diff --git a/Src/Notion.Client/Models/Parents/IParent.cs b/Src/Notion.Client/Models/Parents/IParent.cs index e2c50e5f..ccf3999b 100644 --- a/Src/Notion.Client/Models/Parents/IParent.cs +++ b/Src/Notion.Client/Models/Parents/IParent.cs @@ -1,8 +1,10 @@ -using Newtonsoft.Json; +using System.Diagnostics.CodeAnalysis; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMemberInSuper.Global")] public interface IParent { [JsonConverter(typeof(StringEnumConverter))] diff --git a/Src/Notion.Client/Models/Parents/ParentType.cs b/Src/Notion.Client/Models/Parents/ParentType.cs index 29126694..347414f9 100644 --- a/Src/Notion.Client/Models/Parents/ParentType.cs +++ b/Src/Notion.Client/Models/Parents/ParentType.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum ParentType { [EnumMember(Value = null)] diff --git a/Src/Notion.Client/Models/PropertyItems/ListPropertyItem.cs b/Src/Notion.Client/Models/PropertyItems/ListPropertyItem.cs index 5e35159c..d337ccfd 100644 --- a/Src/Notion.Client/Models/PropertyItems/ListPropertyItem.cs +++ b/Src/Notion.Client/Models/PropertyItems/ListPropertyItem.cs @@ -1,8 +1,11 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; namespace Notion.Client { + [SuppressMessage("ReSharper", "ClassWithVirtualMembersNeverInherited.Global")] + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] public class ListPropertyItem : IPropertyItemObject { [JsonProperty("results")] diff --git a/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs b/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs index ed3bef38..6ba77c67 100644 --- a/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs +++ b/Src/Notion.Client/Models/PropertyItems/SimplePropertyItem.cs @@ -1,4 +1,5 @@ -using JsonSubTypes; +using System.Diagnostics.CodeAnalysis; +using JsonSubTypes; using Newtonsoft.Json; namespace Notion.Client @@ -24,6 +25,7 @@ namespace Notion.Client [JsonSubtypes.KnownSubTypeAttribute(typeof(PeoplePropertyItem), "people")] [JsonSubtypes.KnownSubTypeAttribute(typeof(RelationPropertyItem), "relation")] [JsonSubtypes.KnownSubTypeAttribute(typeof(RollupPropertyItem), "rollup")] + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] public abstract class SimplePropertyItem : IPropertyItemObject { public string Object => "property_item"; diff --git a/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs index f893e47a..c423be82 100644 --- a/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/PropertyValue.cs @@ -1,4 +1,5 @@ -using JsonSubTypes; +using System.Diagnostics.CodeAnalysis; +using JsonSubTypes; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -28,6 +29,8 @@ namespace Notion.Client [JsonSubtypes.KnownSubTypeAttribute(typeof(StatusPropertyValue), PropertyValueType.Status)] [JsonSubtypes.KnownSubTypeAttribute(typeof(TitlePropertyValue), PropertyValueType.Title)] [JsonSubtypes.KnownSubTypeAttribute(typeof(UrlPropertyValue), PropertyValueType.Url)] + [SuppressMessage("ReSharper", "UnusedMember.Global")] + [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class PropertyValue { /// diff --git a/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs b/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs index f8fb0a30..96ddaf77 100644 --- a/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs +++ b/Src/Notion.Client/Models/PropertyValue/PropertyValueType.cs @@ -1,10 +1,12 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { /// /// Types of Property Value /// + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum PropertyValueType { [EnumMember(Value = null)] diff --git a/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs b/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs index 487b27c8..29a64ef7 100644 --- a/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs +++ b/Src/Notion.Client/Models/PropertyValue/StatusPropertyValue.cs @@ -1,4 +1,5 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -9,7 +10,9 @@ namespace Notion.Client /// public class StatusPropertyValue : PropertyValue { - public enum Color + [SuppressMessage("ReSharper", "UnusedMember.Global")] + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + public enum StatusColor { [EnumMember(Value = "default")] Default, @@ -66,7 +69,7 @@ public class Data /// [JsonProperty("color")] [JsonConverter(typeof(StringEnumConverter))] - public Color? Color { get; set; } + public StatusColor? Color { get; set; } } } } diff --git a/Src/Notion.Client/Models/User/PartialUser.cs b/Src/Notion.Client/Models/User/PartialUser.cs index 5b335f0b..7e74c6d8 100644 --- a/Src/Notion.Client/Models/User/PartialUser.cs +++ b/Src/Notion.Client/Models/User/PartialUser.cs @@ -1,5 +1,8 @@ -namespace Notion.Client +using System.Diagnostics.CodeAnalysis; + +namespace Notion.Client { + [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] public class PartialUser : IObject { public string Id { get; set; } diff --git a/Src/Notion.Client/NotionAPIErrorCode.cs b/Src/Notion.Client/NotionAPIErrorCode.cs index 71e99d29..1dc822bd 100644 --- a/Src/Notion.Client/NotionAPIErrorCode.cs +++ b/Src/Notion.Client/NotionAPIErrorCode.cs @@ -1,7 +1,9 @@ -using System.Runtime.Serialization; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.Serialization; namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum NotionAPIErrorCode { [EnumMember(Value = "invalid_json")] diff --git a/Src/Notion.Client/NotionApiException.cs b/Src/Notion.Client/NotionApiException.cs index c7c9d7d4..d11fea6f 100644 --- a/Src/Notion.Client/NotionApiException.cs +++ b/Src/Notion.Client/NotionApiException.cs @@ -1,21 +1,18 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Net; namespace Notion.Client { - public class NotionApiException : Exception + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] + public sealed class NotionApiException : Exception { public NotionApiException(HttpStatusCode statusCode, NotionAPIErrorCode? notionAPIErrorCode, string message) : this(statusCode, notionAPIErrorCode, message, null) { } - public NotionApiException(HttpStatusCode statusCode, string message) - : this(statusCode, null, message, null) - { - } - - public NotionApiException( + private NotionApiException( HttpStatusCode statusCode, NotionAPIErrorCode? notionAPIErrorCode, string message, @@ -24,7 +21,7 @@ public NotionApiException( NotionAPIErrorCode = notionAPIErrorCode; StatusCode = statusCode; - Data.Add("StatusCode", statusCode); + Data.Add("StatusCode", StatusCode); Data.Add("NotionApiErrorCode", NotionAPIErrorCode); } diff --git a/Src/Notion.Client/NotionClient.cs b/Src/Notion.Client/NotionClient.cs index f752413a..ca0c1334 100644 --- a/Src/Notion.Client/NotionClient.cs +++ b/Src/Notion.Client/NotionClient.cs @@ -1,5 +1,8 @@ -namespace Notion.Client +using System.Diagnostics.CodeAnalysis; + +namespace Notion.Client { + [SuppressMessage("ReSharper", "UnusedMemberInSuper.Global")] public interface INotionClient { IUsersClient Users { get; } @@ -20,13 +23,13 @@ public interface INotionClient public class NotionClient : INotionClient { public NotionClient( - RestClient restClient, - UsersClient users, - DatabasesClient databases, - PagesClient pages, - SearchClient search, - CommentsClient comments, - BlocksClient blocks) + IRestClient restClient, + IUsersClient users, + IDatabasesClient databases, + IPagesClient pages, + ISearchClient search, + ICommentsClient comments, + IBlocksClient blocks) { RestClient = restClient; Users = users; diff --git a/Src/Notion.Client/RestClient/IRestClient.cs b/Src/Notion.Client/RestClient/IRestClient.cs index 792840b6..7abb8553 100644 --- a/Src/Notion.Client/RestClient/IRestClient.cs +++ b/Src/Notion.Client/RestClient/IRestClient.cs @@ -34,7 +34,6 @@ Task DeleteAsync( string uri, IDictionary queryParams = null, IDictionary headers = null, - JsonSerializerSettings serializerSettings = null, CancellationToken cancellationToken = default); } } diff --git a/Src/Notion.Client/RestClient/RestClient.cs b/Src/Notion.Client/RestClient/RestClient.cs index 23993086..307fcd7a 100644 --- a/Src/Notion.Client/RestClient/RestClient.cs +++ b/Src/Notion.Client/RestClient/RestClient.cs @@ -16,7 +16,7 @@ public class RestClient : IRestClient { private readonly ClientOptions _options; - protected readonly JsonSerializerSettings defaultSerializerSettings = new() + protected readonly JsonSerializerSettings DefaultSerializerSettings = new() { NullValueHandling = NullValueHandling.Ignore, ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() } @@ -52,7 +52,7 @@ public async Task PostAsync( { void AttachContent(HttpRequestMessage httpRequest) { - httpRequest.Content = new StringContent(JsonConvert.SerializeObject(body, defaultSerializerSettings), + httpRequest.Content = new StringContent(JsonConvert.SerializeObject(body, DefaultSerializerSettings), Encoding.UTF8, "application/json"); } @@ -72,7 +72,7 @@ public async Task PatchAsync( { void AttachContent(HttpRequestMessage httpRequest) { - var serializedBody = JsonConvert.SerializeObject(body, defaultSerializerSettings); + var serializedBody = JsonConvert.SerializeObject(body, DefaultSerializerSettings); httpRequest.Content = new StringContent(serializedBody, Encoding.UTF8, "application/json"); } @@ -86,7 +86,6 @@ public async Task DeleteAsync( string uri, IDictionary queryParams = null, IDictionary headers = null, - JsonSerializerSettings serializerSettings = null, CancellationToken cancellationToken = default) { await SendAsync(uri, HttpMethod.Delete, queryParams, headers, null, cancellationToken); @@ -97,8 +96,8 @@ private static ClientOptions MergeOptions(ClientOptions options) return new ClientOptions { AuthToken = options.AuthToken, - BaseUrl = options.BaseUrl ?? Constants.BASE_URL, - NotionVersion = options.NotionVersion ?? Constants.DEFAULT_NOTION_VERSION + BaseUrl = options.BaseUrl ?? Constants.BaseUrl, + NotionVersion = options.NotionVersion ?? Constants.DefaultNotionVersion }; } @@ -123,7 +122,7 @@ private static async Task BuildException(HttpResponseMessage response return new NotionApiException(response.StatusCode, errorResponse?.ErrorCode, errorResponse?.Message); } - public async Task SendAsync( + private async Task SendAsync( string requestUri, HttpMethod httpMethod, IDictionary queryParams = null, @@ -164,17 +163,17 @@ private static void AddHeaders(HttpRequestMessage request, IDictionary queryParams) diff --git a/Src/Notion.Client/http/QueryHelpers.cs b/Src/Notion.Client/http/QueryHelpers.cs index 243bfbcd..530536f3 100644 --- a/Src/Notion.Client/http/QueryHelpers.cs +++ b/Src/Notion.Client/http/QueryHelpers.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; using System.Text; @@ -8,6 +9,7 @@ namespace Notion.Client.http { internal static class QueryHelpers { + [SuppressMessage("ReSharper", "UnusedMember.Global")] public static string AddQueryString(string uri, string name, string value) { if (uri == null) diff --git a/Test/Notion.IntegrationTests/CommentsClientTests.cs b/Test/Notion.IntegrationTests/CommentsClientTests.cs index 118a09d6..efc91a44 100644 --- a/Test/Notion.IntegrationTests/CommentsClientTests.cs +++ b/Test/Notion.IntegrationTests/CommentsClientTests.cs @@ -11,7 +11,6 @@ public class CommentsClientTests : IDisposable { private readonly INotionClient _client; private readonly Page _page; - private readonly string _pageParentId; public CommentsClientTests() { @@ -19,12 +18,12 @@ public CommentsClientTests() _client = NotionClientFactory.Create(options); - _pageParentId = Environment.GetEnvironmentVariable("NOTION_PAGE_PARENT_ID") ?? - throw new ArgumentNullException("Page parent id is required."); + var pageParentId = Environment.GetEnvironmentVariable("NOTION_PAGE_PARENT_ID") ?? + throw new InvalidOperationException("Page parent id is required."); _page = _client.Pages.CreateAsync( PagesCreateParametersBuilder.Create( - new ParentPageInput { PageId = _pageParentId } + new ParentPageInput { PageId = pageParentId } ).Build() ).Result; } diff --git a/Test/Notion.IntegrationTests/IBlocksClientTests.cs b/Test/Notion.IntegrationTests/IBlocksClientTests.cs index 6fc53999..34459f01 100644 --- a/Test/Notion.IntegrationTests/IBlocksClientTests.cs +++ b/Test/Notion.IntegrationTests/IBlocksClientTests.cs @@ -199,7 +199,7 @@ private static IEnumerable BlockData() block => { Assert.NotNull(block); - Assert.IsType(block); + _ = Assert.IsType(block); }) }, new object[] @@ -239,7 +239,7 @@ private static IEnumerable BlockData() new TableOfContentsUpdateBlock(), new Action(block => { Assert.NotNull(block); - Assert.IsType(block); + _ = Assert.IsType(block); }) }, new object[] diff --git a/Test/Notion.IntegrationTests/IPageClientTests.cs b/Test/Notion.IntegrationTests/IPageClientTests.cs index 3b861f8e..fb3dafaa 100644 --- a/Test/Notion.IntegrationTests/IPageClientTests.cs +++ b/Test/Notion.IntegrationTests/IPageClientTests.cs @@ -146,13 +146,18 @@ public async Task Test_UpdatePageProperty_with_date_as_null() { // setup - add property to db and create a page with the property having a date - var datePropertyName = "Test Date Property"; - var updateDatabaseParameters = new DatabasesUpdateParameters(); + const string DatePropertyName = "Test Date Property"; - updateDatabaseParameters.Properties = new Dictionary + var updateDatabaseParameters = new DatabasesUpdateParameters { - { "Name", new TitleUpdatePropertySchema { Title = new Dictionary() } }, - { "Test Date Property", new DateUpdatePropertySchema { Date = new Dictionary() } } + Properties = new Dictionary + { + { "Name", new TitleUpdatePropertySchema { Title = new Dictionary() } }, + { + "Test Date Property", + new DateUpdatePropertySchema { Date = new Dictionary() } + } + } }; var pagesCreateParameters = PagesCreateParametersBuilder @@ -165,7 +170,7 @@ public async Task Test_UpdatePageProperty_with_date_as_null() new RichTextText { Text = new Text { Content = "Test Page Title" } } } }) - .AddProperty(datePropertyName, + .AddProperty(DatePropertyName, new DatePropertyValue { Date = new Date @@ -176,14 +181,14 @@ public async Task Test_UpdatePageProperty_with_date_as_null() }) .Build(); - var updatedDb = await _client.Databases.UpdateAsync(_databaseId, updateDatabaseParameters); + await _client.Databases.UpdateAsync(_databaseId, updateDatabaseParameters); var page = await _client.Pages.CreateAsync(pagesCreateParameters); var setDate = (DatePropertyItem)await _client.Pages.RetrievePagePropertyItem(new RetrievePropertyItemParameters { PageId = page.Id, - PropertyId = page.Properties[datePropertyName].Id + PropertyId = page.Properties[DatePropertyName].Id }); setDate?.Date?.Start.Should().Be(Convert.ToDateTime("2020-12-08T12:00:00Z")); @@ -191,7 +196,7 @@ public async Task Test_UpdatePageProperty_with_date_as_null() // verify IDictionary testProps = new Dictionary(); - testProps.Add(datePropertyName, new DatePropertyValue { Date = null }); + testProps.Add(DatePropertyName, new DatePropertyValue { Date = null }); var updatedPage = await _client.Pages.UpdateAsync(page.Id, new PagesUpdateParameters { Properties = testProps }); @@ -200,7 +205,7 @@ public async Task Test_UpdatePageProperty_with_date_as_null() new RetrievePropertyItemParameters { PageId = page.Id, - PropertyId = updatedPage.Properties[datePropertyName].Id + PropertyId = updatedPage.Properties[DatePropertyName].Id }); verifyDate?.Date.Should().BeNull(); diff --git a/Test/Notion.UnitTests/ApiTestBase.cs b/Test/Notion.UnitTests/ApiTestBase.cs index 6c0f3a97..51dfd7fc 100644 --- a/Test/Notion.UnitTests/ApiTestBase.cs +++ b/Test/Notion.UnitTests/ApiTestBase.cs @@ -1,7 +1,5 @@ using System; using System.Linq; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; using Notion.Client; using WireMock.Matchers; using WireMock.RequestBuilders; @@ -11,12 +9,6 @@ namespace Notion.UnitTests; public class ApiTestBase : IDisposable { - protected static readonly JsonSerializerSettings JsonSerializerSettings = new() - { - Formatting = Formatting.Indented, - ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() } - }; - protected readonly ClientOptions ClientOptions; protected readonly WireMockServer Server; @@ -43,7 +35,7 @@ protected IRequestBuilder CreateGetRequestBuilder(string path) .WithPath(path) .UsingGet() .WithHeader("Authorization", $"Bearer {ClientOptions.AuthToken}", MatchBehaviour.AcceptOnMatch) - .WithHeader("Notion-Version", Constants.DEFAULT_NOTION_VERSION, MatchBehaviour.AcceptOnMatch); + .WithHeader("Notion-Version", Constants.DefaultNotionVersion, MatchBehaviour.AcceptOnMatch); } protected IRequestBuilder CreatePostRequestBuilder(string path) @@ -52,7 +44,7 @@ protected IRequestBuilder CreatePostRequestBuilder(string path) .WithPath(path) .UsingPost() .WithHeader("Authorization", $"Bearer {ClientOptions.AuthToken}", MatchBehaviour.AcceptOnMatch) - .WithHeader("Notion-Version", Constants.DEFAULT_NOTION_VERSION, MatchBehaviour.AcceptOnMatch); + .WithHeader("Notion-Version", Constants.DefaultNotionVersion, MatchBehaviour.AcceptOnMatch); } protected IRequestBuilder CreatePatchRequestBuilder(string path) @@ -61,6 +53,6 @@ protected IRequestBuilder CreatePatchRequestBuilder(string path) .WithPath(path) .UsingPatch() .WithHeader("Authorization", $"Bearer {ClientOptions.AuthToken}", MatchBehaviour.AcceptOnMatch) - .WithHeader("Notion-Version", Constants.DEFAULT_NOTION_VERSION, MatchBehaviour.AcceptOnMatch); + .WithHeader("Notion-Version", Constants.DefaultNotionVersion, MatchBehaviour.AcceptOnMatch); } } diff --git a/Test/Notion.UnitTests/BlocksClientTests.cs b/Test/Notion.UnitTests/BlocksClientTests.cs index 97e54404..5d436b97 100644 --- a/Test/Notion.UnitTests/BlocksClientTests.cs +++ b/Test/Notion.UnitTests/BlocksClientTests.cs @@ -107,14 +107,14 @@ public async Task AppendBlockChildren() { block.Type.Should().Be(BlockType.Heading_2); var headingBlock = (HeadingTwoBlock)block; - var text = headingBlock.Heading_2.RichText.OfType().FirstOrDefault(); + var text = headingBlock.Heading_2.RichText.OfType().First(); text.Text.Content.Should().Be("Lacinato kale"); }, block => { block.Type.Should().Be(BlockType.Paragraph); var paragraphBlock = (ParagraphBlock)block; - var text = paragraphBlock.Paragraph.RichText.OfType().LastOrDefault(); + var text = paragraphBlock.Paragraph.RichText.OfType().Last(); text.Text.Content.Should().Be( "Lacinato kale is a variety of kale with a long tradition in Italian cuisine, especially that of Tuscany. It is also known as Tuscan kale, Italian kale, dinosaur kale, kale, flat back kale, palm tree kale, or black Tuscan palm."); diff --git a/Test/Notion.UnitTests/DatabasesClientTests.cs b/Test/Notion.UnitTests/DatabasesClientTests.cs index d29677ea..326bd55a 100644 --- a/Test/Notion.UnitTests/DatabasesClientTests.cs +++ b/Test/Notion.UnitTests/DatabasesClientTests.cs @@ -190,54 +190,53 @@ public async Task CreateDatabaseAsync() .WithBody(jsonData) ); - var createDatabaseParameters = new DatabasesCreateParameters(); - - createDatabaseParameters.Parent = new ParentPageInput { PageId = pageId }; - - createDatabaseParameters.Title = new List + var createDatabaseParameters = new DatabasesCreateParameters { - new RichTextTextInput + Parent = new ParentPageInput { PageId = pageId }, + Title = new List { - Text = new Text + new RichTextTextInput { - Content = "Grocery List", - Link = null + Text = new Text + { + Content = "Grocery List", + Link = null + } } - } - }; - - createDatabaseParameters.Properties = new Dictionary - { - { "Name", new TitlePropertySchema { Title = new Dictionary() } }, - { "Price", new NumberPropertySchema { Number = new Number { Format = "dollar" } } }, + }, + Properties = new Dictionary { - "Food group", - new SelectPropertySchema + { "Name", new TitlePropertySchema { Title = new Dictionary() } }, + { "Price", new NumberPropertySchema { Number = new Number { Format = "dollar" } } }, { - Select = new OptionWrapper + "Food group", + new SelectPropertySchema { - Options = new List + Select = new OptionWrapper { - new() - { - Color = Color.Green, - Name = "🥦Vegetable" - }, - new() - { - Color = Color.Red, - Name = "🍎Fruit" - }, - new() + Options = new List { - Color = Color.Yellow, - Name = "💪Protein" + new() + { + Color = Color.Green, + Name = "🥦Vegetable" + }, + new() + { + Color = Color.Red, + Name = "🍎Fruit" + }, + new() + { + Color = Color.Yellow, + Name = "💪Protein" + } } } } - } - }, - { "Last ordered", new DatePropertySchema { Date = new Dictionary() } } + }, + { "Last ordered", new DatePropertySchema { Date = new Dictionary() } } + } }; var database = await _client.CreateAsync(createDatabaseParameters); @@ -284,52 +283,53 @@ public async Task UpdateDatabaseAsync() .WithBody(jsonData) ); - var updateDatabaseParameters = new DatabasesUpdateParameters(); - - updateDatabaseParameters.Title = new List + var updateDatabaseParameters = new DatabasesUpdateParameters { - new RichTextTextInput - { - Text = new Text + Title = + new List { - Content = "Grocery List New", - Link = null - } - } - }; - - updateDatabaseParameters.Properties = new Dictionary - { - { "Name", new TitleUpdatePropertySchema { Title = new Dictionary() } }, - { "Price", new NumberUpdatePropertySchema { Number = new Number { Format = "yen" } } }, + new RichTextTextInput + { + Text = new Text + { + Content = "Grocery List New", + Link = null + } + } + }, + Properties = new Dictionary { - "Food group", - new SelectUpdatePropertySchema + { "Name", new TitleUpdatePropertySchema { Title = new Dictionary() } }, + { "Price", new NumberUpdatePropertySchema { Number = new Number { Format = "yen" } } }, { - Select = new OptionWrapper + "Food group", + new SelectUpdatePropertySchema { - Options = new List + Select = new OptionWrapper { - new() + Options = new List { - Color = Color.Green, - Name = "🥦Vegetables" - }, - new() - { - Color = Color.Red, - Name = "🍎Fruit" - }, - new() - { - Color = Color.Yellow, - Name = "💪Protein" + new() + { + Color = Color.Green, + Name = "🥦Vegetables" + }, + new() + { + Color = Color.Red, + Name = "🍎Fruit" + }, + new() + { + Color = Color.Yellow, + Name = "💪Protein" + } } } } - } - }, - { "Last ordered", new DateUpdatePropertySchema { Date = new Dictionary() } } + }, + { "Last ordered", new DateUpdatePropertySchema { Date = new Dictionary() } } + } }; var database = await _client.UpdateAsync(databaseId, updateDatabaseParameters); @@ -391,32 +391,31 @@ var jsonData .WithBody(jsonData) ); - var createDatabaseParameters = new DatabasesCreateParameters(); - - createDatabaseParameters.Parent = new ParentPageInput { PageId = pageId }; - - createDatabaseParameters.Title = new List + var createDatabaseParameters = new DatabasesCreateParameters { - new RichTextTextInput + Parent = new ParentPageInput { PageId = pageId }, + Title = new List { - Text = new Text + new RichTextTextInput { - Content = "Grocery List", - Link = null + Text = new Text + { + Content = "Grocery List", + Link = null + } } - } - }; - - createDatabaseParameters.Properties = new Dictionary - { + }, + Properties = new Dictionary { - "Cost of next trip", - new FormulaPropertySchema { - Formula = new Formula { Expression = "if(prop(\"In stock\"), 0, prop(\"Price\"))" } - } - }, - { "Price", new NumberPropertySchema { Number = new Number { Format = "dollar" } } } + "Cost of next trip", + new FormulaPropertySchema + { + Formula = new Formula { Expression = "if(prop(\"In stock\"), 0, prop(\"Price\"))" } + } + }, + { "Price", new NumberPropertySchema { Number = new Number { Format = "dollar" } } } + } }; var database = await _client.CreateAsync(createDatabaseParameters); diff --git a/Test/Notion.UnitTests/FilterTests.cs b/Test/Notion.UnitTests/FilterTests.cs index 6fab8aaa..39b90229 100644 --- a/Test/Notion.UnitTests/FilterTests.cs +++ b/Test/Notion.UnitTests/FilterTests.cs @@ -6,18 +6,6 @@ namespace Notion.UnitTests; -public class SerializerSettingsSource : RestClient -{ - public SerializerSettingsSource(ClientOptions options) : base(options) - { - } - - public JsonSerializerSettings GetSerializerSettings() - { - return defaultSerializerSettings; - } -} - public class FilterTests { private readonly SerializerSettingsSource _settingsSource = new(new ClientOptions()); @@ -146,4 +134,16 @@ public void RichTextFilterTest() SerializeFilter(filter) ); } + + private class SerializerSettingsSource : RestClient + { + public SerializerSettingsSource(ClientOptions options) : base(options) + { + } + + public JsonSerializerSettings GetSerializerSettings() + { + return DefaultSerializerSettings; + } + } } diff --git a/Test/Notion.UnitTests/PropertyTests.cs b/Test/Notion.UnitTests/PropertyTests.cs index c8196f15..07949131 100644 --- a/Test/Notion.UnitTests/PropertyTests.cs +++ b/Test/Notion.UnitTests/PropertyTests.cs @@ -30,7 +30,7 @@ public void TestPropertyType(Type type, PropertyType expectedPropertyType) { var typeInstance = (Property)Activator.CreateInstance(type); - var actualPropertyType = typeInstance.Type; + var actualPropertyType = typeInstance!.Type; Assert.Equal(expectedPropertyType, actualPropertyType); } @@ -58,7 +58,7 @@ public void TestPropertyTypeText(Type type, string expectedPropertyType) { var typeInstance = (Property)Activator.CreateInstance(type); - var actualPropertyType = typeInstance.Type.GetEnumMemberValue(); + var actualPropertyType = typeInstance!.Type.GetEnumMemberValue(); Assert.Equal(expectedPropertyType, actualPropertyType); } From 00cbcbcbb1fae55f6ff3e11139d30377452db06d Mon Sep 17 00:00:00 2001 From: Vedant Koditkar Date: Sat, 8 Oct 2022 18:38:21 +0530 Subject: [PATCH 9/9] =?UTF-8?q?Modernize=20check.sh=20script=20=E2=99=BB?= =?UTF-8?q?=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/check.sh b/.github/scripts/check.sh index d6132c92..3006888a 100644 --- a/.github/scripts/check.sh +++ b/.github/scripts/check.sh @@ -2,7 +2,7 @@ dotnet jb inspectcode Notion.sln -f="Text" --no-build --include="**.cs" -o=".lint/CodeWarningResults.txt" -totalLines=`cat .lint/CodeWarningResults.txt | grep "^.*$" -c` +totalLines=$(file .lint/CodeWarningResults.txt | nl | wc -l) if [[ "$totalLines" -gt 1 ]]; then echo "There are few linter warnings - please fix them before running the pipeline"