@@ -0,0 +1,19 @@
|
||||
namespace ROLAC.API.Services.Notifications;
|
||||
|
||||
/// <summary>The three fields a browser hands over when it creates a push subscription.</summary>
|
||||
public sealed record WebPushTarget(string Endpoint, string P256dh, string Auth);
|
||||
|
||||
/// <summary>
|
||||
/// Outcome of pushing to one subscription. <see cref="IsExpired"/> is true when the push service
|
||||
/// reported the subscription is gone (HTTP 404/410) so the caller can prune it.
|
||||
/// </summary>
|
||||
public sealed record WebPushSendResult(bool Success, bool IsExpired, string? Error);
|
||||
|
||||
/// <summary>
|
||||
/// Thin wrapper over the WebPush library's encrypt-and-POST so that <see cref="WebPushService"/>'s
|
||||
/// recipient resolution, pruning, and logging can be unit-tested without a real push service.
|
||||
/// </summary>
|
||||
public interface IWebPushSender
|
||||
{
|
||||
Task<WebPushSendResult> SendAsync(WebPushTarget target, string payloadJson, CancellationToken ct = default);
|
||||
}
|
||||
Reference in New Issue
Block a user