Extension methods of Nadeo API for ASP.NET Core. Part of the ManiaAPI.NET library set.
$ dotnet add package ManiaAPI.NadeoAPI.Extensions.HostingProvides an efficient way to inject all Nadeo services into your application.
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"]!,
AuthorizationMethod.DedicatedServer);
});
Features this setup brings:
NadeoServices, NadeoLiveServices, and NadeoMeetServices will be available as transients