INotificationsRepository.cs 3.0 KB

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