@zinn-digital/sdk — TypeScript client for the Zinn Digital Platform API
A fully typed client for the Zinn Digital public API. Every path, parameter and response type is generated from the platform's OpenAPI specification, and a new version is published automatically whenever the specification changes.
npm install @zinn-digital/sdk
import { createApiClient } from "@zinn-digital/sdk";
const api = createApiClient({ baseUrl: "https://api.zinndigital.com" });
// Public catalogue endpoints need no key.
const { data: regions } = await api.GET("/v1/catalog/regions");
// Everything else uses a per-organisation API key (create one on the dashboard's API keys page).
api.use({
onRequest: ({ request }) => {
request.headers.set("Authorization", `Bearer ${process.env.ZINN_API_KEY}`);
},
});
const { data: sites, error } = await api.GET("/v1/sites");
The client is openapi-fetch; components, paths and
operations types are exported for your own code (import type { components } from "@zinn-digital/sdk").
- Guide: https://zinndigital.com/developers/sdk-typescript
- API reference: https://zinndigital.com/developers/api
- Licence: MIT