Exemplo n.º 1
0
        /// <summary>
        /// Validate and make the request.
        /// </summary>
        public new async Task <PublishToSNSResult> SendAsync()
        {
            try
            {
                Validate();
                PublishToUserOperator publishService = new PublishToUserOperator(new PublishToUserOperatorModel(this), base.Provider);
                PublishToSNSResult    result         = await publishService.PublishToSubscriberAsync(NotificationToken);

                return(result);
            }
            catch (AWSMobilePushNotificationServiceException ex)
            {
                return(new PublishToSNSFailedResult(ex.Message));
            }
            catch (Exception ex)
            {
                if (Provider.CatchAllExceptions)
                {
                    return(new PublishToSNSFailedResult(ex.Message));
                }
                else
                {
                    throw ex;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Validate and make the request.
        /// </summary>
        /// <returns> List of results corresponding to the each subscriber of the user</returns>
        public async Task <List <PublishToSNSResult> > SendAsync()
        {
            try
            {
                Validate();
                PublishToUserOperator     publishService = new PublishToUserOperator(new PublishToUserOperatorModel(this), base.Provider);
                List <PublishToSNSResult> results        = await publishService.PublishToUserAsync();

                return(results);
            }
            catch (AWSMobilePushNotificationServiceException ex)
            {
                return(new List <PublishToSNSResult> {
                    new PublishToSNSFailedResult(ex)
                });
            }
            catch (Exception ex)
            {
                if (Provider.CatchAllExceptions)
                {
                    return(new List <PublishToSNSResult> {
                        new PublishToSNSFailedResult(ex.Message)
                    });
                }
                else
                {
                    throw ex;
                }
            }
        }