Novu 0.3.0
See the version list below for details.
dotnet add package Novu --version 0.3.0
NuGet\Install-Package Novu -Version 0.3.0
<PackageReference Include="Novu" Version="0.3.0" />
paket add Novu --version 0.3.0
#r "nuget: Novu, 0.3.0"
// Install Novu as a Cake Addin
#addin nuget:?package=Novu&version=0.3.0
// Install Novu as a Cake Tool
#tool nuget:?package=Novu&version=0.3.0
<div align="center"> <a href="https://novu.co" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/2233092/213641039-220ac15f-f367-4d13-9eaf-56e79433b8c1.png"> <img src="https://user-images.githubusercontent.com/2233092/213641043-3bbb3f21-3c53-4e67-afe5-755aeb222159.png" width="280" alt="Logo"/> </picture> </a> </div>
novu-dotnet
.NET SDK for Novu - The open-source notification infrastructure for engineers. 🚀
novu-dotnet targets .NET Standard 2.0 and is compatible with .NET Core 2.0+ and .NET Framework 4.6.1+.
Features
- Bindings against most API endpoints
- Events, subscribers, notifications, integrations, layouts, topics, workflows, workflow groups, messages, execution details
- Not Implemented: environments, inbound parse, changes
- Bootstrap each services as part of services provider or directly as a singleton class (setting injectable)
- A Sync service that will mirror an environment based a set of templates (layouts, integrations, workflow groups, workflows)
WARNING: 0.3.0 has breaking changes and the tests should be relied on for understanding the client libraries
Dependencies
dotnet novu | novu api package | Notes |
---|---|---|
0.2.2 | ⇐ 0.17 | Singleton client with Refit's use of RestService |
0.3.0 | >= 0.18 | 0.3.0 is not compatible with 0.2.2 and requires upgrade to code. Also 0.18 introduced a breaking change only found in 0.3.0. All 0.2.2 must be upgraded if used against the production system. HttpClient can now be used and injected. |
Installation
dotnet add package Novu
Configuration
Direct instantiation
using Novu.DTO;
using Novu.Models;
using Novu;
var novuConfiguration = new NovuClientConfiguration
{
// Defaults to https://api.novu.co/v1
Url = "https://novu-api.my-domain.com/v1",
ApiKey = "12345",
};
var novu = new NovuClient(novuConfiguration);
// Note: this client exposes all endpoints as methods but uses RestService
var subscribers = await novu.Subscriber.Get();
Dependency Injection
Configure via settings
{
"Novu": {
"Url": "http://localhost:3000/v1",
"ApiKey": "e36b820fcc9a68a83db6c79c30f1a461"
}
}
Setup Injection via extension methods
public static IServiceCollection RegisterNotificationSetupServices(
this IServiceCollection services,
IConfiguration configuration)
{
// registers all clients with novu config from appsetting.json
// the services inject HttpClient
return services
.RegisterNovuClients(configuration)
// here as an example that the registered services are injected into local service
.AddTransient<NovuNotificationService>();
}
Write your consuming code with the injected clients
// then instantiate via injection
public class NovuNotificationService
{
private readonly IEventClient _event;
public NovuSyncService(IEventClient @event)
{
_event = @event;
}
public async Task Trigger(string subscriberId){
var trigger = await Event.Trigger(
new EventCreateData
{
EventName = 'event-name',
To = { SubscriberId =subscriberId },
Payload = new Payload("Bogus payload"),
});
}
public record Payload(string Message)
{
[JsonProperty("message")] public string Message { get; set; }
}
}
Examples
Usage of the library is best understood by looking at the tests.
- Integration Tests: these show the minimal dependencies required to do one primary request (create, update, delete)
- Acceptance Tests: these show a sequence of actions to complete a business process in an environment
Repository Overview
Novu is the main SDK with Novu.Tests housing all unit tests. Novu.Extensions is required for DI and Novu.Sync if your are looking for mirroring environments.
novu-dotnet
The key folders to look into:
- DTO directory holds all objects needed to use the clients
- Interfaces directory holds all interfaces that are intended to outline how a class should be structured
- Models directory holds various models that are sub-resources inside the DTOs
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
- Refit (>= 7.0.0)
- Refit.Newtonsoft.Json (>= 7.0.0)
- System.ComponentModel.Annotations (>= 5.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Novu:
Package | Downloads |
---|---|
Novu.Extensions
Novu .NET SDK |
|
Novu.Sync
Novu .NET SDK |
GitHub repositories
This package is not used by any popular GitHub repositories.