Files
zeekay 34e2e06bdf The C# client, generated from hanzo-inc/cloud@a779b8b229 (8.5.988)
Every /v1 operation the gateway serves as a typed method, generated by
hanzoai/openapi's driver from its `csharp` row (openapi-generator 7.14.0,
httpclient library). Published as `Hanzo` on nuget.org, namespace
Hanzo.AI. The repo owns the csproj, Gateway.cs (endpoint, bearer and
X-Org-Id from the environment), seven wire tests against a stub transport,
and the six flows every Hanzo SDK carries. hanzo.yml gates all three and
puts the repo on the client lane; release.yml pushes a version nuget.org
does not yet serve. scripts/dotnet installs a .NET 10 SDK where a runner
has none.
2026-11-06 12:59:19 -08:00

40 lines
1.2 KiB
C#

using System;
using System.Linq;
using Hanzo.AI.Api;
using Hanzo.AI.Client;
namespace Hanzo.AI.Examples
{
/// <summary>
/// hello — prove the key works and print what it owns.
/// Operation: get_account_keys — GET /v1/account/keys. With no key or a bad one
/// it answers 403; that refusal is the point of the flow.
/// </summary>
public static class Hello
{
public static int Run()
{
var keys = new AccountApi(Gateway.Configuration());
try
{
var owned = keys.GetAccountKeys().Keys;
if (owned == null || owned.Count == 0)
{
Console.WriteLine("the key is good, and it owns no keys of its own");
return 0;
}
foreach (var key in owned)
{
Console.WriteLine($"{key.Type,-8} {key.Prefix,-24} {key.Created}");
}
return 0;
}
catch (ApiException e)
{
Console.Error.WriteLine($"keys refused: HTTP {e.ErrorCode} {e.ErrorContent}");
return 1;
}
}
}
}