| name | api-module |
| description | Add an API endpoint module to packages/api-client from an OpenAPI schema. Use for new backend endpoints, API client modules, or tasks that provide an OpenAPI schema. |
Add an API Module
Read the applicable AGENTS.md files before you edit code.
Read the API module standard in full.
- Identify the OpenAPI schema from the request. If more than one schema is possible, ask the user to select one.
- Read the schema. Identify each endpoint, HTTP method, request type, response type, and path parameter.
- Get the service and version from the URL prefix. For example, map
/v3/projects to labrinth/v3/.
- Define the API types in
types.ts. Make each type match the schema exactly.
- Do not change, rename, or remove API fields.
- Make a module class that extends
AbstractModule. Implement each endpoint with this.client.request() or this.client.upload().
- Use the request-option pattern from the standard. Do not call
$fetch, fetch, or another HTTP client directly.
- Add the module to
MODULE_REGISTRY so the client can instantiate it.
- Export new service types from the applicable barrel
index.ts.
- Check the module paths, registry key, public type exports, and endpoint types.
Run only the checks that the user or the applicable AGENTS.md permits.