SteamStorageAPI.SDK 2.0.2

dotnet add package SteamStorageAPI.SDK --version 2.0.2
                    
NuGet\Install-Package SteamStorageAPI.SDK -Version 2.0.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="SteamStorageAPI.SDK" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SteamStorageAPI.SDK" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="SteamStorageAPI.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 SteamStorageAPI.SDK --version 2.0.2
                    
#r "nuget: SteamStorageAPI.SDK, 2.0.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 SteamStorageAPI.SDK@2.0.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=SteamStorageAPI.SDK&version=2.0.2
                    
Install as a Cake Addin
#tool nuget:?package=SteamStorageAPI.SDK&version=2.0.2
                    
Install as a Cake Tool

SteamStorageAPI.SDK

A .NET 10 client library for interacting with the SteamStorage API. Provides a typed HTTP client, Steam OAuth authorization via SignalR, ping utilities, and a clean event-driven error handling model.


Installation

Package Manager:

Install-Package SteamStorageAPI.SDK

.NET CLI:

dotnet add package SteamStorageAPI.SDK

Quick Start

Desktop / WPF / Avalonia

Register the SDK in your DI container:

services.AddSteamStorageApi(options =>
{
    options.ClientName       = "MainClient"
    options.ServerAddress    = "https://your-server.com";
    options.ApiAddress       = "https://your-server.com/api";
    options.HostName         = "your-server.com";
    options.TokenHubEndpoint = "https://your-server.com/token/token-hub";
});

services.AddSteamStorageAuthorizationService(options =>
{
    options.TokenHubTimeout = TimeSpan.FromMinutes(2);
});

services.AddSteamStoragePingService(options =>
{
    options.PingTimeout = TimeSpan.FromSeconds(5);
});

ASP.NET Core (Web)

Use AddSteamStorageApiWeb instead — it resolves IApiClient per request via IHttpContextAccessor:

services.AddSteamStorageApiWeb(options =>
{
    options.ClientName       = "MainClient"
    options.ServerAddress    = "https://your-server.com";
    options.ApiAddress       = "https://your-server.com/api";
    options.HostName         = "your-server.com";
    options.TokenHubEndpoint = "https://your-server.com/token/token-hub";
});

Authorization

public class MyViewModel
{
    private readonly IAuthorizationService _authService;

    public MyViewModel(IAuthorizationService authService)
    {
        _authService = authService;
        _authService.AuthorizationCompleted += OnAuthorizationCompleted;
        _authService.LogOutCompleted        += OnLogOutCompleted;
    }

    // Opens a browser for Steam OAuth and waits for a token via SignalR
    public async Task LoginAsync()
        => await _authService.LogInAsync();

    // For web flows — redirects to Steam with a custom return URL
    public async Task LoginWebAsync(string returnUrl)
        => await _authService.LogInAsync(returnUrl);

    public async Task LogoutAsync()
        => await _authService.LogOutAsync();

    private void OnAuthorizationCompleted(object? sender) { /* update UI */ }
    private void OnLogOutCompleted(object? sender)        { /* clear session */ }
}

Making API Requests

Inject IApiClient and call GetAsync, PostAsync, PutAsync, or DeleteAsync with a typed method enum:

// GET with no parameters
var currencies = await _apiClient.GetAsync<Currencies.CurrenciesResponse>(
    ApiConstants.ApiMethods.GetCurrencies);

// GET with query parameters
var actives = await _apiClient.GetAsync<Actives.ActivesResponse, Actives.GetActivesRequest>(
    ApiConstants.ApiMethods.GetActives,
    new Actives.GetActivesRequest(groupId: 1, page: 1));

// POST with body
await _apiClient.PostAsync(
    ApiConstants.ApiMethods.PostActiveGroup,
    new ActiveGroups.PostActiveGroupRequest("My Group", ...));

