From 5ffb8ec6a203f4115131486365c9b77da68da47a Mon Sep 17 00:00:00 2001 From: dmelendez35 Date: Thu, 28 Nov 2024 14:30:28 -0600 Subject: [PATCH 1/2] Remove camel case from parameters properties, moce cammel case conversion logic to ParameterBased class --- .../FulFillmentInbound/ParameterGetLabels.cs | 2 +- .../v20240320/ParameterListPrepDetails.cs | 4 ++-- .../v20240320/ParameterListShipmentBase.cs | 2 +- .../ParameterListTransportationOptions.cs | 6 +++--- .../FikaAmazonAPI/Parameter/ParameterBased.cs | 4 ++-- .../Services/FulFillmentInboundService.cs | 2 +- .../FulFillmentInboundServicev20240320.cs | 18 +++++++++--------- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetLabels.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetLabels.cs index 1af86bea..bdfedff8 100644 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetLabels.cs +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetLabels.cs @@ -7,7 +7,7 @@ namespace FikaAmazonAPI.Parameter.FulFillmentInbound public class ParameterGetLabels : ParameterBased { public string MarketplaceId { get; set; } - public string shipmentId { get; set; } + public string ShipmentId { get; set; } public PageType PageType { get; set; } public LabelType LabelType { get; set; } public int? NumberOfPackages { get; set; } diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListPrepDetails.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListPrepDetails.cs index e25296b8..86764c62 100644 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListPrepDetails.cs +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListPrepDetails.cs @@ -5,8 +5,8 @@ namespace FikaAmazonAPI.Parameter.FulFillmentInbound.v20240320 { public class ParameterListPrepDetails : ParameterBased { - public string marketplaceId { get; set; } + public string MarketplaceId { get; set; } - public ICollection mskus { get; set; } + public ICollection Mskus { get; set; } } } diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListShipmentBase.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListShipmentBase.cs index bee463a7..3ca31cda 100644 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListShipmentBase.cs +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListShipmentBase.cs @@ -4,6 +4,6 @@ public class ParameterListShipmentBase : PaginationParameter { public string InboundPlanId { get; set; } public string ShipmentId { get; set; } - public string paginationToken { get; set; } + public string PaginationToken { get; set; } } } diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListTransportationOptions.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListTransportationOptions.cs index 2ac482e6..65366dbe 100644 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListTransportationOptions.cs +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/v20240320/ParameterListTransportationOptions.cs @@ -2,8 +2,8 @@ { public class ParameterListTransportationOptions : PaginationParameter { - public string placementOptionId { get; set; } - public string shipmentId { get; set; } - public string paginationToken { get; set; } + public string PlacementOptionId { get; set; } + public string ShipmentId { get; set; } + public string PaginationToken { get; set; } } } diff --git a/Source/FikaAmazonAPI/Parameter/ParameterBased.cs b/Source/FikaAmazonAPI/Parameter/ParameterBased.cs index 25e7cd5d..bc77e20f 100644 --- a/Source/FikaAmazonAPI/Parameter/ParameterBased.cs +++ b/Source/FikaAmazonAPI/Parameter/ParameterBased.cs @@ -76,8 +76,8 @@ public virtual List> getParameters() output = JsonConvert.SerializeObject(value, settings); } - - var propName = p.Name; + // Convert to cammelCase to avoid issues with properties not being properly mapped + var propName = char.ToLowerInvariant(p.Name[0]) + p.Name.Substring(1); queryParameters.Add(new KeyValuePair(propName, output)); } diff --git a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs index d2d0b160..21df238b 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs @@ -194,7 +194,7 @@ public LabelDownloadURL GetLabels(ParameterGetLabels parameterGetLabels) => public async Task GetLabelsAsync(ParameterGetLabels parameterGetLabels, CancellationToken cancellationToken = default) { var parameter = parameterGetLabels.getParameters(); - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetLabels(parameterGetLabels.shipmentId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetLabels(parameterGetLabels.ShipmentId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetLabels, cancellationToken); if (response != null && response.Payload != null) diff --git a/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs b/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs index e567d692..d0e5d360 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs @@ -463,7 +463,7 @@ public async Task> ListShipmentBoxesAsync(ParameterListShipmentBase pa var nextToken = response.Pagination.NextToken; while (!string.IsNullOrEmpty(nextToken) && (!parameterListShipmentBase.maxPages.HasValue || totalPages < parameterListShipmentBase.maxPages.Value)) { - parameterListShipmentBase.paginationToken = nextToken; + parameterListShipmentBase.PaginationToken = nextToken; var getItemNextPage = await ListShipmentBoxesByNextTokenAsync(parameterListShipmentBase, cancellationToken); list.AddRange(getItemNextPage.Boxes); nextToken = getItemNextPage.Pagination?.NextToken; @@ -513,7 +513,7 @@ public async Task> ListShipmentContentUpdatePreviewsA var nextToken = response.Pagination.NextToken; while (!string.IsNullOrEmpty(nextToken) && (!parameterListShipmentBase.maxPages.HasValue || totalPages < parameterListShipmentBase.maxPages.Value)) { - parameterListShipmentBase.paginationToken = nextToken; + parameterListShipmentBase.PaginationToken = nextToken; var getItemNextPage = await ListShipmentContentUpdatePreviewsByNextTokenAsync(parameterListShipmentBase, cancellationToken); list.AddRange(getItemNextPage.ContentUpdatePreviews); nextToken = getItemNextPage.Pagination?.NextToken; @@ -596,7 +596,7 @@ public async Task> ListDeliveryWindowOptionsAsync(Par var nextToken = response.Pagination.NextToken; while (!string.IsNullOrEmpty(nextToken) && (!parameterListShipmentBase.maxPages.HasValue || totalPages < parameterListShipmentBase.maxPages.Value)) { - parameterListShipmentBase.paginationToken = nextToken; + parameterListShipmentBase.PaginationToken = nextToken; var getItemNextPage = await ListDeliveryWindowOptionsByNextTokenAsync(parameterListShipmentBase, cancellationToken); list.AddRange(getItemNextPage.DeliveryWindowOptions); nextToken = getItemNextPage.Pagination?.NextToken; @@ -646,7 +646,7 @@ public async Task> ListShipmentItemsAsync(ParameterListShipmentBase p var nextToken = response.Pagination.NextToken; while (!string.IsNullOrEmpty(nextToken) && (!parameterListShipmentBase.maxPages.HasValue || totalPages < parameterListShipmentBase.maxPages.Value)) { - parameterListShipmentBase.paginationToken = nextToken; + parameterListShipmentBase.PaginationToken = nextToken; var getItemNextPage = await ListShipmentItemsByNextTokenAsync(parameterListShipmentBase, cancellationToken); list.AddRange(getItemNextPage.Items); nextToken = getItemNextPage.Pagination?.NextToken; @@ -700,7 +700,7 @@ public async Task> ListShipmentPalletsAsync(ParameterListShipmentBa var nextToken = response.Pagination.NextToken; while (!string.IsNullOrEmpty(nextToken) && (!parameterListShipmentBase.maxPages.HasValue || totalPages < parameterListShipmentBase.maxPages.Value)) { - parameterListShipmentBase.paginationToken = nextToken; + parameterListShipmentBase.PaginationToken = nextToken; var getItemNextPage = await ListShipmentPalletsByNextTokenAsync(parameterListShipmentBase, cancellationToken); list.AddRange(getItemNextPage.Pallets); nextToken = getItemNextPage.Pagination?.NextToken; @@ -751,7 +751,7 @@ public async Task> GetSelfShipAppoint var nextToken = response.Pagination.NextToken; while (!string.IsNullOrEmpty(nextToken) && (!parameterListShipmentBase.maxPages.HasValue || totalPages < parameterListShipmentBase.maxPages.Value)) { - parameterListShipmentBase.paginationToken = nextToken; + parameterListShipmentBase.PaginationToken = nextToken; var getItemNextPage = await GetSelfShipAppointmentSlotsByNextTokenAsync(parameterListShipmentBase, cancellationToken); list.Add(getItemNextPage.SelfShipAppointmentSlotsAvailability); nextToken = getItemNextPage.Pagination?.NextToken; @@ -846,7 +846,7 @@ public async Task> ListTransportationOptionsAsync(str var nextToken = response.Pagination.NextToken; while (!string.IsNullOrEmpty(nextToken) && (!parameterListTransportationOptions.maxPages.HasValue || totalPages < parameterListTransportationOptions.maxPages.Value)) { - parameterListTransportationOptions.paginationToken = nextToken; + parameterListTransportationOptions.PaginationToken = nextToken; var getItemNextPage = await ListTransportationOptionsByNextTokenAsync(inboundPlanId, parameterListTransportationOptions, cancellationToken); list.AddRange(getItemNextPage.TransportationOptions); nextToken = getItemNextPage.Pagination?.NextToken; @@ -929,9 +929,9 @@ public List ListPrepDetails(ParameterListPrepDetails parameterLi public async Task> ListPrepDetailsAsync(ParameterListPrepDetails parameterListPrepDetails, CancellationToken cancellationToken = default) { - if (string.IsNullOrWhiteSpace(parameterListPrepDetails.marketplaceId)) + if (string.IsNullOrWhiteSpace(parameterListPrepDetails.MarketplaceId)) { - parameterListPrepDetails.marketplaceId = AmazonCredential.MarketPlace.ID; + parameterListPrepDetails.MarketplaceId = AmazonCredential.MarketPlace.ID; } var parameter = parameterListPrepDetails.getParameters(); From 5dcd1bca647d0c8031f129ff3354854c09b2749e Mon Sep 17 00:00:00 2001 From: dmelendez35 Date: Thu, 28 Nov 2024 14:31:18 -0600 Subject: [PATCH 2/2] fix example --- Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs b/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs index 0cbfcdef..58232a2b 100644 --- a/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs +++ b/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs @@ -75,7 +75,7 @@ public void GetFulFillmentInboundLabelsFromWebCreationSample(string shipmentId,i var labelParams = new ParameterGetLabels() { PageType = PageType.PackageLabel_Letter_6, - shipmentId = shipmentId, + ShipmentId = shipmentId, LabelType = LabelType.SELLER_LABEL, PageSize = boxCount };