Files
js-sdk/examples/money/index.ts
zeekay eb4d28df0f the counts say what the document says: 891 shapeless, 191 tags
834 was the number of methods typed `void`, not the number of operations
that state a route without a response shape. The document has 891 of those;
57 come out `any` rather than `void`, which is why the two numbers differ.
README, LLM.md and the hello/money flows all quoted the method count as if
it were the operation count.

Tags likewise: the `tags:` array declares 190 and operations use 191
(`compat` is used undeclared). 192 is the class count — the 191 tag classes
plus `DefaultApi`, which carries the 50 untagged routes (`/`, `/.well-known/*`)
and is not a product.

The billing snippet in "The API surface" referenced a `config` no reader has,
so it was the one README block that did not compile; it now builds its own
Configuration and compiles under --strict on both Bundler and NodeNext
resolution.

LLM.md's IAM note named `src/models/role.ts`, which does not exist — the
membership row is `role-assignment.ts`.
2026-08-14 14:38:56 -07:00

27 lines
1.0 KiB
TypeScript

// money — what is in the wallet, and what spent it.
//
// GET /v1/billing/balance get_billing_balance
// GET /v1/billing/usage get_billing_usage
//
// Neither takes an org: the server derives the tenant from the token's `owner`
// claim, so a key can only ever read its own money. No org flag, no X-Org-Id.
//
// Neither declares a response schema either, so the client types the body void
// even though the server sends JSON. That is a document gap, not an SDK one —
// 891 of the document's 2479 operations state the route and not its shape — so
// this reads the raw payload rather than pretending a type it was not given.
import { BillingApi } from 'hanzoai';
import { config, fail } from '../client';
async function main() {
const billing = new BillingApi(config());
const balance = await billing.getBillingBalance();
console.log('balance:', JSON.stringify(balance.data as unknown, null, 2));
const usage = await billing.getBillingUsage();
console.log('usage:', JSON.stringify(usage.data as unknown, null, 2));
}
main().catch(fail);