Skip to content

Commit

Permalink
Merge pull request #1 from enclave-networks/develop
Browse files Browse the repository at this point in the history
First steps into creating a user consumable NuGet package for the enclave API
  • Loading branch information
enclave-tom authored Nov 26, 2021
2 parents 7c554f3 + ce7a4f7 commit a1d51f3
Show file tree
Hide file tree
Showing 65 changed files with 2,513 additions and 0 deletions.
166 changes: 166 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs

# All files
[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

; Force VS to recommend underscore at the start of created private fields.
[*.cs]
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.severity = suggestion

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _

# name all constant fields using UpperCase
dotnet_naming_rule.constant_fields_should_be_upper_case.severity = warning
dotnet_naming_rule.constant_fields_should_be_upper_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_upper_case.style = upper_case_style

dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_style.upper_case_style.capitalization = pascal_case

; Avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# IDE0024: Use block body for operators
csharp_style_expression_bodied_operators = when_on_single_line

# CA1031: Do not catch general exception types
dotnet_diagnostic.CA1031.severity = none

# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = silent

# CA1003: Use generic event handler instances
dotnet_diagnostic.CA1003.severity = suggestion

# CA1056: URI-like properties should not be strings
dotnet_diagnostic.CA1056.severity = suggestion

# CA1819: Properties should not return arrays
dotnet_diagnostic.CA1819.severity = suggestion

# CA1724: Type names should not match namespaces
dotnet_diagnostic.CA1724.severity = suggestion

# CA1030: Use events where appropriate
dotnet_diagnostic.CA1030.severity = silent

# CA1002: Do not expose generic lists
dotnet_diagnostic.CA1002.severity = suggestion

# CA2227: Collection properties should be read only
dotnet_diagnostic.CA2227.severity = suggestion

# CA1014: Mark assemblies with CLSCompliant
dotnet_diagnostic.CA1014.severity = none

# CA1711: Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1711.severity = suggestion

# CA1028: Enum Storage should be Int32
dotnet_diagnostic.CA1028.severity = none

# CA1826: Don't apply to ordefault methods
dotnet_code_quality.CA1826.exclude_ordefault_methods = true

# CA1308: Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = none

# CA1032: Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = none

# C0162 exclude extension methods from needing null contract assertions
dotnet_code_quality.CA1062.exclude_extension_method_this_parameter = true

# CA2225: Operator overloads have named alternates
dotnet_diagnostic.CA2225.severity = none

# CA2229: Implement serialization constructors
dotnet_diagnostic.CA2229.severity = none

# CA1508: Avoid dead conditional code - Too many false positives for this to be useful.
dotnet_diagnostic.CA1508.severity = none

# SA1309: Field names should not begin with underscore
dotnet_diagnostic.SA1309.severity = none

# SA1101: Prefix local calls with this
dotnet_diagnostic.SA1101.severity = none

# SA1600: Elements should be documented
dotnet_diagnostic.SA1600.severity = none

# SA1623: Property summary documentation should match accessors
dotnet_diagnostic.SA1623.severity = none

# SA1200: Using directives should be placed correctly
dotnet_diagnostic.SA1200.severity = none

# SA1633: File should have header
dotnet_diagnostic.SA1633.severity = none

# SA1116: Split parameters should start on line after declaration
dotnet_diagnostic.SA1116.severity = none

# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none

# SA1204: Static elements should appear before instance elements
dotnet_diagnostic.SA1204.severity = none

# CA1721: Property names should not match get methods
dotnet_diagnostic.CA1721.severity = suggestion

# CA1720: Identifier contains type name
dotnet_diagnostic.CA1720.severity = none

# SA1602: Enumeration items should be documented
dotnet_diagnostic.SA1602.severity = suggestion

# SA1642: Constructor summary documentation should begin with standard text
dotnet_diagnostic.SA1642.severity = none

# SA1611: Element parameters should be documented
dotnet_diagnostic.SA1611.severity = none

# SA1615: Element return value should be documented
dotnet_diagnostic.SA1615.severity = none

# SA1201: Elements should appear in the correct order
dotnet_diagnostic.SA1201.severity = none

# CA1054: URI-like parameters should not be strings
dotnet_diagnostic.CA1054.severity = none

# SA1515: Single-line comment should be preceded by blank line
dotnet_diagnostic.SA1515.severity = none

# CA1716: Identifiers should not match keywords
dotnet_diagnostic.CA1716.severity = none

# CA1812: Internal types should be instantiated (suppressing because analyser doesn't understand serialisers)
dotnet_diagnostic.CA1812.severity = suggestion

# CA1055: URI-like return values should not be strings
dotnet_diagnostic.CA1055.severity = none

# CA1062: Exclude our guard methods from null-check warnings.
dotnet_code_quality.CA1062.null_check_validation_methods = NotNull

dotnet_diagnostic.SA0001.severity=silent

# CA2234: Pass system uri objects instead of strings
dotnet_diagnostic.CA2234.severity = silent
csharp_style_namespace_declarations=file_scoped:warning
56 changes: 56 additions & 0 deletions .github/workflows/sdk-api-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: SDK API Build

on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop ]

