INotificationSubscriptionManager.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using Abp.Domain.Entities;
  4. namespace Abp.Notifications
  5. {
  6. /// <summary>
  7. /// Used to manage subscriptions for notifications.
  8. /// </summary>
  9. public interface INotificationSubscriptionManager
  10. {
  11. /// <summary>
  12. /// Subscribes to a notification for given user and notification informations.
  13. /// </summary>
  14. /// <param name="user">User</param>
  15. /// <param name="notificationName">Name of the notification.</param>
  16. /// <param name="entityIdentifier">entity identifier</param>
  17. Task SubscribeAsync(UserIdentifier user, string notificationName, EntityIdentifier entityIdentifier = null);
  18. /// <summary>
  19. /// Subscribes to all available notifications for given user.
  20. /// It does not subscribe entity related notifications.
  21. /// </summary>
  22. /// <param name="user">User.</param>
  23. Task SubscribeToAllAvailableNotificationsAsync(UserIdentifier user);
  24. /// <summary>
  25. /// Unsubscribes from a notification.
  26. /// </summary>
  27. /// <param name="user">User.</param>
  28. /// <param name="notificationName">Name of the notification.</param>
  29. /// <param name="entityIdentifier">entity identifier</param>
  30. Task UnsubscribeAsync(UserIdentifier user, string notificationName, EntityIdentifier entityIdentifier = null);
  31. /// <summary>
  32. /// Gets all subscribtions for given notification (including all tenants).
  33. /// This only works for single database approach in a multitenant application!
  34. /// </summary>
  35. /// <param name="notificationName">Name of the notification.</param>
  36. /// <param name="entityIdentifier">entity identifier</param>
  37. Task<List<NotificationSubscription>> GetSubscriptionsAsync(string notificationName, EntityIdentifier entityIdentifier = null);
  38. /// <summary>
  39. /// Gets all subscribtions for given notification.
  40. /// </summary>
  41. /// <param name="tenantId">Tenant id. Null for the host.</param>
  42. /// <param name="notificationName">Name of the notification.</param>
  43. /// <param name="entityIdentifier">entity identifier</param>
  44. Task<List<NotificationSubscription>> GetSubscriptionsAsync(int? tenantId, string notificationName, EntityIdentifier entityIdentifier = null);
  45. /// <summary>
  46. /// Gets subscribed notifications for a user.
  47. /// </summary>
  48. /// <param name="user">User.</param>
  49. Task<List<NotificationSubscription>> GetSubscribedNotificationsAsync(UserIdentifier user);
  50. /// <summary>
  51. /// Checks if a user subscribed for a notification.
  52. /// </summary>
  53. /// <param name="user">User.</param>
  54. /// <param name="notificationName">Name of the notification.</param>
  55. /// <param name="entityIdentifier">entity identifier</param>
  56. Task<bool> IsSubscribedAsync(UserIdentifier user, string notificationName, EntityIdentifier entityIdentifier = null);
  57. }
  58. }