Example #1
0
        /// <summary>
        /// Update push notification service settings
        /// </summary>
        /// <param name="options"> Update Notification parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Notification </returns>
        public static NotificationResource Update(UpdateNotificationOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }
Example #2
0
 private static Request BuildUpdateRequest(UpdateNotificationOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Conversations,
                "/v1/Services/" + options.PathChatServiceSid + "/Configuration/Notifications",
                postParams: options.GetParams(),
                headerParams: null
                ));
 }
Example #3
0
        /// <summary>
        /// Update push notification service settings
        /// </summary>
        /// <param name="pathChatServiceSid"> The SID of the Conversation Service that the Configuration applies to. </param>
        /// <param name="logEnabled"> Weather the notification logging is enabled. </param>
        /// <param name="newMessageEnabled"> Whether to send a notification when a new message is added to a conversation.
        ///                         </param>
        /// <param name="newMessageTemplate"> The template to use to create the notification text displayed when a new message
        ///                          is added to a conversation. </param>
        /// <param name="newMessageSound"> The name of the sound to play when a new message is added to a conversation. </param>
        /// <param name="newMessageBadgeCountEnabled"> Whether the new message badge is enabled. </param>
        /// <param name="addedToConversationEnabled"> Whether to send a notification when a participant is added to a
        ///                                  conversation. </param>
        /// <param name="addedToConversationTemplate"> The template to use to create the notification text displayed when a
        ///                                   participant is added to a conversation. </param>
        /// <param name="addedToConversationSound"> The name of the sound to play when a participant is added to a
        ///                                conversation. </param>
        /// <param name="removedFromConversationEnabled"> Whether to send a notification to a user when they are removed from a
        ///                                      conversation. </param>
        /// <param name="removedFromConversationTemplate"> The template to use to create the notification text displayed to a
        ///                                       user when they are removed. </param>
        /// <param name="removedFromConversationSound"> The name of the sound to play to a user when they are removed from a
        ///                                    conversation. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Notification </returns>
        public static NotificationResource Update(string pathChatServiceSid,
                                                  bool?logEnabled                        = null,
                                                  bool?newMessageEnabled                 = null,
                                                  string newMessageTemplate              = null,
                                                  string newMessageSound                 = null,
                                                  bool?newMessageBadgeCountEnabled       = null,
                                                  bool?addedToConversationEnabled        = null,
                                                  string addedToConversationTemplate     = null,
                                                  string addedToConversationSound        = null,
                                                  bool?removedFromConversationEnabled    = null,
                                                  string removedFromConversationTemplate = null,
                                                  string removedFromConversationSound    = null,
                                                  ITwilioRestClient client               = null)
        {
            var options = new UpdateNotificationOptions(pathChatServiceSid)
            {
                LogEnabled = logEnabled, NewMessageEnabled = newMessageEnabled, NewMessageTemplate = newMessageTemplate, NewMessageSound = newMessageSound, NewMessageBadgeCountEnabled = newMessageBadgeCountEnabled, AddedToConversationEnabled = addedToConversationEnabled, AddedToConversationTemplate = addedToConversationTemplate, AddedToConversationSound = addedToConversationSound, RemovedFromConversationEnabled = removedFromConversationEnabled, RemovedFromConversationTemplate = removedFromConversationTemplate, RemovedFromConversationSound = removedFromConversationSound
            };

            return(Update(options, client));
        }
Example #4
0
        /// <summary>
        /// Update push notification service settings
        /// </summary>
        /// <param name="options"> Update Notification parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Notification </returns>
        public static async System.Threading.Tasks.Task <NotificationResource> UpdateAsync(UpdateNotificationOptions options,
                                                                                           ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }