|
7 | 7 |
|
8 | 8 | namespace Acme.App.MastercardApi.Client.Client
|
9 | 9 | {
|
10 |
| - partial class ApiClient |
11 |
| - { |
12 |
| - private readonly Uri _basePath; |
13 |
| - private readonly RestSharpSigner _signer; |
14 |
| - private readonly RestSharpFieldLevelEncryptionInterceptor _encryptionInterceptor; |
15 |
| - |
| 10 | + partial class ApiClient |
| 11 | + { |
| 12 | + private readonly Uri _basePath; |
| 13 | + private readonly RestSharpSigner _signer; |
| 14 | + private readonly RestSharpEncryptionInterceptor _encryptionInterceptor; |
| 15 | + |
16 | 16 | /// <summary>
|
17 |
| - /// |
| 17 | + /// Construct an ApiClient which will automatically: |
| 18 | + /// - Sign requests |
| 19 | + /// - Encrypt/decrypt requests and responses |
18 | 20 | /// </summary>
|
19 |
| - /// <param name="signingKey"></param> |
20 |
| - /// <param name="basePath"></param> |
21 |
| - /// <param name="consumerKey"></param> |
22 |
| - /// <param name="config"></param> |
23 |
| - public ApiClient(RSA signingKey, string basePath, string consumerKey, FieldLevelEncryptionConfig config) |
24 |
| - { |
25 |
| - _baseUrl = basePath; |
26 |
| - _basePath = new Uri(basePath); |
27 |
| - _signer = new RestSharpSigner(consumerKey, signingKey); |
28 |
| - _encryptionInterceptor = new RestSharpFieldLevelEncryptionInterceptor(config); |
29 |
| - } |
30 |
| - |
31 |
| - partial void InterceptRequest(IRestRequest request) |
32 |
| - { |
33 |
| - _encryptionInterceptor.InterceptRequest(request); |
34 |
| - _signer.Sign(this._basePath, request); |
35 |
| - } |
| 21 | + public ApiClient(RSA signingKey, string basePath, string consumerKey, EncryptionConfig config) |
| 22 | + { |
| 23 | + _baseUrl = basePath; |
| 24 | + _basePath = new Uri(basePath); |
| 25 | + _signer = new RestSharpSigner(consumerKey, signingKey); |
| 26 | + _encryptionInterceptor = RestSharpEncryptionInterceptor.From(config); |
| 27 | + } |
| 28 | + |
| 29 | + partial void InterceptRequest(IRestRequest request) |
| 30 | + { |
| 31 | + _encryptionInterceptor.InterceptRequest(request); |
| 32 | + _signer.Sign(_basePath, request); |
| 33 | + } |
36 | 34 | }
|
37 | 35 | }
|
0 commit comments