Skip to content

Commit

Permalink
Update ReportService - GetReportsByNextToken if nextToken is empty th…
Browse files Browse the repository at this point in the history
…en request the first page

Currently there is GetReportsByNextToken to get the next page of reports, however, there is no (public method) way to retrieve the initial page of reports. This revision makes that if nextToken is empty the first page will be retrieved. Note: We can rename this method to: "GetReportsPage" ?
  • Loading branch information
SDP190 authored Dec 27, 2023
1 parent 63c032f commit 5b6a03e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/FikaAmazonAPI/Services/ReportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ public GetReportsResponseV00 GetReportsByNextToken(ParameterReportList parameter
Task.Run(() => GetReportsByNextTokenAsync(parameterReportList)).ConfigureAwait(false).GetAwaiter().GetResult();
public async Task<GetReportsResponseV00> GetReportsByNextTokenAsync(ParameterReportList parameterReportList, CancellationToken cancellationToken = default)
{
var parameterReportListNew = new ParameterReportList();
parameterReportListNew.nextToken = parameterReportList.nextToken;
var parameters = parameterReportListNew.getParameters();
List<KeyValuePair<string, string>> parameters = null;
if(string.IsNullOrEmpty(parameterReportList.nextToken))
parameters = parameterReportList.getParameters();
else
{
var parameterReportListNew = new ParameterReportList();
parameterReportListNew.nextToken = parameterReportList.nextToken;
parameters = parameterReportListNew.getParameters();
}

await CreateAuthorizedRequestAsync(ReportApiUrls.GetReports, RestSharp.Method.Get, parameters, cancellationToken: cancellationToken);
var response = await ExecuteRequestAsync<GetReportsResponseV00>(RateLimitType.Report_GetReports, cancellationToken);
Expand Down

0 comments on commit 5b6a03e

Please sign in to comment.