-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
Trumpee.MassTransit.Messages/Analytics/Notifications/Notification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Trumpee.MassTransit.Messages.Analytics.Notifications.Payloads; | ||
|
||
namespace Trumpee.MassTransit.Messages.Analytics.Notifications; | ||
|
||
/// <summary> | ||
/// Provides methods to create notification-related analytics events. | ||
/// </summary> | ||
public static class Notification | ||
{ | ||
/// <summary> | ||
/// Creates an analytics event indicating that a notification has been created. | ||
/// </summary> | ||
/// <param name="source">The source of the event.</param> | ||
/// <param name="notificationId">The ID of the notification.</param> | ||
/// <returns>An analytics event indicating the notification has been created.</returns> | ||
public static AnalyticsEvent<NotificationCreatedPayload> Created( | ||
string source, string notificationId) | ||
{ | ||
var payload = new NotificationCreatedPayload | ||
{ | ||
NotificationId = notificationId | ||
}; | ||
|
||
const string actionName = "NotificationCreated"; | ||
return AnalyticsEvent<NotificationCreatedPayload>.Create( | ||
streamId: notificationId, | ||
action: actionName, | ||
source: source, | ||
payload: payload); | ||
} | ||
|
||
/// <summary> | ||
/// Creates an analytics event indicating that a notification has been sent. | ||
/// </summary> | ||
/// <param name="source">The source of the event.</param> | ||
/// <param name="notificationId">The ID of the notification.</param> | ||
/// <returns>An analytics event indicating the notification has been sent.</returns> | ||
public static AnalyticsEvent<NotificationSent> Sent( | ||
string source, string notificationId) | ||
{ | ||
var payload = new NotificationSent | ||
{ | ||
NotificationId = notificationId | ||
}; | ||
|
||
const string actionName = "NotificationSent"; | ||
return AnalyticsEvent<NotificationSent>.Create( | ||
streamId: notificationId, | ||
action: actionName, | ||
source: source, | ||
payload: payload); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Trumpee.MassTransit.Messages/Analytics/Notifications/Payloads/NotificationCreated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Trumpee.MassTransit.Messages.Analytics.Notifications.Payloads; | ||
|
||
/// <summary> | ||
/// Represents the payload for a notification created event. | ||
/// </summary> | ||
public record NotificationCreatedPayload | ||
{ | ||
/// <summary> | ||
/// Gets or sets the ID of the notification. | ||
/// </summary> | ||
public required string NotificationId { get; init; } | ||
} |
12 changes: 12 additions & 0 deletions
12
Trumpee.MassTransit.Messages/Analytics/Notifications/Payloads/NotificationSent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Trumpee.MassTransit.Messages.Analytics.Notifications.Payloads; | ||
|
||
/// <summary> | ||
/// Represents the payload for a notification sent event. | ||
/// </summary> | ||
public class NotificationSent | ||
{ | ||
/// <summary> | ||
/// Gets or sets the ID of the notification. | ||
/// </summary> | ||
public required string NotificationId { get; set; } | ||
} |