From 0c375b49ee3fdf9aa6ea0b10ba6563e589c1fa28 Mon Sep 17 00:00:00 2001 From: dansharpe83 Date: Mon, 3 Apr 2023 12:18:32 +0100 Subject: [PATCH] Added LastUpdatedBefore to OrderList added LastUpdatedBefore to OrderList so it can be used to make sure we don't miss any orders --- .../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 acad89d9..1d60260f 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) {