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 🙏

© 2024 – Pkg Stats / Ryan Hefner

hz-agent-api

v0.0.12

Published

API for 汇智

Downloads

60

Readme

hz-agent-api

汇智的API库,支持 UMD、CJS、ESM 多模式和 Tree-Shaking。

目的:高效率完成前端业务代码

业务开发过程中,快速的调用接口。

本项目的开发流程(用于汇智的开发人员)

  1. 在 src 目录下创建一个文件夹,文件夹用大类的命名,如 auth 就是鉴权的模块。
  2. 在文件夹中创建一个 js 文件,名用小类的命名,如 loginDeployOfH5 就是部署 H5 的登录接口。
  3. auth 目录下,再新建一个 index.js,用于导出整个模块的 API。
  4. 在根目录下的 index.js 中,使用 export 导出模块中所有的 API。
  5. 在根目录下的 package.json 中,修改 version 的版本号。
  6. pnpm install 后执行打包操作 pnpm run build
  7. npm publish 进行发包。

安装和使用 :wrench:

ESM

使用 npm 安装。支持 Tree-shaking。

npm i hz-agent-api -D
// 引入不登录获取智能体信息API接口
import { getAgentDetails } from 'hz-agent-api';

// 在Vue3组件挂载时调用
onMounted(async() => {
  const tenantId = '476'
  const agentNo = 'AG1806510241710477312NELS'
  const shareKey = 'LINK18156324277003264008266'
  const res = getAgentDetails(tenantId, agentNo, shareKey)
  console.log('不登录获取智能体信息', res)
})

CJS

hz-agent-api/lib

切换版本号后,直接下载 lib 目录下的 AGENT_API.cjs.js 使用,在 node 环境中引入使用。

CDN

CDN

hz-agent-api/lib

切换版本号后,直接下载 lib 目录下的 AGENT_API.browser.js 使用,支持 CDN 方式,直接在 html 文件中引入使用。

<script src="./js/AGENT_API.browser.js"></script>
<script>
  const tenantId = '476'
  const agentNo = 'AG1806510241710477312NELS'
  const shareKey = 'LINK18156324277003264008266'
  const agentObj = HZAPI.getAgentDetails(tenantId, agentNo, shareKey);
</script>

npm 链接 :link:

hz-agent-api

API 文档 :package:

鉴权

部署方式登录 - 部署 PC、小程序、安卓和IOS 的登录

方法:loginDeployOfCommon

参数:

  • tenantId:租户ID
  • appKey:应用key
  • signature:签名
  • timestamp:时间戳
  • userIdentifier:用户标识

返回值:登录成功后返回的 token 等的对象信息

部署方式登录 - 部署公众号的登录

方法:loginDeployOfH5

参数:

返回值:登录成功后返回的 token 等的对象信息

智能体

分享智能体 - 不登录获取智能体信息

方法:getAgentDetails

参数:

  • tenantId:租户ID
  • agentNo:智能体编号
  • shareKey:分享key

返回值:智能体信息对象