Exemplo n.º 1
0
        public void GetReportScheduledList()
        {
            // create the scheduled list request
            var request = new GetReportScheduleListRequest
            {
                Merchant = _merchantId,
                //ReportTypeList
            };

            // submit the request
            var  response           = _amazonClient.GetReportScheduleList(request);
            var  reportScheduleList = response.GetReportScheduleListResult.ReportSchedule;
            var  nextToken          = response.GetReportScheduleListResult.NextToken;
            var  hasNext            = response.GetReportScheduleListResult.HasNext;
            var  reportCounter      = 1;
            bool hasNextReport;

            do
            {
                hasNextReport = false;

                // download and parse the scheduled report
                foreach (var scheduledReport in reportScheduleList)
                {
                    // check if the report request quota reach to 15
                    if (reportCounter % 15 == 0)
                    {
                        // if so, pause for 1 minute, this is the restore rate for GetReport
                        Thread.Sleep(60000);
                    }

                    //var stream = downloadReportStream(scheduledReport.);

                    //// save the stream into a file
                    //var filePath = saveStreamToFile(stream, string.Format("{0}{1}", scheduledReport.ReportId, scheduledReport.ReportType));

                    //// add the filepath and report id to the lists
                    //reportFilePaths.Add(filePath);
                    //reportIds.Add(scheduledReport.ReportId);

                    reportCounter++;
                }
            } while (hasNextReport);
        }