INotificationsRepository.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 [notification updated].
  19. /// </summary>
  20. event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
  21. /// <summary>
  22. /// Occurs when [notifications marked read].
  23. /// </summary>
  24. event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
  25. /// <summary>
  26. /// Opens the connection to the repository
  27. /// </summary>
  28. /// <returns>Task.</returns>
  29. Task Initialize();
  30. /// <summary>
  31. /// Gets the notifications.
  32. /// </summary>
  33. /// <param name="query">The query.</param>
  34. /// <returns>NotificationResult.</returns>
  35. NotificationResult GetNotifications(NotificationQuery query);
  36. /// <summary>
  37. /// Gets the notification.
  38. /// </summary>
  39. /// <param name="id">The id.</param>
  40. /// <param name="userId">The user id.</param>
  41. /// <returns>Notification.</returns>
  42. Notification GetNotification(string id, string userId);
  43. /// <summary>
  44. /// Adds the notification.
  45. /// </summary>
  46. /// <param name="notification">The notification.</param>
  47. /// <param name="cancellationToken">The cancellation token.</param>
  48. /// <returns>Task.</returns>
  49. Task AddNotification(Notification notification, CancellationToken cancellationToken);
  50. /// <summary>
  51. /// Marks the read.
  52. /// </summary>
  53. /// <param name="notificationIdList">The notification id list.</param>
  54. /// <param name="userId">The user id.</param>
  55. /// <param name="isRead">if set to <c>true</c> [is read].</param>
  56. /// <param name="cancellationToken">The cancellation token.</param>
  57. /// <returns>Task.</returns>
  58. Task MarkRead(IEnumerable<string> notificationIdList, string userId, bool isRead, CancellationToken cancellationToken);
  59. /// <summary>
  60. /// Gets the notifications summary.
  61. /// </summary>
  62. /// <param name="userId">The user id.</param>
  63. /// <returns>NotificationsSummary.</returns>
  64. NotificationsSummary GetNotificationsSummary(string userId);
  65. }
  66. }