Skip to content

Commit 0e804f0

Browse files
committed
add defult marketplaceIds
1 parent 2ad625e commit 0e804f0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Source/FikaAmazonAPI/Services/ReportService.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public List<Report> GetReports(ParameterReportList parameterReportList) =>
2323
Task.Run(() => GetReportsAsync(parameterReportList)).ConfigureAwait(false).GetAwaiter().GetResult();
2424
public async Task<List<Report>> GetReportsAsync(ParameterReportList parameterReportList)
2525
{
26+
if (parameterReportList.marketplaceIds == null || parameterReportList.marketplaceIds.Count == 0)
27+
{
28+
parameterReportList.marketplaceIds = new List<string>();
29+
parameterReportList.marketplaceIds.Add(AmazonCredential.MarketPlace.ID);
30+
}
2631
if (parameterReportList.createdSince.HasValue)
2732
{
2833
var totalDays = (parameterReportList.createdSince.Value - DateTime.UtcNow).TotalDays;
@@ -101,6 +106,11 @@ public string CreateReport(ParameterCreateReportSpecification createReportSpecif
101106
Task.Run(() => CreateReportAsync(createReportSpecification)).ConfigureAwait(false).GetAwaiter().GetResult();
102107
public async Task<string> CreateReportAsync(ParameterCreateReportSpecification createReportSpecification)
103108
{
109+
if (createReportSpecification.marketplaceIds == null || createReportSpecification.marketplaceIds.Count == 0)
110+
{
111+
createReportSpecification.marketplaceIds = new MarketplaceIds();
112+
createReportSpecification.marketplaceIds.Add(AmazonCredential.MarketPlace.ID);
113+
}
104114
await CreateAuthorizedRequestAsync(ReportApiUrls.CreateReport, RestSharp.Method.Post, null, createReportSpecification);
105115
var response = await ExecuteRequestAsync<AmazonSpApiSDK.Models.Reports.CreateReportResult>(RateLimitType.Report_CreateReport);
106116

@@ -248,7 +258,7 @@ public async Task<bool> CancelReportScheduleAsync(string reportScheduleId)
248258

249259
public string CreateReportAndDownloadFile(ReportTypes reportType, DateTime? dataStartTime = null, DateTime? dataEndTime = null, ReportOptions reportOptions = null, bool isRestrictedReport = false, List<MarketPlace> marketplaces = null, int millisecondsDelay = 500) =>
250260
Task.Run(() => CreateReportAndDownloadFileAsync(reportType, dataStartTime, dataEndTime, reportOptions, isRestrictedReport, marketplaces, millisecondsDelay)).ConfigureAwait(false).GetAwaiter().GetResult();
251-
public async Task<string> CreateReportAndDownloadFileAsync(ReportTypes reportType, DateTime? dataStartTime = null, DateTime? dataEndTime = null, ReportOptions reportOptions = null, bool isRestrictedReport = false, List<MarketPlace> marketplaces = null,int millisecondsDelay=500)
261+
public async Task<string> CreateReportAndDownloadFileAsync(ReportTypes reportType, DateTime? dataStartTime = null, DateTime? dataEndTime = null, ReportOptions reportOptions = null, bool isRestrictedReport = false, List<MarketPlace> marketplaces = null, int millisecondsDelay = 500)
252262
{
253263
if (!isRestrictedReport && Enum.TryParse<RestrictedReportTypes>(reportType.ToString(), out _))
254264
{

0 commit comments

Comments
 (0)