INotificationsRepository.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using MediaBrowser.Model.Notifications;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Controller.Notifications
  7. {
  8. /// <summary>
  9. /// Interface INotificationsRepository
  10. /// </summary>
  11. public interface INotificationsRepository
  12. {
  13. /// <summary>
  14. /// Occurs when [notification added].
  15. /// </summary>
  16. event EventHandler<NotificationUpdateEventArgs> NotificationAdded;
  17. /// <summary>
  18. /// Occurs when [notifications marked read].
  19. /// </summary>
  20. event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
  21. /// <summary>
  22. /// Opens the connection to the repository
  23. /// </summary>
  24. /// <returns>Task.</returns>
  25. Task Initialize();
  26. /// <summary>
  27. /// Gets the notifications.
  28. /// </summary>
  29. /// <param name="query">The query.</param>
  30. /// <returns>NotificationResult.</returns>
  31. NotificationResult GetNotifications(NotificationQuery query);
  32. /// <summary>
  33. /// Adds the notification.
  34. /// </summary>
  35. /// <param name="notification">The notification.</param>
  36. /// <param name="cancellationToken">The cancellation token.</param>
  37. /// <returns>Task.</returns>
  38. Task AddNotification(Notification notification, CancellationToken cancellationToken);
  39. /// <summary>
  40. /// Marks the read.
  41. /// </summary>
  42. /// <param name="notificationIdList">The notification id list.</param>
  43. /// <param name="userId">The user id.</param>
  44. /// <param name="isRead">if set to <c>true</c> [is read].</param>
  45. /// <param name="cancellationToken">The cancellation token.</param>
  46. /// <returns>Task.</returns>
  47. Task MarkRead(IEnumerable<string> notificationIdList, string userId, bool isRead, CancellationToken cancellationToken);
  48. /// <summary>
  49. /// Marks all read.
  50. /// </summary>
  51. /// <param name="userId">The user identifier.</param>
  52. /// <param name="isRead">if set to <c>true</c> [is read].</param>
  53. /// <param name="cancellationToken">The cancellation token.</param>
  54. /// <returns>Task.</returns>
  55. Task MarkAllRead(string userId, bool isRead, CancellationToken cancellationToken);
  56. /// <summary>
  57. /// Gets the notifications summary.
  58. /// </summary>
  59. /// <param name="userId">The user id.</param>
  60. /// <returns>NotificationsSummary.</returns>
  61. NotificationsSummary GetNotificationsSummary(string userId);
  62. }
  63. }