Skip to content

Commit 568cb4f

Browse files
authored
Merge pull request #31 from J-W-Chan/main
20211216
2 parents b212fc2 + 60920c3 commit 568cb4f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Source/FikaAmazonAPI/Services/FbaInventoryService.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ public List<InventorySummaries> GetInventorySummaries(ParameterGetInventorySumma
2222

2323
CreateAuthorizedRequest(FbaInventoriesApiUrls.GetInventorySummaries, RestSharp.Method.GET, param);
2424
var response = ExecuteRequest<GetInventorySummariesResponse>();
25-
var nextToken = response.Pagination?.NextToken;
2625
list.Add(response.Payload.InventorySummaries);
27-
while (!string.IsNullOrEmpty(nextToken))
26+
if (response.Pagination != null && !string.IsNullOrEmpty(response.Pagination.NextToken))
2827
{
29-
var nextresponse = GetInventorySummariesByNextToken(nextToken,ParameterGetInventorySummaries);
30-
list.Add(nextresponse.Payload.InventorySummaries);
31-
nextToken = nextresponse.Pagination?.NextToken;
28+
var nextToken = response.Pagination.NextToken;
29+
while (!string.IsNullOrEmpty(nextToken))
30+
{
31+
var getInventorySummaries = GetInventorySummariesByNextToken(nextToken);
32+
list.Add(getInventorySummaries.Payload.InventorySummaries);
33+
nextToken = getInventorySummaries.Pagination?.NextToken;
34+
}
3235
}
3336
return list;
3437
}

0 commit comments

Comments
 (0)