
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
zsgf-client
Advanced tools
一个基于 Fetch API 的现代化 TypeScript/JavaScript 客户端 SDK,帮助您快速集成和调用 ZSGF 服务。
✅ TypeScript 支持 - 完整的类型定义,提供更好的开发体验
✅ 多环境兼容 - 支持 Node.js、浏览器和各种构建工具
✅ 现代化 API - 基于 Fetch API,支持 Promise/async-await
✅ 轻量级 - 无额外依赖,体积小巧
npm install zsgf-client
或使用 yarn:
yarn add zsgf-client
import { Configuration, DefaultApi } from 'zsgf-client';
// 配置客户端
const config = new Configuration({
basePath: 'https://api.example.com',
// 其他配置项...
});
// 创建 API 实例
const api = new DefaultApi(config);
// 调用 API
async function example() {
try {
const response = await api.someMethod();
console.log(response);
} catch (error) {
console.error('API 调用失败:', error);
}
}
const { Configuration, DefaultApi } = require('zsgf-client');
const config = new Configuration({
basePath: 'https://api.example.com'
});
const api = new DefaultApi(config);
api.someMethod()
.then(response => {
console.log(response);
})
.catch(error => {
console.error('API 调用失败:', error);
});
本 SDK 使用 TypeScript 开发,提供完整的类型定义。类型定义会通过 package.json 自动解析,无需额外配置。
// 完整的类型提示和错误检查
import { Configuration, DefaultApi, SomeModel } from 'zsgf-client';
const config: Configuration = new Configuration({
basePath: 'https://api.example.com'
});
const api: DefaultApi = new DefaultApi(config);
const config = new Configuration({
basePath: 'https://api.example.com', // API 基础路径
apiKey: 'your-api-key', // API 密钥
username: 'your-username', // 用户名
password: 'your-password', // 密码
accessToken: 'your-access-token', // 访问令牌
headers: { // 自定义请求头
'Custom-Header': 'value'
}
});
import { ResponseError } from 'zsgf-client';
try {
const response = await api.someMethod();
// 处理成功响应
} catch (error) {
if (error instanceof ResponseError) {
console.error('HTTP 错误:', error.response.status);
console.error('错误信息:', await error.response.text());
} else {
console.error('其他错误:', error);
}
}
如果需要支持较旧的浏览器(如 IE11),请安装相应的 Polyfill:
npm install es6-promise whatwg-fetch
然后在代码中引入:
import 'es6-promise/auto';
import 'whatwg-fetch';
欢迎提交 Issue 和 Pull Request!
npm install zsgf-client@2.1.4 --save
FAQs
typescript fetch client for zashigaofa.com
The npm package zsgf-client receives a total of 1 weekly downloads. As such, zsgf-client popularity was classified as not popular.
We found that zsgf-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.