mirror of
https://github.com/hanzoai/java-sdk.git
synced 2026-10-30 15:07:36 +00:00
Maven Central has no ai.hanzo group — repo1.maven.org/maven2/ai/hanzo/ is a 404 — so the README printed coordinates that resolve nowhere. It now builds and installs into the reader's own ~/.m2 and depends on that; the coordinates return when an upload succeeds. ai.hanzo.Hanzo moves the auth wiring out of examples/ and into the module. The document declares no securitySchemes, so the generator registered no credential: setAccessToken throws and a client built by hand goes out bare. One hand-written file beside the generated package sets Authorization and X-Org-Id, so a reader's first program wires up the same way the examples do instead of copying a helper only the examples had. It survives regeneration — sdks.yaml hands the generator ai/hanzo/cloud, not ai/hanzo. Counts are measured rather than remembered: 2,479 operations over 192 API classes and 2,461 models, from a document whose operation ids are identical to what api.hanzo.ai serves. The agent flow asks for zen5, which the catalog has; zen-1 was never a model. Three dependencies nothing imports are gone (oltu, jakarta.ws.rs-api, commons-lang3) — the oauth2 scheme whose generated classes they served is not in this document. jakarta.annotation-api stays and stays on 1.x: every generated type carries @javax.annotation.Generated, and 2.0 renames that package.
30 lines
1.1 KiB
Groovy
30 lines
1.1 KiB
Groovy
// The six canonical flows. Every Hanzo SDK ships the same six under
|
|
// examples/<flow>/ — the list is data in hanzoai/openapi flows.yaml, not a
|
|
// choice this repo makes.
|
|
//
|
|
// They are compiled by `./gradlew build`, which is the point: an example that
|
|
// does not compile is worse than no example.
|
|
|
|
// One source directory: examples/<flow>/<Flow>.java. Nothing else lives here —
|
|
// HANZO_API_KEY, HANZO_BASE_URL and HANZO_ORG_ID are resolved by ai.hanzo.Hanzo
|
|
// in the client itself, so an example wires up the same way a reader's program
|
|
// does instead of demonstrating a helper only the examples have.
|
|
sourceSets.main.java {
|
|
srcDirs = ['.']
|
|
exclude 'build/**'
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':hanzo-java-cloud')
|
|
}
|
|
|
|
// ./gradlew hello | chat | money | store | agent | tools
|
|
['hello', 'chat', 'money', 'store', 'agent', 'tools'].each { flow ->
|
|
tasks.register(flow, JavaExec) {
|
|
group = 'hanzo'
|
|
description = "Run the $flow example."
|
|
mainClass = "ai.hanzo.cloud.examples.${flow.capitalize()}"
|
|
classpath = sourceSets.main.runtimeClasspath
|
|
}
|
|
}
|