Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions src/LagoVista.Core/Interfaces/INotificationPublisherV2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using LagoVista.Core.Models;
using System;
using System.Threading.Tasks;

namespace LagoVista.Core.Interfaces
{
/// <summary>
/// Additive delivery-target flags. The legacy Targets enum and
/// INotificationPublisher signatures remain unchanged.
/// </summary>
[Flags]
public enum NotificationTargets
{
None = 0,
WebSocket = 1 << 0,
Push = 1 << 1,
Browser = 1 << 2,
Sms = 1 << 3
}

/// <summary>
/// Optional publisher capability for callers that explicitly select
/// multiple delivery transports. Existing publishers may continue to
/// implement INotificationPublisher only.
/// </summary>
public interface INotificationPublisherV2 : INotificationPublisher
{
Task PublishAsync(NotificationTargets targets, Notification notification,
NotificationVerbosity verbosity = NotificationVerbosity.Normal);

Task PublishAsync<TPayload>(NotificationTargets targets, Channels channel,
string channelId, TPayload message,
NotificationVerbosity verbosity = NotificationVerbosity.Normal);

Task PublishAsync<TPayload>(NotificationTargets targets, Channels channel,
string channelId, string text, TPayload message,
NotificationVerbosity verbosity = NotificationVerbosity.Normal);

Task PublishAsync<TEntity>(NotificationTargets targets, TEntity entity,
NotificationVerbosity verbosity = NotificationVerbosity.Normal)
where TEntity : IIDEntity;

Task PublishTextAsync(NotificationTargets targets, Channels channel,
string channelId, string text,
NotificationVerbosity verbosity = NotificationVerbosity.Normal);
}
}
4 changes: 4 additions & 0 deletions src/LagoVista.Core/Models/Notification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public Notification()
[JsonProperty("dateStamp")]
public String DateStamp { get; set; }

// Absent in legacy queue messages: consumers retain existing WebSocket delivery.
[JsonProperty("deliveryTargets", NullValueHandling = NullValueHandling.Ignore)]
public NotificationTargets? DeliveryTargets { get; set; }

[JsonProperty("channel")]
public EntityHeader<Channels> Channel { get; set; }

Expand Down
Loading