2020-12-23 11:02:50 +11:00
|
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
|
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2021-05-11 14:33:49 +02:00
|
|
|
|
using Umbraco.Cms.Core.Notifications;
|
2020-12-23 11:02:50 +11:00
|
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
|
namespace Umbraco.Cms.Core.Events
|
2020-12-23 11:02:50 +11:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines a handler for a notification.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <typeparam name="TNotification">The type of notification being handled.</typeparam>
|
|
|
|
|
|
public interface INotificationHandler<in TNotification>
|
|
|
|
|
|
where TNotification : INotification
|
2021-01-19 09:57:55 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Handles a notification
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="notification">The notification</param>
|
|
|
|
|
|
void Handle(TNotification notification);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines a handler for a async notification.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <typeparam name="TNotification">The type of notification being handled.</typeparam>
|
|
|
|
|
|
public interface INotificationAsyncHandler<in TNotification>
|
|
|
|
|
|
where TNotification : INotification
|
2020-12-23 11:02:50 +11:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Handles a notification
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="notification">The notification</param>
|
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
|
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|
|
|
|
|
Task HandleAsync(TNotification notification, CancellationToken cancellationToken);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|