Unofficial open-source C# SDK for TofuPilot. Integrate all your hardware test runs into one app with just a few lines of C#.
Looking for the official client? See tofupilot/csharp-client.
dotnet add package Hylaean.TofuPilotusing Hylaean.TofuPilot;
using Hylaean.TofuPilot.Models.Runs;
using Hylaean.TofuPilot.Abstractions.Models;
// Create a client (reads TOFUPILOT_API_KEY from environment by default)
using var client = new TofuPilotClient(apiKey: "your-api-key");
// List recent runs
var runs = await client.Runs.ListAsync(new ListRunsRequest { Limit = 10 });
// Create a test run
var run = await client.Runs.CreateAsync(new CreateRunRequest
{
ProcedureId = "your-procedure-id",
Outcome = RunOutcome.PASS,
SerialNumber = "SN-001",
StartedAt = DateTimeOffset.UtcNow.AddMinutes(-5),
EndedAt = DateTimeOffset.UtcNow
});
Console.WriteLine($"Created run: {run.Id}");services.AddTofuPilot(options =>
{
options.ApiKey = configuration["TofuPilot:ApiKey"];
options.BaseUrl = "https://www.tofupilot.com";
options.Retry = new RetryOptions
{
MaxRetries = 3,
InitialDelayMs = 1000,
MaxDelayMs = 30000
};
});
// Inject TofuPilotClient anywhere
public class TestRunService(TofuPilotClient client)
{
public Task<Run> CreateTestRunAsync(string serialNumber) =>
client.Runs.CreateAsync(new CreateRunRequest
{
ProcedureId = "proc-123",
Outcome = RunOutcome.PASS,
SerialNumber = serialNumber,
StartedAt = DateTimeOffset.UtcNow.AddMinutes(-5),
EndedAt = DateTimeOffset.UtcNow
});
}| Topic | Description |
|---|---|
| Resources | Full reference for all API resources (runs, units, procedures, parts, batches, stations, attachments, users) |
| Configuration | Direct instantiation, DI setup, environment variables, retry options |
| Error Handling | Typed exceptions, status codes, base exception properties |
| API Coverage | Operation-by-operation mapping to the OpenAPI spec |
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.