@gtmi/ramp-api-client
v0.0.2
Published
Type-safe SDK for the **RAMP API server** (`apps/api`). Auto-generated from the app's committed OpenAPI spec with [`@hey-api/openapi-ts`](https://heyapi.dev), shipping tree-shakeable per-operation functions, request/response types, and runtime [zod](https
Keywords
Readme
@gtmi/ramp-api-client
Type-safe SDK for the RAMP API server (apps/api). Auto-generated from the
app's committed OpenAPI spec with @hey-api/openapi-ts,
shipping tree-shakeable per-operation functions, request/response types, and
runtime zod schemas.
Install
pnpm add @gtmi/ramp-api-clientUsage
import { createRampApiClient, postConversations } from '@gtmi/ramp-api-client';
const client = createRampApiClient({
baseUrl: process.env.RAMP_API_URL!,
getAuthToken: () => process.env.CR_SERVER_API_KEY!, // sent as `Authorization: Bearer …`
});
const { data, error } = await postConversations({
client,
body: { configurationId: 'cfg_123' },
});Every operation accepts the client returned by createRampApiClient. Without
getAuthToken, no Authorization header is sent (use for public endpoints).
Runtime validation
Generated zod schemas are exported under schemas:
import { schemas } from '@gtmi/ramp-api-client';
schemas.zPostConversationsBody.parse(input);A note on response types
Request inputs are fully typed and zod-validated. Response types are only as
rich as the OpenAPI spec's response schemas, which are sparse today — many
responses are loosely typed until handler @response JSDoc is enriched. As that
JSDoc lands, regenerating this SDK upgrades the response types with no API
change here.
Regenerating
This package is generated from apps/api/public/openapi.json:
pnpm --filter @gtmi/ramp-api-client generatesrc/generated/ is committed and drift-checked in CI. Do not edit it by hand.
