Skip to content

HandyS11/RustMapsApi

Repository files navigation

RustMapsApi

A strongly-typed .NET client for the public RustMaps API (v4). Look up procedural and custom maps, request map generation, upload saves, and read your generation limits — with Result<T> everywhere and first-class dependency injection.

CI CD Docs

.NET NuGet Version License: MIT codecov Mutation Score

Getting Started · Documentation · Samples

Packages

Package NuGet Description
RustMapsApi NuGet The v4 API client — IRustMapsClient, Result<T>, models & requests, DI.
RustMapsApi.Assets NuGet Monument icon artwork (SVG) mapped by MonumentType — resolve a monument's icon offline.

Install

dotnet add package RustMapsApi          # the API client
dotnet add package RustMapsApi.Assets   # optional monument icons

Quickstart

1. Register the client (dependency injection). Provide your RustMaps API key:

using Microsoft.Extensions.DependencyInjection;
using RustMapsApi.V4;

services.AddRustMapsClientV4(options => options.ApiKey = "YOUR_API_KEY");

2. Look up a map. Inject IRustMapsClient and check IsSuccess before reading Data:

public sealed class MapService(IRustMapsClient client)
{
    public async Task<string?> GetUrlAsync(string mapId)
    {
        var result = await client.GetMapByIdAsync(mapId);
        return result.IsSuccess ? result.Data!.Url : null;
    }
}

3. Search, generate, or upload:

// Structured search (zero-based page index)
var page = await client.SearchAsync(query, page: 0);

// Request generation of a procedural map
var status = await client.CreateMapAsync(request);

// Read your current generation limits
var limits = await client.GetLimitsAsync();

You can also new up the client directly with your own HttpClient — see the package README for the standalone usage and the full API surface.

Monument icons

RustMapsApi.Assets bundles RustMaps' monument icon artwork (SVG) and maps each MonumentType to its icon — resolve a monument's icon straight from an API response with no network call:

using RustMapsApi.V4.Assets;

foreach (var monument in map.Monuments ?? [])
{
    if (MonumentAssets.TryGetAsset(monument.Type, out var asset))
        File.WriteAllText(asset.FileName, asset.GetSvg());
}

See the runnable Avalonia icon gallery that renders every bundled icon.

Build and test

dotnet build RustMapsApi.slnx -c Release
dotnet test

Live integration tests run only when RUSTMAPS_API_KEY is set; otherwise they are skipped.

Documentation

Full guides and the API reference live on the documentation site (built with DocFX). Start with Getting Started, then see the Client guide for the full API surface. Runnable examples are in samples/.

Credits

About

A strongly-typed .NET client for the public RustMaps API (v4). Look up procedural and custom maps, request map generation, upload saves, and read your generation limits — with Result<T> everywhere and first-class dependency injection.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors