Files
Umbraco-CMS/src/Umbraco.Core/Events/IScopedNotificationPublisher.cs

46 lines
1.7 KiB
C#
Raw Normal View History

// Copyright (c) Umbraco.
// See LICENSE for more details.
2021-07-12 09:46:56 -06:00
using System;
using System.Threading.Tasks;
using Umbraco.Cms.Core.Notifications;
namespace Umbraco.Cms.Core.Events
{
public interface IScopedNotificationPublisher
{
2021-07-12 09:46:56 -06:00
/// <summary>
/// Suppresses all notifications from being added/created until the result object is disposed.
2021-07-12 09:46:56 -06:00
/// </summary>
/// <returns></returns>
IDisposable Suppress();
2021-07-12 09:46:56 -06:00
/// <summary>
/// Publishes a cancelable notification to the notification subscribers
/// </summary>
/// <param name="notification"></param>
/// <returns>True if the notification was cancelled by a subscriber, false otherwise</returns>
bool PublishCancelable(ICancelableNotification notification);
/// <summary>
/// Publishes a cancelable notification to the notification subscribers
/// </summary>
/// <param name="notification"></param>
/// <returns>True if the notification was cancelled by a subscriber, false otherwise</returns>
Task<bool> PublishCancelableAsync(ICancelableNotification notification);
/// <summary>
/// Publishes a notification to the notification subscribers
/// </summary>
/// <param name="notification"></param>
/// <remarks>The notification is published upon successful completion of the current scope, i.e. when things have been saved/published/deleted etc.</remarks>
void Publish(INotification notification);
/// <summary>
/// Invokes publishing of all pending notifications within the current scope
/// </summary>
/// <param name="completed"></param>
void ScopeExit(bool completed);
}
}