@docstudio/api-client

中文文档
168.21.0发布于 2026/11/01MITTypeScriptESM + CJS

DocStudio API客户端

中文使用文档
文档目录7 节
  1. 要求
  2. 安装
  3. 开始
  4. 身份验证
  5. 二进制响应
  6. 释放
  7. 许可证

DocStudio API客户端为Node.js

的TypeScript客户端 DocStudio API,由 服务器的OpenAPI文档 openapi-generator (typescript-axios)。

  • API版本: R168.21
    • 发电机版本: 7.24.0
  • 建设方案: org.openapitools.codegen.languages.TypeScriptAxiosClientCodegen

要求

package.json tsconfig是手工维护的;生成器的副本 被丢弃。

Node.js 18或更高版本。 axios 是唯一的运行时依赖项;包中包含CommonJS 和ES模块构建加上TypeScript声明。

安装

npm install @docstudio/api-client

开始

import {
    AuthenticationControllerApi,
    MailboxControllerApi,
    Configuration,
} from '@docstudio/api-client';

const basePath = 'https://api.docstudio.com';

const auth = new AuthenticationControllerApi(new Configuration({ basePath }));
const { data: session } = await auth.login({ login: email, password });

const config = new Configuration({ basePath, accessToken: session.token });
const mailboxes = new MailboxControllerApi(config);

const { data } = await mailboxes.getAllForUser();

大多数端点都限定在邮箱的范围内,并将其UUID作为 mailbox 参数, 客户端发送的是什么 Mailbox 头。

身份验证

每个文件只设置一个凭证 Configuration.

// user API - bearer token
new Configuration({ basePath, accessToken: token });

// form API - form token, with the prefix included in the value
new Configuration({ basePath, apiKey: `Form ${formToken}` });

这两种证书都在 Authorization 头。少数端点接受 要么;如果两者都设置了,则最后应用表单令牌并获胜,这就是为什么a Configuration 应该只带一个。

二进制响应

返回文件的端点解析为 ArrayBuffer. 客户端设置 responseType 因为axios会将正文解码为UTF-8文本和 腐败。注意生成的签名如下 File -这是发电机的标签 二进制主体,而不是运行时类型。

const { data } = await envelopes.downloadFinalPdf(id, documentId, mailbox);
await writeFile('envelope.pdf', Buffer.from(data as unknown as ArrayBuffer));

释放

这个包是从DocStudio OpenAPI文档生成的;以上API版本为 生成它的API版本。版本由DocStudio团队从 内部工具。

许可证

麻省理工学院

版本与发布记录

@docstudio/api-client 共发布 3 个版本,首次发布于 2026/10/28;过去 12 个月发布了 3 个版本。

版本发布日期距今
168.21.0latest2026/11/012 天前
168.18.02026/10/286 天前
0.0.0-stage2026/10/286 天前

关于 @docstudio/api-client 的常见问题

@docstudio/api-client 是什么?

DocStudio API客户端

如何安装 @docstudio/api-client?

在项目目录运行 npm install @docstudio/api-client,或使用 pnpm add / yarn add / bun add。

@docstudio/api-client 支持 TypeScript 吗?

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

@docstudio/api-client 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@docstudio/api-client 需要什么版本的 Node.js?

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

@docstudio/api-client 可以商用吗?

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

@docstudio/api-client 还在维护吗?

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