jobs:
build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]

- name: Setup .NET 6 (SDK)
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
source-url: https://nuget.pkg.github.com/enclave-networks/index.json
env:
NUGET_AUTH_TOKEN: ${{github.token}}

- name: Build
run: dotnet build Enclave.Sdk.Api.sln -c Release /p:Version=${{ steps.gitversion.outputs.SemVer }}

- name: Unit Tests
working-directory: tests/Enclave.Sdk.Api.Tests
run: dotnet test -c Release

- name: Push Github Source Packages
if: github.event_name == 'push'
run: dotnet nuget push src/**/*${{ steps.gitversion.outputs.SemVer }}.nupkg --api-key ${{github.token}} -s https://nuget.pkg.github.com/enclave-networks/index.json --skip-duplicate --no-symbols true

- name: Create Release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.gitversion.outputs.SemVer }}
release_name: Release v${{ steps.gitversion.outputs.SemVer }}
body: Latest SDK API Release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
tests/Enclave.Sdk.Api.Tests/IntegrationTests.cs
49 changes: 49 additions & 0 deletions Enclave.Sdk.Api.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Enclave.Sdk.Api", "src\Enclave.Sdk\Enclave.Sdk.Api.csproj", "{AE9A2DA2-DBA1-4A0F-AE39-26E777C2CDF4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Enclave.Sdk.Api.Tests", "tests\Enclave.Sdk.Api.Tests\Enclave.Sdk.Api.Tests.csproj", "{AC896965-74E9-405F-BA4E-E9D7336B906B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA499537-7F6B-4E85-934A-04368AF78E9E}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{822BFA5E-EC93-45BF-B36E-1CAD1E7D88B1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BD898880-875C-43EA-B22C-A7C801CFA607}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
GitVersion.yml = GitVersion.yml
.github\workflows\sdk-api-build.yml = .github\workflows\sdk-api-build.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AE9A2DA2-DBA1-4A0F-AE39-26E777C2CDF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE9A2DA2-DBA1-4A0F-AE39-26E777C2CDF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE9A2DA2-DBA1-4A0F-AE39-26E777C2CDF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE9A2DA2-DBA1-4A0F-AE39-26E777C2CDF4}.Release|Any CPU.Build.0 = Release|Any CPU
{AC896965-74E9-405F-BA4E-E9D7336B906B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC896965-74E9-405F-BA4E-E9D7336B906B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC896965-74E9-405F-BA4E-E9D7336B906B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC896965-74E9-405F-BA4E-E9D7336B906B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AE9A2DA2-DBA1-4A0F-AE39-26E777C2CDF4} = {CA499537-7F6B-4E85-934A-04368AF78E9E}
{AC896965-74E9-405F-BA4E-E9D7336B906B} = {822BFA5E-EC93-45BF-B36E-1CAD1E7D88B1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {33E7CCF5-8133-4138-BDDC-6B2785C7DDC6}
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
assembly-versioning-scheme: None
mode: ContinuousDelivery
next-version: 0.0.1
branches:
main:
mode: ContinuousDelivery
develop:
increment: Patch
ignore:
sha: []
merge-message-formats: {}
17 changes: 17 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<LangVersion>9.0</LangVersion>
<RepositoryUrl>https://github.com/enclave-networks/Enclave.Sdk.Api</RepositoryUrl>
<Nullable>enable</Nullable>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Linq.Async" Version="5.0.0" />

<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.354">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions src/Enclave.Sdk/Clients/AuthorityClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Enclave.Sdk.Api.Clients.Interfaces;

namespace Enclave.Sdk.Api.Clients;

public class AuthorityClient : ClientBase, IAuthorityClient
{
private string _orgRoute;

public AuthorityClient(HttpClient httpClient, string orgRoute)
: base(httpClient)
{
_orgRoute = orgRoute;
}
}
Loading

0 comments on commit a1d51f3

Please sign in to comment.