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

34 lines
1.2 KiB
C#

using System;
using Hanzo.AI.Api;
using Hanzo.AI.Client;
namespace Hanzo.AI.Examples
{
/// <summary>
/// money — balance, then the usage that moved it.
/// Operations: get_billing_balance, get_billing_usage. Neither takes an org: the
/// tenant comes from the token's owner claim, so a key reads only its own money.
/// The document publishes no response schema for either, so the generated
/// methods return nothing and this prints the status. When cloud declares the
/// shapes, a regeneration gives them bodies.
/// </summary>
public static class Money
{
public static int Run()
{
var billing = new BillingApi(Gateway.Configuration());
try
{
Console.WriteLine($"balance HTTP {billing.GetBillingBalanceWithHttpInfo().StatusCode:D}");
Console.WriteLine($"usage HTTP {billing.GetBillingUsageWithHttpInfo().StatusCode:D}");
return 0;
}
catch (ApiException e)
{
Console.Error.WriteLine($"billing failed: HTTP {e.ErrorCode} {e.ErrorContent}");
return 1;
}
}
}
}