mirror of
https://github.com/hanzo-csharp/sdk.git
synced 2026-11-15 01:32:19 +00:00
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.
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System;
|
|
using Hanzo.AI.Api;
|
|
using Hanzo.AI.Client;
|
|
|
|
namespace Hanzo.AI.Examples
|
|
{
|
|
/// <summary>
|
|
/// tools — the tool catalog this key can reach.
|
|
/// Operation: get_tool — GET /v1/tool.
|
|
/// </summary>
|
|
public static class Tools
|
|
{
|
|
public static int Run()
|
|
{
|
|
var tools = new ToolApi(Gateway.Configuration());
|
|
try
|
|
{
|
|
var listed = tools.GetTool().Tools;
|
|
if (listed == null || listed.Count == 0)
|
|
{
|
|
Console.WriteLine("no tools reachable with this key");
|
|
return 0;
|
|
}
|
|
foreach (var tool in listed)
|
|
{
|
|
Console.WriteLine($"{tool.Name,-32} {tool.Source,-12} {(tool.Activated == true ? "activated" : "available")}");
|
|
}
|
|
Console.WriteLine();
|
|
Console.WriteLine($"{listed.Count} tools");
|
|
return 0;
|
|
}
|
|
catch (ApiException e)
|
|
{
|
|
Console.Error.WriteLine($"tools failed: HTTP {e.ErrorCode} {e.ErrorContent}");
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
}
|