C# SDK
This is the README that tungsten generates for the C# target, shown for a small example API (Swagger's Petstore). Names change with your API; the structure does not.
These recorded examples retain their original generator and runtime versions. Their installation snippets name example generated packages; they are not a current registry installation recipe. See runtime distribution for the verified stable 0.1.2 package versions and matching source routes for the unreleased 0.1.3 candidate.
The C# SDK of the openapi API, generated by tungsten 0.1.3. Do not edit the generated files; put your own code in custom/.
Install
dotnet add package Openapi.Sdk --version 0.1.0
It depends on Tungsten.Runtime (net10.0), which carries validation, auth, idempotency, confirmation, retries, pagination, streams and the error envelope.
Use
using Openapi.Sdk;
using Tungsten.Runtime;
var client = new OpenapiClient(new ClientOptions
{
BaseUrl = "https://api.example.com",
});
Every operation is an async method returning Result<T>: Result<T>.Ok with the typed value, or Result<T>.Err with the diagnostic envelope (category, remediation, retryable). Destructive operations need a confirmation token from their Preview...Async method, passed as new CallOptions { Confirm = Confirm.Token(token) }.
Operations
| Operation | Method |
|---|---|
openapi.listPets | Pets.ListAsync |
openapi.createPets | Pets.CreateAsync |
openapi.showPetById | Pets.GetAsync |