/// <summary>
 /// Initializes a new instance of the <see cref="NewNotificationConfiguration"/> class
 /// with the specified properties.
 /// </summary>
 /// <param name="label">The friendly name of the notification.</param>
 /// <param name="notificationTypeId">The notification type ID. This is obtained from <see cref="NotificationType.Id">NotificationType.Id</see>, or from the predefined values in <see cref="NotificationTypeId"/>.</param>
 /// <param name="details">A <see cref="NotificationDetails"/> object containing the detailed configuration properties for the specified notification type.</param>
 /// <param name="metadata">A collection of metadata to associate with the notification. If the value is <see langword="null"/>, no custom metadata is associated with the notification.</param>
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="label"/> is <see langword="null"/>.
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is empty.
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> is non-<see langword="null"/> and <paramref name="notificationTypeId"/> is <see langword="null"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> does not support notifications of type <paramref name="notificationTypeId"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
 /// </exception>
 public NewNotificationConfiguration(string label, NotificationTypeId notificationTypeId, NotificationDetails details, IDictionary<string, string> metadata = null)
     : base(label, notificationTypeId, details, metadata)
 {
     if (label == null)
         throw new ArgumentNullException("label");
     if (details == null)
         throw new ArgumentNullException("details");
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationConfiguration"/> class
        /// with the specified properties.
        /// </summary>
        /// <param name="label">The friendly name of the notification. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="notificationTypeId">The notification type ID. This is obtained from <see cref="NotificationType.Id">NotificationType.Id</see>, or from the predefined values in <see cref="NotificationTypeId"/>. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="details">A <see cref="NotificationDetails"/> object containing the detailed configuration properties for the specified notification type. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="metadata">A collection of metadata to associate with the notification. If the value is <see langword="null"/>, no custom metadata is associated with the notification. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <exception cref="ArgumentException">
        /// If <paramref name="label"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="details"/> is non-<see langword="null"/> and <paramref name="notificationTypeId"/> is <see langword="null"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="details"/> does not support notifications of type <paramref name="notificationTypeId"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
        /// </exception>
        protected NotificationConfiguration(string label, NotificationTypeId notificationTypeId, NotificationDetails details, IDictionary<string, string> metadata)
        {
            if (label == string.Empty)
                throw new ArgumentException("label cannot be empty");
            if (details != null && notificationTypeId == null)
                throw new ArgumentException("notificationTypeId must be specified if details is specified", "notificationTypeId");
            if (details != null && !details.SupportsNotificationType(notificationTypeId))
                throw new ArgumentException(string.Format("The notification details object does not support '{0}' notifications.", notificationTypeId), "details");
            if (metadata != null && metadata.ContainsKey(string.Empty))
                throw new ArgumentException("metadata cannot contain any empty keys", "metadata");

            _label = label;
            _type = notificationTypeId;
            _details = details != null ? JObject.FromObject(details) : null;
            _metadata = metadata;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationConfiguration"/> class
        /// with the specified properties.
        /// </summary>
        /// <param name="label">The friendly name of the notification. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="notificationTypeId">The notification type ID. This is obtained from <see cref="NotificationType.Id">NotificationType.Id</see>, or from the predefined values in <see cref="NotificationTypeId"/>. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="details">A <see cref="NotificationDetails"/> object containing the detailed configuration properties for the specified notification type. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="metadata">A collection of metadata to associate with the notification. If the value is <see langword="null"/>, no custom metadata is associated with the notification. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <exception cref="ArgumentException">
        /// If <paramref name="label"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="details"/> is non-<see langword="null"/> and <paramref name="notificationTypeId"/> is <see langword="null"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="details"/> does not support notifications of type <paramref name="notificationTypeId"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
        /// </exception>
        protected NotificationConfiguration(string label, NotificationTypeId notificationTypeId, NotificationDetails details, IDictionary <string, string> metadata)
        {
            if (label == string.Empty)
            {
                throw new ArgumentException("label cannot be empty");
            }
            if (details != null && notificationTypeId == null)
            {
                throw new ArgumentException("notificationTypeId must be specified if details is specified", "notificationTypeId");
            }
            if (details != null && !details.SupportsNotificationType(notificationTypeId))
            {
                throw new ArgumentException(string.Format("The notification details object does not support '{0}' notifications.", notificationTypeId), "details");
            }
            if (metadata != null && metadata.ContainsKey(string.Empty))
            {
                throw new ArgumentException("metadata cannot contain any empty keys", "metadata");
            }

            _label   = label;
            _type    = notificationTypeId;
            _details = details != null?JObject.FromObject(details) : null;

            _metadata = metadata;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateNotificationConfiguration"/> class
 /// with the specified properties.
 /// </summary>
 /// <param name="label">The friendly name of the notification. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <param name="notificationTypeId">The notification type ID. This is obtained from <see cref="NotificationType.Id">NotificationType.Id</see>, or from the predefined values in <see cref="NotificationTypeId"/>. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <param name="details">A <see cref="NotificationDetails"/> object containing the detailed configuration properties for the specified notification type. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <param name="metadata">A collection of metadata to associate with the notification. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is empty.
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> is non-<see langword="null"/> and <paramref name="notificationTypeId"/> is <see langword="null"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> does not support notifications of type <paramref name="notificationTypeId"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
 /// </exception>
 public UpdateNotificationConfiguration(string label = null, NotificationTypeId notificationTypeId = null, NotificationDetails details = null, IDictionary <string, string> metadata = null)
     : base(label, notificationTypeId, details, metadata)
 {
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewNotificationConfiguration"/> class
 /// with the specified properties.
 /// </summary>
 /// <param name="label">The friendly name of the notification.</param>
 /// <param name="notificationTypeId">The notification type ID. This is obtained from <see cref="NotificationType.Id">NotificationType.Id</see>, or from the predefined values in <see cref="NotificationTypeId"/>.</param>
 /// <param name="details">A <see cref="NotificationDetails"/> object containing the detailed configuration properties for the specified notification type.</param>
 /// <param name="metadata">A collection of metadata to associate with the notification. If the value is <see langword="null"/>, no custom metadata is associated with the notification.</param>
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="label"/> is <see langword="null"/>.
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is empty.
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> is non-<see langword="null"/> and <paramref name="notificationTypeId"/> is <see langword="null"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> does not support notifications of type <paramref name="notificationTypeId"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
 /// </exception>
 public NewNotificationConfiguration(string label, NotificationTypeId notificationTypeId, NotificationDetails details, IDictionary <string, string> metadata = null)
     : base(label, notificationTypeId, details, metadata)
 {
     if (label == null)
     {
         throw new ArgumentNullException("label");
     }
     if (details == null)
     {
         throw new ArgumentNullException("details");
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateNotificationConfiguration"/> class
 /// with the specified properties.
 /// </summary>
 /// <param name="label">The friendly name of the notification. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <param name="notificationTypeId">The notification type ID. This is obtained from <see cref="NotificationType.Id">NotificationType.Id</see>, or from the predefined values in <see cref="NotificationTypeId"/>. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <param name="details">A <see cref="NotificationDetails"/> object containing the detailed configuration properties for the specified notification type. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <param name="metadata">A collection of metadata to associate with the notification. If this value is <see langword="null"/>, the existing value for the notification is not changed.</param>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is empty.
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> is non-<see langword="null"/> and <paramref name="notificationTypeId"/> is <see langword="null"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> does not support notifications of type <paramref name="notificationTypeId"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
 /// </exception>
 public UpdateNotificationConfiguration(string label = null, NotificationTypeId notificationTypeId = null, NotificationDetails details = null, IDictionary<string, string> metadata = null)
     : base(label, notificationTypeId, details, metadata)
 {
 }