Qualithm.Platform
0.2.0
Prefix Reserved
See the version list below for details.
dotnet add package Qualithm.Platform --version 0.2.0
NuGet\Install-Package Qualithm.Platform -Version 0.2.0
<PackageReference Include="Qualithm.Platform" Version="0.2.0" />
<PackageVersion Include="Qualithm.Platform" Version="0.2.0" />
<PackageReference Include="Qualithm.Platform" />
paket add Qualithm.Platform --version 0.2.0
#r "nuget: Qualithm.Platform, 0.2.0"
#:package Qualithm.Platform@0.2.0
#addin nuget:?package=Qualithm.Platform&version=0.2.0
#tool nuget:?package=Qualithm.Platform&version=0.2.0
Platform SDK Cs
C# client for the Qualithm Platform API, generated from its OpenAPI spec. Every operation and type comes from the spec the API serves, so the client changes when the API does.
Features
- Every management operation — one typed
asyncmethod per operation, grouped by resource (DevicesApi,AutomationsApi, …), with the spec's names - One error type — every failure is a
PlatformExceptioncarrying the API's stableCode - Configured from the environment —
QUALITHM_API_TOKENandQUALITHM_API_URL net10.0— one class library on the current .NET LTS
Installation
dotnet add package Qualithm.Platform
Quick Start
Create an API token in the Qualithm app, on the team page under API tokens, then:
using Qualithm.Platform;
using Qualithm.Platform.Api;
using var platform = new PlatformClient(token: "<your-api-token>");
// An API token belongs to one team, so its team list has exactly that team.
var teams = await platform.Api<TeamsApi>().ListTeamsAsync();
var teamId = teams.Data.Items[0].Id;
var page = await platform.Api<DevicesApi>().ListDevicesAsync(teamId);
foreach (var device in page.Data.Items)
{
Console.WriteLine(device.Name);
}
Usage
Configure the client
PlatformClient reads QUALITHM_API_TOKEN and QUALITHM_API_URL when you don't pass token or
baseUrl. The base URL defaults to the production API, https://api.qualithm.com. Create one
client and keep it for the life of your app: it owns the HTTP connection pool.
using var platform = new PlatformClient(baseUrl: "https://api.qualithm.com");
Call an operation
Each generated …Api class in Qualithm.Platform.Api is one resource group. platform.Api<T>()
returns it bound to your client, created once. Method names match the spec's operationIds. Every
response is the API's envelope, so the result is in Data. Operations on a team's resources take
its teamId:
var automations = await platform.Api<AutomationsApi>().ListAutomationsAsync(teamId, page: 1, limit: 50);
Error Handling
Every error response and failed request throws PlatformException. Branch on Code, never on
Message. A code this version doesn't know yet reads as ApiErrorCode.UnknownDefaultOpenApi. A
request that got no response has Status 0:
using Qualithm.Platform.Model;
try
{
await platform.Api<DevicesApi>().GetDeviceAsync(teamId, deviceId);
}
catch (PlatformException e) when (e.Code == ApiErrorCode.NotFound)
{
// the device doesn't exist, or isn't in this team
}
API Reference
The operations and types are generated from the platform's OpenAPI spec, committed as
openapi.json. Every public type carries /// XML doc comments, which ship in the
package for the editor. CI builds the reference with docfx on every pull request into main:
dotnet tool restore
dotnet docfx docs/docfx.json --serve
Examples
See examples/:
| Example | Description |
|---|---|
| ListDevices | List the devices in the token's team, and report a PlatformException |
QUALITHM_API_TOKEN=<your-api-token> dotnet run --project examples/ListDevices
Development
Everything builds and tests on macOS, Linux or Windows with the .NET SDK global.json pins.
Regenerating the client needs Docker.
git config core.hooksPath .githooks # run the checks before each commit
dotnet restore --locked-mode
dotnet format # fix formatting
dotnet test
dotnet pack -c Release # the .nupkg and .snupkg, in bin/Release
.claude/rules/checks.md lists the commands CI runs, and .githooks/pre-commit runs them.
Regenerating
src/Qualithm.Platform/Generated/ comes from openapi.json and the generator pinned in
scripts/generate. Never edit it by hand: CI regenerates it and fails on any difference. The
platform opens a pull request here with the new spec and the regenerated code whenever its API
changes. To regenerate by hand:
scripts/generate
The hand-written layer is PlatformClient.cs and PlatformException.cs. The generated code sits
outside the repo's checks, which hold only the hand-written layer:
- Format and analyzers:
scripts/generatestarts every generated file with// <auto-generated/>, whichdotnet formatand the .NET analyzers skip, and keeps the generator's nullable setting (#nullable enable annotations)..editorconfigsilences the one compiler warning the generated code trips (CS8073), forGenerated/only. - Coverage: the test project passes
--coverlet-exclude-by-file "**/Generated/**/*.cs"throughTestingPlatformCommandLineArguments, so the 80% line gate measures the hand-written layer.
Minimum Supported .NET Version
.NET 10 (SDK pinned in global.json).
License
Apache-2.0
| Product | Versions 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. |
-
net10.0
- JsonSubTypes (>= 2.0.1)
- Newtonsoft.Json (>= 13.0.3)
- Polly (>= 8.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.