Wrapper for the official web API from ManiaPlanet (Trackmania 2 and Shootmania). Part of the ManiaAPI.NET library set.
$ dotnet add package ManiaAPI.ManiaPlanetAPIWraps https://maniaplanet.com/swagger (ManiaPlanet web API). This API does not require authorization, but you can authorize to have more methods available.
For the list of scopes, see here at the bottom. Generate your credentials here.
using ManiaAPI.ManiaPlanetAPI;
var mp = new ManiaPlanetAPI();
// You can optionally authorize to do more things, and possibly be less limited
await mp.AuthorizeAsync("clientId", "clientSecret", ["basic", "dedicated", "maps"]);
// Ready to use
For ingame API, use the ManiaPlanetIngameAPI. This is not an authenticated API, but you can use it to authenticate logins of users or servers by their token.
using ManiaAPI.ManiaPlanetAPI;
var mpIngame = new ManiaPlanetIngameAPI();
// Authenticate a user
var user = await mpIngame.AuthenticateAsync("username", "token");
if (user.Login != "username")
{
throw new Exception("Invalid token");
}
For DI, consider using the ManiaAPI.ManiaPlanetAPI.Extensions.Hosting package.