aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Notifications
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Notifications')
-rw-r--r--MediaBrowser.Controller/Notifications/INotificationManager.cs49
-rw-r--r--MediaBrowser.Controller/Notifications/INotificationsRepository.cs19
-rw-r--r--MediaBrowser.Controller/Notifications/NotificationUpdateEventArgs.cs4
-rw-r--r--MediaBrowser.Controller/Notifications/UserNotification.cs21
4 files changed, 77 insertions, 16 deletions
diff --git a/MediaBrowser.Controller/Notifications/INotificationManager.cs b/MediaBrowser.Controller/Notifications/INotificationManager.cs
new file mode 100644
index 000000000..8ed62f59f
--- /dev/null
+++ b/MediaBrowser.Controller/Notifications/INotificationManager.cs
@@ -0,0 +1,49 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Model.Notifications;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Controller.Notifications
+{
+ public interface INotificationManager
+ {
+ /// <summary>
+ /// Sends the notification.
+ /// </summary>
+ /// <param name="request">The request.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendNotification(NotificationRequest request, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Adds the parts.
+ /// </summary>
+ /// <param name="services">The services.</param>
+ void AddParts(IEnumerable<INotificationService> services);
+ }
+
+ public interface INotificationService
+ {
+ /// <summary>
+ /// Gets the name.
+ /// </summary>
+ /// <value>The name.</value>
+ string Name { get; }
+
+ /// <summary>
+ /// Sends the notification.
+ /// </summary>
+ /// <param name="request">The request.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendNotification(UserNotification request, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Determines whether [is enabled for user] [the specified user identifier].
+ /// </summary>
+ /// <param name="user">The user.</param>
+ /// <returns><c>true</c> if [is enabled for user] [the specified user identifier]; otherwise, <c>false</c>.</returns>
+ bool IsEnabledForUser(User user);
+ }
+}
diff --git a/MediaBrowser.Controller/Notifications/INotificationsRepository.cs b/MediaBrowser.Controller/Notifications/INotificationsRepository.cs
index 7a4b69b52..87b89e79c 100644
--- a/MediaBrowser.Controller/Notifications/INotificationsRepository.cs
+++ b/MediaBrowser.Controller/Notifications/INotificationsRepository.cs
@@ -1,8 +1,7 @@
-using System.Threading;
-using MediaBrowser.Controller.Persistence;
-using MediaBrowser.Model.Notifications;
+using MediaBrowser.Model.Notifications;
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Notifications
@@ -44,7 +43,7 @@ namespace MediaBrowser.Controller.Notifications
/// <param name="id">The id.</param>
/// <param name="userId">The user id.</param>
/// <returns>Notification.</returns>
- Notification GetNotification(Guid id, Guid userId);
+ Notification GetNotification(string id, string userId);
/// <summary>
/// Adds the notification.
@@ -55,14 +54,6 @@ namespace MediaBrowser.Controller.Notifications
Task AddNotification(Notification notification, CancellationToken cancellationToken);
/// <summary>
- /// Updates the notification.
- /// </summary>
- /// <param name="notification">The notification.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task UpdateNotification(Notification notification, CancellationToken cancellationToken);
-
- /// <summary>
/// Marks the read.
/// </summary>
/// <param name="notificationIdList">The notification id list.</param>
@@ -70,13 +61,13 @@ namespace MediaBrowser.Controller.Notifications
/// <param name="isRead">if set to <c>true</c> [is read].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task MarkRead(IEnumerable<Guid> notificationIdList, Guid userId, bool isRead, CancellationToken cancellationToken);
+ Task MarkRead(IEnumerable<string> notificationIdList, string userId, bool isRead, CancellationToken cancellationToken);
/// <summary>
/// Gets the notifications summary.
/// </summary>
/// <param name="userId">The user id.</param>
/// <returns>NotificationsSummary.</returns>
- NotificationsSummary GetNotificationsSummary(Guid userId);
+ NotificationsSummary GetNotificationsSummary(string userId);
}
}
diff --git a/MediaBrowser.Controller/Notifications/NotificationUpdateEventArgs.cs b/MediaBrowser.Controller/Notifications/NotificationUpdateEventArgs.cs
index e156ca26a..d8a6634df 100644
--- a/MediaBrowser.Controller/Notifications/NotificationUpdateEventArgs.cs
+++ b/MediaBrowser.Controller/Notifications/NotificationUpdateEventArgs.cs
@@ -10,8 +10,8 @@ namespace MediaBrowser.Controller.Notifications
public class NotificationReadEventArgs : EventArgs
{
- public Guid[] IdList { get; set; }
- public Guid UserId { get; set; }
+ public string[] IdList { get; set; }
+ public string UserId { get; set; }
public bool IsRead { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Notifications/UserNotification.cs b/MediaBrowser.Controller/Notifications/UserNotification.cs
new file mode 100644
index 000000000..d035a3995
--- /dev/null
+++ b/MediaBrowser.Controller/Notifications/UserNotification.cs
@@ -0,0 +1,21 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Model.Notifications;
+using System;
+
+namespace MediaBrowser.Controller.Notifications
+{
+ public class UserNotification
+ {
+ public string Name { get; set; }
+
+ public string Description { get; set; }
+
+ public string Url { get; set; }
+
+ public NotificationLevel Level { get; set; }
+
+ public DateTime Date { get; set; }
+
+ public User User { get; set; }
+ }
+}