@wecom/cloudbase-framework-plugin-node-sdk
Advanced tools
Comparing version 0.3.0-alpha.12 to 0.3.0-alpha.13
import { Wecom, WecomOptions } from './Wecom'; | ||
export * from '@wecom/cloudbase-framework-plugin-actions/lib/types/collection'; | ||
export * from '@wecom/cloudbase-framework-plugin-actions/lib/types/session'; | ||
export declare function init(options: WecomOptions): Wecom; | ||
@@ -5,0 +4,0 @@ declare const _default: { |
@@ -16,3 +16,2 @@ "use strict"; | ||
__exportStar(require("@wecom/cloudbase-framework-plugin-actions/lib/types/collection"), exports); | ||
__exportStar(require("@wecom/cloudbase-framework-plugin-actions/lib/types/session"), exports); | ||
function init(options) { | ||
@@ -19,0 +18,0 @@ return new Wecom_1.Wecom(options); |
{ | ||
"name": "@wecom/cloudbase-framework-plugin-node-sdk", | ||
"version": "0.3.0-alpha.12", | ||
"version": "0.3.0-alpha.13", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"author": "Tencent Wecom Team", | ||
"license": "Apache-2.0", | ||
@@ -14,6 +15,15 @@ "files": [ | ||
}, | ||
"homepage": "https://github.com/TencentWecom/wecom-cloudbase-framework-plugin/tree/master/packages/cloudbase-framework-plugin-node-sdk", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/TencentWecom/wecom-cloudbase-framework-plugin.git", | ||
"directory": "packages/cloudbase-framework-plugin-node-sdk" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/TencentWecom/wecom-cloudbase-framework-plugin/issues" | ||
}, | ||
"dependencies": { | ||
"@cloudbase/node-sdk": "^2.3.5", | ||
"@wecom/cloudbase-framework-plugin-actions": "0.3.0-alpha.12", | ||
"@wecom/cloudbase-framework-plugin-util": "0.3.0-alpha.12" | ||
"@wecom/cloudbase-framework-plugin-actions": "0.3.0-alpha.13", | ||
"@wecom/cloudbase-framework-plugin-util": "0.3.0-alpha.13" | ||
}, | ||
@@ -20,0 +30,0 @@ "devDependencies": { |
407
README.md
@@ -1,406 +0,1 @@ | ||
# Tencent CloudBase Framework Wecom Service Plugin Node SDK | ||
## 开始使用 | ||
```js | ||
import tcb from '@cloudbase/node-sdk' | ||
import wecom from '@wecom/cloudbase-framework-plugin-node-sdk' | ||
const app = wecom.init({ | ||
cloudbase: tcb.init({ | ||
env: tcb.SYMBOL_CURRENT_ENV, | ||
}), | ||
}) | ||
const token = await app.getSuiteAccessToken({ suiteId }) | ||
console.log(token) | ||
``` | ||
## API | ||
### `getProviderAccessToken` | ||
获取服务商凭证 | ||
```js | ||
app.getProviderAccessToken() | ||
``` | ||
__返回说明__ | ||
`string`,服务商凭证 | ||
### `getSuiteTicket` | ||
获取第三方应用票据 | ||
```js | ||
app.getSuiteTicket({ suiteId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
__返回说明__ | ||
`string`,第三方应用票据 | ||
### `getSuiteSecret` | ||
获取第三方应用 secret | ||
```js | ||
app.getSuiteSecret({ suiteId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
__返回说明__ | ||
`string`,第三方应用 secret | ||
### `getSuiteAccessToken` | ||
获取第三方应用凭证 | ||
```js | ||
app.getSuiteAccessToken({ suiteId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
__返回说明__ | ||
`string`,第三方应用凭证 | ||
### `getAuthInfo` | ||
获取应用授权信息 | ||
```js | ||
app.getAuthInfo({ suiteId, corpId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
| corpId | string | 是 | 授权方企业 ID | | ||
__返回说明__ | ||
`Object`,应用授权信息 | ||
| 参数 | 类型 | 说明 | | ||
| --- | --- | --- | | ||
| permanentCode | string | 永久授权码 | | ||
| agentId | number | 授权方应用 ID | | ||
### `getCorpAccessToken` | ||
获取企业凭证 | ||
```js | ||
app.getCorpAccessToken({ suiteId, corpId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
| corpId | string | 是 | 授权方企业 ID | | ||
__返回说明__ | ||
`string`,授权方企业凭证 | ||
### `getCorpJSAPITicket` | ||
获取企业 jsapi_ticket | ||
```js | ||
app.getCorpJSAPITicket({ suiteId, corpId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
| corpId | string | 是 | 授权方企业 ID | | ||
__返回说明__ | ||
`string`,企业 jsapi_ticket | ||
### `getCorpJSAPISignature` | ||
获取企业 jsapi 签名 | ||
```js | ||
app.getCorpJSAPISignature({ suiteId, corpId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
| corpId | string | 是 | 授权方企业 ID | | ||
__返回说明__ | ||
`string`,企业 jsapi 签名 | ||
### `getAgentJSAPITicket` | ||
获取应用 jsapi_ticket | ||
```js | ||
app.getAgentJSAPITicket({ suiteId, corpId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
| corpId | string | 是 | 授权方企业 ID | | ||
__返回说明__ | ||
`string`,应用 jsapi_ticket | ||
### `getAgentJSAPISignature` | ||
获取应用 jsapi 签名 | ||
```js | ||
app.getAgentJSAPISignature({ suiteId, corpId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
| corpId | string | 是 | 授权方企业 ID | | ||
__返回说明__ | ||
`string`,应用 jsapi 签名 | ||
### `createSession` | ||
消费 OAuth code 并记录成员和登录态,见 [获取访问用户身份](https://open.work.weixin.qq.com/api/doc/90001/90143/91121) | ||
```js | ||
app.createSession({ suiteId, code }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| suiteId | string | 是 | 第三方应用 ID | | ||
| code | string | 是 | OAuth code | | ||
__返回说明__ | ||
`Object`,新增登录态信息 | ||
| 参数 | 类型 | 说明 | | ||
| --- | --- | --- | | ||
| sid | string | Session ID | | ||
| userInfo | Object | 用户信息,见 [WWUserInfo](#wwuserinfo) | | ||
| response | Object | Open API 响应数据,见 [获取访问用户身份](https://open.work.weixin.qq.com/api/doc/90001/90143/91121) | | ||
| createTime | number | 创建时间戳 | | ||
| accessTime | number | 最后访问时间戳 | | ||
### `createQRCodeSession` | ||
消费扫码登录 OAuth code 并记录成员和登录态,见 [获取登录用户信息](https://open.work.weixin.qq.com/api/doc/90001/90143/91125) | ||
```js | ||
app.createQRCodeSession({ code }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| code | string | 是 | OAuth code | | ||
__返回说明__ | ||
`Object`,新增登录态信息 | ||
| 参数 | 类型 | 说明 | | ||
| --- | --- | --- | | ||
| sid | string | Session ID | | ||
| userInfo | Object | 用户信息,见 [WWUserInfo](#wwuserinfo) | | ||
| response | Object | Open API 响应数据,见 [获取登录用户信息](https://open.work.weixin.qq.com/api/doc/90001/90143/91125) | | ||
| createTime | string | 创建时间戳 | | ||
| accessTime | string | 最后访问时间戳 | | ||
### `addSession` | ||
消费扫码登录 OAuth code 并记录成员和登录态,见 [获取登录用户信息](https://open.work.weixin.qq.com/api/doc/90001/90143/91125) | ||
```js | ||
app.addSession({ openUserId, corpId, userId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| openUserId | string | 是 | 对服务商全局唯一的用户 ID | | ||
| corpId | string | 是 | 用户所属企业 ID | | ||
| userId | string | 是 | 企业内的用户 ID | | ||
__返回说明__ | ||
`Object`,新增登录态信息 | ||
| 参数 | 类型 | 说明 | | ||
| --- | --- | --- | | ||
| sid | string | Session ID | | ||
| timestamp | number | 创建时间戳 | | ||
### `getSession` | ||
获取登录态 | ||
```js | ||
app.getSession({ sid }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| sid | string | 是 | [createSession](#createsession) 返回的 sid | | ||
__返回说明__ | ||
`Object`,登录态信息 | ||
| 参数 | 类型 | 说明 | | ||
| --- | --- | --- | | ||
| sid | string | Session ID | | ||
| userInfo | Object | 用户信息,见 [WWUserInfo](#wwuserinfo) | | ||
| createTime | string | 创建时间戳 | | ||
| updateTime | string | 最后访问时间戳 | | ||
### `deleteSession` | ||
删除登录态 | ||
```js | ||
app.deleteSession({ sid }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| sid | string | 是 | [createSession](#createsession) 返回的 sid | | ||
#### `setUser` | ||
记录用户信息 | ||
```js | ||
app.setUser({ openUserId, corpId, userId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 说明 | | ||
| --- | --- | --- | | ||
| openUserId | string | 对服务商全局唯一的用户 ID | | ||
| corpId | string | 用户所属企业 ID | | ||
| userId | string | 企业内的用户 ID | | ||
### `getUser` | ||
获取用户信息 | ||
```js | ||
app.getUser({ openUserId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| openUserId | string | 是 | [createSession](#createsession) 返回的 openUserId | | ||
__返回说明__ | ||
`Object`,用户信息,见 [WWUserInfo](#wwuserinfo) | ||
### `deleteUser` | ||
删除用户信息 | ||
```js | ||
app.deleteUser({ openUserId }) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| openUserId | string | 是 | [createSession](#createsession) 返回的 openUserId | | ||
### `request` | ||
请求企业微信 Open API | ||
```js | ||
app.request({ | ||
name: 'service/getuserinfo3rd', | ||
query: { suite_access_token: suiteAccessToken, code: query.code } | ||
}) | ||
``` | ||
__参数说明__ | ||
| 参数 | 类型 | 必填 | 说明 | | ||
| --- | --- | --- | --- | | ||
| name | string | 是 | [createSession](#createsession) 返回的 openUserId | | ||
| query | Object | 否 | 请求 query 参数 | | ||
| body | Object | 否 | 请求 body 参数 | | ||
| method | string | 否 | 请求方法,默认 body 为空时为 GET,否则为 POST | | ||
__返回说明__ | ||
`Object`,Open API 返回数据。该接口会自动处理 errcode 逻辑,当 errcode 不为 0 时将自动抛出 Error | ||
## WWUserInfo | ||
```ts | ||
interface WWUserInfo { | ||
/** 对服务商全局唯一的用户 ID */ | ||
openUserId: string; | ||
/** 用户所属企业 ID */ | ||
corpId: string; | ||
/** 企业内的用户 ID */ | ||
userId: string; | ||
} | ||
``` | ||
# @wecom/cloudbase-framework-plugin-node-sdk |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
22573
9
1
0
332
2
1
+ Added@wecom/cloudbase-framework-plugin-actions@0.3.0-alpha.13(transitive)
+ Added@wecom/cloudbase-framework-plugin-util@0.3.0-alpha.13(transitive)
- Removed@wecom/cloudbase-framework-plugin-actions@0.3.0-alpha.12(transitive)
- Removed@wecom/cloudbase-framework-plugin-util@0.3.0-alpha.12(transitive)
Updated@wecom/cloudbase-framework-plugin-actions@0.3.0-alpha.13
Updated@wecom/cloudbase-framework-plugin-util@0.3.0-alpha.13