-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Admin API and Consumer API SDKs (#633)
* refactor: specify api version in each route * feat: factory methods for consumer api Client * refactor: improve code quality * refactor: improve code quality * feat: add factory methods for Admin API SDK * refactor: introduce ConsumerApiEndpoint * refactor: use apiVersion on each endpoint instead of in http client * refactor: get rid of Configuration * chore: make method public * chore: fix namespace * chore: remove redundant parantheses --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f470de8
commit 60777fa
Showing
38 changed files
with
476 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Backbone.BuildingBlocks.SDK.Endpoints.Common; | ||
|
||
namespace Backbone.AdminApi.Sdk.Endpoints; | ||
|
||
public abstract class AdminApiEndpoint : Endpoint | ||
{ | ||
protected const string API_VERSION = "v1"; | ||
|
||
protected AdminApiEndpoint(EndpointClient client) : base(client) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
BuildingBlocks/src/BuildingBlocks.SDK/Crypto/CryptoExchangeAlgorithm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// ReSharper disable InconsistentNaming | ||
|
||
#pragma warning disable IDE1006 | ||
|
||
namespace Backbone.BuildingBlocks.SDK.Crypto; | ||
|
||
public enum CryptoExchangeAlgorithm | ||
{ | ||
ECDH_P256 = 1, | ||
ECDH_P521 = 2, | ||
ECDH_X25519 = 3 | ||
} |
11 changes: 11 additions & 0 deletions
11
BuildingBlocks/src/BuildingBlocks.SDK/Crypto/CryptoHashAlgorithm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// ReSharper disable InconsistentNaming | ||
// ReSharper disable UnusedMember.Global | ||
|
||
namespace Backbone.BuildingBlocks.SDK.Crypto; | ||
|
||
public enum CryptoHashAlgorithm | ||
{ | ||
SHA256 = 1, | ||
SHA512 = 2, | ||
BLAKE2B = 3 | ||
} |
11 changes: 11 additions & 0 deletions
11
BuildingBlocks/src/BuildingBlocks.SDK/Crypto/CryptoSignaturePublicKey.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// ReSharper disable InconsistentNaming | ||
|
||
#pragma warning disable IDE1006 | ||
|
||
namespace Backbone.BuildingBlocks.SDK.Crypto; | ||
|
||
public class CryptoSignaturePublicKey | ||
{ | ||
public required CryptoExchangeAlgorithm alg; | ||
public required string pub; | ||
} |
11 changes: 11 additions & 0 deletions
11
BuildingBlocks/src/BuildingBlocks.SDK/Crypto/CryptoSignatureSignedChallenge.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// ReSharper disable InconsistentNaming | ||
|
||
#pragma warning disable IDE1006 | ||
|
||
namespace Backbone.BuildingBlocks.SDK.Crypto; | ||
|
||
public class CryptoSignatureSignedChallenge | ||
{ | ||
public required CryptoHashAlgorithm alg; | ||
public required byte[] sig; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Backbone.BuildingBlocks.SDK.Endpoints.Common; | ||
|
||
namespace Backbone.ConsumerApi.Sdk.Authentication; | ||
|
||
public class AnonymousAuthenticator : IAuthenticator | ||
{ | ||
public Task Authenticate(HttpRequestMessage request) | ||
{ | ||
throw new Exception("In order to use an authenticated request, you have to provide an user credentials."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Backbone.ConsumerApi.Sdk.Authentication; | ||
|
||
public class ClientCredentials | ||
{ | ||
public ClientCredentials(string clientId, string clientSecret) | ||
{ | ||
ClientId = clientId; | ||
ClientSecret = clientSecret; | ||
} | ||
|
||
public string ClientId { get; } | ||
public string ClientSecret { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Backbone.ConsumerApi.Sdk.Authentication; | ||
|
||
public class UserCredentials | ||
{ | ||
public UserCredentials(string username, string password) | ||
{ | ||
Username = username; | ||
Password = password; | ||
} | ||
|
||
public string Username { get; } | ||
public string Password { get; } | ||
} |
Oops, something went wrong.