diff --git a/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs b/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs index 0cbfcdef..cc37b801 100644 --- a/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs +++ b/Source/FikaAmazonAPI.SampleCode/FulFillmentInboundSample.cs @@ -1,17 +1,4 @@ -using FikaAmazonAPI.AmazonSpApiSDK.Models.FbaSmallandLight; -using FikaAmazonAPI.AmazonSpApiSDK.Models.MerchantFulfillment; -using FikaAmazonAPI.AmazonSpApiSDK.Models.Sellers; -using FikaAmazonAPI.AmazonSpApiSDK.Models.Shipping; -using FikaAmazonAPI.Parameter.FulFillmentInbound; -using FikaAmazonAPI.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using static FikaAmazonAPI.Utils.Constants; - -namespace FikaAmazonAPI.SampleCode +namespace FikaAmazonAPI.SampleCode { public class FulFillmentInboundSample { @@ -21,68 +8,7 @@ public FulFillmentInboundSample(AmazonConnection amazonConnection) this.amazonConnection = amazonConnection; } - public void GetInboundGuidance() - { - var parm = new Parameter.FulFillmentInbound.ParameterGetInboundGuidance() { - MarketplaceId= MarketPlace.UnitedArabEmirates.ID, - ASINList=new List { "B071XVSXRL" } - }; - amazonConnection.FulFillmentInbound.GetInboundGuidance(parm); - } - - public void GetPrepInstructions() - { - var parm = new Parameter.FulFillmentInbound.ParameterGetPrepInstructions() { - ShipToCountryCode = "AE", - MarketplaceId= MarketPlace.UnitedArabEmirates.ID, - ASINList =new List { "B071XVSXRL" } - }; - amazonConnection.FulFillmentInbound.GetPrepInstructions(parm); - } - - public void CreateShipmentPlan() - { - FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.CreateInboundShipmentPlanRequest oCreateInboundShipmentPlanRequest = new FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.CreateInboundShipmentPlanRequest(); - - oCreateInboundShipmentPlanRequest.ShipToCountryCode = "AE"; - oCreateInboundShipmentPlanRequest.LabelPrepPreference = FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.LabelPrepPreference.SELLERLABEL; - - - oCreateInboundShipmentPlanRequest.ShipFromAddress = new FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.Address(); - oCreateInboundShipmentPlanRequest.ShipFromAddress.AddressLine1 = "Add"; - oCreateInboundShipmentPlanRequest.ShipFromAddress.AddressLine2 = "ADD2"; - oCreateInboundShipmentPlanRequest.ShipFromAddress.City = "City"; - oCreateInboundShipmentPlanRequest.ShipFromAddress.CountryCode = "AE"; - oCreateInboundShipmentPlanRequest.ShipFromAddress.PostalCode = "0000"; - oCreateInboundShipmentPlanRequest.ShipFromAddress.Name = "Name"; - - - - oCreateInboundShipmentPlanRequest.InboundShipmentPlanRequestItems = new FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.InboundShipmentPlanRequestItemList(); - FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.InboundShipmentPlanRequestItem oInboundShipmentPlanRequestItem = new FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.InboundShipmentPlanRequestItem(); - oInboundShipmentPlanRequestItem.SellerSKU = "16118"; - oInboundShipmentPlanRequestItem.ASIN = "B08BXH6234"; - oInboundShipmentPlanRequestItem.Quantity = 1; - oInboundShipmentPlanRequestItem.Condition = FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound.Condition.NewItem; - - oCreateInboundShipmentPlanRequest.InboundShipmentPlanRequestItems.Add(oInboundShipmentPlanRequestItem); - var oResult = amazonConnection.FulFillmentInbound.CreateInboundShipmentPlan(oCreateInboundShipmentPlanRequest); - - } - - public void GetFulFillmentInboundLabelsFromWebCreationSample(string shipmentId,int boxCount) - { - var labelParams = new ParameterGetLabels() - { - PageType = PageType.PackageLabel_Letter_6, - shipmentId = shipmentId, - LabelType = LabelType.SELLER_LABEL, - PageSize = boxCount - }; - - var labels = amazonConnection.FulFillmentInbound.GetLabels(labelParams); - - } + // ToDo add new Samples } } diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetListInboundPlans.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetListInboundPlans.cs index 836dddf0..ad81b54b 100644 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetListInboundPlans.cs +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetListInboundPlans.cs @@ -1,11 +1,9 @@ using FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound; -using FikaAmazonAPI.Search; namespace FikaAmazonAPI.Parameter.FulFillmentInbound { - public class ParameterGetListInboundPlans : ParameterBased + public class ParameterGetListInboundPlans : PaginationParameter { - public int? PageSize { get; set; } public string PaginationToken { get; set; } public Status? Status { get; set; } public SortBy? SortBy { get; set; } diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetShipmentItems.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetShipmentItems.cs deleted file mode 100644 index 67fd2a3a..00000000 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetShipmentItems.cs +++ /dev/null @@ -1,17 +0,0 @@ -using FikaAmazonAPI.Search; -using System; -using static FikaAmazonAPI.Utils.Constants; - -namespace FikaAmazonAPI.Parameter.FulFillmentInbound -{ - public class ParameterGetShipmentItems : ParameterBased - { - public DateTime? LastUpdatedAfter { get; set; } - public DateTime? LastUpdatedBefore { get; set; } - public QueryType QueryType { get; set; } - public string NextToken { get; set; } - public string MarketplaceId { get; set; } - public string ShipmentId { get; set; } - public int? MaxNumberOfPages { get; set; } - } -} diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetShipments.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetShipments.cs deleted file mode 100644 index c4aadc0d..00000000 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterGetShipments.cs +++ /dev/null @@ -1,19 +0,0 @@ -using FikaAmazonAPI.Search; -using System; -using System.Collections.Generic; -using static FikaAmazonAPI.Utils.Constants; -using FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound; - -namespace FikaAmazonAPI.Parameter.FulFillmentInbound -{ - public class ParameterGetShipments : ParameterBased - { - public ICollection ShipmentStatusList { get; set; } - public ICollection ShipmentIdList { get; set; } - public DateTime? LastUpdatedAfter { get; set; } - public DateTime? LastUpdatedBefore { get; set; } - public QueryType QueryType { get; set; } - public string NextToken { get; set; } - public string MarketplaceId { get; set; } - } -} diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListInboundPlan.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListInboundPlan.cs index 6d2fc3f4..c4fffee5 100644 --- a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListInboundPlan.cs +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListInboundPlan.cs @@ -1,11 +1,8 @@ -using FikaAmazonAPI.Search; - -namespace FikaAmazonAPI.Parameter.FulFillmentInbound +namespace FikaAmazonAPI.Parameter.FulFillmentInbound { - public class ParameterListInboundPlan : ParameterBased + public class ParameterListInboundPlan : PaginationParameter { public string InboundPlanId { get; set; } - public int? PageSize { get; set; } public string PaginationToken { get; set; } } } diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListPackingGroupItems.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListPackingGroupItems.cs new file mode 100644 index 00000000..0a65ca6b --- /dev/null +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListPackingGroupItems.cs @@ -0,0 +1,12 @@ +using FikaAmazonAPI.Search; + +namespace FikaAmazonAPI.Parameter.FulFillmentInbound +{ + public class ParameterListPackingGroupItems : PaginationParameter + { + public string InboundPlanId { get; set; } + public string PackingOptionId { get; set; } + public string PackingGroupId { get; set; } + public string PaginationToken { get; set; } + } +} diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListTransportationOptions.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListTransportationOptions.cs new file mode 100644 index 00000000..956eb469 --- /dev/null +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterListTransportationOptions.cs @@ -0,0 +1,9 @@ +namespace FikaAmazonAPI.Parameter.FulFillmentInbound +{ + public class ParameterListTransportationOptions : PaginationParameter + { + public string PlacementOptionId { get; set; } + public string ShipmentId { get; set; } + public string PaginationToken { get; set; } + } +} diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterUpdateItemComplianceDetails.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterUpdateItemComplianceDetails.cs new file mode 100644 index 00000000..a79643a7 --- /dev/null +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParameterUpdateItemComplianceDetails.cs @@ -0,0 +1,9 @@ +using FikaAmazonAPI.Search; + +namespace FikaAmazonAPI.Parameter.FulFillmentInbound +{ + public class ParameterUpdateItemComplianceDetails : ParameterBased + { + public string MarketplaceId { get; set; } + } +} diff --git a/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParematerListItemComplianceDetails.cs b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParematerListItemComplianceDetails.cs new file mode 100644 index 00000000..f45777d9 --- /dev/null +++ b/Source/FikaAmazonAPI/Parameter/FulFillmentInbound/ParematerListItemComplianceDetails.cs @@ -0,0 +1,11 @@ +using FikaAmazonAPI.Search; +using System.Collections.Generic; + +namespace FikaAmazonAPI.Parameter.FulFillmentInbound +{ + public class ParematerListItemComplianceDetails : ParameterBased + { + public ICollection MSkus { get; set; } + public string MarketplaceId { get; set; } + } +} diff --git a/Source/FikaAmazonAPI/Services/ApiUrls.cs b/Source/FikaAmazonAPI/Services/ApiUrls.cs index 56c67a97..25ce3de6 100644 --- a/Source/FikaAmazonAPI/Services/ApiUrls.cs +++ b/Source/FikaAmazonAPI/Services/ApiUrls.cs @@ -107,9 +107,28 @@ public static string CreateInboundPlan public static string ListPackingOptions(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/packingOptions"; public static string GeneratePackingOptions(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/packingOptions"; public static string ConfirmPackingOption(string inboundPlanId, string packingOptionId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/packingOptions/{packingOptionId}/confirmation"; - - - + public static string ListPackingGroupItems(string inboundPlanId, string packingOptionId, string packingGroupId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/packingOptions/{packingOptionId}/packingGroups/{packingGroupId}/items"; + public static string ListInboundPlanPallets(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/pallets"; + public static string ListPlacementOptions(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/placementOptions"; + public static string GeneratePlacementOptions(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/placementOptions"; + public static string ConfirmPlacementOption(string inboundPlanId, string placementOptionId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/placementOptions/{placementOptionId}/confirmation"; + public static string GetShipment(string inboundPlanId, string shipmentId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}"; + public static string GetDeliveryChallanDocument(string inboundPlanId, string shipmentId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/deliveryChallanDocument"; + public static string UpdateShipmentDeliveryWindow(string inboundPlanId, string shipmentId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/deliveryWindow"; + public static string GetSelfShipAppointmentSlots(string inboundPlanId, string shipmentId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentSlots"; + public static string GenerateSelfShipAppointmentSlots(string inboundPlanId, string shipmentId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentSlots"; + public static string CancelSelfShipAppointment(string inboundPlanId, string shipmentId, string slotId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentSlots/{slotId}/cancellation"; + public static string ScheduleSelfShipAppointment(string inboundPlanId, string shipmentId, string slotId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/selfShipAppointmentSlots/{slotId}/schedule"; + public static string UpdateShipmentTrackingDetails(string inboundPlanId, string shipmentId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/shipments/{shipmentId}/trackingDetails"; + public static string ListTransportationOptions(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/transportationOptions"; + public static string GenerateTransportationOptions(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/transportationOptions"; + public static string ConfirmTransportationOptions(string inboundPlanId) => $"{_resourceBaseUrl}/inboundPlans/{inboundPlanId}/transportationOptions/confirmation"; + public static string ListItemComplianceDetails() => $"{_resourceBaseUrl}/items/compliance"; + public static string UpdateItemComplianceDetails() => $"{_resourceBaseUrl}/items/compliance"; + public static string GetInboundOperationStatus(string operationId) => $"{_resourceBaseUrl}/operations/{operationId}"; + + + public static string GetInboundGuidance { get => $"{_resourceBaseUrl}/itemsGuidance"; diff --git a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs index 819d5d24..71388f37 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs @@ -1,7 +1,9 @@ using FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound; +using FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentOutbound; +using FikaAmazonAPI.AmazonSpApiSDK.Models.Shipping; using FikaAmazonAPI.Parameter.FulFillmentInbound; using FikaAmazonAPI.Utils; -using System; +using RestSharp; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -15,18 +17,47 @@ public FulFillmentInboundService(AmazonCredential amazonCredential) : base(amazo } - public ListInboundPlansResponse GetListInboundPlans(ParameterGetListInboundPlans parameterGetListInboundPlans) => + #region GetListInboundPlans + public List GetListInboundPlans(ParameterGetListInboundPlans parameterGetListInboundPlans) => Task.Run(() => GetListInboundPlansAsync(parameterGetListInboundPlans)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task GetListInboundPlansAsync(ParameterGetListInboundPlans parameterGetListInboundPlans, CancellationToken cancellationToken = default) + public async Task> GetListInboundPlansAsync(ParameterGetListInboundPlans parameterGetListInboundPlans, CancellationToken cancellationToken = default) { var parameter = parameterGetListInboundPlans.getParameters(); await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetListInboundPlans, RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); - return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetListInboundPlans, cancellationToken); + List list = new List(); + + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetListInboundPlans, cancellationToken); + list.AddRange(response.InboundPlans); + + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterGetListInboundPlans.maxPages.HasValue || totalPages < parameterGetListInboundPlans.maxPages.Value)) + { + parameterGetListInboundPlans.PaginationToken = nextToken; + var getItemNextPage = await GetListInboundPlansByNextTokenAsync(parameterGetListInboundPlans, cancellationToken); + list.AddRange(getItemNextPage.InboundPlans); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } + + return list; } + private async Task GetListInboundPlansByNextTokenAsync(ParameterGetListInboundPlans parameterGetListInboundPlans, CancellationToken cancellationToken = default) + { + var parameter = parameterGetListInboundPlans.getParameters(); + + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetListInboundPlans, RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetListInboundPlans, cancellationToken); + } + #endregion + #region CreateInboundPlan public CreateInboundPlanResponse CreateInboundPlan(CreateInboundPlanRequest createInboundPlanRequest) => Task.Run(() => CreateInboundPlanAsync(createInboundPlanRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); @@ -35,8 +66,9 @@ public async Task CreateInboundPlanAsync(CreateInboun await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.CreateInboundPlan, RestSharp.Method.Post, postJsonObj: createInboundPlanRequest, cancellationToken: cancellationToken); return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_CreateInboundPlan, cancellationToken); } + #endregion - + #region GetInboundPlan public InboundPlan GetInboundPlan(string inboundPlanId) => Task.Run(() => GetInboundPlanAsync(inboundPlanId)).ConfigureAwait(false).GetAwaiter().GetResult(); @@ -45,18 +77,48 @@ public async Task GetInboundPlanAsync(string inboundPlanId, Cancell await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetInboundPlan(inboundPlanId), RestSharp.Method.Get, null, cancellationToken: cancellationToken); return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetInboundPlan, cancellationToken); } + #endregion - - public ListInboundPlanBoxesResponse ListInboundPlanBoxes(ParameterListInboundPlan parameterListInboundPlan) => + #region ListInboundPlanBoxes + public List ListInboundPlanBoxes(ParameterListInboundPlan parameterListInboundPlan) => Task.Run(() => ListInboundPlanBoxesAsync(parameterListInboundPlan)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task ListInboundPlanBoxesAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) + public async Task> ListInboundPlanBoxesAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { var parameter = parameterListInboundPlan.getParameters(); await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListInboundPlanBoxes(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); - return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanBoxesResponse, cancellationToken); + + List list = new List(); + + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanBoxes, cancellationToken); + list.AddRange(response.Boxes); + + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListInboundPlan.maxPages.HasValue || totalPages < parameterListInboundPlan.maxPages.Value)) + { + parameterListInboundPlan.PaginationToken = nextToken; + var getItemNextPage = await GetListInboundPlanBoxesByNextTokenAsync(parameterListInboundPlan, cancellationToken); + list.AddRange(getItemNextPage.Boxes); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } + + return list; + } + + private async Task GetListInboundPlanBoxesByNextTokenAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) + { + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListInboundPlanBoxes(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanBoxes, cancellationToken); } + #endregion + #region CancelInboundPlan public CancelInboundPlanResponse CancelInboundPlan(string inboundPlanId) => Task.Run(() => CancelInboundPlanAsync(inboundPlanId)).ConfigureAwait(false).GetAwaiter().GetResult(); @@ -65,39 +127,99 @@ public async Task CancelInboundPlanAsync(string inbou await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.CancelInboundPlan(inboundPlanId), RestSharp.Method.Put, null, cancellationToken: cancellationToken); return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_CancelInboundPlan, cancellationToken); } + #endregion - public ListInboundPlanItemsResponse ListInboundPlanItems(ParameterListInboundPlan parameterListInboundPlan) => + #region ListInboundPlanItems + public List ListInboundPlanItems(ParameterListInboundPlan parameterListInboundPlan) => Task.Run(() => ListInboundPlanItemsAsync(parameterListInboundPlan)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task ListInboundPlanItemsAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) + public async Task> ListInboundPlanItemsAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { var parameter = parameterListInboundPlan.getParameters(); await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListInboundPlanItems(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); - return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanItems, cancellationToken); + + List list = new List(); + + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanItems, cancellationToken); + list.AddRange(response.Items); + + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListInboundPlan.maxPages.HasValue || totalPages < parameterListInboundPlan.maxPages.Value)) + { + parameterListInboundPlan.PaginationToken = nextToken; + var getItemNextPage = await ListInboundPlanItemsByNextTokenAsync(parameterListInboundPlan, cancellationToken); + list.AddRange(getItemNextPage.Items); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } + + return list; } + private async Task ListInboundPlanItemsByNextTokenAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) + { + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListInboundPlanItems(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanItems, cancellationToken); + } + #endregion + #region SetPackingInformation public SetPackingInformationResponse SetPackingInformation(string inboundPlanId, SetPackingInformationRequest setPackingInformationRequest) => Task.Run(() => SetPackingInformationAsync(inboundPlanId, setPackingInformationRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); public async Task SetPackingInformationAsync(string inboundPlanId, SetPackingInformationRequest setPackingInformationRequest, CancellationToken cancellationToken = default) { await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.SetPackingInformation(inboundPlanId), RestSharp.Method.Post, postJsonObj: setPackingInformationRequest, cancellationToken: cancellationToken); - return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_CreateInboundPlan, cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_SetPackingInformation, cancellationToken); } + #endregion - - public ListPackingOptionsResponse ListPackingOptions(ParameterListInboundPlan parameterListInboundPlan) => + #region ListPackingOptions + public List ListPackingOptions(ParameterListInboundPlan parameterListInboundPlan) => Task.Run(() => ListPackingOptionsAsync(parameterListInboundPlan)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task ListPackingOptionsAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) + public async Task> ListPackingOptionsAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { var parameter = parameterListInboundPlan.getParameters(); await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListPackingOptions(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); - return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListPackingOptions, cancellationToken); + + List list = new List(); + + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListPackingOptions, cancellationToken); + list.AddRange(response.PackingOptions); + + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListInboundPlan.maxPages.HasValue || totalPages < parameterListInboundPlan.maxPages.Value)) + { + parameterListInboundPlan.PaginationToken = nextToken; + var getItemNextPage = await ListPackingOptionsAsyncByNextTokenAsync(parameterListInboundPlan, cancellationToken); + list.AddRange(getItemNextPage.PackingOptions); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } + + return list; + } + private async Task ListPackingOptionsAsyncByNextTokenAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) + { + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListPackingOptions(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListPackingOptions, cancellationToken); + } + #endregion + #region GeneratePackingOptions public GeneratePackingOptionsResponse GeneratePackingOptions(string inboundPlanId) => Task.Run(() => GeneratePackingOptionsAsync(inboundPlanId)).ConfigureAwait(false).GetAwaiter().GetResult(); @@ -106,287 +228,371 @@ public async Task GeneratePackingOptionsAsync(st await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GeneratePackingOptions(inboundPlanId), RestSharp.Method.Post, null, cancellationToken: cancellationToken); return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GeneratePackingOptions, cancellationToken); } + #endregion - + #region ConfirmPackingOption public ConfirmPackingOptionResponse ConfirmPackingOption(ParameterConfirmPackingOption parameterConfirmPackingOption) => Task.Run(() => ConfirmPackingOptionAsync(parameterConfirmPackingOption)).ConfigureAwait(false).GetAwaiter().GetResult(); public async Task ConfirmPackingOptionAsync(ParameterConfirmPackingOption parameterConfirmPackingOption, CancellationToken cancellationToken = default) { - var parameter = parameterConfirmPackingOption.getParameters(); await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ConfirmPackingOption(parameterConfirmPackingOption.InboundPlanId,parameterConfirmPackingOption.PackingOptionId), RestSharp.Method.Post, null, cancellationToken: cancellationToken); return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ConfirmPackingOption, cancellationToken); } + #endregion + #region ListPackingGroupItems + public List ListPackingGroupItems(ParameterListPackingGroupItems parameterListPackingGroupItems) => + Task.Run(() => ListPackingGroupItemsAsync(parameterListPackingGroupItems)).ConfigureAwait(false).GetAwaiter().GetResult(); + public async Task> ListPackingGroupItemsAsync(ParameterListPackingGroupItems parameterListPackingGroupItems, CancellationToken cancellationToken = default) + { + var parameter = parameterListPackingGroupItems.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListPackingGroupItems(parameterListPackingGroupItems.InboundPlanId, parameterListPackingGroupItems.PackingOptionId, parameterListPackingGroupItems.PackingGroupId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + + List list = new List(); + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListPackingGroupItems, cancellationToken); + list.AddRange(response.Items); + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListPackingGroupItems.maxPages.HasValue || totalPages < parameterListPackingGroupItems.maxPages.Value)) + { + parameterListPackingGroupItems.PaginationToken = nextToken; + var getItemNextPage = await ListPackingGroupItemsAsyncByNextTokenAsync(parameterListPackingGroupItems, cancellationToken); + list.AddRange(getItemNextPage.Items); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } + return list; + } + - - - - public InboundShipmentResult UpdateInboundShipment(string shipmentId, InboundShipmentRequest inboundShipmentRequest) => - Task.Run(() => UpdateInboundShipmentAsync(shipmentId, inboundShipmentRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task UpdateInboundShipmentAsync(string shipmentId, InboundShipmentRequest inboundShipmentRequest, CancellationToken cancellationToken = default) + private async Task ListPackingGroupItemsAsyncByNextTokenAsync(ParameterListPackingGroupItems parameterListPackingGroupItems, CancellationToken cancellationToken = default) { - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.UpdateInboundShipment(shipmentId), RestSharp.Method.Put, postJsonObj: inboundShipmentRequest, cancellationToken: cancellationToken); - - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_UpdateInboundShipment, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + var parameter = parameterListPackingGroupItems.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListPackingGroupItems(parameterListPackingGroupItems.InboundPlanId, parameterListPackingGroupItems.PackingOptionId, parameterListPackingGroupItems.PackingGroupId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListPackingGroupItems, cancellationToken); } + #endregion - public InboundShipmentResult CreateInboundShipment(string shipmentId, InboundShipmentRequest inboundShipmentRequest) => - Task.Run(() => CreateInboundShipmentAsync(shipmentId, inboundShipmentRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); + #region ListInboundPlanPallets + public List ListInboundPlanPallets(ParameterListInboundPlan parameterListInboundPlan) => + Task.Run(() => ListInboundPlanPalletsAsync(parameterListInboundPlan)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task CreateInboundShipmentAsync(string shipmentId, InboundShipmentRequest inboundShipmentRequest, CancellationToken cancellationToken = default) + public async Task> ListInboundPlanPalletsAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.CreateInboundShipment(shipmentId), RestSharp.Method.Post, postJsonObj: inboundShipmentRequest, cancellationToken: cancellationToken); - - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_CreateInboundShipment, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; - } + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListInboundPlanPallets(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + + List list = new List(); - public InboundShipmentResult GetPreorderInfo(string shipmentId) => - Task.Run(() => GetPreorderInfoAsync(shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanPallets, cancellationToken); + list.AddRange(response.Pallets); - public async Task GetPreorderInfoAsync(string shipmentId, CancellationToken cancellationToken = default) - { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListInboundPlan.maxPages.HasValue || totalPages < parameterListInboundPlan.maxPages.Value)) + { + parameterListInboundPlan.PaginationToken = nextToken; + var getItemNextPage = await ListPackingGroupItemsAsyncByNextTokenAsync(parameterListInboundPlan, cancellationToken); + list.AddRange(getItemNextPage.Pallets); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetPreorderInfo(shipmentId), RestSharp.Method.Get, queryParameters, cancellationToken: cancellationToken); + return list; - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetPreorderInfo, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; } - public ConfirmPreorderResult ConfirmPreorder(string shipmentId, DateTime NeedByDate) => - Task.Run(() => ConfirmPreorderAsync(shipmentId, NeedByDate)).ConfigureAwait(false).GetAwaiter().GetResult(); - - public async Task ConfirmPreorderAsync(string shipmentId, DateTime NeedByDate, CancellationToken cancellationToken = default) + private async Task ListPackingGroupItemsAsyncByNextTokenAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); - queryParameters.Add(new KeyValuePair("NeedByDate", NeedByDate.ToString("YYYY-MM-DD"))); - - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ConfirmPreorder(shipmentId), RestSharp.Method.Put, queryParameters, cancellationToken: cancellationToken); - - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ConfirmPreorder, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListInboundPlanPallets(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListInboundPlanPallets, cancellationToken); } + #endregion - public GetPrepInstructionsResult GetPrepInstructions(ParameterGetPrepInstructions parameterGetPrepInstructions) => - Task.Run(() => GetPrepInstructionsAsync(parameterGetPrepInstructions)).ConfigureAwait(false).GetAwaiter().GetResult(); + #region ListPlacementOptions + public List ListPlacementOptions(ParameterListInboundPlan parameterListInboundPlan) => + Task.Run(() => ListPlacementOptionsAsync(parameterListInboundPlan)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task GetPrepInstructionsAsync(ParameterGetPrepInstructions parameterGetPrepInstructions, CancellationToken cancellationToken = default) + public async Task> ListPlacementOptionsAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { - var parameter = parameterGetPrepInstructions.getParameters(); - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetPrepInstructions, RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListPlacementOptions(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + + List list = new List(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetPrepInstructions, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; - } - public GetTransportDetailsResult GetTransportDetails(string shipmentId) => - Task.Run(() => GetTransportDetailsAsync(shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListPlacementOptions, cancellationToken); + list.AddRange(response.PlacementOptions); - public async Task GetTransportDetailsAsync(string shipmentId, CancellationToken cancellationToken = default) - { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListInboundPlan.maxPages.HasValue || totalPages < parameterListInboundPlan.maxPages.Value)) + { + parameterListInboundPlan.PaginationToken = nextToken; + var getItemNextPage = await ListPlacementOptionsAsyncByNextTokenAsync(parameterListInboundPlan, cancellationToken); + list.AddRange(getItemNextPage.PlacementOptions); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetTransportDetails(shipmentId), RestSharp.Method.Get, queryParameters, cancellationToken: cancellationToken); + return list; + } - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetTransportDetails, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + private async Task ListPlacementOptionsAsyncByNextTokenAsync(ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) + { + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListPlacementOptions(parameterListInboundPlan.InboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListPlacementOptions, cancellationToken); } + #endregion - public CommonTransportResult PutTransportDetails(string shipmentId, PutTransportDetailsRequest putTransportDetailsRequest) => - Task.Run(() => PutTransportDetailsAsync(shipmentId, putTransportDetailsRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); + #region GeneratePlacementOptions + public GeneratePlacementOptionsResponse GeneratePlacementOptions(string inboundPlanId, GeneratePlacementOptionsRequest generatePlacementOptionsRequest) => + Task.Run(() => GeneratePlacementOptionsAsync(inboundPlanId, generatePlacementOptionsRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task PutTransportDetailsAsync(string shipmentId, PutTransportDetailsRequest putTransportDetailsRequest, CancellationToken cancellationToken = default) + public async Task GeneratePlacementOptionsAsync(string inboundPlanId, GeneratePlacementOptionsRequest generatePlacementOptionsRequest, CancellationToken cancellationToken = default) { - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.PutTransportDetails(shipmentId), RestSharp.Method.Put, postJsonObj: putTransportDetailsRequest, cancellationToken: cancellationToken); - - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_PutTransportDetails, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GeneratePlacementOptions(inboundPlanId), RestSharp.Method.Post, postJsonObj: generatePlacementOptionsRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GeneratePlacementOptions, cancellationToken); } + #endregion - public CommonTransportResult VoidTransport(string shipmentId) => - Task.Run(() => VoidTransportAsync(shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); + #region ConfirmPlacementOption + public ConfirmPlacementOptionResponse ConfirmPlacementOption(string inboundPlanId, string placementOptionId) => + Task.Run(() => ConfirmPlacementOptionAsync(inboundPlanId, placementOptionId)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task VoidTransportAsync(string shipmentId, CancellationToken cancellationToken = default) + public async Task ConfirmPlacementOptionAsync(string inboundPlanId, string placementOptionId, CancellationToken cancellationToken = default) { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ConfirmPlacementOption(inboundPlanId, placementOptionId), RestSharp.Method.Post, null, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ConfirmPlacementOption, cancellationToken); + } + #endregion - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.VoidTransport(shipmentId), RestSharp.Method.Post, queryParameters, cancellationToken: cancellationToken); + #region GetShipment + public AmazonSpApiSDK.Models.FulfillmentInbound.Shipment GetShipment(string inboundPlanId, string shipmentId) => + Task.Run(() => GetShipmentAsync(inboundPlanId, shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_VoidTransport, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + public async Task GetShipmentAsync(string inboundPlanId, string shipmentId, CancellationToken cancellationToken = default) + { + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetShipment(inboundPlanId, shipmentId), RestSharp.Method.Get, null, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetShipment, cancellationToken); } + #endregion - public CommonTransportResult EstimateTransport(string shipmentId) => - Task.Run(() => EstimateTransportAsync(shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); + #region GetDeliveryChallanDocument + public GetDeliveryChallanDocumentResponse GetDeliveryChallanDocument(string inboundPlanId, string shipmentId) => + Task.Run(() => GetDeliveryChallanDocumentAsync(inboundPlanId, shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task EstimateTransportAsync(string shipmentId, CancellationToken cancellationToken = default) + public async Task GetDeliveryChallanDocumentAsync(string inboundPlanId, string shipmentId, CancellationToken cancellationToken = default) { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetDeliveryChallanDocument(inboundPlanId, shipmentId), RestSharp.Method.Get, null, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetDeliveryChallanDocument, cancellationToken); + } + #endregion - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.EstimateTransport(shipmentId), RestSharp.Method.Post, queryParameters, cancellationToken: cancellationToken); + #region UpdateShipmentDeliveryWindow + public UpdateShipmentDeliveryWindowResponse UpdateShipmentDeliveryWindow(string inboundPlanId, string shipmentId, UpdateShipmentDeliveryWindowRequest updateShipmentDeliveryWindowRequest) => + Task.Run(() => UpdateShipmentDeliveryWindowAsync(inboundPlanId, shipmentId, updateShipmentDeliveryWindowRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_EstimateTransport, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + public async Task UpdateShipmentDeliveryWindowAsync(string inboundPlanId, string shipmentId, UpdateShipmentDeliveryWindowRequest updateShipmentDeliveryWindowRequest, CancellationToken cancellationToken = default) + { + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.UpdateShipmentDeliveryWindow(inboundPlanId, shipmentId), RestSharp.Method.Post, postJsonObj: updateShipmentDeliveryWindowRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_UpdateShipmentDeliveryWindow, cancellationToken); } + #endregion - public CommonTransportResult ConfirmTransport(string shipmentId) => - Task.Run(() => ConfirmTransportAsync(shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); + #region GetSelfShipAppointmentSlots + public List GetSelfShipAppointmentSlots(string shipmentId, ParameterListInboundPlan parameterListInboundPlan) => + Task.Run(() => GetSelfShipAppointmentSlotsAsync(shipmentId, parameterListInboundPlan)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task ConfirmTransportAsync(string shipmentId, CancellationToken cancellationToken = default) + public async Task> GetSelfShipAppointmentSlotsAsync(string shipmentId, ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetSelfShipAppointmentSlots(parameterListInboundPlan.InboundPlanId, shipmentId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ConfirmTransport(shipmentId), RestSharp.Method.Post, queryParameters, cancellationToken: cancellationToken); + List list = new List(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ConfirmTransport, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; - } + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetSelfShipAppointmentSlots, cancellationToken); + list.Add(response.SelfShipAppointmentSlotsAvailability); - public LabelDownloadURL GetLabels(ParameterGetLabels parameterGetLabels) => - Task.Run(() => GetLabelsAsync(parameterGetLabels)).ConfigureAwait(false).GetAwaiter().GetResult(); + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) + { + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListInboundPlan.maxPages.HasValue || totalPages < parameterListInboundPlan.maxPages.Value)) + { + parameterListInboundPlan.PaginationToken = nextToken; + var getItemNextPage = await GetSelfShipAppointmentSlotsByNextTokenAsync(shipmentId, parameterListInboundPlan, cancellationToken); + list.Add(getItemNextPage.SelfShipAppointmentSlotsAvailability); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; + } + } - 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); + return list; - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetLabels, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; } - public BillOfLadingDownloadURL GetBillOfLading(string shipmentId) => - Task.Run(() => GetBillOfLadingAsync(shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task GetBillOfLadingAsync(string shipmentId, CancellationToken cancellationToken = default) + private async Task GetSelfShipAppointmentSlotsByNextTokenAsync(string shipmentId, ParameterListInboundPlan parameterListInboundPlan, CancellationToken cancellationToken = default) { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); + var parameter = parameterListInboundPlan.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetSelfShipAppointmentSlots(parameterListInboundPlan.InboundPlanId, shipmentId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetSelfShipAppointmentSlots, cancellationToken); + } + #endregion - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetBillOfLading(shipmentId), RestSharp.Method.Get, queryParameters, cancellationToken: cancellationToken); + #region GenerateSelfShipAppointmentSlots + public GenerateSelfShipAppointmentSlotsResponse GenerateSelfShipAppointmentSlots(string inboundPlanId, string shipmentId, GenerateSelfShipAppointmentSlotsRequest generateSelfShipAppointmentSlotsRequest) => + Task.Run(() => GenerateSelfShipAppointmentSlotsAsync(inboundPlanId, shipmentId, generateSelfShipAppointmentSlotsRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetBillOfLading, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + public async Task GenerateSelfShipAppointmentSlotsAsync(string inboundPlanId, string shipmentId, GenerateSelfShipAppointmentSlotsRequest generateSelfShipAppointmentSlotsRequest, CancellationToken cancellationToken = default) + { + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GenerateSelfShipAppointmentSlots(inboundPlanId, shipmentId), RestSharp.Method.Post, postJsonObj: generateSelfShipAppointmentSlotsRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GenerateSelfShipAppointmentSlots, cancellationToken); } + #endregion - public GetShipmentsResult GetShipments(ParameterGetShipments parameterGetLabels) => - Task.Run(() => GetShipmentsAsync(parameterGetLabels)).ConfigureAwait(false).GetAwaiter().GetResult(); + #region CancelSelfShipAppointment + public CancelSelfShipAppointmentResponse CancelSelfShipAppointment(string inboundPlanId, string shipmentId, string slotId, CancelSelfShipAppointmentRequest cancelSelfShipAppointmentRequest) => + Task.Run(() => CancelSelfShipAppointmentAsync(inboundPlanId, shipmentId, slotId, cancelSelfShipAppointmentRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task GetShipmentsAsync(ParameterGetShipments parameterGetLabels, CancellationToken cancellationToken = default) + public async Task CancelSelfShipAppointmentAsync(string inboundPlanId, string shipmentId, string slotId, CancelSelfShipAppointmentRequest cancelSelfShipAppointmentRequest, CancellationToken cancellationToken = default) { - var parameter = parameterGetLabels.getParameters(); - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetShipments, RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); - - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetShipments, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.CancelSelfShipAppointment(inboundPlanId, shipmentId, slotId), RestSharp.Method.Put, postJsonObj: cancelSelfShipAppointmentRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_CancelSelfShipAppointment, cancellationToken); } + #endregion - public GetShipmentItemsResult GetShipmentItemsByShipmentId(string shipmentId) => - Task.Run(() => GetShipmentItemsByShipmentIdAsync(shipmentId)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task GetShipmentItemsByShipmentIdAsync(string shipmentId, CancellationToken cancellationToken = default) + #region ScheduleSelfShipAppointment + public ScheduleSelfShipAppointmentResponse ScheduleSelfShipAppointment(string inboundPlanId, string shipmentId, string slotId, ScheduleSelfShipAppointmentRequest scheduleSelfShipAppointmentRequest) => + Task.Run(() => ScheduleSelfShipAppointmentAsync(inboundPlanId, shipmentId, slotId, scheduleSelfShipAppointmentRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); + + public async Task ScheduleSelfShipAppointmentAsync(string inboundPlanId, string shipmentId, string slotId, ScheduleSelfShipAppointmentRequest scheduleSelfShipAppointmentRequest, CancellationToken cancellationToken = default) { - List> queryParameters = new List>(); - queryParameters.Add(new KeyValuePair("MarketplaceId", AmazonCredential.MarketPlace.ID)); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.CancelSelfShipAppointment(inboundPlanId, shipmentId, slotId), RestSharp.Method.Post, postJsonObj: scheduleSelfShipAppointmentRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ScheduleSelfShipAppointment, cancellationToken); + } + #endregion - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetShipmentItemsByShipmentId(shipmentId), RestSharp.Method.Get, queryParameters, cancellationToken: cancellationToken); + #region UpdateShipmentTrackingDetails + public UpdateShipmentTrackingDetailsResponse UpdateShipmentTrackingDetails(string inboundPlanId, string shipmentId, UpdateShipmentTrackingDetailsRequest updateShipmentTrackingDetailsRequest) => + Task.Run(() => UpdateShipmentTrackingDetailsAsync(inboundPlanId, shipmentId, updateShipmentTrackingDetailsRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetShipmentItemsByShipmentId, cancellationToken); - if (response != null && response.Payload != null) - return response.Payload; - return null; - } - public InboundShipmentItemList GetShipmentItems(ParameterGetShipmentItems parameterShipmentItems) => - Task.Run(() => GetShipmentItemsAsync(parameterShipmentItems)).ConfigureAwait(false).GetAwaiter().GetResult(); - public async Task GetShipmentItemsAsync(ParameterGetShipmentItems parameterShipmentItems, CancellationToken cancellationToken = default) + public async Task UpdateShipmentTrackingDetailsAsync(string inboundPlanId, string shipmentId, UpdateShipmentTrackingDetailsRequest updateShipmentTrackingDetailsRequest, CancellationToken cancellationToken = default) { - var inboundShipmentItemList = new InboundShipmentItemList(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.UpdateShipmentTrackingDetails(inboundPlanId, shipmentId), RestSharp.Method.Put, postJsonObj: updateShipmentTrackingDetailsRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_UpdateShipmentTrackingDetails, cancellationToken); + } + #endregion - var parameter = parameterShipmentItems.getParameters(); - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetShipmentItems, RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + #region ListTransportationOptions + public List ListTransportationOptions(string inboundPlanId, ParameterListTransportationOptions parameterListTransportationOptions) => + Task.Run(() => ListTransportationOptionsAsync(inboundPlanId, parameterListTransportationOptions)).ConfigureAwait(false).GetAwaiter().GetResult(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetShipmentItems, cancellationToken); + public async Task> ListTransportationOptionsAsync(string inboundPlanId, ParameterListTransportationOptions parameterListTransportationOptions, CancellationToken cancellationToken = default) + { + var parameter = parameterListTransportationOptions.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListTransportationOptions(inboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); - var nextToken = response.Payload?.NextToken; - inboundShipmentItemList = response.Payload?.ItemData; - int PageCount = 1; + List list = new List(); - if (parameterShipmentItems.MaxNumberOfPages.HasValue && parameterShipmentItems.MaxNumberOfPages.Value == 1) - { - inboundShipmentItemList.NextToken = nextToken; - } - else + var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListTransportationOptions, cancellationToken); + list.AddRange(response.TransportationOptions); + + var totalPages = 1; + if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken)) { - while (!string.IsNullOrEmpty(nextToken)) + var nextToken = response.Pagination.NextToken; + while (!string.IsNullOrEmpty(nextToken) && (!parameterListTransportationOptions.maxPages.HasValue || totalPages < parameterListTransportationOptions.maxPages.Value)) { - var orderPayload = await GetShipmentItemsByNextTokenAsync(nextToken, parameterShipmentItems, cancellationToken); - inboundShipmentItemList.AddRange(orderPayload.ItemData); - - nextToken = orderPayload.NextToken; - inboundShipmentItemList.NextToken = nextToken; - - if (parameterShipmentItems.MaxNumberOfPages.HasValue) - { - PageCount++; - if (PageCount >= parameterShipmentItems.MaxNumberOfPages.Value) - break; - } + parameterListTransportationOptions.PaginationToken = nextToken; + var getItemNextPage = await ListTransportationOptionsByNextTokenAsync(inboundPlanId, parameterListTransportationOptions, cancellationToken); + list.AddRange(getItemNextPage.TransportationOptions); + nextToken = getItemNextPage.Pagination?.NextToken; + totalPages++; } } + return list; - return inboundShipmentItemList; } - public async Task GetShipmentItemsByNextTokenAsync(string nextToken, ParameterGetShipmentItems parameterShipmentItems, CancellationToken cancellationToken = default) + private async Task ListTransportationOptionsByNextTokenAsync(string inboundPlanId, ParameterListTransportationOptions parameterListTransportationOptions, CancellationToken cancellationToken = default) { - parameterShipmentItems.NextToken = nextToken; - parameterShipmentItems.QueryType = Constants.QueryType.NEXT_TOKEN; - parameterShipmentItems.LastUpdatedBefore = null; - parameterShipmentItems.LastUpdatedAfter = null; + var parameter = parameterListTransportationOptions.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListTransportationOptions(inboundPlanId), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListTransportationOptions, cancellationToken); + } + #endregion + + #region GenerateTransportationOptions + public GenerateTransportationOptionsResponse GenerateTransportationOptions(string inboundPlanId, GenerateTransportationOptionsRequest generateTransportationOptionsRequest) => + Task.Run(() => GenerateTransportationOptionsAsync(inboundPlanId, generateTransportationOptionsRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); + + public async Task GenerateTransportationOptionsAsync(string inboundPlanId, GenerateTransportationOptionsRequest generateTransportationOptionsRequest, CancellationToken cancellationToken = default) + { + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GenerateTransportationOptions(inboundPlanId), RestSharp.Method.Post, postJsonObj: generateTransportationOptionsRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GenerateTransportationOptions, cancellationToken); + } + #endregion + + #region ConfirmTransportationOptions + public ConfirmTransportationOptionsResponse ConfirmTransportationOptions(string inboundPlanId, ConfirmTransportationOptionsRequest confirmTransportationOptionsRequest) => + Task.Run(() => ConfirmTransportationOptionsAsync(inboundPlanId, confirmTransportationOptionsRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); + + public async Task ConfirmTransportationOptionsAsync(string inboundPlanId, ConfirmTransportationOptionsRequest confirmTransportationOptionsRequest, CancellationToken cancellationToken = default) + { + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ConfirmTransportationOptions(inboundPlanId), RestSharp.Method.Post, postJsonObj: confirmTransportationOptionsRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ConfirmTransportationOptions, cancellationToken); + } + #endregion - var parameter = parameterShipmentItems.getParameters(); - await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetShipmentItems, RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + #region ListItemComplianceDetails + public ListItemComplianceDetailsResponse ListItemComplianceDetails(ParematerListItemComplianceDetails parematerListItemComplianceDetails) => + Task.Run(() => ListItemComplianceDetailsAsync(parematerListItemComplianceDetails)).ConfigureAwait(false).GetAwaiter().GetResult(); - var response = await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetShipmentItems, cancellationToken); + public async Task ListItemComplianceDetailsAsync(ParematerListItemComplianceDetails parematerListItemComplianceDetails, CancellationToken cancellationToken = default) + { + var parameter = parematerListItemComplianceDetails.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.ListItemComplianceDetails(), RestSharp.Method.Get, parameter, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_ListItemComplianceDetails, cancellationToken); + } + #endregion + + #region UpdateItemComplianceDetails + public UpdateItemComplianceDetailsResponse UpdateItemComplianceDetails(ParameterUpdateItemComplianceDetails parameterUpdateItemComplianceDetails, UpdateItemComplianceDetailsRequest updateItemComplianceDetailsRequest) => + Task.Run(() => UpdateItemComplianceDetailsAsync(parameterUpdateItemComplianceDetails, updateItemComplianceDetailsRequest)).ConfigureAwait(false).GetAwaiter().GetResult(); + + public async Task UpdateItemComplianceDetailsAsync(ParameterUpdateItemComplianceDetails parameterUpdateItemComplianceDetails, UpdateItemComplianceDetailsRequest updateItemComplianceDetailsRequest, CancellationToken cancellationToken = default) + { + var parameter = parameterUpdateItemComplianceDetails.getParameters(); + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.UpdateItemComplianceDetails(), RestSharp.Method.Put, parameter: parameter, postJsonObj: updateItemComplianceDetailsRequest, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_UpdateItemComplianceDetails, cancellationToken); + } + #endregion - if (response != null && response.Payload != null) - return response.Payload; - return null; + #region GetInboundOperationStatus + public InboundOperationStatus GetInboundOperationStatus(string operationId) => + Task.Run(() => GetInboundOperationStatusAsync(operationId)).ConfigureAwait(false).GetAwaiter().GetResult(); + + public async Task GetInboundOperationStatusAsync(string operationId, CancellationToken cancellationToken = default) + { + await CreateAuthorizedRequestAsync(FulFillmentInboundApiUrls.GetInboundOperationStatus(operationId), RestSharp.Method.Get,null, cancellationToken: cancellationToken); + return await ExecuteRequestAsync(RateLimitType.FulFillmentInbound_GetInboundOperationStatus, cancellationToken); } + #endregion } } diff --git a/Source/FikaAmazonAPI/Utils/RateLimitType.cs b/Source/FikaAmazonAPI/Utils/RateLimitType.cs index 1bdc57ea..877c62cf 100644 --- a/Source/FikaAmazonAPI/Utils/RateLimitType.cs +++ b/Source/FikaAmazonAPI/Utils/RateLimitType.cs @@ -85,32 +85,33 @@ public enum RateLimitType FulFillmentInbound_GetListInboundPlans, FulFillmentInbound_CreateInboundPlan, FulFillmentInbound_GetInboundPlan, - FulFillmentInbound_ListInboundPlanBoxesResponse, + FulFillmentInbound_ListInboundPlanBoxes, FulFillmentInbound_CancelInboundPlan, FulFillmentInbound_ListInboundPlanItems, FulFillmentInbound_SetPackingInformation, FulFillmentInbound_ListPackingOptions, FulFillmentInbound_GeneratePackingOptions, FulFillmentInbound_ConfirmPackingOption, - - - - FulFillmentInbound_UpdateInboundShipment, - FulFillmentInbound_CreateInboundShipment, - FulFillmentInbound_GetPreorderInfo, - FulFillmentInbound_ConfirmPreorder, - FulFillmentInbound_GetPrepInstructions, - FulFillmentInbound_GetTransportDetails, - FulFillmentInbound_PutTransportDetails, - FulFillmentInbound_VoidTransport, - FulFillmentInbound_EstimateTransport, - FulFillmentInbound_ConfirmTransport, - FulFillmentInbound_GetLabels, - FulFillmentInbound_GetBillOfLading, - FulFillmentInbound_GetShipments, - FulFillmentInbound_GetShipmentItemsByShipmentId, - FulFillmentInbound_GetShipmentItems, - + FulFillmentInbound_ListPackingGroupItems, + FulFillmentInbound_ListInboundPlanPallets, + FulFillmentInbound_ListPlacementOptions, + FulFillmentInbound_GeneratePlacementOptions, + FulFillmentInbound_ConfirmPlacementOption, + FulFillmentInbound_GetShipment, + FulFillmentInbound_GetDeliveryChallanDocument, + FulFillmentInbound_UpdateShipmentDeliveryWindow, + FulFillmentInbound_GetSelfShipAppointmentSlots, + FulFillmentInbound_GenerateSelfShipAppointmentSlots, + FulFillmentInbound_CancelSelfShipAppointment, + FulFillmentInbound_ScheduleSelfShipAppointment, + FulFillmentInbound_UpdateShipmentTrackingDetails, + FulFillmentInbound_ListTransportationOptions, + FulFillmentInbound_GenerateTransportationOptions, + FulFillmentInbound_ConfirmTransportationOptions, + FulFillmentInbound_ListItemComplianceDetails, + FulFillmentInbound_UpdateItemComplianceDetails, + FulFillmentInbound_GetInboundOperationStatus, + FulFillmentOutbound_GetFulfillmentPreview, FulFillmentOutbound_ListAllFulfillmentOrders, FulFillmentOutbound_CreateFulfillmentOrder, diff --git a/Source/FikaAmazonAPI/Utils/RateLimitsDefinitions.cs b/Source/FikaAmazonAPI/Utils/RateLimitsDefinitions.cs index c6c56d40..b0570c61 100644 --- a/Source/FikaAmazonAPI/Utils/RateLimitsDefinitions.cs +++ b/Source/FikaAmazonAPI/Utils/RateLimitsDefinitions.cs @@ -95,30 +95,41 @@ internal static Dictionary RateLimitsTime() { RateLimitType.FBAInboundEligibility_GetItemEligibilityPreview, new RateLimits(1.0M, 1) }, - - { RateLimitType.EasyShip_CreateScheduledPackage, new RateLimits(1.0M, 5) }, - { RateLimitType.EasyShip_GetScheduledPackage, new RateLimits(1.0M, 5) }, - { RateLimitType.EasyShip_ListHandoverSlots, new RateLimits(1.0M, 5) }, - { RateLimitType.EasyShip_UpdateScheduledPackages, new RateLimits(1.0M, 5) }, - - { RateLimitType.FulFillmentInbound_GetListInboundPlans, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_CreateInboundPlan, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_UpdateInboundShipment, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_CreateInboundShipment, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetPreorderInfo, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_ConfirmPreorder, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetPrepInstructions, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetTransportDetails, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_PutTransportDetails, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_VoidTransport, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_EstimateTransport, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_ConfirmTransport, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetLabels, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetBillOfLading, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetShipments, new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetShipmentItemsByShipmentId,new RateLimits(2.0M, 30) }, - { RateLimitType.FulFillmentInbound_GetShipmentItems, new RateLimits(2.0M, 30) }, - + { RateLimitType.EasyShip_CreateScheduledPackage, new RateLimits(1.0M, 5) }, + { RateLimitType.EasyShip_GetScheduledPackage, new RateLimits(1.0M, 5) }, + { RateLimitType.EasyShip_ListHandoverSlots, new RateLimits(1.0M, 5) }, + { RateLimitType.EasyShip_UpdateScheduledPackages, new RateLimits(1.0M, 5) }, + + { RateLimitType.FulFillmentInbound_GetListInboundPlans, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_CreateInboundPlan, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_GetInboundPlan, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_ListInboundPlanBoxes, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_CancelInboundPlan, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_ListInboundPlanItems, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_SetPackingInformation, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_ListPackingOptions, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_GeneratePackingOptions, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_ConfirmPackingOption, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_ListPackingGroupItems, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_ListInboundPlanPallets, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_ListPlacementOptions, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_GeneratePlacementOptions, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_ConfirmPlacementOption, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_GetShipment, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_GetDeliveryChallanDocument, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_UpdateShipmentDeliveryWindow, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_GetSelfShipAppointmentSlots, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_GenerateSelfShipAppointmentSlots, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_CancelSelfShipAppointment, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_ScheduleSelfShipAppointment, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_UpdateShipmentTrackingDetails, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_ListTransportationOptions, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_GenerateTransportationOptions, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_ConfirmTransportationOptions, new RateLimits(0.05M, 1) }, + { RateLimitType.FulFillmentInbound_ListItemComplianceDetails, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_UpdateItemComplianceDetails, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentInbound_GetInboundOperationStatus, new RateLimits(1.0M, 1) }, + { RateLimitType.FulFillmentOutbound_GetFulfillmentPreview, new RateLimits(2.0M, 30) }, { RateLimitType.FulFillmentOutbound_ListAllFulfillmentOrders, new RateLimits(2.0M, 30) }, { RateLimitType.FulFillmentOutbound_CreateFulfillmentOrder, new RateLimits(2.0M, 30) }, diff --git a/Source/FikaAmazonAPI/Utils/UnitOfMeasurementConverter.cs b/Source/FikaAmazonAPI/Utils/UnitOfMeasurementConverter.cs deleted file mode 100644 index c8234b9f..00000000 --- a/Source/FikaAmazonAPI/Utils/UnitOfMeasurementConverter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using FikaAmazonAPI.AmazonSpApiSDK.Models.FulfillmentInbound; - -namespace FikaAmazonAPI.Utils -{ - class UnitOfMeasurementConverter : StringEnumConverter - { - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - string unitOfMeasurementString = reader.Value.ToString(); - if (unitOfMeasurementString.Equals("in", StringComparison.OrdinalIgnoreCase)) - return UnitOfMeasurement.Inches; - else - return (UnitOfMeasurement)Enum.Parse(typeof(UnitOfMeasurement), unitOfMeasurementString, true); - } - } -}