From 84a63b3ce04dc9b706cba4d3b8879445181c23eb Mon Sep 17 00:00:00 2001 From: Dan Sharpe Date: Mon, 13 Feb 2023 14:00:09 +0000 Subject: [PATCH 1/8] exclude null objects and fix an issue in NeedFileJoining NeedFileJoining needed to be changed to a bool --- .../AmazonSpApiSDK/Models/ShippingV2/Address.cs | 14 +++++++------- .../Models/ShippingV2/ChannelDetails.cs | 4 ++-- .../Models/ShippingV2/DocumentSize.cs | 6 +++--- .../Models/ShippingV2/GetRatesRequest.cs | 10 +++++----- .../AmazonSpApiSDK/Models/ShippingV2/Item.cs | 14 +++++++------- .../AmazonSpApiSDK/Models/ShippingV2/Package.cs | 6 +++--- .../Models/ShippingV2/PurchaseShipmentRequest.cs | 8 ++++---- .../ShippingV2/RequestedDocumentSpecification.cs | 2 +- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Address.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Address.cs index 20ae324d..96f9eae1 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Address.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Address.cs @@ -33,7 +33,7 @@ public class Address { /// /// Additional address information, if required. [DataMember(Name="addressLine2", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "addressLine2")] + [JsonProperty(PropertyName = "addressLine2", DefaultValueHandling = DefaultValueHandling.Ignore )] public string AddressLine2 { get; set; } /// @@ -41,7 +41,7 @@ public class Address { /// /// Additional address information, if required. [DataMember(Name="addressLine3", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "addressLine3")] + [JsonProperty(PropertyName = "addressLine3", DefaultValueHandling = DefaultValueHandling.Ignore)] public string AddressLine3 { get; set; } /// @@ -49,15 +49,15 @@ public class Address { /// /// The name of the business or institution associated with the address. [DataMember(Name="companyName", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "companyName")] + [JsonProperty(PropertyName = "companyName", DefaultValueHandling = DefaultValueHandling.Ignore)] public string CompanyName { get; set; } /// /// Gets or Sets StateOrRegion /// - [DataMember(Name="stateOrRegion", EmitDefaultValue=false)] + [DataMember(Name = "stateOrRegion", EmitDefaultValue = false)] [JsonProperty(PropertyName = "stateOrRegion")] - public string StateOrRegion { get; set; } + public string StateOrRegion { get; set; } = string.Empty; /// /// Gets or Sets City @@ -85,7 +85,7 @@ public class Address { /// /// The email address of the contact associated with the address. [DataMember(Name="email", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "email")] + [JsonProperty(PropertyName = "email", DefaultValueHandling = DefaultValueHandling.Ignore)] public string Email { get; set; } /// @@ -93,7 +93,7 @@ public class Address { /// /// The phone number of the person, business or institution located at that address, including the country calling code. [DataMember(Name="phoneNumber", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "phoneNumber")] + [JsonProperty(PropertyName = "phoneNumber", DefaultValueHandling = DefaultValueHandling.Ignore)] public string PhoneNumber { get; set; } diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/ChannelDetails.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/ChannelDetails.cs index 6ba009c3..9801adac 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/ChannelDetails.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/ChannelDetails.cs @@ -24,14 +24,14 @@ public class ChannelDetails { /// Gets or Sets AmazonOrderDetails /// [DataMember(Name="amazonOrderDetails", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "amazonOrderDetails")] + [JsonProperty(PropertyName = "amazonOrderDetails", DefaultValueHandling = DefaultValueHandling.Ignore)] public AmazonOrderDetails AmazonOrderDetails { get; set; } /// /// Gets or Sets AmazonShipmentDetails /// [DataMember(Name="amazonShipmentDetails", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "amazonShipmentDetails")] + [JsonProperty(PropertyName = "amazonShipmentDetails", DefaultValueHandling = DefaultValueHandling.Ignore)] public AmazonShipmentDetails AmazonShipmentDetails { get; set; } diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/DocumentSize.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/DocumentSize.cs index 1f035b13..9b61174f 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/DocumentSize.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/DocumentSize.cs @@ -17,7 +17,7 @@ public class DocumentSize { /// /// The width of the document measured in the units specified. [DataMember(Name="width", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "width")] + [JsonProperty(PropertyName = "width", DefaultValueHandling = DefaultValueHandling.Ignore)] public decimal? Width { get; set; } /// @@ -25,7 +25,7 @@ public class DocumentSize { /// /// The length of the document measured in the units specified. [DataMember(Name="length", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "length")] + [JsonProperty(PropertyName = "length", DefaultValueHandling = DefaultValueHandling.Ignore)] public decimal? Length { get; set; } /// @@ -33,7 +33,7 @@ public class DocumentSize { /// /// The unit of measurement. [DataMember(Name="unit", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "unit")] + [JsonProperty(PropertyName = "unit", DefaultValueHandling = DefaultValueHandling.Ignore)] public string Unit { get; set; } diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/GetRatesRequest.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/GetRatesRequest.cs index 315ab499..e9e5d1ec 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/GetRatesRequest.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/GetRatesRequest.cs @@ -17,7 +17,7 @@ public class GetRatesRequest { /// /// The ship to address. [DataMember(Name="shipTo", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "shipTo")] + [JsonProperty(PropertyName = "shipTo", DefaultValueHandling = DefaultValueHandling.Ignore)] public Address ShipTo { get; set; } /// @@ -33,7 +33,7 @@ public class GetRatesRequest { /// /// The return to address. [DataMember(Name="returnTo", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "returnTo")] + [JsonProperty(PropertyName = "returnTo", DefaultValueHandling = DefaultValueHandling.Ignore)] public Address ReturnTo { get; set; } /// @@ -41,7 +41,7 @@ public class GetRatesRequest { /// /// The ship date and time (the requested pickup). This defaults to the current date and time. [DataMember(Name="shipDate", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "shipDate")] + [JsonProperty(PropertyName = "shipDate", DefaultValueHandling = DefaultValueHandling.Ignore)] public DateTime? ShipDate { get; set; } /// @@ -55,14 +55,14 @@ public class GetRatesRequest { /// Gets or Sets ValueAddedServices /// [DataMember(Name="valueAddedServices", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "valueAddedServices")] + [JsonProperty(PropertyName = "valueAddedServices", DefaultValueHandling = DefaultValueHandling.Ignore)] public ValueAddedServiceDetails ValueAddedServices { get; set; } /// /// Gets or Sets TaxDetails /// [DataMember(Name="taxDetails", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "taxDetails")] + [JsonProperty(PropertyName = "taxDetails", DefaultValueHandling = DefaultValueHandling.Ignore)] public TaxDetailList TaxDetails { get; set; } /// diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Item.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Item.cs index 9635f167..32f533e3 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Item.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Item.cs @@ -16,7 +16,7 @@ public class Item { /// Gets or Sets ItemValue /// [DataMember(Name="itemValue", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "itemValue")] + [JsonProperty(PropertyName = "itemValue", DefaultValueHandling = DefaultValueHandling.Ignore)] public Currency ItemValue { get; set; } /// @@ -24,7 +24,7 @@ public class Item { /// /// The product description of the item. [DataMember(Name="description", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "description")] + [JsonProperty(PropertyName = "description", DefaultValueHandling = DefaultValueHandling.Ignore)] public string Description { get; set; } /// @@ -32,7 +32,7 @@ public class Item { /// /// A unique identifier for an item provided by the client. [DataMember(Name="itemIdentifier", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "itemIdentifier")] + [JsonProperty(PropertyName = "itemIdentifier", DefaultValueHandling = DefaultValueHandling.Ignore)] public string ItemIdentifier { get; set; } /// @@ -63,14 +63,14 @@ public class Item { /// /// The product type of the item. [DataMember(Name="productType", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "productType")] + [JsonProperty(PropertyName = "productType", DefaultValueHandling = DefaultValueHandling.Ignore)] public string ProductType { get; set; } /// /// Gets or Sets InvoiceDetails /// [DataMember(Name="invoiceDetails", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "invoiceDetails")] + [JsonProperty(PropertyName = "invoiceDetails", DefaultValueHandling = DefaultValueHandling.Ignore)] public InvoiceDetails InvoiceDetails { get; set; } /// @@ -78,14 +78,14 @@ public class Item { /// /// A list of unique serial numbers in an Amazon package that can be used to guarantee non-fraudulent items. The number of serial numbers in the list must be less than or equal to the quantity of items being shipped. Only applicable when channel source is Amazon. [DataMember(Name="serialNumbers", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "serialNumbers")] + [JsonProperty(PropertyName = "serialNumbers", DefaultValueHandling = DefaultValueHandling.Ignore)] public List SerialNumbers { get; set; } /// /// Gets or Sets DirectFulfillmentItemIdentifiers /// [DataMember(Name="directFulfillmentItemIdentifiers", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "directFulfillmentItemIdentifiers")] + [JsonProperty(PropertyName = "directFulfillmentItemIdentifiers", DefaultValueHandling = DefaultValueHandling.Ignore)] public DirectFulfillmentItemIdentifiers DirectFulfillmentItemIdentifiers { get; set; } diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Package.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Package.cs index d2661e95..6d75f402 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Package.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/Package.cs @@ -38,7 +38,7 @@ public class Package { /// /// When true, the package contains hazardous materials. Defaults to false. [DataMember(Name="isHazmat", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "isHazmat")] + [JsonProperty(PropertyName = "isHazmat", DefaultValueHandling = DefaultValueHandling.Ignore)] public bool? IsHazmat { get; set; } /// @@ -46,14 +46,14 @@ public class Package { /// /// The seller name displayed on the label. [DataMember(Name="sellerDisplayName", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "sellerDisplayName")] + [JsonProperty(PropertyName = "sellerDisplayName", DefaultValueHandling = DefaultValueHandling.Ignore)] public string SellerDisplayName { get; set; } /// /// Gets or Sets Charges /// [DataMember(Name="charges", EmitDefaultValue=false)] - [JsonProperty(PropertyName = "charges")] + [JsonProperty(PropertyName = "charges", DefaultValueHandling = DefaultValueHandling.Ignore)] public ChargeList Charges { get; set; } /// diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/PurchaseShipmentRequest.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/PurchaseShipmentRequest.cs index ee185f09..ad1479cb 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/PurchaseShipmentRequest.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/PurchaseShipmentRequest.cs @@ -17,7 +17,7 @@ public class PurchaseShipmentRequest /// Gets or Sets RequestToken /// [DataMember(Name = "requestToken", EmitDefaultValue = false)] - [JsonProperty(PropertyName = "requestToken")] + [JsonProperty(PropertyName = "requestToken", DefaultValueHandling = DefaultValueHandling.Ignore)] public string RequestToken { get; set; } /// @@ -31,14 +31,14 @@ public class PurchaseShipmentRequest /// Gets or Sets RequestedDocumentSpecification /// [DataMember(Name = "requestedDocumentSpecification", EmitDefaultValue = false)] - [JsonProperty(PropertyName = "requestedDocumentSpecification")] + [JsonProperty(PropertyName = "requestedDocumentSpecification", DefaultValueHandling = DefaultValueHandling.Ignore)] public RequestedDocumentSpecification RequestedDocumentSpecification { get; set; } /// /// Gets or Sets RequestedValueAddedServices /// [DataMember(Name = "requestedValueAddedServices", EmitDefaultValue = false)] - [JsonProperty(PropertyName = "requestedValueAddedServices")] + [JsonProperty(PropertyName = "requestedValueAddedServices", DefaultValueHandling = DefaultValueHandling.Ignore)] public RequestedValueAddedServiceList RequestedValueAddedServices { get; set; } /// @@ -46,7 +46,7 @@ public class PurchaseShipmentRequest /// /// The additional inputs required to purchase a shipping offering, in JSON format. The JSON provided here must adhere to the JSON schema that is returned in the response to the getAdditionalInputs operation. Additional inputs are only required when indicated by the requiresAdditionalInputs property in the response to the getRates operation. [DataMember(Name = "additionalInputs", EmitDefaultValue = false)] - [JsonProperty(PropertyName = "additionalInputs")] + [JsonProperty(PropertyName = "additionalInputs", DefaultValueHandling = DefaultValueHandling.Ignore)] public Dictionary AdditionalInputs { get; set; } diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/RequestedDocumentSpecification.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/RequestedDocumentSpecification.cs index 5305d0fd..6297835a 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/RequestedDocumentSpecification.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/ShippingV2/RequestedDocumentSpecification.cs @@ -45,7 +45,7 @@ public class RequestedDocumentSpecification /// [DataMember(Name = "needFileJoining", EmitDefaultValue = false)] [JsonProperty(PropertyName = "needFileJoining")] - public string NeedFileJoining { get; set; } + public bool NeedFileJoining { get; set; } /// /// A list of the document types requested. From 49bbbfc7845c27477e6eb7fe8b301e8b330db240 Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Thu, 30 Mar 2023 11:28:09 +0100 Subject: [PATCH 2/8] Add LastUpdatedBefore to the OrderList Add LastUpdatedBefore to the OrderList response, so it can be used as https://www.youtube.com/watch?v=aeSAo5a6ClQ --- .../FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/OrderList.cs | 1 + Source/FikaAmazonAPI/Services/OrderService.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/OrderList.cs b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/OrderList.cs index 431e9068..9a62d088 100644 --- a/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/OrderList.cs +++ b/Source/FikaAmazonAPI/AmazonSpApiSDK/Models/Orders/OrderList.cs @@ -32,6 +32,7 @@ public OrderList() : base() } public string NextToken { get; set; } + public DateTime? LastUpdatedBefore { get; set; } /// /// Returns the string presentation of the object diff --git a/Source/FikaAmazonAPI/Services/OrderService.cs b/Source/FikaAmazonAPI/Services/OrderService.cs index bb7c8207..89c2a0df 100644 --- a/Source/FikaAmazonAPI/Services/OrderService.cs +++ b/Source/FikaAmazonAPI/Services/OrderService.cs @@ -1,4 +1,5 @@ -using FikaAmazonAPI.AmazonSpApiSDK.Models.Orders; +using System; +using FikaAmazonAPI.AmazonSpApiSDK.Models.Orders; using FikaAmazonAPI.AmazonSpApiSDK.Models.Token; using FikaAmazonAPI.Parameter.Order; using FikaAmazonAPI.Search; @@ -51,6 +52,9 @@ public async Task GetOrdersAsync(ParameterOrderList searchOrderList, var response = await ExecuteRequestAsync(Utils.RateLimitType.Order_GetOrders, cancellationToken); var nextToken = response.Payload.NextToken; orderList = response.Payload.Orders; + if(!string.IsNullOrWhiteSpace(response.Payload.LastUpdatedBefore)) + orderList.LastUpdatedBefore = DateTime.Parse(response.Payload.LastUpdatedBefore); + int PageCount = 1; if (searchOrderList.MaxNumberOfPages.HasValue && searchOrderList.MaxNumberOfPages.Value == 1) { From ba60f48e38f79d43f7eedcc8de1fa1d26e37fc53 Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Wed, 4 Dec 2024 13:59:29 +0000 Subject: [PATCH 3/8] added loggerFactory --- Source/FikaAmazonAPI/AmazonConnection.cs | 7 +++++-- Source/FikaAmazonAPI/FikaAmazonAPI.csproj | 1 + Source/FikaAmazonAPI/Services/ListingsItemService.cs | 3 ++- Source/FikaAmazonAPI/Services/RequestService.cs | 8 ++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Source/FikaAmazonAPI/AmazonConnection.cs b/Source/FikaAmazonAPI/AmazonConnection.cs index 1c013731..3675e34a 100644 --- a/Source/FikaAmazonAPI/AmazonConnection.cs +++ b/Source/FikaAmazonAPI/AmazonConnection.cs @@ -4,11 +4,13 @@ using System; using System.Globalization; using System.Threading; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI { public class AmazonConnection { + private readonly ILoggerFactory _loggerFactory; private AmazonCredential Credentials { get; set; } public AppIntegrationsServiceV20240401 AppIntegrationsServiceV20240401 => this._AppIntegrationsServiceV20240401 ?? throw _NoCredentials; @@ -91,8 +93,9 @@ public class AmazonConnection private UnauthorizedAccessException _NoCredentials = new UnauthorizedAccessException($"Error, you cannot make calls to Amazon without credentials!"); public string RefNumber { get; set; } - public AmazonConnection(AmazonCredential Credentials, string RefNumber = null, CultureInfo? cultureInfo = null) + public AmazonConnection(AmazonCredential Credentials, string RefNumber = null, CultureInfo? cultureInfo = null, ILoggerFactory? loggerFactory = null) { + _loggerFactory = loggerFactory; this.Authenticate(Credentials); this.RefNumber = RefNumber; Thread.CurrentThread.CurrentCulture = cultureInfo ?? CultureInfo.CurrentCulture; @@ -129,7 +132,7 @@ private void Init(AmazonCredential Credentials) this._EasyShip20220323 = new EasyShip20220323Service(this.Credentials); this._AplusContent = new AplusContentService(this.Credentials); this._Feed = new FeedService(this.Credentials); - this._ListingsItem = new ListingsItemService(this.Credentials); + this._ListingsItem = new ListingsItemService(this.Credentials, _loggerFactory); this._Restrictions = new RestrictionService(this.Credentials); this._MerchantFulfillment = new MerchantFulfillmentService(this.Credentials); this._Messaging = new MessagingService(this.Credentials); diff --git a/Source/FikaAmazonAPI/FikaAmazonAPI.csproj b/Source/FikaAmazonAPI/FikaAmazonAPI.csproj index 98c6a5a5..a4b07137 100644 --- a/Source/FikaAmazonAPI/FikaAmazonAPI.csproj +++ b/Source/FikaAmazonAPI/FikaAmazonAPI.csproj @@ -35,6 +35,7 @@ + diff --git a/Source/FikaAmazonAPI/Services/ListingsItemService.cs b/Source/FikaAmazonAPI/Services/ListingsItemService.cs index 6a53905c..9fc77373 100644 --- a/Source/FikaAmazonAPI/Services/ListingsItemService.cs +++ b/Source/FikaAmazonAPI/Services/ListingsItemService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ListingsItemService : RequestService { - public ListingsItemService(AmazonCredential amazonCredential) : base(amazonCredential) + public ListingsItemService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory) : base(amazonCredential, loggerFactory) { } diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index 9c3e3ec9..1e1edf4c 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -15,6 +15,7 @@ using System.Net; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.AmazonSpApiSDK.Models.Token.CacheTokenData; using static FikaAmazonAPI.Utils.Constants; @@ -42,6 +43,13 @@ protected string ApiBaseUrl } } + private ILogger? _logger = null; + + public RequestService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory) : this(amazonCredential) + { + _logger = loggerFactory?.CreateLogger() ?? null; + } + /// /// Creates request base service /// From df1481cb553273d10e4124b0959152823e169237 Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Thu, 5 Dec 2024 10:08:10 +0000 Subject: [PATCH 4/8] replace conosle.writes with loggers --- .../FikaAmazonAPI/Services/RequestService.cs | 67 +++++++++---------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index 1e1edf4c..016a125b 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -47,7 +47,7 @@ protected string ApiBaseUrl public RequestService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory) : this(amazonCredential) { - _logger = loggerFactory?.CreateLogger() ?? null; + _logger = loggerFactory?.CreateLogger(); } /// @@ -162,38 +162,33 @@ private void SaveLastRequestHeader(IReadOnlyCollection new { - resource = request.Resource, - parameters = request.Parameters.Select(parameter => new - { - name = parameter.Name, - value = parameter.Value, - type = parameter.Type.ToString() - }), - // ToString() here to have the method as a nice string otherwise it will just show the enum value - method = request.Method.ToString(), - // This will generate the actual Uri used in the request - //uri = request. _restClient.BuildUri(request), - }; - - var responseToLog = new - { - statusCode = response.StatusCode, - content = response.Content, - headers = response.Headers, - // The Uri that actually responded (could be different from the requestUri if a redirection occurred) - responseUri = response.ResponseUri, - errorMessage = response.ErrorMessage, - }; - - Debug.WriteLine("\n\n---------------------------------------------------------\n"); - string msg = string.Format("Request completed, \nRequest: {0} \n\nResponse: {1}", requestToLog, responseToLog); - - Debug.WriteLine(msg); - } + name = parameter.Name, + value = parameter.Value, + type = parameter.Type.ToString() + }), + // ToString() here to have the method as a nice string otherwise it will just show the enum value + method = request.Method.ToString(), + // This will generate the actual Uri used in the request + //uri = request. _restClient.BuildUri(request), + }; + + var responseToLog = new + { + statusCode = response.StatusCode, + content = response.Content, + headers = response.Headers, + // The Uri that actually responded (could be different from the requestUri if a redirection occurred) + responseUri = response.ResponseUri, + errorMessage = response.ErrorMessage, + }; + + //There are PII considerations here + _logger?.LogInformation("Request completed, \nRequest: {request} \n\nResponse: {response}", requestToLog, responseToLog); } private void RestHeader() @@ -226,9 +221,8 @@ public async Task ExecuteRequestAsync(RateLimitType rateLimitType = RateLi catch (AmazonQuotaExceededException ex) { if (tryCount >= AmazonCredential.MaxThrottledRetryCount) - { - if (AmazonCredential.IsDebugMode) - Console.WriteLine("Throttle max try count reached"); + { + _logger?.LogWarning("Throttle max try count reached"); throw; } @@ -291,9 +285,8 @@ protected void ParseResponse(RestResponse response) } else { - if (AmazonCredential.IsDebugMode) - Console.WriteLine("Amazon Api didn't respond with Okay, see exception for more details" + - response.Content); + + _logger?.LogWarning("Amazon Api didn't respond with Okay, see exception for more details: {content}", response.Content); var errorResponse = response.Content.ConvertToErrorResponse(); if (errorResponse != null) From 485ea27483b324319ef3df3b03262ff416e1bbc6 Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Thu, 5 Dec 2024 11:48:49 +0000 Subject: [PATCH 5/8] added a logging example --- .../FikaAmazonAPI.SampleCode.csproj | 2 ++ .../LoggingExamples.cs | 35 +++++++++++++++++++ Source/FikaAmazonAPI.SampleCode/Program.cs | 7 ++-- .../FikaAmazonAPI/Services/RequestService.cs | 7 ++-- 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 Source/FikaAmazonAPI.SampleCode/LoggingExamples.cs diff --git a/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj b/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj index b452e77e..71c42073 100644 --- a/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj +++ b/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj @@ -27,6 +27,8 @@ + + diff --git a/Source/FikaAmazonAPI.SampleCode/LoggingExamples.cs b/Source/FikaAmazonAPI.SampleCode/LoggingExamples.cs new file mode 100644 index 00000000..2ac214f7 --- /dev/null +++ b/Source/FikaAmazonAPI.SampleCode/LoggingExamples.cs @@ -0,0 +1,35 @@ +using FikaAmazonAPI.Parameter.Order; +using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace FikaAmazonAPI.SampleCode; + +public class LoggingExamples +{ + private AmazonConnection _amazonConnection; + public LoggingExamples(IConfigurationRoot config) + { + var factory = LoggerFactory.Create(builder => builder.AddConsole()); + + _amazonConnection = new AmazonConnection(new AmazonCredential() + { + //AccessKey = config.GetSection("FikaAmazonAPI:AccessKey").Value, + //SecretKey = config.GetSection("FikaAmazonAPI:SecretKey").Value, + //RoleArn = config.GetSection("FikaAmazonAPI:RoleArn").Value, + ClientId = config.GetSection("FikaAmazonAPI:ClientId").Value, + ClientSecret = config.GetSection("FikaAmazonAPI:ClientSecret").Value, + RefreshToken = config.GetSection("FikaAmazonAPI:RefreshToken").Value, + MarketPlaceID = config.GetSection("FikaAmazonAPI:MarketPlaceID").Value, + SellerID = config.GetSection("FikaAmazonAPI:SellerId").Value, + IsDebugMode = true, + Environment = Constants.Environments.Sandbox + }, loggerFactory: factory); + } + + public async Task ConsoleLoggerExample() + { + var listingItemExample = new ListingsItemsSample(_amazonConnection); + await listingItemExample.SetListingsItemAttribute("test"); + } +} \ No newline at end of file diff --git a/Source/FikaAmazonAPI.SampleCode/Program.cs b/Source/FikaAmazonAPI.SampleCode/Program.cs index ba0d40c5..dcbe56a3 100644 --- a/Source/FikaAmazonAPI.SampleCode/Program.cs +++ b/Source/FikaAmazonAPI.SampleCode/Program.cs @@ -27,8 +27,8 @@ static async Task Main(string[] args) }); - ReportManagerSample reportManagerSample = new ReportManagerSample(amazonConnection); - reportManagerSample.CallReport(); + //ReportManagerSample reportManagerSample = new ReportManagerSample(amazonConnection); + // reportManagerSample.CallReport(); //var error = amazonConnection.Reports.CreateReportAndDownloadFile(Utils.Constants.ReportTypes.GET_STRANDED_INVENTORY_UI_DATA); //var dddd = amazonConnection.Reports.CreateReportAndDownloadFile(Utils.Constants.ReportTypes.GET_FBA_MYI_ALL_INVENTORY_DATA); //var dddd = amazonConnection.Reports.CreateReportAndDownloadFile(Utils.Constants.ReportTypes.GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA); @@ -36,7 +36,8 @@ static async Task Main(string[] args) //var dddddd = reportManager.GetAFNInventoryQtyAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - + var loggingExamples = new LoggingExamples(config); + await loggingExamples.ConsoleLoggerExample(); Console.ReadLine(); diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index 016a125b..3bf5c713 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -186,9 +186,12 @@ private void LogRequest(RestRequest request, RestResponse response) responseUri = response.ResponseUri, errorMessage = response.ErrorMessage, }; - + Debug.WriteLine("\n\n---------------------------------------------------------\n"); + string msg = string.Format("Request completed, \nRequest: {0} \n\nResponse: {1}", requestToLog, responseToLog); + + Debug.WriteLine(msg); //There are PII considerations here - _logger?.LogInformation("Request completed, \nRequest: {request} \n\nResponse: {response}", requestToLog, responseToLog); + _logger?.LogInformation("Request completed, \nRequest: {@request} \n\nResponse: {@response}", requestToLog, responseToLog); } private void RestHeader() From 7c097a4fc81dd399dbca89f3a9b524910267e0ac Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Thu, 5 Dec 2024 14:56:25 +0000 Subject: [PATCH 6/8] added serilog example, tweaked some logging --- .../FikaAmazonAPI.SampleCode.csproj | 2 + Source/FikaAmazonAPI.SampleCode/Program.cs | 2 +- .../SerilogLoggingExamples.cs | 39 +++++++++++++++++++ .../FikaAmazonAPI/Services/RequestService.cs | 15 ++++--- 4 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 Source/FikaAmazonAPI.SampleCode/SerilogLoggingExamples.cs diff --git a/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj b/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj index 71c42073..a9d8fb2c 100644 --- a/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj +++ b/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj @@ -32,6 +32,8 @@ + + diff --git a/Source/FikaAmazonAPI.SampleCode/Program.cs b/Source/FikaAmazonAPI.SampleCode/Program.cs index dcbe56a3..c4ee081e 100644 --- a/Source/FikaAmazonAPI.SampleCode/Program.cs +++ b/Source/FikaAmazonAPI.SampleCode/Program.cs @@ -36,7 +36,7 @@ static async Task Main(string[] args) //var dddddd = reportManager.GetAFNInventoryQtyAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - var loggingExamples = new LoggingExamples(config); + var loggingExamples = new SerilogLoggingExamples(config); await loggingExamples.ConsoleLoggerExample(); Console.ReadLine(); diff --git a/Source/FikaAmazonAPI.SampleCode/SerilogLoggingExamples.cs b/Source/FikaAmazonAPI.SampleCode/SerilogLoggingExamples.cs new file mode 100644 index 00000000..885b23b9 --- /dev/null +++ b/Source/FikaAmazonAPI.SampleCode/SerilogLoggingExamples.cs @@ -0,0 +1,39 @@ +using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using Serilog; + +namespace FikaAmazonAPI.SampleCode; + +public class SerilogLoggingExamples +{ + private AmazonConnection _amazonConnection; + + public SerilogLoggingExamples(IConfigurationRoot config) + { + Log.Logger = new LoggerConfiguration() + .WriteTo.Console() + .CreateLogger(); + var factory = LoggerFactory.Create(c => c.AddSerilog()); + + _amazonConnection = new AmazonConnection(new AmazonCredential() + { + //AccessKey = config.GetSection("FikaAmazonAPI:AccessKey").Value, + //SecretKey = config.GetSection("FikaAmazonAPI:SecretKey").Value, + //RoleArn = config.GetSection("FikaAmazonAPI:RoleArn").Value, + ClientId = config.GetSection("FikaAmazonAPI:ClientId").Value, + ClientSecret = config.GetSection("FikaAmazonAPI:ClientSecret").Value, + RefreshToken = config.GetSection("FikaAmazonAPI:RefreshToken").Value, + MarketPlaceID = config.GetSection("FikaAmazonAPI:MarketPlaceID").Value, + SellerID = config.GetSection("FikaAmazonAPI:SellerId").Value, + IsDebugMode = true, + Environment = Constants.Environments.Sandbox + }, loggerFactory: factory); + } + + public async Task ConsoleLoggerExample() + { + var listingItemExample = new ListingsItemsSample(_amazonConnection); + await listingItemExample.SetListingsItemAttribute("test"); + } +} \ No newline at end of file diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index 3bf5c713..280565cf 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -170,26 +170,29 @@ private void LogRequest(RestRequest request, RestResponse response) name = parameter.Name, value = parameter.Value, type = parameter.Type.ToString() - }), + }).ToList(), // ToString() here to have the method as a nice string otherwise it will just show the enum value method = request.Method.ToString(), // This will generate the actual Uri used in the request //uri = request. _restClient.BuildUri(request), }; + + //remove the access token from the headers + requestToLog.parameters.RemoveAll(p => p.name == "x-amz-access-token"); var responseToLog = new { statusCode = response.StatusCode, content = response.Content, - headers = response.Headers, + headers = response.Headers.Select(h => new + { + name = h.Name, + value = h.Value + }), // The Uri that actually responded (could be different from the requestUri if a redirection occurred) responseUri = response.ResponseUri, errorMessage = response.ErrorMessage, }; - Debug.WriteLine("\n\n---------------------------------------------------------\n"); - string msg = string.Format("Request completed, \nRequest: {0} \n\nResponse: {1}", requestToLog, responseToLog); - - Debug.WriteLine(msg); //There are PII considerations here _logger?.LogInformation("Request completed, \nRequest: {@request} \n\nResponse: {@response}", requestToLog, responseToLog); } From 60d25192538ea44b5be1406b9a85f529f7499abc Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Thu, 19 Dec 2024 13:47:53 +0000 Subject: [PATCH 7/8] updated some constructors post merge fix --- Source/FikaAmazonAPI/AmazonConnection.cs | 2 +- Source/FikaAmazonAPI/Services/RequestService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/FikaAmazonAPI/AmazonConnection.cs b/Source/FikaAmazonAPI/AmazonConnection.cs index a03dc103..22be9393 100644 --- a/Source/FikaAmazonAPI/AmazonConnection.cs +++ b/Source/FikaAmazonAPI/AmazonConnection.cs @@ -135,7 +135,7 @@ private void Init(AmazonCredential Credentials) this._EasyShip20220323 = new EasyShip20220323Service(this.Credentials, this.RateLimitingHandler); this._AplusContent = new AplusContentService(this.Credentials, this.RateLimitingHandler); this._Feed = new FeedService(this.Credentials, this.RateLimitingHandler); - this._ListingsItem = new ListingsItemService(this.Credentials, this.RateLimitingHandler, _loggerFactory); + this._ListingsItem = new ListingsItemService(this.Credentials, _loggerFactory, this.RateLimitingHandler ); this._Restrictions = new RestrictionService(this.Credentials, this.RateLimitingHandler); this._MerchantFulfillment = new MerchantFulfillmentService(this.Credentials, this.RateLimitingHandler); this._Messaging = new MessagingService(this.Credentials, this.RateLimitingHandler); diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index d3da359a..2750f3e6 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -45,7 +45,7 @@ protected string ApiBaseUrl private ILogger? _logger = null; - public RequestService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory) : this(amazonCredential) + public RequestService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : this(amazonCredential, rateLimitingHandler) { _logger = loggerFactory?.CreateLogger(); } From 6f463c4c87986705259bb266826032a14688dd40 Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Thu, 19 Dec 2024 15:10:20 +0000 Subject: [PATCH 8/8] Updated the constructors to allow the iloggerfactory --- Source/FikaAmazonAPI/AmazonConnection.cs | 72 +++++++++---------- .../Services/AplusContentService.cs | 3 +- .../Services/AppIntegrationsV20240401.cs | 3 +- .../Services/AuthorizationService.cs | 3 +- .../Services/CatalogItemService.cs | 3 +- .../Services/EasyShip20220323Service.cs | 3 +- .../Services/FbaInboundEligibilityService.cs | 3 +- .../Services/FbaInboundService.cs | 3 +- .../Services/FbaInventoryService.cs | 3 +- .../Services/FbaOutboundService.cs | 3 +- .../Services/FbaSmallandLightService.cs | 3 +- Source/FikaAmazonAPI/Services/FeedService.cs | 3 +- .../Services/FinancialService.cs | 3 +- .../Services/FulFillmentInboundService.cs | 3 +- .../FulFillmentInboundServicev20240320.cs | 3 +- .../Services/FulFillmentOutboundService.cs | 3 +- .../Services/MerchantFulfillmentService.cs | 3 +- .../Services/MessagingService.cs | 3 +- .../Services/NotificationService.cs | 3 +- Source/FikaAmazonAPI/Services/OrderService.cs | 3 +- .../Services/ProductFeeService.cs | 3 +- .../Services/ProductPricingService.cs | 3 +- .../Services/ProductTypeService.cs | 3 +- .../FikaAmazonAPI/Services/ReportService.cs | 3 +- .../FikaAmazonAPI/Services/RequestService.cs | 8 +-- .../Services/RestrictionService.cs | 3 +- Source/FikaAmazonAPI/Services/SalesService.cs | 3 +- .../FikaAmazonAPI/Services/SellerService.cs | 3 +- .../FikaAmazonAPI/Services/ServicesService.cs | 3 +- .../Services/ShipmentInvoicingService.cs | 3 +- .../FikaAmazonAPI/Services/ShippingService.cs | 3 +- .../Services/ShippingServiceV2.cs | 3 +- .../Services/SolicitationService.cs | 3 +- Source/FikaAmazonAPI/Services/TokenService.cs | 3 +- .../FikaAmazonAPI/Services/UploadService.cs | 3 +- .../VendorDirectFulfillmentOrderService.cs | 3 +- Source/FikaAmazonAPI/Services/VendorOrders.cs | 3 +- .../Services/VendorTransactionStatus.cs | 3 +- 38 files changed, 110 insertions(+), 78 deletions(-) diff --git a/Source/FikaAmazonAPI/AmazonConnection.cs b/Source/FikaAmazonAPI/AmazonConnection.cs index 22be9393..4f027648 100644 --- a/Source/FikaAmazonAPI/AmazonConnection.cs +++ b/Source/FikaAmazonAPI/AmazonConnection.cs @@ -118,44 +118,44 @@ private void Init(AmazonCredential Credentials) this.Credentials = Credentials; - this._Authorization = new AuthorizationService(this.Credentials); - this._AppIntegrationsServiceV20240401 = new AppIntegrationsServiceV20240401(this.Credentials); - this._Orders = new OrderService(this.Credentials); - this._Reports = new ReportService(this.Credentials); - this._Solicitations = new SolicitationService(this.Credentials); - this._Financials = new FinancialService(this.Credentials); - this._CatalogItems = new CatalogItemService(this.Credentials); - this._ProductPricing = new ProductPricingService(this.Credentials); + this._Authorization = new AuthorizationService(this.Credentials, _loggerFactory); + this._AppIntegrationsServiceV20240401 = new AppIntegrationsServiceV20240401(this.Credentials, _loggerFactory); + this._Orders = new OrderService(this.Credentials, _loggerFactory); + this._Reports = new ReportService(this.Credentials, _loggerFactory); + this._Solicitations = new SolicitationService(this.Credentials, _loggerFactory); + this._Financials = new FinancialService(this.Credentials, _loggerFactory); + this._CatalogItems = new CatalogItemService(this.Credentials, _loggerFactory); + this._ProductPricing = new ProductPricingService(this.Credentials, _loggerFactory); - this._FbaInbound = new FbaInboundService(this.Credentials, this.RateLimitingHandler); - this._FbaInventory = new FbaInventoryService(this.Credentials, this.RateLimitingHandler); - this._FbaOutbound = new FbaOutboundService(this.Credentials, this.RateLimitingHandler); - this._FbaSmallandLight = new FbaSmallandLightService(this.Credentials, this.RateLimitingHandler); - this._FbaInboundEligibility = new FbaInboundEligibilityService(this.Credentials, this.RateLimitingHandler); - this._EasyShip20220323 = new EasyShip20220323Service(this.Credentials, this.RateLimitingHandler); - this._AplusContent = new AplusContentService(this.Credentials, this.RateLimitingHandler); - this._Feed = new FeedService(this.Credentials, this.RateLimitingHandler); + this._FbaInbound = new FbaInboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaInventory = new FbaInventoryService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaOutbound = new FbaOutboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaSmallandLight = new FbaSmallandLightService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaInboundEligibility = new FbaInboundEligibilityService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._EasyShip20220323 = new EasyShip20220323Service(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._AplusContent = new AplusContentService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Feed = new FeedService(this.Credentials, _loggerFactory, this.RateLimitingHandler); this._ListingsItem = new ListingsItemService(this.Credentials, _loggerFactory, this.RateLimitingHandler ); - this._Restrictions = new RestrictionService(this.Credentials, this.RateLimitingHandler); - this._MerchantFulfillment = new MerchantFulfillmentService(this.Credentials, this.RateLimitingHandler); - this._Messaging = new MessagingService(this.Credentials, this.RateLimitingHandler); - this._Notification = new NotificationService(this.Credentials, this.RateLimitingHandler); - this._ProductFee = new ProductFeeService(this.Credentials, this.RateLimitingHandler); - this._ProductType = new ProductTypeService(this.Credentials, this.RateLimitingHandler); - this._Sales = new SalesService(this.Credentials, this.RateLimitingHandler); - this._Seller = new SellerService(this.Credentials, this.RateLimitingHandler); - this._Services = new ServicesService(this.Credentials, this.RateLimitingHandler); - this._ShipmentInvoicing = new ShipmentInvoicingService(this.Credentials, this.RateLimitingHandler); - this._Shipping = new ShippingService(this.Credentials, this.RateLimitingHandler); - this._ShippingV2 = new ShippingServiceV2(this.Credentials, this.RateLimitingHandler); - this._Upload = new UploadService(this.Credentials, this.RateLimitingHandler); - this._Tokens = new TokenService(this.Credentials, this.RateLimitingHandler); - this._FulFillmentInbound = new FulFillmentInboundService(this.Credentials, this.RateLimitingHandler); - this._FulFillmentInboundv20240320 = new FulFillmentInboundServicev20240320(this.Credentials, this.RateLimitingHandler); - this._FulFillmentOutbound = new FulFillmentOutboundService(this.Credentials, this.RateLimitingHandler); - this._VendorDirectFulfillmentOrders = new VendorDirectFulfillmentOrderService(this.Credentials, this.RateLimitingHandler); - this._VendorOrders = new VendorOrderService(this.Credentials, this.RateLimitingHandler); - this._VendorTransactionStatus = new VendorTransactionStatusService(this.Credentials, this.RateLimitingHandler); + this._Restrictions = new RestrictionService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._MerchantFulfillment = new MerchantFulfillmentService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Messaging = new MessagingService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Notification = new NotificationService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ProductFee = new ProductFeeService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ProductType = new ProductTypeService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Sales = new SalesService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Seller = new SellerService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Services = new ServicesService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ShipmentInvoicing = new ShipmentInvoicingService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Shipping = new ShippingService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ShippingV2 = new ShippingServiceV2(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Upload = new UploadService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Tokens = new TokenService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FulFillmentInbound = new FulFillmentInboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FulFillmentInboundv20240320 = new FulFillmentInboundServicev20240320(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FulFillmentOutbound = new FulFillmentOutboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._VendorDirectFulfillmentOrders = new VendorDirectFulfillmentOrderService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._VendorOrders = new VendorOrderService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._VendorTransactionStatus = new VendorTransactionStatusService(this.Credentials, _loggerFactory, this.RateLimitingHandler); AmazonCredential.DebugMode = this.Credentials.IsDebugMode; } diff --git a/Source/FikaAmazonAPI/Services/AplusContentService.cs b/Source/FikaAmazonAPI/Services/AplusContentService.cs index f91059dd..fe4ecdb7 100644 --- a/Source/FikaAmazonAPI/Services/AplusContentService.cs +++ b/Source/FikaAmazonAPI/Services/AplusContentService.cs @@ -1,4 +1,5 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { @@ -6,7 +7,7 @@ namespace FikaAmazonAPI.Services public class AplusContentService : RequestService { - public AplusContentService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public AplusContentService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs b/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs index 3cb5dc08..9f82b0f4 100644 --- a/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs +++ b/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs @@ -5,12 +5,13 @@ using System.Text; using System.Threading.Tasks; using System.Threading; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class AppIntegrationsServiceV20240401: RequestService { - public AppIntegrationsServiceV20240401(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public AppIntegrationsServiceV20240401(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/AuthorizationService.cs b/Source/FikaAmazonAPI/Services/AuthorizationService.cs index 4a05a71f..379e2bb7 100644 --- a/Source/FikaAmazonAPI/Services/AuthorizationService.cs +++ b/Source/FikaAmazonAPI/Services/AuthorizationService.cs @@ -4,13 +4,14 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.AmazonSpApiSDK.Models.Token.CacheTokenData; namespace FikaAmazonAPI.Services { public class AuthorizationService : RequestService { - public AuthorizationService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public AuthorizationService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } public string GetAuthorizationCode(ParameterAuthorizationCode parameterGetOrderMetrics) => diff --git a/Source/FikaAmazonAPI/Services/CatalogItemService.cs b/Source/FikaAmazonAPI/Services/CatalogItemService.cs index e98eccbc..6dd32466 100644 --- a/Source/FikaAmazonAPI/Services/CatalogItemService.cs +++ b/Source/FikaAmazonAPI/Services/CatalogItemService.cs @@ -8,13 +8,14 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using Item = FikaAmazonAPI.AmazonSpApiSDK.Models.CatalogItems.Item; namespace FikaAmazonAPI.Services { public class CatalogItemService : RequestService { - public CatalogItemService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public CatalogItemService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs b/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs index 41c7cebf..7c81d849 100644 --- a/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs +++ b/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class EasyShip20220323Service : RequestService { - public EasyShip20220323Service(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public EasyShip20220323Service(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs b/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs index 4677a7f9..06e527da 100644 --- a/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs +++ b/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaInboundEligibilityService : RequestService { - public FbaInboundEligibilityService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaInboundEligibilityService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaInboundService.cs b/Source/FikaAmazonAPI/Services/FbaInboundService.cs index 080afbed..6f9994c4 100644 --- a/Source/FikaAmazonAPI/Services/FbaInboundService.cs +++ b/Source/FikaAmazonAPI/Services/FbaInboundService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaInboundService : RequestService { - public FbaInboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaInboundService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaInventoryService.cs b/Source/FikaAmazonAPI/Services/FbaInventoryService.cs index ff1cff8b..0aeeb718 100644 --- a/Source/FikaAmazonAPI/Services/FbaInventoryService.cs +++ b/Source/FikaAmazonAPI/Services/FbaInventoryService.cs @@ -4,13 +4,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaInventoryService : RequestService { - public FbaInventoryService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaInventoryService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaOutboundService.cs b/Source/FikaAmazonAPI/Services/FbaOutboundService.cs index ababfeb3..ef20da54 100644 --- a/Source/FikaAmazonAPI/Services/FbaOutboundService.cs +++ b/Source/FikaAmazonAPI/Services/FbaOutboundService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaOutboundService : RequestService { - public FbaOutboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaOutboundService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs b/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs index 75398c54..6dae01fb 100644 --- a/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs +++ b/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaSmallandLightService : RequestService { - public FbaSmallandLightService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaSmallandLightService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory,IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential,loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FeedService.cs b/Source/FikaAmazonAPI/Services/FeedService.cs index f8b2f2d6..3b462531 100644 --- a/Source/FikaAmazonAPI/Services/FeedService.cs +++ b/Source/FikaAmazonAPI/Services/FeedService.cs @@ -12,6 +12,7 @@ using System.Net; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.Utils.Constants; namespace FikaAmazonAPI.Services @@ -19,7 +20,7 @@ namespace FikaAmazonAPI.Services public class FeedService : RequestService { - public FeedService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FeedService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FinancialService.cs b/Source/FikaAmazonAPI/Services/FinancialService.cs index 0d48710c..4269f021 100644 --- a/Source/FikaAmazonAPI/Services/FinancialService.cs +++ b/Source/FikaAmazonAPI/Services/FinancialService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FinancialService : RequestService { - public FinancialService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FinancialService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs index 0ecd4ac2..9fab6f67 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FulFillmentInboundService : RequestService { - public FulFillmentInboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FulFillmentInboundService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs b/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs index db13474e..948761d4 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FulFillmentInboundServicev20240320 : RequestService { - public FulFillmentInboundServicev20240320(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FulFillmentInboundServicev20240320(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs b/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs index e4569f8b..64be45af 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FulFillmentOutboundService : RequestService { - public FulFillmentOutboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FulFillmentOutboundService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory,IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs b/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs index f225a726..c4988332 100644 --- a/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs +++ b/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs @@ -5,13 +5,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class MerchantFulfillmentService : RequestService { - public MerchantFulfillmentService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public MerchantFulfillmentService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/MessagingService.cs b/Source/FikaAmazonAPI/Services/MessagingService.cs index cdc35865..9c6ed8bf 100644 --- a/Source/FikaAmazonAPI/Services/MessagingService.cs +++ b/Source/FikaAmazonAPI/Services/MessagingService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class MessagingService : RequestService { - public MessagingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public MessagingService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/NotificationService.cs b/Source/FikaAmazonAPI/Services/NotificationService.cs index 85b8374c..3753b61b 100644 --- a/Source/FikaAmazonAPI/Services/NotificationService.cs +++ b/Source/FikaAmazonAPI/Services/NotificationService.cs @@ -10,6 +10,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.AmazonSpApiSDK.Models.Token.CacheTokenData; using static FikaAmazonAPI.Utils.Constants; @@ -17,7 +18,7 @@ namespace FikaAmazonAPI.Services { public class NotificationService : RequestService { - public NotificationService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public NotificationService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/OrderService.cs b/Source/FikaAmazonAPI/Services/OrderService.cs index 81dd14d6..dabd8202 100644 --- a/Source/FikaAmazonAPI/Services/OrderService.cs +++ b/Source/FikaAmazonAPI/Services/OrderService.cs @@ -7,12 +7,13 @@ using System.Threading; using System.Threading.Tasks; using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class OrderService : RequestService { - public OrderService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public OrderService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ProductFeeService.cs b/Source/FikaAmazonAPI/Services/ProductFeeService.cs index cc2fac92..9f74bea1 100644 --- a/Source/FikaAmazonAPI/Services/ProductFeeService.cs +++ b/Source/FikaAmazonAPI/Services/ProductFeeService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ProductFeeService : RequestService { - public ProductFeeService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ProductFeeService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ProductPricingService.cs b/Source/FikaAmazonAPI/Services/ProductPricingService.cs index 387b4ba4..d17da835 100644 --- a/Source/FikaAmazonAPI/Services/ProductPricingService.cs +++ b/Source/FikaAmazonAPI/Services/ProductPricingService.cs @@ -8,13 +8,14 @@ using System.Threading.Tasks; using FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing.v2022_05_01; using FikaAmazonAPI.Parameter.ProductPricing.v2022_05_01; +using Microsoft.Extensions.Logging; using Price = FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing.Price; namespace FikaAmazonAPI.Services { public class ProductPricingService : RequestService { - public ProductPricingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ProductPricingService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ProductTypeService.cs b/Source/FikaAmazonAPI/Services/ProductTypeService.cs index de50d975..6bacb4e1 100644 --- a/Source/FikaAmazonAPI/Services/ProductTypeService.cs +++ b/Source/FikaAmazonAPI/Services/ProductTypeService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ProductTypeService : RequestService { - public ProductTypeService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ProductTypeService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ReportService.cs b/Source/FikaAmazonAPI/Services/ReportService.cs index 97897781..c15ca639 100644 --- a/Source/FikaAmazonAPI/Services/ReportService.cs +++ b/Source/FikaAmazonAPI/Services/ReportService.cs @@ -10,13 +10,14 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.Utils.Constants; namespace FikaAmazonAPI.Services { public class ReportService : RequestService { - public ReportService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ReportService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } #region GetReport diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index 2750f3e6..1339ef1c 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -45,20 +45,16 @@ protected string ApiBaseUrl private ILogger? _logger = null; - public RequestService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : this(amazonCredential, rateLimitingHandler) - { - _logger = loggerFactory?.CreateLogger(); - } - /// /// Creates request base service /// /// A credential containing the API user's information and cached token values /// A singleton designed to handle concurrent requests based on the rate limiting policy - public RequestService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) + public RequestService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) { RateLimitingHandler = rateLimitingHandler ?? new RateLimitingHandler(); + _logger = loggerFactory?.CreateLogger(); AmazonCredential = amazonCredential; AmazonSandboxUrl = amazonCredential.MarketPlace.Region.SandboxHostUrl; AmazonProductionUrl = amazonCredential.MarketPlace.Region.HostUrl; diff --git a/Source/FikaAmazonAPI/Services/RestrictionService.cs b/Source/FikaAmazonAPI/Services/RestrictionService.cs index ca847556..aeca705b 100644 --- a/Source/FikaAmazonAPI/Services/RestrictionService.cs +++ b/Source/FikaAmazonAPI/Services/RestrictionService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class RestrictionService : RequestService { - public RestrictionService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public RestrictionService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/SalesService.cs b/Source/FikaAmazonAPI/Services/SalesService.cs index 921e47a9..7b009c10 100644 --- a/Source/FikaAmazonAPI/Services/SalesService.cs +++ b/Source/FikaAmazonAPI/Services/SalesService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class SalesService : RequestService { - public SalesService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public SalesService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/SellerService.cs b/Source/FikaAmazonAPI/Services/SellerService.cs index e37e8f7c..f610b668 100644 --- a/Source/FikaAmazonAPI/Services/SellerService.cs +++ b/Source/FikaAmazonAPI/Services/SellerService.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class SellerService : RequestService { - public SellerService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public SellerService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ServicesService.cs b/Source/FikaAmazonAPI/Services/ServicesService.cs index 8a379c62..fc2b538f 100644 --- a/Source/FikaAmazonAPI/Services/ServicesService.cs +++ b/Source/FikaAmazonAPI/Services/ServicesService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ServicesService : RequestService { - public ServicesService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ServicesService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs b/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs index 99d616cc..e5f7347e 100644 --- a/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs +++ b/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public partial class ShipmentInvoicingService : RequestService { - public ShipmentInvoicingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ShipmentInvoicingService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ShippingService.cs b/Source/FikaAmazonAPI/Services/ShippingService.cs index ff8356fb..55511e82 100644 --- a/Source/FikaAmazonAPI/Services/ShippingService.cs +++ b/Source/FikaAmazonAPI/Services/ShippingService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ShippingService : RequestService { - public ShippingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ShippingService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs b/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs index 3862fcb1..2cd54488 100644 --- a/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs +++ b/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ShippingServiceV2 : RequestService { - public ShippingServiceV2(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ShippingServiceV2(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/SolicitationService.cs b/Source/FikaAmazonAPI/Services/SolicitationService.cs index 09320859..80fbcee7 100644 --- a/Source/FikaAmazonAPI/Services/SolicitationService.cs +++ b/Source/FikaAmazonAPI/Services/SolicitationService.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class SolicitationService : RequestService { - public SolicitationService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public SolicitationService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory,rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/TokenService.cs b/Source/FikaAmazonAPI/Services/TokenService.cs index ee0a18b2..d8f68e42 100644 --- a/Source/FikaAmazonAPI/Services/TokenService.cs +++ b/Source/FikaAmazonAPI/Services/TokenService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class TokenService : RequestService { - public TokenService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public TokenService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/UploadService.cs b/Source/FikaAmazonAPI/Services/UploadService.cs index 83ada89a..59fcfadf 100644 --- a/Source/FikaAmazonAPI/Services/UploadService.cs +++ b/Source/FikaAmazonAPI/Services/UploadService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class UploadService : RequestService { - public UploadService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public UploadService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs b/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs index cd3d114c..603217d7 100644 --- a/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs +++ b/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class VendorDirectFulfillmentOrderService : RequestService { - public VendorDirectFulfillmentOrderService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public VendorDirectFulfillmentOrderService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/VendorOrders.cs b/Source/FikaAmazonAPI/Services/VendorOrders.cs index 96da5ef1..8f49adbf 100644 --- a/Source/FikaAmazonAPI/Services/VendorOrders.cs +++ b/Source/FikaAmazonAPI/Services/VendorOrders.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class VendorOrderService : RequestService { - public VendorOrderService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public VendorOrderService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs b/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs index 5c732de9..7656b538 100644 --- a/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs +++ b/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class VendorTransactionStatusService : RequestService { - public VendorTransactionStatusService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public VendorTransactionStatusService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { }