npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wxbot/open-api-sdk

v1.0.2

Published

chat open api 协议 API SDK

Readme

@wxbot/open-api-sdk

一个基于 TypeScript 的聊天机器人 Open API SDK,提供简洁易用的接口来调用聊天机器人服务。

特性

  • 🚀 完整的 TypeScript 类型支持
  • 📦 基于 Axios 的 HTTP 客户端
  • 🔧 灵活的配置选项
  • 📝 自动生成的 API 客户端(基于 OpenAPI Generator)

安装

npm install @wxbot/open-api-sdk

或使用 yarn:

yarn add @wxbot/open-api-sdk

或使用 pnpm:

pnpm add @wxbot/open-api-sdk

快速开始

基础用法

import { OpenAPIApi, Configuration } from '@wxbot/open-api-sdk';

// 创建配置
const config = new Configuration({
  basePath: 'https://your-api-domain.com',
  // 如果需要认证,可以添加以下配置
  // apiKey: 'your-api-key',
  // accessToken: 'your-access-token',
});

// 创建 API 实例
const api = new OpenAPIApi(config);

// 发送文本消息
async function sendMessage() {
  try {
    const response = await api.openApiControllerSendTextMessage({
      // 根据实际 API 要求填写参数
      message: '你好,这是一条测试消息',
      // 其他必要参数...
    });
    console.log('消息发送成功:', response.data);
  } catch (error) {
    console.error('消息发送失败:', error);
  }
}

sendMessage();

自定义 Axios 实例

import axios from 'axios';
import { OpenAPIApi, Configuration } from '@wxbot/open-api-sdk';

// 创建自定义 axios 实例
const axiosInstance = axios.create({
  timeout: 10000,
  headers: {
    'Custom-Header': 'value',
  },
});

// 使用自定义配置
const config = new Configuration({
  basePath: 'https://your-api-domain.com',
  baseOptions: {
    // axios 配置选项
  },
});

const api = new OpenAPIApi(config, undefined, axiosInstance);

API 文档

OpenAPIApi

主要的 API 类,提供以下方法:

openApiControllerSendTextMessage(sendTextMessageDto, options?)

发送文本消息到聊天机器人。

参数:

  • sendTextMessageDto: SendTextMessageDto - 消息数据传输对象
  • options?: RawAxiosRequestConfig - 可选的 Axios 请求配置

返回:

  • Promise<SendTextMessageResponseDto> - 消息发送响应

配置选项

Configuration 类支持以下选项:

{
  basePath?: string;           // API 基础路径
  apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
  username?: string;           // HTTP Basic Auth 用户名
  password?: string;           // HTTP Basic Auth 密码
  accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
  baseOptions?: any;           // Axios 基础配置
}

类型定义

SDK 提供完整的 TypeScript 类型定义,包括:

  • SendTextMessageDto - 发送消息请求数据类型
  • SendTextMessageResponseDto - 发送消息响应数据类型
  • Configuration - 配置选项类型
  • 其他相关类型...

开发

构建项目

npm run build

监听模式构建

npm run build:watch

清理构建产物

npm run clean

系统要求

  • Node.js >= 16.0.0
  • TypeScript >= 5.3.0

依赖

  • axios: ^1.6.0 - HTTP 客户端

许可证

MIT

贡献

欢迎提交 Issue 和 Pull Request!

支持

如有问题或建议,请通过以下方式联系:

  • 提交 Issue
  • 发送邮件

更新日志

1.0.0

  • 🎉 初始版本发布
  • ✨ 支持发送文本消息
  • 📦 完整的 TypeScript 类型支持