Пример #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);
        }
 /// <summary>
 /// Get Report Schedule List
 /// </summary>
 /// <param name="request">Get Report Schedule List  request</param>
 /// <returns>Get Report Schedule List  Response from the service</returns>
 /// <remarks>
 /// returns the list of report schedules
 ///
 /// </remarks>
 public GetReportScheduleListResponse GetReportScheduleList(GetReportScheduleListRequest request)
 {
     return(Invoke <GetReportScheduleListResponse>("GetReportScheduleListResponse.xml"));
 }
        /// <summary>
        /// returns the list of report schedules
        ///
        /// </summary>
        /// <param name="service">Instance of MarketplaceWebService service</param>
        /// <param name="request">GetReportScheduleListRequest request</param>
        public static async Task InvokeGetReportScheduleList(MarketplaceWebService service, GetReportScheduleListRequest request)
        {
            try
            {
                GetReportScheduleListResponse response = await service.GetReportScheduleList(request);


                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();

                Console.WriteLine("        GetReportScheduleListResponse");
                if (response.IsSetGetReportScheduleListResult())
                {
                    Console.WriteLine("            GetReportScheduleListResult");
                    GetReportScheduleListResult getReportScheduleListResult = response.GetReportScheduleListResult;
                    if (getReportScheduleListResult.IsSetNextToken())
                    {
                        Console.WriteLine("                NextToken");
                        Console.WriteLine("                    {0}", getReportScheduleListResult.NextToken);
                    }
                    if (getReportScheduleListResult.IsSetHasNext())
                    {
                        Console.WriteLine("                HasNext");
                        Console.WriteLine("                    {0}", getReportScheduleListResult.HasNext);
                    }
                    List <ReportSchedule> reportScheduleList = getReportScheduleListResult.ReportSchedule;
                    foreach (ReportSchedule reportSchedule in reportScheduleList)
                    {
                        Console.WriteLine("                ReportSchedule");
                        if (reportSchedule.IsSetReportType())
                        {
                            Console.WriteLine("                    ReportType");
                            Console.WriteLine("                        {0}", reportSchedule.ReportType);
                        }
                        if (reportSchedule.IsSetSchedule())
                        {
                            Console.WriteLine("                    Schedule");
                            Console.WriteLine("                        {0}", reportSchedule.Schedule);
                        }
                        if (reportSchedule.IsSetScheduledDate())
                        {
                            Console.WriteLine("                    ScheduledDate");
                            Console.WriteLine("                        {0}", reportSchedule.ScheduledDate);
                        }
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }

                Console.WriteLine("            ResponseHeaderMetadata");
                Console.WriteLine("                RequestId");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.RequestId);
                Console.WriteLine("                ResponseContext");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.ResponseContext);
                Console.WriteLine("                Timestamp");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.Timestamp);
            }
            catch (MarketplaceWebServiceException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
                Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata);
            }
        }
Пример #4
0
 /// <summary>
 /// Get Report Schedule List
 /// </summary>
 /// <param name="request">Get Report Schedule List  request</param>
 /// <returns>Get Report Schedule List  Response from the service</returns>
 /// <remarks>
 /// returns the list of report schedules
 ///
 /// </remarks>
 public async Task <GetReportScheduleListResponse> GetReportScheduleList(GetReportScheduleListRequest request)
 {
     return(await Invoke <GetReportScheduleListResponse>("GetReportScheduleListResponse.xml"));
 }