diff --git a/clients/sellingpartner-api-aa-csharp/README.md b/clients/sellingpartner-api-aa-csharp/README.md index 7ae8977..ea3118b 100644 --- a/clients/sellingpartner-api-aa-csharp/README.md +++ b/clients/sellingpartner-api-aa-csharp/README.md @@ -61,7 +61,7 @@ AWSAuthenticationCredentials awsAuthenticationCredentials = new AWSAuthenticatio restRequest = new AWSSigV4Signer(awsAuthenticationCredentials) .Sign(restRequest, restClient.BaseUrl.Host); ``` -Note the IRestRequest reference is treated as **mutable** when signed. +Note the IRestRequest reference is treated as **mutable** when signed. **AWSSigV4 Authentication is now optional** ## RateLimitConfiguration @@ -77,6 +77,8 @@ RateLimitConfiguration rateLimitConfig = new RateLimitConfigurationOnRequests }; ``` +## Version +Selling Partner API Authentication/Authorization Library version 1.0 ## Resources This package features Mustache templates designed for use with [swagger codegen](https://swagger.io/tools/swagger-codegen/). diff --git a/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/ApiClient.mustache b/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/ApiClient.mustache index faad469..9a75056 100644 --- a/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/ApiClient.mustache +++ b/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/ApiClient.mustache @@ -49,7 +49,11 @@ namespace {{packageName}}.Client private void InterceptRequest(IRestRequest request) { lwaAuthorizationSigner.Sign(request); - awsSigV4Signer.Sign(request, RestClient.BaseUrl.Host); + + if(awsSigV4Signer != null && RestClient.BaseUrl.Host.Contains("business-api.amazon.com")) + { + awsSigV4Signer.Sign(request, RestClient.BaseUrl.Host); + } } /// @@ -74,7 +78,10 @@ namespace {{packageName}}.Client {{/netStandard}} lwaAuthorizationSigner = new LWAAuthorizationSigner(Configuration.AuthorizationCredentials); - awsSigV4Signer = new AWSSigV4Signer(Configuration.AuthenticationCredentials); + if(Configuration.AuthenticationCredentials != null) + { + awsSigV4Signer = new AWSSigV4Signer(Configuration.AuthenticationCredentials); + } rateLimitConfig = Configuration.RateLimitConfig; if(rateLimitConfig != null) { diff --git a/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/api.mustache b/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/api.mustache index 32b375e..2075637 100644 --- a/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/api.mustache +++ b/clients/sellingpartner-api-aa-csharp/src/Amazon.SellingPartnerAPIAA/resources/swagger-codegen/templates/api.mustache @@ -464,18 +464,19 @@ namespace {{packageName}}.{{apiPackage}} throw new NullReferenceException("LWAAuthoriztionCredentials not set"); } - if (awsAuthenticationCredentials == null) - { - throw new NullReferenceException("AWSAuthenticationCredentials not set"); - } {{packageName}}.Client.Configuration configuration = new {{packageName}}.Client.Configuration() { AuthorizationCredentials = lwaAuthorizationCredentials, - AuthenticationCredentials = awsAuthenticationCredentials, RateLimitConfig = rateLimitConfiguration }; + + if(awsAuthenticationCredentials != null) + { + configuration.AuthenticationCredentials = awsAuthenticationCredentials; + } + // default HTTP connection timeout (in milliseconds) configuration.Timeout = 100000;