ManiaAPI.NadeoAPI.Extensions.Hosting
2.9.0
dotnet add package ManiaAPI.NadeoAPI.Extensions.Hosting --version 2.9.0
NuGet\Install-Package ManiaAPI.NadeoAPI.Extensions.Hosting -Version 2.9.0
<PackageReference Include="ManiaAPI.NadeoAPI.Extensions.Hosting" Version="2.9.0" />
<PackageVersion Include="ManiaAPI.NadeoAPI.Extensions.Hosting" Version="2.9.0" />
<PackageReference Include="ManiaAPI.NadeoAPI.Extensions.Hosting" />
paket add ManiaAPI.NadeoAPI.Extensions.Hosting --version 2.9.0
#r "nuget: ManiaAPI.NadeoAPI.Extensions.Hosting, 2.9.0"
#:package ManiaAPI.NadeoAPI.Extensions.Hosting@2.9.0
#addin nuget:?package=ManiaAPI.NadeoAPI.Extensions.Hosting&version=2.9.0
#tool nuget:?package=ManiaAPI.NadeoAPI.Extensions.Hosting&version=2.9.0
ManiaAPI.NadeoAPI.Extensions.Hosting
Provides an efficient way to inject all Nadeo services into your application.
Setup
Providing options.Credentials is optional, but setting it will automatically authorize on the first request and maintain that connection, so you don't have to call AuthorizeAsync.
using ManiaAPI.TrackmaniaAPI.Extensions.Hosting;
builder.Services.AddNadeoAPI(options =>
{
options.Credentials = new NadeoAPICredentials(
builder.Configuration["NadeoAPI:Login"]!,
builder.Configuration["NadeoAPI:Password"]!);
});
Features this setup brings:
NadeoServices,NadeoLiveServices, andNadeoMeetServiceswill be available as transients- HTTP client will be handled properly
- Credentials will be handled as a singleton
Resilience
HTTP requests can transiently fail, so it's a good idea to add some retry logic.
Since the setup exposes each service's IHttpClientBuilder through configureNadeoServices, configureNadeoLiveServices, and configureNadeoMeetServices, you can add Microsoft.Extensions.Http.Resilience to automatically retry requests, apply timeouts, and use circuit breakers:
using ManiaAPI.NadeoAPI.Extensions.Hosting;
builder.Services.AddNadeoAPI(options =>
{
options.Credentials = new NadeoAPICredentials(
builder.Configuration["NadeoAPI:Login"]!,
builder.Configuration["NadeoAPI:Password"]!);
},
configureNadeoServices: http => http.AddStandardResilienceHandler(),
configureNadeoLiveServices: http => http.AddStandardResilienceHandler(),
configureNadeoMeetServices: http => http.AddStandardResilienceHandler());
| 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 is compatible. 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 is compatible. 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. |
-
net10.0
- ManiaAPI.NadeoAPI (>= 2.9.0)
-
net8.0
- ManiaAPI.NadeoAPI (>= 2.9.0)
-
net9.0
- ManiaAPI.NadeoAPI (>= 2.9.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.