コード例 #1
0
        /// <summary>
        /// cancels feed submissions - by default all of the submissions of the
        /// last 30 days that have not started processing
        ///
        /// </summary>
        /// <param name="service">Instance of MarketplaceWebService service</param>
        /// <param name="request">CancelFeedSubmissionsRequest request</param>
        public static void InvokeCancelFeedSubmissions(MarketplaceWebService service, CancelFeedSubmissionsRequest request)
        {
            try
            {
                CancelFeedSubmissionsResponse response = service.CancelFeedSubmissions(request);


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

                Console.WriteLine("        CancelFeedSubmissionsResponse");
                if (response.IsSetCancelFeedSubmissionsResult())
                {
                    Console.WriteLine("            CancelFeedSubmissionsResult");
                    CancelFeedSubmissionsResult cancelFeedSubmissionsResult = response.CancelFeedSubmissionsResult;
                    if (cancelFeedSubmissionsResult.IsSetCount())
                    {
                        Console.WriteLine("                Count");
                        Console.WriteLine("                    {0}", cancelFeedSubmissionsResult.Count);
                    }
                    List <FeedSubmissionInfo> feedSubmissionInfoList = cancelFeedSubmissionsResult.FeedSubmissionInfo;
                    foreach (FeedSubmissionInfo feedSubmissionInfo in feedSubmissionInfoList)
                    {
                        Console.WriteLine("                FeedSubmissionInfo");
                        if (feedSubmissionInfo.IsSetFeedSubmissionId())
                        {
                            Console.WriteLine("                    FeedSubmissionId");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedSubmissionId);
                        }
                        if (feedSubmissionInfo.IsSetFeedType())
                        {
                            Console.WriteLine("                    FeedType");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedType);
                        }
                        if (feedSubmissionInfo.IsSetSubmittedDate())
                        {
                            Console.WriteLine("                    SubmittedDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.SubmittedDate);
                        }
                        if (feedSubmissionInfo.IsSetFeedProcessingStatus())
                        {
                            Console.WriteLine("                    FeedProcessingStatus");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedProcessingStatus);
                        }
                        if (feedSubmissionInfo.IsSetStartedProcessingDate())
                        {
                            Console.WriteLine("                    StartedProcessingDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.StartedProcessingDate);
                        }
                        if (feedSubmissionInfo.IsSetCompletedProcessingDate())
                        {
                            Console.WriteLine("                    CompletedProcessingDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.CompletedProcessingDate);
                        }
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
            }
            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);
            }
        }
コード例 #2
0
        private FeedSubmissionInfo[] CancelFeedSubmissions(string[] FeedSubmissionIds, EFeedType[] FeedTypeList, DateTime SubmittedFromDate, DateTime SubmittedToDate)
        {
            this.Throttle();
            AmazonCredential             Credentials = this.GetCredential();
            MarketplaceWebServiceClient  Client      = this.GetClient(Credentials);
            CancelFeedSubmissionsRequest Request     = default(CancelFeedSubmissionsRequest);

            if (FeedSubmissionIds != null)
            {
                Request = new CancelFeedSubmissionsRequest()
                {
                    Merchant             = Credentials.MerchantID,
                    FeedSubmissionIdList = new IdList()
                    {
                        Id = FeedSubmissionIds.ToList()
                    }
                }
            }
            ;
            else if (FeedTypeList != null)
            {
                Request = new CancelFeedSubmissionsRequest()
                {
                    Merchant     = Credentials.MerchantID,
                    FeedTypeList = new TypeList()
                    {
                        Type = FeedTypeList.Select(Item => EnumStringHandler.GetEnumString <EFeedType>(Item)).ToList()
                    }
                }
            }
            ;
            else if (SubmittedFromDate != default(DateTime) && SubmittedFromDate != default(DateTime))
            {
                Request = new CancelFeedSubmissionsRequest()
                {
                    Merchant          = Credentials.MerchantID,
                    SubmittedFromDate = SubmittedFromDate,
                    SubmittedToDate   = SubmittedToDate
                }
            }
            ;
            else
            {
                throw new ArgumentException("Error, invalid arguments provided!");
            }
            CancelFeedSubmissionsResponse Response = Client.CancelFeedSubmissions(Request);

            if (Response.IsSetCancelFeedSubmissionsResult())
            {
                CancelFeedSubmissionsResult Result = Response.CancelFeedSubmissionsResult;
                if (Result.IsSetCount())
                {
                    if (Result.Count > 0)
                    {
                        Console.WriteLine($"Successfully canceled [{Result.Count}] feeds!");
                    }
                }

                if (Result.IsSetFeedSubmissionInfo())
                {
                    return(Result.FeedSubmissionInfo.ToArray());
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }