Raw view: Generate a Typed API Client From OpenAPI

No invisible, zero-width, or bidi-control characters detected.

Generate a typed {{LANGUAGE}} client for the API described in the OpenAPI document below. The client should look like something a careful engineer wrote by hand for this one API, not like generic generator output.

<openapi_spec>
{{OPENAPI_SPEC}}
</openapi_spec>

<operations>
{{OPERATIONS}}
</operations>

HTTP library: {{HTTP_LIBRARY}} (use the platform's built-in fetch/http client if this is empty). Auth: {{AUTH_SCHEME}} (if empty, infer from `securitySchemes` and say what you inferred).

<operations> lists the operationIds or `METHOD /path` pairs to include. If it is empty, include every operation in the spec.

Requirements:

1. Read the spec top to bottom first. Resolve every `$ref` you will use. Note any schema that is `oneOf`/`anyOf`, nullable, has `additionalProperties`, or uses a format the language lacks a native type for (`date-time`, `int64`, `binary`). These are where generated clients usually lie about types; handle each explicitly.
2. Emit types first: one named type per component schema, with the spec's description carried into a doc comment. Model `required` precisely (optional fields are optional, not `| null` unless the spec says nullable). Enums become the language's closest exhaustive construct.
3. Emit one function per operation, named from `operationId` (convert case to the language's convention). Signature: path params, then query params, then body, then an optional per-call options object (headers, signal/timeout). Return the typed success body for the documented 2xx response.
4. Errors are values, not surprises. Every non-2xx status that the spec documents becomes a typed error carrying the parsed body; undocumented statuses throw a single generic `ApiError` with status and raw text. State in a comment which statuses are typed.
5. Centralize the base URL, auth header injection, serialization, and query encoding (arrays, nested objects, dates) in one small transport layer that each operation calls. Zero code generation at runtime; zero reflection.
6. Add exactly one usage example at the bottom in a comment: construct the client, call one operation, handle one typed error.

Prefer the standard library. Add a dependency only if {{HTTP_LIBRARY}} names one.

## Output format

**Client code** - one fenced code block per file, each preceded by its file path as a bold line (`**src/api/types.ts**`). Keep it to the fewest files that stay readable: typically `types`, `client`, and `errors`.

**Type decisions** - table: schema, spec construct (`oneOf`, `nullable`, `int64`, etc.), how modeled, what a caller must know.

**Not covered** - bullet list of operations or schemas you skipped or simplified, with the reason (unresolvable `$ref`, unsupported content type, etc.). Write "None" if everything was covered.

**Sanity checks** - 3 short items a developer should verify against a live server before trusting the client (for example, "confirm `created_at` is RFC 3339 and not epoch").