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" />
<PackageReference Include="Invokation.Skill.Sdk" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=Invokation.Skill.Sdk&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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()orPostMatchResult() - 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
- Documentation: https://docs.ivk.dev
- Discord: Community Discord
| Product | Versions 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.
-
net10.0
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.5)
-
net6.0
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.5)
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.