INotificationDefinitionManager.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. namespace Abp.Notifications
  4. {
  5. /// <summary>
  6. /// Used to manage notification definitions.
  7. /// </summary>
  8. public interface INotificationDefinitionManager
  9. {
  10. /// <summary>
  11. /// Adds the specified notification definition.
  12. /// </summary>
  13. void Add(NotificationDefinition notificationDefinition);
  14. /// <summary>
  15. /// Gets a notification definition by name.
  16. /// Throws exception if there is no notification definition with given name.
  17. /// </summary>
  18. NotificationDefinition Get(string name);
  19. /// <summary>
  20. /// Gets a notification definition by name.
  21. /// Returns null if there is no notification definition with given name.
  22. /// </summary>
  23. NotificationDefinition GetOrNull(string name);
  24. /// <summary>
  25. /// Gets all notification definitions.
  26. /// </summary>
  27. IReadOnlyList<NotificationDefinition> GetAll();
  28. /// <summary>
  29. /// Checks if given notification (<see cref="name"/>) is available for given user.
  30. /// </summary>
  31. Task<bool> IsAvailableAsync(string name, UserIdentifier user);
  32. /// <summary>
  33. /// Gets all available notification definitions for given user.
  34. /// </summary>
  35. /// <param name="user">User.</param>
  36. Task<IReadOnlyList<NotificationDefinition>> GetAllAvailableAsync(UserIdentifier user);
  37. /// <summary>
  38. /// Remove notification with given name
  39. /// </summary>
  40. /// <param name="name"></param>
  41. void Remove(string name);
  42. }
  43. }