From 8b5776085b1e09bad66b5d0b93b19f4ace0635ee Mon Sep 17 00:00:00 2001 From: Jason Barden Date: Mon, 28 Apr 2025 10:53:46 +0100 Subject: [PATCH] Initial Commit --- .editorconfig | 2 +- .github/workflows/dotnet.yml | 81 ++++++++++++----- .gitignore | 52 +---------- .../.idea/.gitignore | 13 +++ .../.idea/.name | 1 + .../.idea/indexLayout.xml | 8 ++ .../.idea/vcs.xml | 6 ++ AStar.Dev.Api.Client.Sdk.Shared.sln | 52 +++++++++++ AStar.Dev.Example.sln.sln | 57 ------------ AStar.png | Bin 0 -> 12513 bytes CodeMaid.config | 82 ------------------ nuget.ci.config | 5 -- nuget.config | 6 -- .../AStar.Dev.Api.Client.Sdk.Shared.csproj | 59 +++++++++++++ .../AStar.Dev.Api.Client.Sdk.Shared.xml | 37 ++++++++ .../AddApiHttpClient.cs | 53 +++++++++++ .../IApiConfiguration.cs | 17 ++++ .../AStar.Dev.Example.ClassLib.csproj | 9 -- src/AStar.Dev.Example.ClassLib/Class1.cs | 6 -- ...ev.Api.Client.Sdk.Shared.Tests.Unit.csproj | 30 +++++++ .../AddApiHttpClientShould.cs | 21 +++++ .../MockApiClient.cs | 5 ++ .../MockApiConfiguration.cs | 10 +++ ...tar.Dev.Example.ClassLib.Tests.Unit.csproj | 25 ------ .../UnitTest1.cs | 10 --- 25 files changed, 372 insertions(+), 275 deletions(-) create mode 100644 .idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.gitignore create mode 100644 .idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.name create mode 100644 .idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/indexLayout.xml create mode 100644 .idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/vcs.xml create mode 100644 AStar.Dev.Api.Client.Sdk.Shared.sln delete mode 100644 AStar.Dev.Example.sln.sln create mode 100644 AStar.png delete mode 100644 CodeMaid.config delete mode 100644 nuget.ci.config delete mode 100644 nuget.config create mode 100644 src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.csproj create mode 100644 src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.xml create mode 100644 src/AStar.Dev.Api.Client.Sdk.Shared/AddApiHttpClient.cs create mode 100644 src/AStar.Dev.Api.Client.Sdk.Shared/IApiConfiguration.cs delete mode 100644 src/AStar.Dev.Example.ClassLib/AStar.Dev.Example.ClassLib.csproj delete mode 100644 src/AStar.Dev.Example.ClassLib/Class1.cs create mode 100644 test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj create mode 100644 test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AddApiHttpClientShould.cs create mode 100644 test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiClient.cs create mode 100644 test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiConfiguration.cs delete mode 100644 test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/AStar.Dev.Example.ClassLib.Tests.Unit.csproj delete mode 100644 test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/UnitTest1.cs diff --git a/.editorconfig b/.editorconfig index 326085a..2f25389 100644 --- a/.editorconfig +++ b/.editorconfig @@ -273,4 +273,4 @@ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent dotnet_style_qualification_for_field = false:silent dotnet_style_qualification_for_property = false:error dotnet_style_qualification_for_method = false:error -dotnet_style_qualification_for_event = false:error \ No newline at end of file +dotnet_style_qualification_for_event = false:error diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 0473985..8c7acc5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,9 +1,7 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - name: .NET on: + workflow_dispatch: push: branches: [ "main" ] pull_request: @@ -11,25 +9,62 @@ on: jobs: build: + name: Build and analyze + runs-on: windows-latest + env: + ProjectName: 'AStar.Dev.Api.Client.Sdk.Shared' + RepositoryName: 'astar-dev-api-client-sdk-shared' + steps: + - name: Set up JDK + uses: actions/setup-java@v4.4.0 + with: + java-version: 17 + distribution: 'zulu' - runs-on: ubuntu-latest + - name: Checkout + uses: actions/checkout@v4.2.1 + with: + fetch-depth: 0 + + - name: Cache SonarCloud packages + uses: actions/cache@v4.2.3 + with: + path: ~\sonar\cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Cache SonarCloud scanner + id: cache-sonar-scanner + uses: actions/cache@v4.2.3 + with: + path: .\.sonar\scanner + key: ${{ runner.os }}-sonar-scanner + restore-keys: ${{ runner.os }}-sonar-scanner + + - name: Install SonarCloud scanner + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + shell: powershell + run: | + New-Item -Path .\.sonar\scanner -ItemType Directory + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner + + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: powershell + run: | + dotnet tool install --global dotnet-coverage + .\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_${{ env.RepositoryName }}" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml + dotnet build --configuration Release + dotnet-coverage collect 'dotnet test --filter "FullyQualifiedName!~Acceptance.Tests"' -f xml -o 'coverage.xml' + .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + + - name: Pack NuGet package + if: github.ref == 'refs/heads/main' + run: dotnet pack .\src\${{ env.ProjectName }}\${{ env.ProjectName }}.csproj + + - name: Push to NuGet + if: github.ref == 'refs/heads/main' + run: dotnet nuget push "**\${{ env.ProjectName }}.*.nupkg" --api-key ${{secrets.nuget_api_key}} --skip-duplicate --source https://api.nuget.org/v3/index.json - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 9.0.x - - - name: Delete nuget*.config files - run: rm -f nuget*.config - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore - - - name: Test - run: dotnet test --no-build --verbosity normal diff --git a/.gitignore b/.gitignore index a4fe18b..dfcfd56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.rsuser @@ -23,7 +23,6 @@ mono_crash.* [Rr]eleases/ x64/ x86/ -[Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ @@ -62,9 +61,6 @@ project.lock.json project.fragment.lock.json artifacts/ -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - # StyleCop StyleCopReport.xml @@ -82,8 +78,6 @@ StyleCopReport.xml *.pgc *.pgd *.rsp -# but not Directory.Build.rsp, as it configures directory-level build defaults -!Directory.Build.rsp *.sbr *.tlb *.tli @@ -92,7 +86,6 @@ StyleCopReport.xml *.tmp_proj *_wpftmp.csproj *.log -*.tlog *.vspscc *.vssscc .builds @@ -144,11 +137,6 @@ _TeamCity* .axoCover/* !.axoCover/settings.json -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - # Visual Studio code coverage results *.coverage *.coveragexml @@ -296,17 +284,6 @@ node_modules/ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) *.vbw -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - # Visual Studio LightSwitch build output **/*.HTMLClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts @@ -363,9 +340,6 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ -# Visual Studio History (VSHistory) files -.vshistory/ - # BeatPulse healthcheck temp database healthchecksdb @@ -374,27 +348,3 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.gitignore b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.gitignore new file mode 100644 index 0000000..7a03d60 --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/.idea.AStar.Dev.Api.Client.Sdk.Shared.iml +/contentModel.xml +/projectSettingsUpdater.xml +/modules.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.name b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.name new file mode 100644 index 0000000..90ddc1c --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/.name @@ -0,0 +1 @@ +AStar.Dev.Api.Client.Sdk.Shared \ No newline at end of file diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/indexLayout.xml b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/vcs.xml b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.AStar.Dev.Api.Client.Sdk.Shared/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AStar.Dev.Api.Client.Sdk.Shared.sln b/AStar.Dev.Api.Client.Sdk.Shared.sln new file mode 100644 index 0000000..d153135 --- /dev/null +++ b/AStar.Dev.Api.Client.Sdk.Shared.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{92CD35A9-E04F-435D-8049-9479A49A4E3A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C08B6FBA-54C5-4A0E-BF57-91B13304DC08}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Api.Client.Sdk.Shared", "src\AStar.Dev.Api.Client.Sdk.Shared\AStar.Dev.Api.Client.Sdk.Shared.csproj", "{F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit", "test\AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit\AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj", "{DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{67DA8F1D-3A94-402B-A849-6FFD9F32CA60}" + ProjectSection(SolutionItems) = preProject + .github\dependabot.yml = .github\dependabot.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{0BE9B040-6CE1-43DA-8B35-F35C4E90098E}" + ProjectSection(SolutionItems) = preProject + .github\workflows\dotnet.yml = .github\workflows\dotnet.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8B31BBC4-D482-405D-8477-31E3F774D7C8}" + ProjectSection(SolutionItems) = preProject + AStar.png = AStar.png + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085} = {92CD35A9-E04F-435D-8049-9479A49A4E3A} + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF} = {C08B6FBA-54C5-4A0E-BF57-91B13304DC08} + {0BE9B040-6CE1-43DA-8B35-F35C4E90098E} = {67DA8F1D-3A94-402B-A849-6FFD9F32CA60} + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6CB8CAB-AE3F-48F7-9DA5-77830D77A085}.Release|Any CPU.Build.0 = Release|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAB06894-014F-44E9-B5D3-9BB08DC9F0EF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/AStar.Dev.Example.sln.sln b/AStar.Dev.Example.sln.sln deleted file mode 100644 index be68fef..0000000 --- a/AStar.Dev.Example.sln.sln +++ /dev/null @@ -1,57 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ADD5430F-CD80-42C7-80DA-90048E210EE7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{73794993-9898-4968-AF19-C3E7450C94E4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Example.ClassLib", "src\AStar.Dev.Example.ClassLib\AStar.Dev.Example.ClassLib.csproj", "{A9C19332-40FE-4E24-A890-405D46CD72A5}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "end-to-end", "end-to-end", "{F1C7FB9E-2F0F-41C9-822A-7320339193CA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "integration", "integration", "{D724595D-C6BC-4F31-9D2A-4F4707436F10}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "unit", "{10DD984D-6788-4E04-A89C-3270006F5C56}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AStar.Dev.Example.ClassLib.Tests.Unit", "test\unit\AStar.Dev.Example.ClassLib.Tests.Unit\AStar.Dev.Example.ClassLib.Tests.Unit.csproj", "{1D7D41F6-3866-4C00-A1BA-1675227FA9FA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E1CEEE40-22D0-4F7B-AB2B-A308F8DE6A54}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitignore = .gitignore - build-and-test.ps1 = build-and-test.ps1 - CodeMaid.config = CodeMaid.config - LICENSE = LICENSE - nuget.ci.config = nuget.ci.config - nuget.config = nuget.config - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A9C19332-40FE-4E24-A890-405D46CD72A5}.Release|Any CPU.Build.0 = Release|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {A9C19332-40FE-4E24-A890-405D46CD72A5} = {ADD5430F-CD80-42C7-80DA-90048E210EE7} - {F1C7FB9E-2F0F-41C9-822A-7320339193CA} = {73794993-9898-4968-AF19-C3E7450C94E4} - {D724595D-C6BC-4F31-9D2A-4F4707436F10} = {73794993-9898-4968-AF19-C3E7450C94E4} - {10DD984D-6788-4E04-A89C-3270006F5C56} = {73794993-9898-4968-AF19-C3E7450C94E4} - {1D7D41F6-3866-4C00-A1BA-1675227FA9FA} = {10DD984D-6788-4E04-A89C-3270006F5C56} - EndGlobalSection -EndGlobal diff --git a/AStar.png b/AStar.png new file mode 100644 index 0000000000000000000000000000000000000000..8cac0a1d8136c82d5b582bdea30f24bf2e085e0f GIT binary patch literal 12513 zcmeHuXIxX+({KP0RuI@_V~A3WtYrbI8+uVAs7o`304lw@K?P;$9Rvh|il`tU2q+|% z5|9nO1P}x%u_W}~qJe;b)R5%8+5i9lKF^1DpHJ_{=Rm zs&*8-2l%I|EyaRA^zWxm05Q~z6B7MHx0H)7^V|l0cO4@A7(tn!#WUd>41p8BprV@y zJv3lfFFL79%0-QNj0{9dxE#~mH?BB^0Mb9N z|LsMCO`U_ldK!Y#PmAyFIFLyMXDCv&__xl|0axFf)3s)(b`224r=VP#>91-w)cYpR zEJ3^tC=3mI-FVqZksD4HQ@;WiyjiAtDdhPzsEHj*2oFwny+rJa(<|E!DwYjVe1f11 zFk_#_5X5mG$4}=5JhI z%?VYAR(vnz;vO*Fo$|4IMsLFyasjkYC$lXbR(Pw!pBVvpa0(TjO7lFaX4>!*wPZ_B z_p!Ku_7&KRMk&_shNKCxsf*wiUUd9(?c86=tBs**(Td=DvzU+5Gx8l%7z1np*|Q0d zK^s_3qbTc|Va+qhO zF=9ptNPs#k17em=;r~T&G2nT(IW_++n-(S{dock*RMiZb)_W417wQ`=)Gc+CZhAt^ zF!84q%*sK(qj14eqPc}rpv38kk_m+=h~_?f3@o$pi|n;VyCxHg0C=v7RMkU1>irc= z3XO^u0=G1$zH#n2!+wSXC_uuVAt-tQce=&;E8nuQCXh`~VSnb#V_1%R(pE_%Wa(-G zgbJ9OJKcV8dZKDqsNw=#(6B^RC8ScXI+)6oq{w@Uek-l7nCn;=nlUOdfrNpZLaZ;H zd+nt%6H(#}2?Gx-v7Rs&|IhFlrz>lkTH316tTIUfZ~LJS@wDlP~7*e&)y zz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S zO|)6OYgx9UaX+Zcxb2>YXc#8`H?iePdRRGu+p0m^b-*m{@w>L7_;tAn8$@4hn94?^ zGT^MfpX@Y9t2cQT+`@!efO$I%d%kK&-n?ltnF+&RDjNmu_we`xX;)Y}4Y6bj{h;y} z-B=--}BK7VCXE6C)oE839 z-73m5rl~zSG$=Fu+LjNFw}fd#H5u@c80>G>*qHH*P%a-^c#Y?SQ(&1J@y<6H;2rpA z^{U!slu?*zla|U^Rw9y2+C=0!u81pUAeL;Py(*;*wp2&-ikSHowwoo3^mlh)TNl6B z+OcK>9dINv$_PR6$4esK6m5={)7GtM4Q==N=y=T(CJ5Wo!USg<9q3{I85LtzGxe02 z9Db}eKrPiGYL8yo?{Jk>h$Ji2{75AP#r@bL6m0EkSKNHqMeoO-bHdY;t*}dG7^5@Ok|AV*m@fVMXyHw}4`s?%!yb_`ysGHI$_E z=<3Bpg0>y40Ww;`sV>@NNqzKc5(8UME67R@Ko5T#7`cvK5nQrjH6Y1RI#|{VLQu?) z@1?43<26#goB+z88xj;Q&Da6M4w3$7+r;lq1zGV|&yZe^Tt!nwHc6YaStEmkKe1@* zuJ<(WmD!*TvBKYfXEIPm3c95u**>^D=S!Tuq)=_JF}32U(*3K3q*sxVrbaN`+>v4* zT#NIiy>KI#*$LFp@6fj@IjnHnw|Yq>(Q*Xiyoq|E5aY*51hh^4Ak0d7{S|I zuzT8AmcY8*h6{!+j|T%8duX!{F)(_bxa)VCF7fY?5~6nWJfMFEN#D;Oxd?4iCgzC* zo6%FjXQE<{)P7>D9n)LD7Rx!cQRU|WZ##t)-Zm1v?bOt z1bphg5qFgmmK@RvNC2Cm_hXi#BQV~X(f`|){{N*Lf3C)HmnV>LrQGE!H}x;@-x45~ MOs&qBpL2=*KT7L~lmGw# literal 0 HcmV?d00001 diff --git a/CodeMaid.config b/CodeMaid.config deleted file mode 100644 index 54f2ebe..0000000 --- a/CodeMaid.config +++ /dev/null @@ -1,82 +0,0 @@ - - - - -
- - - - - - <?xml version="1.0" encoding="utf-16"?> - <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <string>ReSharper disable </string> - <string>ReSharper enable </string> - </ArrayOfString> - - - - True - - - 1 - - - False - - - True - - - True - - - 1 - - - 2 - - - True - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - True - - - 1 - - - - \ No newline at end of file diff --git a/nuget.ci.config b/nuget.ci.config deleted file mode 100644 index aa5beec..0000000 --- a/nuget.ci.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/nuget.config b/nuget.config deleted file mode 100644 index 782724b..0000000 --- a/nuget.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.csproj b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.csproj new file mode 100644 index 0000000..eaf3901 --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.csproj @@ -0,0 +1,59 @@ + + + + latest-recommended + AStar Developement, Jason Barden + AStar Development + AStar Developement, 2025 + + This package contains classes that are shared across the various Client SDKs. + + It is not intended to be consumed on its own. + + $(AssemblyName).xml + True + True + true + enable + True + true + enable + AStar.png + LICENSE + https://github.com/astar-development/astar-dev-api-client-sdk-shared/ + Readme.md + Initial version. + True + git + https://github.com/astar-development/astar-dev-api-client-sdk-shared/ + snupkg + net9.0 + AStar.Dev.Api.Client.Sdk.Shared + 5b2a14cf-7e6b-4012-babe-f57facd457d2 + 0.1.0 + + + + + + + + + + + + + + + + + True + 1701;1702; + + + + True + 1701;1702; + + + diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.xml b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.xml new file mode 100644 index 0000000..a355700 --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/AStar.Dev.Api.Client.Sdk.Shared.xml @@ -0,0 +1,37 @@ + + + + AStar.Dev.Api.Client.Sdk.Shared + + + + + + + + + + + + + + + + + Defines the + + interface + + + + + Gets or sets the Base URL for the API + + + + + Gets or sets the Scopes for the API + + + + diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/AddApiHttpClient.cs b/src/AStar.Dev.Api.Client.Sdk.Shared/AddApiHttpClient.cs new file mode 100644 index 0000000..3a0e977 --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/AddApiHttpClient.cs @@ -0,0 +1,53 @@ +using System.Net; +using System.Net.Mime; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Http.Resilience; +using Microsoft.Extensions.Options; +using Microsoft.Identity.Web; +using Polly; + +#pragma warning disable CA1716 +namespace AStar.Dev.Api.Client.Sdk.Shared; +#pragma warning restore CA1716 + +/// +/// +public static class AddApiHttpClient +{ + /// + /// + /// + /// + /// + /// + public static void AddApiClient(this IServiceCollection services, string[] scopes) + where TApiClient : class + where TApiConfiguration : class, IApiConfiguration + { + var optionsScopes = string.Join(" ", scopes); + + _ = services.AddHttpClient() + .AddMicrosoftIdentityUserAuthenticationHandler( + nameof(TApiClient), + options => options.Scopes = optionsScopes) + .ConfigureHttpClient((serviceProvider, client) => + { + client.BaseAddress = serviceProvider.GetRequiredService>().Value + .BaseUrl; + + client.DefaultRequestHeaders.Accept.Add(new(MediaTypeNames.Application.Json)); + }) + .AddResilienceHandler($"{nameof(TApiClient)}Handler", + b => b.AddFallback(new() + { + FallbackAction = _ => Outcome.FromResultAsValueTask( + new + HttpResponseMessage(HttpStatusCode + .ServiceUnavailable)) + }) + .AddConcurrencyLimiter(100) + .AddRetry(new HttpRetryStrategyOptions()) + .AddCircuitBreaker(new HttpCircuitBreakerStrategyOptions()) + .AddTimeout(new HttpTimeoutStrategyOptions())); + } +} \ No newline at end of file diff --git a/src/AStar.Dev.Api.Client.Sdk.Shared/IApiConfiguration.cs b/src/AStar.Dev.Api.Client.Sdk.Shared/IApiConfiguration.cs new file mode 100644 index 0000000..1f219ed --- /dev/null +++ b/src/AStar.Dev.Api.Client.Sdk.Shared/IApiConfiguration.cs @@ -0,0 +1,17 @@ +namespace AStar.Dev.Api.Client.Sdk.Shared; + +/// +/// Defines the interface +/// +public interface IApiConfiguration +{ + /// + /// Gets or sets the Base URL for the API + /// + Uri BaseUrl { get; set; } + + /// + /// Gets or sets the Scopes for the API + /// + string[] Scopes { get; set; } +} \ No newline at end of file diff --git a/src/AStar.Dev.Example.ClassLib/AStar.Dev.Example.ClassLib.csproj b/src/AStar.Dev.Example.ClassLib/AStar.Dev.Example.ClassLib.csproj deleted file mode 100644 index 125f4c9..0000000 --- a/src/AStar.Dev.Example.ClassLib/AStar.Dev.Example.ClassLib.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - net9.0 - enable - enable - - - diff --git a/src/AStar.Dev.Example.ClassLib/Class1.cs b/src/AStar.Dev.Example.ClassLib/Class1.cs deleted file mode 100644 index 27e9361..0000000 --- a/src/AStar.Dev.Example.ClassLib/Class1.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace AStar.Dev.Example.ClassLib; - -public class Class1 -{ - -} diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj new file mode 100644 index 0000000..ea66800 --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit.csproj @@ -0,0 +1,30 @@ + + + + net9.0 + enable + enable + false + True + latest-recommended + + + + + + + + + + + + + + + + + + + + + diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AddApiHttpClientShould.cs b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AddApiHttpClientShould.cs new file mode 100644 index 0000000..bbc53da --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/AddApiHttpClientShould.cs @@ -0,0 +1,21 @@ +using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; + +#pragma warning disable CA1716 +namespace AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit; +#pragma warning restore CA1716 + +[TestSubject(typeof(AddApiHttpClient))] +public class AddApiHttpClientShould +{ + [Fact] + public void IncludeTheAddApiHttpClientMethod() + { + var sut = new ServiceCollection(); + var initialServiceCount = sut.Count; + + sut.AddApiClient(["Scope Does Not Matter Here"]); + + sut.Count.ShouldBe(initialServiceCount + 44); + } +} \ No newline at end of file diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiClient.cs b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiClient.cs new file mode 100644 index 0000000..efbb9f4 --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiClient.cs @@ -0,0 +1,5 @@ +namespace AStar.Dev.Api.Client.Sdk.Shared.Tests; + +internal sealed class MockApiClient +{ +} \ No newline at end of file diff --git a/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiConfiguration.cs b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiConfiguration.cs new file mode 100644 index 0000000..493b44f --- /dev/null +++ b/test/AStar.Dev.Api.Client.Sdk.Shared.Tests.Unit/MockApiConfiguration.cs @@ -0,0 +1,10 @@ +namespace AStar.Dev.Api.Client.Sdk.Shared.Tests; + +internal sealed class MockApiConfiguration : IApiConfiguration +{ + /// + public Uri BaseUrl { get; set; } = new ("https://not.set.com"); + + /// + public string[] Scopes { get; set; } = []; +} \ No newline at end of file diff --git a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/AStar.Dev.Example.ClassLib.Tests.Unit.csproj b/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/AStar.Dev.Example.ClassLib.Tests.Unit.csproj deleted file mode 100644 index 6fbda4a..0000000 --- a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/AStar.Dev.Example.ClassLib.Tests.Unit.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net9.0 - enable - enable - false - - - - - - - - - - - - - - - - - - diff --git a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/UnitTest1.cs b/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/UnitTest1.cs deleted file mode 100644 index 3928e91..0000000 --- a/test/unit/AStar.Dev.Example.ClassLib.Tests.Unit/UnitTest1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace AStar.Dev.Example.ClassLib.Tests.Unit; - -public class UnitTest1 -{ - [Fact] - public void Test1() - { - - } -}