LANCommander.HQ.SDK 1.1.2

dotnet add package LANCommander.HQ.SDK --version 1.1.2
                    
NuGet\Install-Package LANCommander.HQ.SDK -Version 1.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LANCommander.HQ.SDK" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LANCommander.HQ.SDK" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="LANCommander.HQ.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LANCommander.HQ.SDK --version 1.1.2
                    
#r "nuget: LANCommander.HQ.SDK, 1.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LANCommander.HQ.SDK@1.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LANCommander.HQ.SDK&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=LANCommander.HQ.SDK&version=1.1.2
                    
Install as a Cake Tool

LANCommander.HQ.SDK

.NET client SDK for the LANCommander.HQ API.

LANCommander.HQ is a community-driven metadata service for LAN games. This SDK gives .NET applications strongly-typed access to every endpoint exposed by the API: game metadata search across providers (IGDB, MobyGames, Steam, GOG, etc.), admin CRUD for the canonical catalog, taxonomies, edition groups, identity mappings, DMCA workflow, and master-server browsing.

Install

dotnet add package LANCommander.HQ.SDK

Quick start

using LANCommander.HQ.SDK;
using LANCommander.HQ.SDK.Authentication;

// A long-running service: authenticate once, stay authenticated.
using var client = new HQClient(new HQClientOptions
{
    BaseAddress = new Uri("https://api.lancommander.app"),
    RefreshToken = configuration["HQ:RefreshToken"],
    TokenStore = new FileTokenStore("/var/lib/myapp/hq-tokens.json"),
    ClientName = "my-lancommander-server",
});

var providers = await client.Providers.ListAsync();
var search = await client.Games.SearchAsync(provider: "igdb", query: "Half-Life");
var game = await client.Games.GetAsync("igdb", search.First().ProviderId);

Dependency injection

using LANCommander.HQ.SDK.Extensions;

services.AddLANCommanderHQ(options =>
{
    options.BaseAddress = new Uri(configuration["HQ:BaseAddress"]!);
    options.RefreshToken = configuration["HQ:RefreshToken"];
    options.TokenStore = new FileTokenStore(configuration["HQ:TokenPath"]!);
});

Then inject HQClient (or any of the per-resource services like AdminGamesClient, MasterServersClient, etc.) anywhere in your app.

Authentication

The SDK sends a short-lived access token as an Authorization: Bearer header, and renews it from a long-lived refresh token before it expires. Set a refresh token once and the client stays authenticated indefinitely — including across restarts, and across long idle periods where nothing calls the API at all.

Getting the first token pair

Access tokens cannot be minted from nothing, so one interactive sign-in is needed to start a connection:

  1. Send the user to GET /Auth/Login?returnUrl={yourCallback} on the API server.
  2. After they sign in, GET /Auth/TokenRelay redirects to your callback with a single-use ?code= parameter, valid for one minute.
  3. Exchange it, and persist the result:
var pair = await client.Auth.ExchangeCodeAsync(code, clientName: "my-server");
await tokenStore.SaveAsync(pair!.ToTokenSet());

An already-signed-in caller can skip the browser entirely and open a connection directly with client.Auth.CreateSessionAsync("my-server").

Rotation, and why the store matters

Refresh tokens are single-use. Every renewal returns a new refresh token and invalidates the previous one, so the SDK writes each new token set to IHQTokenStore before using it.

This makes the store load-bearing rather than an optimisation. The default InMemoryTokenStore loses the rotated token when the process exits, which means re-authenticating on every start. Any service should use FileTokenStore — or its own IHQTokenStore over a secret manager, which is the better option on a host where other tenants can read the filesystem.

Two important consequences:

  • One client per credential. Two processes sharing a refresh token will rotate against each other. The server treats a second presentation of a spent token as theft and revokes the whole session, signing both of them out. Give each instance its own connection.
  • Rejection is terminal. If the refresh token is revoked, expires from inactivity, or is flagged as reused, the SDK clears the store and throws HQAuthenticationException. Retrying will not help; the connection must be set up again.

Refresh tokens expire on inactivity, not on a fixed schedule — the clock resets on every use — so a client that calls even occasionally never needs re-authorising. Users can see and revoke connections from their account page, which is what ClientName labels.

Other credential options

Option Use for
RefreshToken + TokenStore Services and any long-running client. Self-renewing.
Token A single short-lived access token. Stops working when it expires.
TokenProvider You manage credentials yourself; the SDK will not refresh or retry behind it.
TokenProviderFactory (DI) Per-scope credentials, e.g. a Blazor AuthenticationStateProvider.

A Locale option (or X-Locale header) is forwarded so server-side localization picks the right translation.

Coverage

Surface Service
Auth + identity client.Auth
Providers client.Providers
Game metadata client.Games
Unified provider entries client.UnifiedGames
Admin games client.AdminGames
Admin taxonomies client.AdminTaxonomies
Admin taxonomy aliases client.AdminTaxonomyMappings
Admin identity mappings client.AdminIdentityMappings
Admin edition groups client.AdminEditionGroups
Admin media uploads client.AdminMedia
Admin DMCA client.AdminDmca
Public DMCA submission client.Dmca
Master servers client.MasterServers

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on LANCommander.HQ.SDK:

Repository Stars
LANCommander/LANCommander
Version Downloads Last Updated
1.1.2 292 9/2/2026
1.1.1 91 9/1/2026
1.1.0 135 9/1/2026
1.0.2 133 6/5/2026
1.0.1 2,105 5/28/2026
1.0.0 760 5/7/2026