INotificationsRepository.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. /// Gets the notifications.
  23. /// </summary>
  24. /// <param name="query">The query.</param>
  25. /// <returns>NotificationResult.</returns>
  26. NotificationResult GetNotifications(NotificationQuery query);
  27. /// <summary>
  28. /// Adds the notification.
  29. /// </summary>
  30. /// <param name="notification">The notification.</param>
  31. /// <param name="cancellationToken">The cancellation token.</param>
  32. /// <returns>Task.</returns>
  33. Task AddNotification(Notification notification, CancellationToken cancellationToken);
  34. /// <summary>
  35. /// Marks the read.
  36. /// </summary>
  37. /// <param name="notificationIdList">The notification id list.</param>
  38. /// <param name="userId">The user id.</param>
  39. /// <param name="isRead">if set to <c>true</c> [is read].</param>
  40. /// <param name="cancellationToken">The cancellation token.</param>
  41. /// <returns>Task.</returns>
  42. Task MarkRead(IEnumerable<string> notificationIdList, string userId, bool isRead, CancellationToken cancellationToken);
  43. /// <summary>
  44. /// Marks all read.
  45. /// </summary>
  46. /// <param name="userId">The user identifier.</param>
  47. /// <param name="isRead">if set to <c>true</c> [is read].</param>
  48. /// <param name="cancellationToken">The cancellation token.</param>
  49. /// <returns>Task.</returns>
  50. Task MarkAllRead(string userId, bool isRead, CancellationToken cancellationToken);
  51. /// <summary>
  52. /// Gets the notifications summary.
  53. /// </summary>
  54. /// <param name="userId">The user id.</param>
  55. /// <returns>NotificationsSummary.</returns>
  56. NotificationsSummary GetNotificationsSummary(string userId);
  57. }
  58. }