ManiaAPI.TMX
2.10.0
dotnet add package ManiaAPI.TMX --version 2.10.0
NuGet\Install-Package ManiaAPI.TMX -Version 2.10.0
<PackageReference Include="ManiaAPI.TMX" Version="2.10.0" />
<PackageVersion Include="ManiaAPI.TMX" Version="2.10.0" />
<PackageReference Include="ManiaAPI.TMX" />
paket add ManiaAPI.TMX --version 2.10.0
#r "nuget: ManiaAPI.TMX, 2.10.0"
#:package ManiaAPI.TMX@2.10.0
#addin nuget:?package=ManiaAPI.TMX&version=2.10.0
#tool nuget:?package=ManiaAPI.TMX&version=2.10.0
ManiaAPI.TMX
Wraps:
- https://tm.mania.exchange
- https://trackmania.exchange
- https://sm.mania.exchange
- https://tmuf.exchange
- https://tmnf.exchange
- https://original.tm-exchange.com
- https://sunrise.tm-exchange.com
- https://nations.tm-exchange.com
- https://item.exchange (as
IX)
Setup
[!WARNING]
Note thatTMXandMXare classes for covering different sets of games. Examples below will mostly useTMX. But you can use them withMXtoo.
using ManiaAPI.TMX;
// Pick one from TMUF, TMNF, Nations, Sunrise, Original
var tmx = new TMX(TmxSite.TMUF);
// or one from Trackmania, Maniaplanet, Shootmania
var tmx = new MX(TMXSite.Trackmania);
or with DI, for a specific site, using an injected HttpClient:
using ManiaAPI.TMX;
builder.Services.AddHttpClient("TMX_TMNF");
builder.Services.AddScoped<TMX>(provider => new TMX(
provider.GetRequiredService<IHttpClientFactory>().CreateClient("TMX_TMNF"), TmxSite.TMNF));
For multiple sites in DI, you can use keyed services:
foreach (var site in Enum.GetValues<TmxSite>())
{
if (site.isMX()) {
services.AddHttpClient($"{nameof(MX)}_{site}");
services.AddKeyedScoped(site, (provider, key) => new MX(
provider.GetRequiredService<IHttpClientFactory>().CreateClient($"{nameof(MX)}_{key}"), site, options));
services.AddScoped(provider => provider.GetRequiredKeyedService<MX>(site));
}
else {
services.AddHttpClient($"{nameof(TMX)}_{site}");
services.AddKeyedScoped(site, (provider, key) => new TMX(
provider.GetRequiredService<IHttpClientFactory>().CreateClient($"{nameof(TMX)}_{key}"), site, options));
services.AddScoped(provider => provider.GetRequiredKeyedService<TMX>(site));
}
}
services.AddScoped(provider => Enum.GetValues<TmxSite>().Where(site => site.isMX())
.ToImmutableDictionary(site => site, site => provider.GetRequiredKeyedService<MX>(site)));
services.AddScoped(provider => Enum.GetValues<TmxSite>().Where(site => !site.isMX())
.ToImmutableDictionary(site => site, site => provider.GetRequiredKeyedService<TMX>(site)));
Features this last setup brings:
- You can inject
ImmutableDictionary<TmxSite, TMX>to get all TMX sites as individual instances - If you don't need specific site context, you can inject
IEnumerable<TMX>to get all TMX sites - Specific
TMXcan be injected using[FromKeyedServices(TmxSite.TMNF)]
If you just inject TMX alone, it will give the last-registered one (in this case, Original). If you need a specific site, use [FromKeyedServices(...)].
Get Replays
var replayCollection = await tmx.GetReplaysAsync(new()
{
TrackId = 4808334,
Count = 20
});
foreach (var item in replayCollection.Results)
{
Console.WriteLine(item.ReplayTime);
})
Search Tracks
var trackCollection = await tmx.SearchTracksAsync(new()
{
Name = "wirtual", // tracks that have wirtual in their name
Count = 20
});
foreach (var item in trackCollection.Results)
{
Console.WriteLine(item.TrackName);
})
Search Leaderboards
var leaderboardCollection = await tmx.SearchLeaderboardsAsync(new()
{
Count = 10
});
foreach (var item in leaderboardCollection.Results)
{
Console.WriteLine(item.User.Name);
}
Search Trackpacks
var trackpackCollection = await tmx.SearchTrackpacksAsync(new()
{
Count = 15
});
foreach (var item in trackpackCollection.Results)
{
Console.WriteLine(item.PackName);
}
Search Users
var userCollection = await tmx.SearchUsersAsync(new()
{
InModerators = true,
Count = 10
});
foreach (var item in userCollection.Results)
{
Console.WriteLine(item.Name);
}
Search Videos
var videoCollection = await tmx.SearchVideosAsync(new()
{
TrackId = [4808334],
Count = 10
});
foreach (var item in videoCollection.Results)
{
Console.WriteLine($"{item.Title}: {item.Link}");
}
Get site metadata
Search orders, tags, track types and vehicles of the site, for the values used in search parameters:
var trackOrders = await tmx.GetTrackSearchOrdersAsync(); // also trackpack, user, video and leaderboard orders
var tags = await tmx.GetTagsAsync();
var tagDescriptions = await tmx.GetTagDescriptionsAsync();
var trackTypes = await tmx.GetTrackTypesAsync();
var vehicles = await tmx.GetVehiclesAsync();
Item Exchange
IX wraps https://item.exchange, which hosts custom items, blocks and item sets for ManiaPlanet and Trackmania. It has no v2 API, so it uses the v1 methods the MX API documentation lists as active.
using ManiaAPI.TMX;
var ix = new IX();
// Search items, 10 to 200 per page
var result = await ix.SearchItemsAsync(new()
{
ItemName = ["rock"],
Collections = [IXEnvironment.Valley],
Limit = 20
});
foreach (var item in result.Results)
{
Console.WriteLine($"{item.Name} ({item.TypeName}) by {item.Username}");
}
// Items or sets by ID, a user's basket, and random picks
var items = await ix.GetItemsAsync([256, 40503]);
var sets = await ix.GetItemSetsAsync([41]); // with their items
var basket = await ix.GetBasketAsync(1814); // null for an unknown user
var random = await ix.GetRandomItemAsync(new() { Game = IXGame.Trackmania });
// Downloads and images
using var download = await ix.GetItemDownloadResponseAsync(40503); // .Gbx, or .zip when an item needs several files
string icon = ix.GetItemIconUrl(256);
string setImage = ix.GetItemSetImageUrl(41, position: 1);
Get Replay Gbx
Just the URL:
string url = tmx.GetReplayGbxUrl(replayId: 5032240);
Or request it:
using HttpResponseMessage response = await tmx.GetReplayGbxResponseAsync(replayId: 5032240);
Or use ManiaAPI.TMX.Extensions.Gbx package to load it into CGameCtnReplayRecord, either just the header or full Gbx:
using ManiaAPI.TMX.Extensions.Gbx;
// Just the header
Gbx<CGameCtnReplayRecord> gbxReplayHeader = await tmx.GetReplayGbxHeaderAsync(replayId: 5032240);
// Full Gbx
Gbx<CGameCtnReplayRecord> gbxReplay = await tmx.GetReplayGbxAsync(replayId: 5032240);
Get Track Gbx
Just the URL:
string url = tmx.GetTrackGbxUrl(trackId: 4808334);
Or request it:
using HttpResponseMessage response = await tmx.GetTrackGbxResponseAsync(trackId: 4808334);
Or use ManiaAPI.TMX.Extensions.Gbx package to load it into CGameCtnChallenge, either just the header or full Gbx:
using ManiaAPI.TMX.Extensions.Gbx;
// Just the header
Gbx<CGameCtnChallenge> gbxMapHeader = await tmx.GetTrackGbxHeaderAsync(trackId: 4808334);
// Full Gbx
Gbx<CGameCtnChallenge> gbxMap = await tmx.GetTrackGbxAsync(trackId: 4808334);
Get Track Thumbnail
Just the URL:
string url = tmx.GetTrackThumbnailUrl(trackId: 4808334);
Or request it:
using HttpResponseMessage response = await tmx.GetTrackThumbnailResponseAsync(trackId: 4808334);
Get Track Image
Just the URL:
string url = tmx.GetTrackImageUrl(trackId: 4808334, imageIndex: 0);
Or request it:
using HttpResponseMessage response = await tmx.GetTrackImageResponseAsync(trackId: 4808334, imageIndex: 0);
| 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. net11.0 is compatible. |
-
net10.0
- TmEssentials (>= 2.6.0)
-
net11.0
- TmEssentials (>= 2.6.0)
-
net8.0
- TmEssentials (>= 2.6.0)
-
net9.0
- TmEssentials (>= 2.6.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ManiaAPI.TMX:
| Package | Downloads |
|---|---|
|
ManiaAPI.TMX.Extensions.Gbx
Extension methods of TMX API for GBX.NET features. Part of the ManiaAPI.NET library set. |
|
|
ManiaAPI.TMX.Extensions.Hosting
Extension methods of TMX API for ASP.NET Core. Part of the ManiaAPI.NET library set. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.10.0 | 49 | 11/14/2026 |
| 2.9.5 | 263 | 7/22/2026 |
| 2.9.4 | 148 | 7/19/2026 |
| 2.9.3 | 147 | 7/19/2026 |
| 2.9.1 | 146 | 7/12/2026 |
| 2.9.0 | 174 | 7/11/2026 |
| 2.8.2 | 208 | 4/26/2026 |
| 2.8.0 | 522 | 3/1/2026 |
| 2.7.0 | 517 | 2/21/2026 |
| 2.6.0 | 229 | 2/7/2026 |
| 2.5.0 | 487 | 10/16/2025 |
| 2.4.0 | 564 | 9/18/2025 |
| 2.3.1 | 341 | 8/21/2025 |
| 2.2.0 | 476 | 4/6/2025 |
| 2.1.0 | 658 | 3/24/2025 |
| 2.0.0 | 416 | 3/23/2025 |
| 2.0.0-beta3 | 285 | 12/21/2024 |
| 2.0.0-alpha4 | 291 | 12/23/2023 |
| 2.0.0-alpha10 | 222 | 6/19/2024 |
| 1.0.10 | 439 | 3/6/2024 |
- **Added `IX` for Item Exchange**, including item and set searches, baskets, downloads, icons, and images
- Added TMX video searches and metadata requests for search orders, tags, tag descriptions, track types, and vehicles
- Fixed generated video field selections requesting fields unavailable on the selected TMX or MX site
- Made JSON converters public so external serializers preserve Exchange integer and time formats
- Updated the User-Agent to report the installed package version
- Added .NET 11 support