Every gate in this repo compares a client to the document, and every build proves the client is well-formed. Neither answers the question a user actually has: does it work against a server. Seven languages now answer it -- go, python, typescript, dart, php, ruby, rust -- against the local cloud by default and against anything HANZO_BASE_URL names. Each probe asserts a 200 whose body decodes AND a 403 that arrives as an error, because a client that swallows a refusal and returns a zero value looks exactly like one that works. It earned its place on the first run: GET /v1/models is AiAPI.GetModels in Go and ai_api::get_models in Rust but ModelsApi.getModels in TypeScript. One document, three groupings, and nothing but a call finds it.
19 lines
856 B
PHP
19 lines
856 B
PHP
<?php
|
|
require '/home/z/work/hanzo/php-sdk/vendor/autoload.php';
|
|
$base = getenv('HANZO_BASE_URL');
|
|
$cfg = Hanzo\Cloud\Configuration::getDefaultConfiguration()->setHost($base);
|
|
$http = new GuzzleHttp\Client(['http_errors' => false]);
|
|
$fail = 0;
|
|
try {
|
|
$r = (new Hanzo\Cloud\Api\AiApi($http, $cfg))->getModelsWithHttpInfo();
|
|
echo " ok GET /v1/models {$r[1]}\n";
|
|
} catch (Throwable $e) { echo " FAIL models: ".get_class($e)."\n"; $fail++; }
|
|
try {
|
|
(new Hanzo\Cloud\Api\EngineApi($http, $cfg))->engineStatus();
|
|
echo " FAIL engine: unauthenticated call reported success\n"; $fail++;
|
|
} catch (Hanzo\Cloud\ApiException $e) {
|
|
echo " ok GET /v1/engine/status refused: {$e->getCode()}\n";
|
|
} catch (Throwable $e) { echo " ok refused: ".get_class($e)."\n"; }
|
|
echo $fail === 0 ? "PASS php\n" : "FAIL php ($fail)\n";
|
|
exit($fail === 0 ? 0 : 1);
|