// DELETE with body
await _apiClient.DeleteAsync(
    ApiConstants.ApiMethods.DeleteActiveGroup,
    new ActiveGroups.DeleteActiveGroupRequest(groupId: 5));

// Download a file
File.FileResponse? file = await _apiClient.GetFileAsync(
    ApiConstants.ApiMethods.GetExportFile);

All methods accept an optional CancellationToken.


Event-Driven Error Handling

IApiClient exposes four events — subscribe to them once at startup instead of wrapping every call in try-catch:

_apiClient.TokenChanged      += OnTokenChanged;
_apiClient.OperationCanceled += OnOperationCanceled;
_apiClient.ApiException      += OnApiException;
_apiClient.UnhandledException += OnUnhandledException;

private void OnTokenChanged(object? sender, TokenChangedEventArgs e)
{
    // e.Token is null on logout / 401
    Console.WriteLine($"Token changed: {e.Token}");
}

private void OnOperationCanceled(object? sender)
{
    // Request was cancelled via CancellationToken
}

private void OnApiException(object? sender, ApiExceptionEventArgs e)
{
    // 4xx / 5xx from the API — e.Exception.Message contains the server error text
    Console.WriteLine($"API error: {e.Exception.Message}");
}

private void OnUnhandledException(object? sender, UnhandledExceptionEventArgs e)
{
    // Network failure, timeout, JSON parse error, etc.
    Console.WriteLine($"Unexpected error: {e.Exception}");
}

401 Unauthorized is handled automatically — Token is set to null and TokenChanged fires before ApiException.


Ping

PingResult result = await _pingService.GetPingAsync();

if (result.RoundtripTime >= 0)
    Console.WriteLine($"Latency: {result.RoundtripTime} ms");
else
    Console.WriteLine("Host unreachable");

Configuration Reference

ApiClientOptions

Property Type Default Description
ClientName string "MainClient" Named HttpClient identifier
ClientTimeout int 15 HTTP timeout in seconds
HostName string Hostname used for ping
ServerAddress string Base server URL
ApiAddress string API root URL
TokenHubEndpoint string SignalR hub URL for token delivery

AuthorizationServiceOptions

Property Type Description
TokenHubTimeout TimeSpan How long to wait for a token after browser login

PingServiceOptions

Property Type Description
PingTimeout TimeSpan Timeout for ICMP ping

Architecture Overview

IApiClient
├── TokenHandler / WebTokenHandler      — attaches Bearer token to every request
├── ApiExceptionHandler / WebApiExceptionHandler  — converts non-2xx to ApiException
└── ApiClient
    ├── ExecuteAsync                    — central try/catch, fires events
    ├── GetAsync / PostAsync / PutAsync / DeleteAsync
    └── Events: TokenChanged | OperationCanceled | ApiException | UnhandledException

IAuthorizationService
└── AuthorizationService
    ├── LogInAsync      — opens browser → waits for token via SignalR hub
    └── LogOutAsync     — clears token, fires LogOutCompleted

IPingService
└── PingService         — ICMP ping to HostName

Requirements

  • .NET 10.0+
  • Dependencies: Flurl, Microsoft.AspNetCore.SignalR.Client, Microsoft.Extensions.Http

License

See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET 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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 106 4/24/2026
2.0.1 98 4/24/2026
2.0.0 129 4/24/2026
1.8.2 100 4/19/2026
1.8.1 87 4/19/2026
1.8.0 95 4/19/2026
1.7.0 104 4/14/2026
1.6.0 104 3/21/2026
1.5.0 218 5/9/2024
1.4.0 173 5/9/2024
1.3.0 208 5/7/2024
1.2.0 142 5/2/2024
1.1.2 172 5/1/2024
1.1.1 164 5/1/2024
1.1.0 167 4/30/2024
1.0.14 191 4/27/2024
1.0.13 197 4/26/2024
1.0.12 184 4/26/2024
1.0.11 189 4/26/2024
1.0.10 186 4/25/2024
Loading failed