Invokation.Skill.Sdk 1.3.0

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

IVK Skill SDK for C#

Official C# SDK for the Invokation Skill API - skill ratings and matchmaking for games.

Installation

Install via NuGet:

dotnet add package Invokation.Skill.Sdk

Or via the Package Manager Console:

Install-Package Invokation.Skill.Sdk

Quick Start

using Invokation.Skill.Sdk;
using Invokation.Skill.Sdk.Model;
using System.Collections.ObjectModel;

// Create the SDK instance
using var sdk = SkillSdk.CreateBuilder()
    .WithApiKey("your-api-key")
    .WithEnvironment("production")
    .Build();

// Submit match results
var ratingUpdates = await sdk.PostMatchResultAsync("your-model-id", new MatchResultRequest(
    teams: new Collection<TeamInfo>(),
    playerSessions: new Collection<PlayerSession>
    {
        new PlayerSession(playerId: "player_1", playerScore: 200)
        {
            PriorGamesPlayed = 80,
            PriorMmr = 0.5
        },
        new PlayerSession(playerId: "player_2", playerScore: 250)
        {
            PriorGamesPlayed = 70,
            PriorMmr = 0.4
        }
    }
)
{
    MatchId = "unique-match-id"
});

// Access updated ratings
foreach (var player in ratingUpdates.Players)
{
    Console.WriteLine($"{player.PlayerId}: {player.Prior.Mmr:F3} -> {player.Post.Mmr:F3}");
}

Features

  • Async/await and sync APIs - Choose between PostMatchResultAsync() or PostMatchResult()
  • Automatic retry with exponential backoff - Configurable retry behavior for transient failures
  • API key authentication - Simple setup via the builder pattern
  • Full .NET support - Targets .NET 6, .NET 8, and .NET 10

Configuration

Builder Options

var sdk = SkillSdk.CreateBuilder()
    .WithApiKey("your-api-key")           // Required: API key from IVK dashboard
    .WithBaseUrl("https://skill.ivk.dev") // Optional: API base URL (default shown)
    .WithEnvironment("production")         // Optional: Environment name (default: "production")
    .WithRetryConfig(new RetryConfig       // Optional: Retry configuration
    {
        MaxRetries = 3,
        InitialDelayMs = 500,
        MaxDelayMs = 10000
    })
    .WithHttpClient(httpClient)            // Optional: Custom HttpClient
    .WithLogger(logger)                    // Optional: ILogger for debugging
    .Build();

Retry Configuration

The SDK automatically retries failed requests with exponential backoff:

var retryConfig = new RetryConfig
{
    MaxRetries = 5,        // Total attempts (default: 3)
    InitialDelayMs = 100,  // First retry delay (default: 500ms)
    MaxDelayMs = 30000     // Maximum delay cap (default: 10000ms)
};

To disable retries:

.WithRetryConfig(RetryConfig.NoRetry)

API Reference

PostMatchResultAsync / PostMatchResult

Submit match results to update player skill ratings.

var result = await sdk.PostMatchResultAsync(
    modelId: "your-model-id",
    request: matchResultRequest,
    cancellationToken: token  // Optional
);

PostPreMatchAsync / PostPreMatch

Calculate expected match outcomes before a match starts.

var prediction = await sdk.PostPreMatchAsync(
    modelId: "your-model-id",
    request: preMatchRequest
);

foreach (var team in prediction.Teams)
{
    Console.WriteLine($"Team {team.Id}: {team.Expected:P1} win probability");
}

GetConfigurationAsync / GetConfiguration

Retrieve the current model configuration.

var config = await sdk.GetConfigurationAsync(modelId: "your-model-id");
Console.WriteLine($"Model revision: {config.Revision}");

Examples

1v1 Match

var request = new MatchResultRequest(
    teams: new Collection<TeamInfo>(),
    playerSessions: new Collection<PlayerSession>
    {
        new PlayerSession(playerId: "winner", playerScore: 100) { PriorMmr = 0.5 },
        new PlayerSession(playerId: "loser", playerScore: 50) { PriorMmr = 0.5 }
    }
);

var result = await sdk.PostMatchResultAsync("model-id", request);

Team Match (3v3)

var request = new MatchResultRequest(
    teams: new Collection<TeamInfo>
    {
        new TeamInfo(teamId: "blue", teamScore: 3),
        new TeamInfo(teamId: "red", teamScore: 1)
    },
    playerSessions: new Collection<PlayerSession>
    {
        // Blue team
        new PlayerSession(playerId: "p1", playerScore: 100) { TeamId = "blue", PriorMmr = 0.6 },
        new PlayerSession(playerId: "p2", playerScore: 80) { TeamId = "blue", PriorMmr = 0.5 },
        new PlayerSession(playerId: "p3", playerScore: 90) { TeamId = "blue", PriorMmr = 0.55 },
        // Red team
        new PlayerSession(playerId: "p4", playerScore: 70) { TeamId = "red", PriorMmr = 0.5 },
        new PlayerSession(playerId: "p5", playerScore: 60) { TeamId = "red", PriorMmr = 0.45 },
        new PlayerSession(playerId: "p6", playerScore: 50) { TeamId = "red", PriorMmr = 0.4 }
    }
);

var result = await sdk.PostMatchResultAsync("model-id", request);

Error Handling

The SDK throws specific exceptions for different error conditions:

try
{
    var result = await sdk.PostMatchResultAsync(modelId, request);
}
catch (ApiException ex) when (ex.ErrorCode == 401)
{
    Console.WriteLine("Invalid API key");
}
catch (ApiException ex) when (ex.ErrorCode == 404)
{
    Console.WriteLine("Model not found");
}
catch (HttpRequestException ex)
{
    Console.WriteLine($"Network error: {ex.Message}");
}

Dependency Injection

For ASP.NET Core applications:

// In Program.cs or Startup.cs
services.AddSingleton<SkillSdk>(sp =>
{
    var logger = sp.GetService<ILogger<SkillSdk>>();
    return SkillSdk.CreateBuilder()
        .WithApiKey(Configuration["InvokationApiKey"])
        .WithLogger(logger)
        .Build();
});

Development

Prerequisites

  • .NET 6.0 SDK or later
  • Docker (for OpenAPI code generation)
  • Just (task runner)

Common Tasks

# Build
just build

# Run tests
just test

# Generate SDK from OpenAPI spec
just generate-sdk

# Pack for NuGet
just pack

# Clean artifacts
just clean

Support

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 91 3/16/2026
1.2.1 341 2/25/2026
1.2.0 482 1/28/2026
1.1.7 136 1/16/2026
1.1.6 96 1/14/2026
1.0.0 94 1/14/2026