@zinn-digital/sdk

中文文档
0.1.1372发布于 2026/11/03MITTypeScriptES Module

Typed TypeScript client for the Zinn Digital Platform API, generated from its OpenAPI spec.

原始使用文档

@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").

版本与发布记录

@zinn-digital/sdk 共发布 20 个版本,首次发布于 2026/11/01;过去 12 个月发布了 20 个版本。

版本发布日期距今
0.1.1372latest2026/11/03今天
0.1.13712026/11/03今天
0.1.13702026/11/03今天
0.1.13692026/11/03今天
0.1.13682026/11/03今天
0.1.13662026/11/03今天

关于 @zinn-digital/sdk 的常见问题

@zinn-digital/sdk 是什么?

Zinn数字平台API的类型化TypeScript客户端,从它的OpenAPI规范生成。

如何安装 @zinn-digital/sdk?

在项目目录运行 npm install @zinn-digital/sdk,或使用 pnpm add / yarn add / bun add。

@zinn-digital/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@zinn-digital/sdk 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@zinn-digital/sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@zinn-digital/sdk 可以商用吗?

@zinn-digital/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@zinn-digital/sdk 还在维护吗?

最新版本 0.1.1372 发布于 2026/11/03(今天);至今共发布 20 个版本,其中过去 12 个月发布了 20 个;首次发布于 2026/11/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。