StoneRed.NetificationApi
1.0.4.20240314
Prefix Reserved
dotnet add package StoneRed.NetificationApi --version 1.0.4.20240314
NuGet\Install-Package StoneRed.NetificationApi -Version 1.0.4.20240314
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StoneRed.NetificationApi" Version="1.0.4.20240314" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StoneRed.NetificationApi" Version="1.0.4.20240314" />
<PackageReference Include="StoneRed.NetificationApi" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StoneRed.NetificationApi --version 1.0.4.20240314
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: StoneRed.NetificationApi, 1.0.4.20240314"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StoneRed.NetificationApi@1.0.4.20240314
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StoneRed.NetificationApi&version=1.0.4.20240314
#tool nuget:?package=StoneRed.NetificationApi&version=1.0.4.20240314
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
StoneRed.NetificationApi
A .NET library for NotificationAPI
This is an unofficial library for NotificationAPI and attempts to replicate the functionality of the official Server SDK and JS Client SDK as closely as possible.
(A prebuilt notification widget is not included in this library.)
Supported Features
Server:
- Send all types of notifications
- Retract notifications
- Identify user
- Set user preferences
Client:
- Receive
In-Appnotification - Get old notifications
- Get unread notification count
- Clear unread notifications
- Get user preferences
- Update user preferences
Installation
Package Manager
Install-Package StoneRed.NetificationApi
.NET CLI
dotnet add package StoneRed.NetificationApi
Usage
Server
using StoneRed.NetificationApi.Server;
using StoneRed.NetificationApi.Server.Send;
// Initialize NotificationApiServer
NotificationApiServer notificationApiServer = new NotificationApiServer("<ClientId>", "<ClientSecret>", secureMode: false);
// Construct notification
SendNotificationData sendNotificationData = new SendNotificationData
{
NotificationId = "<NotificationId>",
User = new NotificationUser
{
Id = "<UserId>",
}
};
// Send notification
await notificationApiServer.Send(sendNotificationData);
Client
using StoneRed.NetificationApi.Client;
using StoneRed.NetificationApi.Client.Models;
// The client is used to receive notifications
NotificationApiClient notificationApiClient = new NotificationApiClient("<UserId>", "<ClientId>");
// Listen for new notifications
notificationApiClient.NewNotificationsReceived += (sender, args) =>
{
Console.WriteLine("New notifications received");
foreach (NotificationReceivedData notificationReceiveData in args.Notifications)
{
Console.WriteLine($"New notification received: {notificationReceiveData.Id}");
}
};
// Listen for unread count
notificationApiClient.UnreadCountReceived += (sender, args) =>
{
Console.WriteLine($"Unread count received: {args.Count}");
};
// Request unread count
notificationApiClient.RequestUnreadCount();
For a more sophisticated example, please check out this example.
Third party licenses
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Websocket.Client (>= 5.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.