@wheelhouse/api
v0.0.1
Published
Typed fetch client and TanStack Query hooks for Builder Platform APIs
Keywords
Readme
@wheelhouse/api
Typed HTTP client and optional TanStack Query (React) hooks generated from the Wheelhouse Revenue Management OpenAPI document. Ships as ESM with TypeScript declarations under dist/.
Install
npm install @wheelhouse/apiPeers: react ≥ 19 and @tanstack/react-query ≥ 5 are optional; install them only if you import @wheelhouse/api/react.
Package entry points (package.json → exports)
| Subpath | Use when |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| @wheelhouse/api/types | You only need OpenAPI-derived types, JsonBodyInit, ApiErrorLike, and DEFAULT_API_BASE_URL (from servers[0].url in the spec). |
| @wheelhouse/api/client | You call the RM API with fetch via createApiClient / configureApiClient and imperative rm* functions (no React Query in your bundle). |
| @wheelhouse/api/react | You use <ApiProvider>, useApiClient, and Orval-generated useRm* hooks plus query helpers. |
Configure the HTTP client
configureApiClient({ baseUrl, headers })(module scope) or<ApiProvider baseUrl={...} token={...} headers={...}>(React tree).
The RM API expects an integration key: set header X-Integration-Api-Key (see the OpenAPI securitySchemes in rm-api-open-api-spec.json). ApiProvider can also set a Bearer Authorization header when token is passed.
Generated calls use rmApiRequest, which reads the active client from getApiClient() — configure the client before invoking generated functions or hooks.
Regenerating code (codegen)
Source of truth: rm-api-open-api-spec.json at the package root. For now, this will need to be manually downloaded.
From this package:
pnpm run codegenFrom the monorepo root:
pnpm api:codegenThis runs Orval (orval.config.ts: rm + rmReact), syncs DEFAULT_API_BASE_URL from the spec, then Prettier and ESLint --fix on generated trees:
src/types/generated/— models + default base URLsrc/client/generated/— imperative fetch-style functionssrc/react/generated/— React Query v5 hooks (shouldSplitQueryKeyfor hierarchical query keys)
Do not hand-edit generated files.
Build & publish
pnpm run buildPublished tarball includes dist/ only (package.json → files). Run codegen before release when the OpenAPI file changes.
Monorepo
Workspace scripts, CI, and publishing are described in the repository root README.md.
