/// <summary> /// Parses the message. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="notification">The notification.</param> /// <param name="type">The type.</param> /// <param name="c">The c.</param> /// <returns></returns> public NotificationMessageContent ParseMessage <T>(T notification, NotificationType type, NotificationMessageCurlys c) where T : NotificationSettings { var content = notification.Message.FirstOrDefault(x => x.NotificationType == type); if (content == null) { return(new NotificationMessageContent()); } return(Resolve(content.Body, content.Subject, c.Curlys)); }
/// <summary> /// Parses the message. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="notification">The notification.</param> /// <param name="type">The type.</param> /// <param name="c">The c.</param> /// <param name="transportType">Type of the transport.</param> /// <returns></returns> public NotificationMessageContent ParseMessage(NotificationSettingsV2 notification, NotificationType type, NotificationMessageCurlys c, TransportType transportType) { IEnumerable <NotificationMessage> content = null; switch (transportType) { case TransportType.Email: content = notification.EmailNotification; break; case TransportType.Pushbullet: content = notification.PushbulletNotification; break; case TransportType.Pushover: content = notification.PushoverNotification; break; case TransportType.Slack: content = notification.SlackNotification; break; default: throw new ArgumentOutOfRangeException(nameof(transportType), transportType, null); } if (content == null) { return(new NotificationMessageContent()); } var message = content.FirstOrDefault(x => x.NotificationType == type) ?? new NotificationMessage(); return(Resolve(message.Body, message.Subject, c.Curlys)); }