INotificationPublisher.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Threading.Tasks;
  2. using Abp.Domain.Entities;
  3. using Abp.Runtime.Session;
  4. namespace Abp.Notifications
  5. {
  6. /// <summary>
  7. /// Used to publish notifications.
  8. /// </summary>
  9. public interface INotificationPublisher
  10. {
  11. /// <summary>
  12. /// Publishes a new notification.
  13. /// </summary>
  14. /// <param name="notificationName">Unique notification name</param>
  15. /// <param name="data">Notification data (optional)</param>
  16. /// <param name="entityIdentifier">The entity identifier if this notification is related to an entity</param>
  17. /// <param name="severity">Notification severity</param>
  18. /// <param name="userIds">
  19. /// Target user id(s).
  20. /// Used to send notification to specific user(s) (without checking the subscription).
  21. /// If this is null/empty, the notification is sent to subscribed users.
  22. /// </param>
  23. /// <param name="excludedUserIds">
  24. /// Excluded user id(s).
  25. /// This can be set to exclude some users while publishing notifications to subscribed users.
  26. /// It's normally not set if <see cref="userIds"/> is set.
  27. /// </param>
  28. /// <param name="tenantIds">
  29. /// Target tenant id(s).
  30. /// Used to send notification to subscribed users of specific tenant(s).
  31. /// This should not be set if <see cref="userIds"/> is set.
  32. /// <see cref="NotificationPublisher.AllTenants"/> can be passed to indicate all tenants.
  33. /// But this can only work in a single database approach (all tenants are stored in host database).
  34. /// If this is null, then it's automatically set to the current tenant on <see cref="IAbpSession.TenantId"/>.
  35. /// </param>
  36. Task PublishAsync(
  37. string notificationName,
  38. NotificationData data = null,
  39. EntityIdentifier entityIdentifier = null,
  40. NotificationSeverity severity = NotificationSeverity.Info,
  41. UserIdentifier[] userIds = null,
  42. UserIdentifier[] excludedUserIds = null,
  43. int?[] tenantIds = null);
  44. }
  45. }