2021-03-04 07:14:54 +01:00
// Copyright (c) Umbraco.
// See LICENSE for more details.
2021-07-12 09:46:56 -06:00
using System ;
2021-03-03 17:08:21 +01:00
using System.Threading.Tasks ;
2021-05-11 14:33:49 +02:00
using Umbraco.Cms.Core.Notifications ;
2021-03-03 17:08:21 +01:00
namespace Umbraco.Cms.Core.Events
{
public interface IScopedNotificationPublisher
{
2021-07-12 09:46:56 -06:00
/// <summary>
2021-07-14 01:19:06 +10:00
/// Suppresses all notifications from being added/created until the result object is disposed.
2021-07-12 09:46:56 -06:00
/// </summary>
/// <returns></returns>
2021-07-12 11:54:38 -06:00
IDisposable Suppress ( ) ;
2021-07-12 09:46:56 -06:00
2021-03-03 17:08:21 +01: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 ) ;
}
}