Skip to content

Commit

Permalink
chore: 完善文档 (#12)
Browse files Browse the repository at this point in the history
* chore: 完善说明文档

* chore: 完善类型引用及模块注释

* chore: 完善文档链接

* chore: 完善用法
  • Loading branch information
iugo authored Sep 6, 2024
1 parent a398f9a commit 94735b1
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# wechat-work-sdk
# wecom-sdk / wechat-work-sdk

[![JSR @zsqk/wecom-sdk](https://jsr.io/badges/@zsqk/wecom-sdk)](https://jsr.io/@zsqk/wecom-sdk)

服务于企业微信的, 类型安全的后端 SDK, 支持 Deno 和 Node.js (via jsr.io).

具体的功能列表见文档: <https://jsr.io/@zsqk/wecom-sdk/doc>

## test

测试时需要三个环境变量:

- QY_WECHAT_CORPID
- QY_WECHAT_QRLOGIN_AGENTID
- QY_WECHAT_QRLOGIN_SECRET

可选的环境变量:

- FIXEDIP_PROXY

## usage

支持 Deno 和 Node.js (via jsr.io).

仅支持以 ESM 模块方式引用.

具体用法在注释中, 详见: <https://jsr.io/@zsqk/wecom-sdk/doc>
19 changes: 18 additions & 1 deletion src/get-access-token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
import { QywechatRes } from "./basetypes.ts";
/**
* @module
*
* 这个模块包含获取企业微信的 access_token 的函数.
*
* 包含一个 API:
*
* 1. API: getAccessToken
*
* @example
* ```ts
* import { getAccessToken } from "@zsqk/wecom-sdk";
*
* const res = await getAccessToken(corpId, agentSecret);
* ```
*/

import type { QywechatRes } from "./basetypes.ts";

/**
* 获取企业微信的 access_token
Expand Down
21 changes: 20 additions & 1 deletion src/get-jsapi-ticket.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
import { QywechatRes } from "./basetypes.ts";
/**
* @module
*
* 这个模块包含获取企业微信的 jsapi_ticket 的函数.
*
* 包含两个 API 和一个离线工具:
*
* 1. API: getCorpJsapiTicket
* 2. API: getAgentJsapiTicket
* 3. 离线工具: genSignature
*
* @example
* ```ts
* import { getCorpJsapiTicket } from "@zsqk/wecom-sdk";
*
* const res = await getCorpJsapiTicket(accessToken, { proxy });
* ```
*/

import type { QywechatRes } from "./basetypes.ts";
import { hashString } from "@zsqk/somefn/js/hash";

/**
Expand Down

0 comments on commit 94735b1

Please sign in to comment.