From 4817eda18cc0120797bebad39dd614b55ebd0a75 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 19:42:49 +0100
Subject: [PATCH 01/22] Create publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 .github/workflows/publish-nuget.yml
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
new file mode 100644
index 0000000..8021888
--- /dev/null
+++ b/.github/workflows/publish-nuget.yml
@@ -0,0 +1,26 @@
+name: Upload nuget package
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: read
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: '8.0.x' # SDK Version to use.
+ source-url: https://api.nuget.org/v3/index.json
+ env:
+ NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
+ - run: dotnet build --configuration Release src/StoneRed.NetificationApi
+ - name: Create the package
+ run: dotnet pack --configuration Release src/StoneRed.NetificationApi
+ - name: Publish the package to nuget.org
+ run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg
From 85d1acea516bd9526bb345752f0584b8178ea168 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 20:59:46 +0100
Subject: [PATCH 02/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index 8021888..e14bf1a 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -12,8 +12,8 @@ jobs:
packages: write
contents: read
steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-dotnet@v3
+ - uses: actions/checkout@v4
+ - uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # SDK Version to use.
source-url: https://api.nuget.org/v3/index.json
From 752309f68d81af1385385c355e7f676150660e27 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:01:57 +0100
Subject: [PATCH 03/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index e14bf1a..475d64d 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -16,11 +16,10 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # SDK Version to use.
- source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
- run: dotnet build --configuration Release src/StoneRed.NetificationApi
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
- name: Publish the package to nuget.org
- run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg
+ run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
From 856aee2bc0ee83b967ddecdbee51c6866e41393c Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:03:32 +0100
Subject: [PATCH 04/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index 475d64d..2eb8f22 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -22,4 +22,4 @@ jobs:
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
- name: Publish the package to nuget.org
- run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
+ run: dotnet nuget push */src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
From ee6bf84ed726f394ae5a1daa8c6831f95fca3e9d Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:04:20 +0100
Subject: [PATCH 05/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index 2eb8f22..a5ad4d8 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -16,6 +16,7 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # SDK Version to use.
+ source-url: https://nuget.pkg.github.com/Stone-Red-Software/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
- run: dotnet build --configuration Release src/StoneRed.NetificationApi
From dee642eafb444a42e9824f327c2b363b6a40a689 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:05:28 +0100
Subject: [PATCH 06/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index a5ad4d8..f609ee4 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -23,4 +23,4 @@ jobs:
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
- name: Publish the package to nuget.org
- run: dotnet nuget push */src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
+ run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
From 228a5fbbbdc8e0ba85085a4a2e2cf621eeb4ef3e Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:06:32 +0100
Subject: [PATCH 07/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index f609ee4..f81670c 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -17,10 +17,8 @@ jobs:
with:
dotnet-version: '8.0.x' # SDK Version to use.
source-url: https://nuget.pkg.github.com/Stone-Red-Software/index.json
- env:
- NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
- run: dotnet build --configuration Release src/StoneRed.NetificationApi
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
- name: Publish the package to nuget.org
- run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
+ run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_TOKEN -s https://api.nuget.org/v3/index.json
From a7d0c8c24919a11868d7e5b3c882bf612d00186a Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:07:38 +0100
Subject: [PATCH 08/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index f81670c..3710359 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -17,6 +17,8 @@ jobs:
with:
dotnet-version: '8.0.x' # SDK Version to use.
source-url: https://nuget.pkg.github.com/Stone-Red-Software/index.json
+ env:
+ NUGET_AUTH_TOKEN: ${{secrets.GH_TOKEN}}
- run: dotnet build --configuration Release src/StoneRed.NetificationApi
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
From 000a58d89a9a8dab5fda3d1151c7582f4f41769f Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:08:39 +0100
Subject: [PATCH 09/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index 3710359..5cf3e95 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -23,4 +23,4 @@ jobs:
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
- name: Publish the package to nuget.org
- run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_TOKEN -s https://api.nuget.org/v3/index.json
+ run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
From 84f4c50c7f07507074ca0aad3a6bb1c503cc2de0 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:09:50 +0100
Subject: [PATCH 10/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index 5cf3e95..566c354 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -17,10 +17,10 @@ jobs:
with:
dotnet-version: '8.0.x' # SDK Version to use.
source-url: https://nuget.pkg.github.com/Stone-Red-Software/index.json
- env:
- NUGET_AUTH_TOKEN: ${{secrets.GH_TOKEN}}
- run: dotnet build --configuration Release src/StoneRed.NetificationApi
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
- name: Publish the package to nuget.org
run: dotnet nuget push src/StoneRed.NetificationApi/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
+ env:
+ NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
From 2413090406b86c15931edf1207d2058a90e012ff Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:10:38 +0100
Subject: [PATCH 11/22] Update publish-nuget.yml
---
.github/workflows/publish-nuget.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index 566c354..6ed5798 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -17,6 +17,8 @@ jobs:
with:
dotnet-version: '8.0.x' # SDK Version to use.
source-url: https://nuget.pkg.github.com/Stone-Red-Software/index.json
+ env:
+ NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}}
- run: dotnet build --configuration Release src/StoneRed.NetificationApi
- name: Create the package
run: dotnet pack --configuration Release src/StoneRed.NetificationApi
From af2496af533ae6a17608faa3bccee2a05123b3e6 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:13:24 +0100
Subject: [PATCH 12/22] Update nuget details
---
.../StoneRed.NetificationApi.csproj | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj b/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj
index 114f131..36dbc15 100644
--- a/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj
+++ b/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj
@@ -4,8 +4,22 @@
net8.0
enable
enable
+ True
+ 1.0.0.0
+ https://github.com/Stone-Red-Software/StoneRed.NetificationApi
+ MIT
+ A .NET library for NotificationAPI
+ https://github.com/Stone-Red-Software/StoneRed.NetificationApi
+ README.md
+
+
+ True
+ \
+
+
+
From 5e7a9504a0ebb97d2c32afd67cceb7489f9ba1e7 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 21:16:30 +0100
Subject: [PATCH 13/22] Update package version
---
src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj b/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj
index 36dbc15..af3c5a2 100644
--- a/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj
+++ b/src/StoneRed.NetificationApi/StoneRed.NetificationApi.csproj
@@ -5,7 +5,7 @@
enable
enable
True
- 1.0.0.0
+ 1.0.1.0
https://github.com/Stone-Red-Software/StoneRed.NetificationApi
MIT
A .NET library for NotificationAPI
From f7a11870d28d0c7390525a687d70c37180f093e9 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Mon, 4 Mar 2024 22:06:20 +0100
Subject: [PATCH 14/22] Add docs to public classes and fix `fcm` options
---
.../Client/Models/CountReceivedEventArgs.cs | 10 +++
.../Models/NotificationChannelPreference.cs | 22 ++++++
.../Client/Models/NotificationReceivedData.cs | 26 +++++++
.../Models/NotificationUserPreference.cs | 18 +++++
.../NotificationUserPreferenceSetting.cs | 14 ++++
.../Models/NotificationsReceivedEventArgs.cs | 10 +++
.../UserPreferencesReceivedEventArgs.cs | 10 +++
.../Client/NotificationApiClient.cs | 68 +++++++++++++++++--
.../Server/IdentifyUser/IdentifyUserData.cs | 26 +++++++
.../IdentifyUser/NotificationPushProviders.cs | 10 +++
.../IdentifyUser/NotificationPushToken.cs | 23 +++++++
.../NotificationPushTokenDevice.cs | 30 ++++++++
.../IdentifyUser/NotificationWebPushToken.cs | 13 ++++
.../NotificationWebPushTokenKeys.cs | 18 +++++
.../NotificationWebPushTokenSub.cs | 18 +++++
.../Server/NotificationApiServer.cs | 38 +++++++++++
.../Server/Retract/RetractNotificationData.cs | 20 ++++++
.../Server/Send/NotificationApnOptions.cs | 24 +++++++
.../Send/NotificationEmailAttachments.cs | 19 +++++-
.../Server/Send/NotificationEmailOptions.cs | 17 ++++-
.../Send/NotificationFcmAndroidOptions.cs | 14 +++-
.../Server/Send/NotificationFcmOptions.cs | 8 ++-
.../Server/Send/NotificationOptions.cs | 14 ++++
.../Server/Send/NotificationUser.cs | 19 ++++++
.../Server/Send/SendNotificationData.cs | 33 +++++++++
.../NotificationPreference.cs | 21 ++++++
.../SetUserPreferencesData.cs | 17 +++++
.../Shared/NotificationChannels.cs | 26 +++++++
.../StoneRed.NetificationApi.csproj | 1 +
.../Utilities/UserIdHasher.cs | 9 +++
30 files changed, 587 insertions(+), 9 deletions(-)
diff --git a/src/StoneRed.NetificationApi/Client/Models/CountReceivedEventArgs.cs b/src/StoneRed.NetificationApi/Client/Models/CountReceivedEventArgs.cs
index a1c21b4..6c1e580 100644
--- a/src/StoneRed.NetificationApi/Client/Models/CountReceivedEventArgs.cs
+++ b/src/StoneRed.NetificationApi/Client/Models/CountReceivedEventArgs.cs
@@ -1,6 +1,16 @@
namespace StoneRed.NetificationApi.Client.Models;
+///
+/// Represents the event arguments for when the count of unread notifications is received.
+///
+///
+/// Initializes a new instance of the class with the specified count.
+///
+/// The count of unread notifications.
public class CountReceivedEventArgs(int count) : EventArgs
{
+ ///
+ /// Gets the count of unread notifications.
+ ///
public int Count { get; } = count;
}
\ No newline at end of file
diff --git a/src/StoneRed.NetificationApi/Client/Models/NotificationChannelPreference.cs b/src/StoneRed.NetificationApi/Client/Models/NotificationChannelPreference.cs
index 8e117b4..be03e14 100644
--- a/src/StoneRed.NetificationApi/Client/Models/NotificationChannelPreference.cs
+++ b/src/StoneRed.NetificationApi/Client/Models/NotificationChannelPreference.cs
@@ -4,13 +4,32 @@ using System.Diagnostics.CodeAnalysis;
namespace StoneRed.NetificationApi.Client.Models;
+///
+/// Represents a preference for a notification channel.
+///
public class NotificationChannelPreference
{
+ ///
+ /// Gets or sets the channel to set the preference for.
+ ///
public NotificationChannel Channel { get; set; }
+ ///
+ /// Gets or sets the state of the preference.
+ ///
public bool State { get; set; }
+
+ ///
+ /// Gets or sets the sub notification id.
+ ///
public string? SubNotificationId { get; set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The channel to set the preference for.
+ /// The state of the preference.
+ /// The sub notification id.
[SetsRequiredMembers]
public NotificationChannelPreference(NotificationChannel channel, bool state, string? subNotificationId = null)
{
@@ -19,6 +38,9 @@ public class NotificationChannelPreference
SubNotificationId = subNotificationId;
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
public NotificationChannelPreference()
{
}
diff --git a/src/StoneRed.NetificationApi/Client/Models/NotificationReceivedData.cs b/src/StoneRed.NetificationApi/Client/Models/NotificationReceivedData.cs
index bfadba8..107788b 100644
--- a/src/StoneRed.NetificationApi/Client/Models/NotificationReceivedData.cs
+++ b/src/StoneRed.NetificationApi/Client/Models/NotificationReceivedData.cs
@@ -1,11 +1,37 @@
namespace StoneRed.NetificationApi.Client.Models;
+///
+/// Represents the data of a notification received.
+///
public class NotificationReceivedData
{
+ ///
+ /// Gets or sets the ID of the notification.
+ ///
public required string Id { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the notification has been seen.
+ ///
public required bool Seen { get; set; }
+
+ ///
+ /// Gets or sets the title of the notification.
+ ///
public required string Title { get; set; }
+
+ ///
+ /// Gets or sets the redirect URL of the notification.
+ ///
public required string RedirectURL { get; set; }
+
+ ///
+ /// Gets or sets the image URL of the notification.
+ ///
public required string ImageURL { get; set; }
+
+ ///
+ /// Gets or sets the date of the notification.
+ ///
public required DateTime Date { get; set; }
}
\ No newline at end of file
diff --git a/src/StoneRed.NetificationApi/Client/Models/NotificationUserPreference.cs b/src/StoneRed.NetificationApi/Client/Models/NotificationUserPreference.cs
index 9ff5f02..9da94f8 100644
--- a/src/StoneRed.NetificationApi/Client/Models/NotificationUserPreference.cs
+++ b/src/StoneRed.NetificationApi/Client/Models/NotificationUserPreference.cs
@@ -1,9 +1,27 @@
namespace StoneRed.NetificationApi.Client.Models;
+///
+/// Represents a user's preference for a notification.
+///
public class NotificationUserPreference
{
+ ///
+ /// Gets or sets the notification ID.
+ ///
public required string NotificationId { get; set; }
+
+ ///
+ /// Gets or sets the title of the notification.
+ ///
public required string Title { get; set; }
+
+ ///
+ /// Gets or sets the list of settings for the notification.
+ ///
public required List Settings { get; set; }
+
+ ///
+ /// Gets or sets the list of sub-notification preferences.
+ ///
public required List