diff --git a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationEvents.cs b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationEvents.cs index 3636d9028bc..1d992febec2 100644 --- a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationEvents.cs +++ b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationEvents.cs @@ -2,19 +2,53 @@ namespace OrchardCore.Notifications; +/// +/// Represents a contract for notification events. +/// public interface INotificationEvents { + /// + /// Occurs before the notification is created. + /// + /// The . Task CreatingAsync(NotificationContext context); + /// + /// Occurs after the notification is created. + /// + /// The . Task CreatedAsync(NotificationContext context); + /// + /// Occurs before the notification is sent. + /// + /// The . + /// The . Task SendingAsync(INotificationMethodProvider provider, NotificationContext context); + /// + /// Occurs after the notification is sent. + /// + /// The . + /// The . Task SentAsync(INotificationMethodProvider provider, NotificationContext context); + /// + /// Occurs when the notification is failed. + /// + /// The . + /// The . Task FailedAsync(INotificationMethodProvider provider, NotificationContext context); + /// + /// Occurs before the notification is sent. + /// + /// The . Task SendingAsync(NotificationContext context); + /// + /// Occurs after the notification is sent. + /// + /// The . Task SentAsync(NotificationContext context); } diff --git a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMessage.cs b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMessage.cs index 07274993589..c5e820a9d5e 100644 --- a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMessage.cs +++ b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMessage.cs @@ -1,12 +1,27 @@ namespace OrchardCore.Notifications; +/// +/// Represents a contract for notification message information. +/// public interface INotificationMessage { + /// + /// Gets the message summary. + /// string Summary { get; } + /// + /// Gets the plain message body. + /// string TextBody { get; } + /// + /// Gets the HTML message body. + /// string HtmlBody { get; } + /// + /// Gets whether HTML is preferred for the message body. + /// bool IsHtmlPreferred { get; } } diff --git a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProvider.cs b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProvider.cs index d2766cc2519..0daf2f24c10 100644 --- a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProvider.cs +++ b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProvider.cs @@ -3,23 +3,27 @@ namespace OrchardCore.Notifications; +/// +/// Represents a contract for a notification provider. +/// public interface INotificationMethodProvider { /// - /// Unique name for the provider. + /// Gets the provider name. /// + /// The name should be unique. string Method { get; } /// - /// A localized name for the method. + /// Gets a localized name for the method. /// LocalizedString Name { get; } /// /// Attempts to send the given message to the given notifiable object. /// - /// - /// + /// The notifiable object. + /// The . /// true when the message was successfully sent otherwise false. Task TrySendAsync(object notify, INotificationMessage message); } diff --git a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProviderAccessor.cs b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProviderAccessor.cs index 0bab8e15ee9..3263320a444 100644 --- a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProviderAccessor.cs +++ b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationMethodProviderAccessor.cs @@ -3,7 +3,15 @@ namespace OrchardCore.Notifications; +/// +/// Represents a contract for accessing the . +/// public interface INotificationMethodProviderAccessor { + /// + /// Gets the registered notification method providers. + /// + /// The notifiable object. + /// A list of . Task> GetProvidersAsync(object notify); } diff --git a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationService.cs b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationService.cs index db416cc3252..ef123fe1607 100644 --- a/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationService.cs +++ b/src/OrchardCore/OrchardCore.Notifications.Abstractions/INotificationService.cs @@ -2,13 +2,16 @@ namespace OrchardCore.Notifications; +/// +/// Contract for notification service. +/// public interface INotificationService { /// /// Attempts to send the given message to the given notifiable object. /// - /// - /// + /// The notifiable object. + /// The message to be sent. /// The number of messages that were successfully sent to the user. Task SendAsync(object notify, INotificationMessage message); } diff --git a/src/OrchardCore/OrchardCore.Notifications.Abstractions/Notification.cs b/src/OrchardCore/OrchardCore.Notifications.Abstractions/Notification.cs index c366b5e4584..96efa051790 100644 --- a/src/OrchardCore/OrchardCore.Notifications.Abstractions/Notification.cs +++ b/src/OrchardCore/OrchardCore.Notifications.Abstractions/Notification.cs @@ -3,25 +3,28 @@ namespace OrchardCore.Notifications; +/// +/// Represents a notification entity. +/// public class Notification : Entity { /// - /// The Id of the notification. + /// Gets or sets the notification Id. /// public string NotificationId { get; set; } /// - /// The summary of the notification + /// Gets or sets the notification summary. /// public string Summary { get; set; } /// - /// The user id of the user who caused the event to occur. + /// Gets or sets the user id who caused the event to occur. /// public string UserId { get; set; } /// - /// The date and time when the event occurred. + /// Gets or sets the date and time when the event occurred. /// public DateTime CreatedUtc { get; set; } } diff --git a/src/OrchardCore/OrchardCore.Notifications.Abstractions/NotificationContext.cs b/src/OrchardCore/OrchardCore.Notifications.Abstractions/NotificationContext.cs index 13f0025465d..45cd53199e3 100644 --- a/src/OrchardCore/OrchardCore.Notifications.Abstractions/NotificationContext.cs +++ b/src/OrchardCore/OrchardCore.Notifications.Abstractions/NotificationContext.cs @@ -2,17 +2,35 @@ namespace OrchardCore.Notifications; +/// +/// Represents a context for notification. +/// public class NotificationContext { - public Notification Notification { get; set; } - - public INotificationMessage NotificationMessage { get; } - - public object Notify { get; } - + /// + /// Creates a new instance of . + /// + /// The notification message. + /// The notifiable object. + /// Occurs when is null, public NotificationContext(INotificationMessage notificationMessage, object notify) { NotificationMessage = notificationMessage ?? throw new ArgumentNullException(nameof(notificationMessage)); Notify = notify ?? throw new ArgumentNullException(nameof(notify)); } + + /// + /// Gets ot sets the notification. + /// + public Notification Notification { get; set; } + + /// + /// Gets or sets the notification message. + /// + public INotificationMessage NotificationMessage { get; } + + /// + /// Gets or sets the notifiable object. + /// + public object Notify { get; } }