node-easywechat 3.1.4 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-2.yml +21 -0
- package/.github/workflows/build-3.yml +21 -0
- package/.github/workflows/publish-npm-2.yml +24 -0
- package/.github/workflows/publish-npm-3.yml +24 -0
- package/CHANGELOG.md +15 -0
- package/README.md +23 -2
- package/dist/MiniApp/Application.d.ts +4 -4
- package/dist/OfficialAccount/Application.d.ts +4 -4
- package/dist/OpenPlatform/Application.d.ts +5 -5
- package/dist/OpenPlatform/Application.js +1 -1
- package/dist/OpenWork/Account.d.ts +17 -0
- package/dist/OpenWork/Account.js +30 -0
- package/dist/OpenWork/Application.d.ts +120 -0
- package/dist/OpenWork/Application.js +294 -0
- package/dist/OpenWork/Authorization.d.ts +12 -0
- package/dist/OpenWork/Authorization.js +49 -0
- package/dist/OpenWork/AuthorizerAccessToken.d.ts +38 -0
- package/dist/OpenWork/AuthorizerAccessToken.js +105 -0
- package/dist/OpenWork/Config.d.ts +5 -0
- package/dist/OpenWork/Config.js +19 -0
- package/dist/OpenWork/Contracts/AccountInterface.d.ts +33 -0
- package/dist/OpenWork/Contracts/AccountInterface.js +35 -0
- package/dist/OpenWork/Contracts/ApplicationInterface.d.ts +108 -0
- package/dist/OpenWork/Contracts/ApplicationInterface.js +96 -0
- package/dist/OpenWork/Contracts/SuiteTicketInterface.d.ts +23 -0
- package/dist/OpenWork/Contracts/SuiteTicketInterface.js +25 -0
- package/dist/OpenWork/Encryptor.d.ts +9 -0
- package/dist/OpenWork/Encryptor.js +17 -0
- package/dist/OpenWork/JsApiTicket.d.ts +50 -0
- package/dist/OpenWork/JsApiTicket.js +152 -0
- package/dist/OpenWork/Message.d.ts +78 -0
- package/dist/OpenWork/Message.js +9 -0
- package/dist/OpenWork/ProviderAccessToken.d.ts +26 -0
- package/dist/OpenWork/ProviderAccessToken.js +84 -0
- package/dist/OpenWork/Server.d.ts +103 -0
- package/dist/OpenWork/Server.js +242 -0
- package/dist/OpenWork/SuiteAccessToken.d.ts +28 -0
- package/dist/OpenWork/SuiteAccessToken.js +86 -0
- package/dist/OpenWork/SuiteEncryptor.d.ts +9 -0
- package/dist/OpenWork/SuiteEncryptor.js +17 -0
- package/dist/OpenWork/SuiteTicket.d.ts +13 -0
- package/dist/OpenWork/SuiteTicket.js +49 -0
- package/dist/Pay/Application.d.ts +4 -4
- package/dist/Types/global.d.ts +19 -1
- package/dist/Work/AccessToken.d.ts +26 -0
- package/dist/Work/AccessToken.js +84 -0
- package/dist/Work/Account.d.ts +13 -0
- package/dist/Work/Account.js +25 -0
- package/dist/Work/Application.d.ts +75 -0
- package/dist/Work/Application.js +177 -0
- package/dist/Work/Config.d.ts +5 -0
- package/dist/Work/Config.js +17 -0
- package/dist/Work/Contracts/AccountInterface.d.ts +23 -0
- package/dist/Work/Contracts/AccountInterface.js +25 -0
- package/dist/Work/Contracts/ApplicationInterface.d.ts +87 -0
- package/dist/Work/Contracts/ApplicationInterface.js +76 -0
- package/dist/Work/Encryptor.d.ts +9 -0
- package/dist/Work/Encryptor.js +17 -0
- package/dist/Work/JsApiTicket.d.ts +45 -0
- package/dist/Work/JsApiTicket.js +141 -0
- package/dist/Work/Message.d.ts +142 -0
- package/dist/Work/Message.js +9 -0
- package/dist/Work/Server.d.ts +90 -0
- package/dist/Work/Server.js +212 -0
- package/dist/Work/Utils.d.ts +25 -0
- package/dist/Work/Utils.js +56 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -1
- package/package.json +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 2.x 所有提交自动构建并测试
|
|
2
|
+
|
|
3
|
+
name: Build 2.x
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- '2.x'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
- run: npm install
|
|
19
|
+
- run: npm run build
|
|
20
|
+
- run: npm test
|
|
21
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 3.x 所有提交自动构建并测试
|
|
2
|
+
|
|
3
|
+
name: Build 3.x
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- '3.x'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
- run: npm install
|
|
19
|
+
- run: npm run build
|
|
20
|
+
- run: npm test
|
|
21
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 构建、测试并发布2.x分支
|
|
2
|
+
|
|
3
|
+
name: Publish 2.x to npm
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- v2.*
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish-npm:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
registry-url: https://registry.npmjs.org/
|
|
19
|
+
- run: npm install
|
|
20
|
+
- run: npm run build
|
|
21
|
+
- run: npm test
|
|
22
|
+
- run: npm publish --tag latest
|
|
23
|
+
env:
|
|
24
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 构建、测试并发布3.x分支
|
|
2
|
+
|
|
3
|
+
name: Publish 3.x to npm
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- v3.*
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish-npm:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
registry-url: https://registry.npmjs.org/
|
|
19
|
+
- run: npm install
|
|
20
|
+
- run: npm run build
|
|
21
|
+
- run: npm test
|
|
22
|
+
- run: npm publish --tag next
|
|
23
|
+
env:
|
|
24
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## v3.3.0 (2023-03-22)
|
|
5
|
+
|
|
6
|
+
- Feat: 新增企业微信开放平台模块
|
|
7
|
+
|
|
8
|
+
- Fix: 完善企业微信开放平台的配置项
|
|
9
|
+
- Fix: 将企业微信开放平台添加到全局入口
|
|
10
|
+
- Fix: 调整配置项提示
|
|
11
|
+
- Fix: 修复各模块服务端添加的处理方法无法正确提示的问题
|
|
12
|
+
|
|
13
|
+
## v3.2.0 (2023-03-10)
|
|
14
|
+
|
|
15
|
+
- Feat: 新增企业微信模块
|
|
16
|
+
|
|
17
|
+
## v3.1.4 (2023-02-02)
|
|
18
|
+
|
|
4
19
|
## v3.1.3 (2023-02-01)
|
|
5
20
|
|
|
6
21
|
- Fix: 修复默认的文件缓存配置项不生效问题 (#35)
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
## EasyWechat for Node.js
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
 [](https://www.npmjs.com/package/node-easywechat) [](LICENSE)
|
|
5
5
|
|
|
6
6
|
**注:3.x分支针对 EasyWechat 的 6.x版本。**
|
|
7
7
|
|
|
@@ -53,6 +53,13 @@ let app = new OpenPlatform({
|
|
|
53
53
|
// 配置项
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
// 企业微信
|
|
57
|
+
const { Work } = require('node-easywechat');
|
|
58
|
+
// 实例化应用
|
|
59
|
+
let app = new Work({
|
|
60
|
+
// 配置项
|
|
61
|
+
});
|
|
62
|
+
|
|
56
63
|
// ----- 以下为通用的 api 调用方法 -----
|
|
57
64
|
|
|
58
65
|
// 获取 api 调用客户端
|
|
@@ -165,6 +172,20 @@ let data = response.toObject();
|
|
|
165
172
|
}
|
|
166
173
|
```
|
|
167
174
|
|
|
175
|
+
``` js
|
|
176
|
+
// 企业微信配置
|
|
177
|
+
{
|
|
178
|
+
// 企业微信的 corp id
|
|
179
|
+
corp_id: '',
|
|
180
|
+
// 企业微信的 secret
|
|
181
|
+
secret: '',
|
|
182
|
+
// 企业微信的 token
|
|
183
|
+
token: '',
|
|
184
|
+
// EncodingAESKey
|
|
185
|
+
aes_key: '',
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
168
189
|
### 自定义模块(模块替换)使用方法
|
|
169
190
|
|
|
170
191
|
#### 日志模块
|
|
@@ -279,6 +300,6 @@ app.setRequest(request);
|
|
|
279
300
|
- [x] 微信支付
|
|
280
301
|
- [x] 小程序
|
|
281
302
|
- [x] 开放平台
|
|
282
|
-
- [
|
|
303
|
+
- [x] 企业微信
|
|
283
304
|
- [ ] 企业微信开放平台
|
|
284
305
|
- [ ] 自定义
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ConfigInterface from '../Core/Contracts/ConfigInterface';
|
|
2
|
-
import ServerInterface from '../Core/Contracts/ServerInterface';
|
|
3
2
|
import Encryptor from '../Core/Encryptor';
|
|
4
3
|
import AccessTokenAwareClient from '../Core/HttpClient/AccessTokenAwareClient';
|
|
5
4
|
import CacheMixin from '../Core/Mixins/CacheMixin';
|
|
@@ -10,6 +9,7 @@ import ServerRequestMixin from '../Core/Mixins/ServerRequestMixin';
|
|
|
10
9
|
import { MiniAppConfig } from '../Types/global';
|
|
11
10
|
import AccountInterface from './Contracts/AccountInterface';
|
|
12
11
|
import ApplicationInterface from './Contracts/ApplicationInterface';
|
|
12
|
+
import Server from './Server';
|
|
13
13
|
import Utils from './Utils';
|
|
14
14
|
import AccessTokenInterface from '../Core/Contracts/AccessTokenInterface';
|
|
15
15
|
/**
|
|
@@ -19,7 +19,7 @@ declare class Application implements ApplicationInterface {
|
|
|
19
19
|
constructor(config: ConfigInterface | MiniAppConfig);
|
|
20
20
|
protected account: AccountInterface;
|
|
21
21
|
protected encryptor: Encryptor;
|
|
22
|
-
protected server:
|
|
22
|
+
protected server: Server;
|
|
23
23
|
protected accessToken: AccessTokenInterface;
|
|
24
24
|
getAccount(): AccountInterface;
|
|
25
25
|
/**
|
|
@@ -35,13 +35,13 @@ declare class Application implements ApplicationInterface {
|
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
37
37
|
setEncryptor(encryptor: Encryptor): this;
|
|
38
|
-
getServer():
|
|
38
|
+
getServer(): Server;
|
|
39
39
|
/**
|
|
40
40
|
* 设置服务端实例
|
|
41
41
|
* @param server
|
|
42
42
|
* @returns
|
|
43
43
|
*/
|
|
44
|
-
setServer(server:
|
|
44
|
+
setServer(server: Server): this;
|
|
45
45
|
getAccessToken(): AccessTokenInterface;
|
|
46
46
|
/**
|
|
47
47
|
* 设置AccessToken实例
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ProviderInterface from 'node-socialite/dist/Core/ProviderInterface';
|
|
2
2
|
import ConfigInterface from '../Core/Contracts/ConfigInterface';
|
|
3
|
-
import ServerInterface from '../Core/Contracts/ServerInterface';
|
|
4
3
|
import Encryptor from '../Core/Encryptor';
|
|
5
4
|
import AccessTokenAwareClient from '../Core/HttpClient/AccessTokenAwareClient';
|
|
6
5
|
import CacheMixin from '../Core/Mixins/CacheMixin';
|
|
@@ -12,6 +11,7 @@ import { OfficialAccountConfig, OfficialAccountOAuthFactory } from '../Types/glo
|
|
|
12
11
|
import AccountInterface from './Contracts/AccountInterface';
|
|
13
12
|
import ApplicationInterface from './Contracts/ApplicationInterface';
|
|
14
13
|
import JsApiTicket from './JsApiTicket';
|
|
14
|
+
import Server from './Server';
|
|
15
15
|
import Utils from './Utils';
|
|
16
16
|
import AccessTokenInterface from '../Core/Contracts/AccessTokenInterface';
|
|
17
17
|
/**
|
|
@@ -21,7 +21,7 @@ declare class Application implements ApplicationInterface {
|
|
|
21
21
|
constructor(config: ConfigInterface | OfficialAccountConfig);
|
|
22
22
|
protected account: AccountInterface;
|
|
23
23
|
protected encryptor: Encryptor;
|
|
24
|
-
protected server:
|
|
24
|
+
protected server: Server;
|
|
25
25
|
protected accessToken: AccessTokenInterface;
|
|
26
26
|
protected oauthFactory: OfficialAccountOAuthFactory;
|
|
27
27
|
protected ticket: JsApiTicket;
|
|
@@ -39,13 +39,13 @@ declare class Application implements ApplicationInterface {
|
|
|
39
39
|
* @returns
|
|
40
40
|
*/
|
|
41
41
|
setEncryptor(encryptor: Encryptor): this;
|
|
42
|
-
getServer():
|
|
42
|
+
getServer(): Server;
|
|
43
43
|
/**
|
|
44
44
|
* 设置服务端实例
|
|
45
45
|
* @param server
|
|
46
46
|
* @returns
|
|
47
47
|
*/
|
|
48
|
-
setServer(server:
|
|
48
|
+
setServer(server: Server): this;
|
|
49
49
|
getAccessToken(): AccessTokenInterface;
|
|
50
50
|
/**
|
|
51
51
|
* 设置AccessToken实例
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ProviderInterface from 'node-socialite/dist/Core/ProviderInterface';
|
|
2
2
|
import ConfigInterface from '../Core/Contracts/ConfigInterface';
|
|
3
|
-
import ServerInterface from '../Core/Contracts/ServerInterface';
|
|
4
3
|
import Encryptor from '../Core/Encryptor';
|
|
5
4
|
import AccessTokenAwareClient from '../Core/HttpClient/AccessTokenAwareClient';
|
|
6
5
|
import CacheMixin from '../Core/Mixins/CacheMixin';
|
|
@@ -13,18 +12,19 @@ import MiniAppApplication from '../MiniApp/Application';
|
|
|
13
12
|
import { OfficialAccountConfig, OfficialAccountOAuthFactory, MiniAppConfig } from '../Types/global';
|
|
14
13
|
import AccountInterface from './Contracts/AccountInterface';
|
|
15
14
|
import ApplicationInterface from './Contracts/ApplicationInterface';
|
|
15
|
+
import Server from './Server';
|
|
16
16
|
import AccessTokenInterface from '../Core/Contracts/AccessTokenInterface';
|
|
17
17
|
import VerifyTicketInterface from './Contracts/VerifyTicketInterface';
|
|
18
18
|
import Authorization from './Authorization';
|
|
19
19
|
import AuthorizerAccessToken from './AuthorizerAccessToken';
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 开放平台应用
|
|
22
22
|
*/
|
|
23
23
|
declare class Application implements ApplicationInterface {
|
|
24
24
|
constructor(config: ConfigInterface | OfficialAccountConfig);
|
|
25
25
|
protected account: AccountInterface;
|
|
26
26
|
protected encryptor: Encryptor;
|
|
27
|
-
protected server:
|
|
27
|
+
protected server: Server;
|
|
28
28
|
protected componentAccessToken: AccessTokenInterface;
|
|
29
29
|
protected verifyTicket: VerifyTicketInterface;
|
|
30
30
|
getAccount(): AccountInterface;
|
|
@@ -43,13 +43,13 @@ declare class Application implements ApplicationInterface {
|
|
|
43
43
|
* @returns
|
|
44
44
|
*/
|
|
45
45
|
setEncryptor(encryptor: Encryptor): this;
|
|
46
|
-
getServer():
|
|
46
|
+
getServer(): Server;
|
|
47
47
|
/**
|
|
48
48
|
* 设置服务端实例
|
|
49
49
|
* @param server
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
|
-
setServer(server:
|
|
52
|
+
setServer(server: Server): this;
|
|
53
53
|
getAccessToken(): AccessTokenInterface;
|
|
54
54
|
getComponentAccessToken(): AccessTokenInterface;
|
|
55
55
|
/**
|
|
@@ -33,7 +33,7 @@ const ComponentAccessToken_1 = __importDefault(require("./ComponentAccessToken")
|
|
|
33
33
|
const Authorization_1 = __importDefault(require("./Authorization"));
|
|
34
34
|
const AuthorizerAccessToken_1 = __importDefault(require("./AuthorizerAccessToken"));
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* 开放平台应用
|
|
37
37
|
*/
|
|
38
38
|
class Application {
|
|
39
39
|
constructor(config) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import AccountInterface from "./Contracts/AccountInterface";
|
|
2
|
+
declare class Account implements AccountInterface {
|
|
3
|
+
protected corpId: string;
|
|
4
|
+
protected providerSecret: string;
|
|
5
|
+
protected suiteId: string;
|
|
6
|
+
protected suiteSecret: string;
|
|
7
|
+
protected token: string;
|
|
8
|
+
protected aesKey: string;
|
|
9
|
+
constructor(corpId: string, providerSecret: string, suiteId: string, suiteSecret: string, token?: string, aesKey?: string);
|
|
10
|
+
getCorpId(): string;
|
|
11
|
+
getProviderSecret(): string;
|
|
12
|
+
getSuiteId(): string;
|
|
13
|
+
getSuiteSecret(): string;
|
|
14
|
+
getToken(): string;
|
|
15
|
+
getAesKey(): string;
|
|
16
|
+
}
|
|
17
|
+
export = Account;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
class Account {
|
|
3
|
+
constructor(corpId, providerSecret, suiteId, suiteSecret, token = null, aesKey = null) {
|
|
4
|
+
this.corpId = corpId;
|
|
5
|
+
this.providerSecret = providerSecret;
|
|
6
|
+
this.suiteId = suiteId;
|
|
7
|
+
this.suiteSecret = suiteSecret;
|
|
8
|
+
this.token = token;
|
|
9
|
+
this.aesKey = aesKey;
|
|
10
|
+
}
|
|
11
|
+
getCorpId() {
|
|
12
|
+
return this.corpId;
|
|
13
|
+
}
|
|
14
|
+
getProviderSecret() {
|
|
15
|
+
return this.providerSecret;
|
|
16
|
+
}
|
|
17
|
+
getSuiteId() {
|
|
18
|
+
return this.suiteId;
|
|
19
|
+
}
|
|
20
|
+
getSuiteSecret() {
|
|
21
|
+
return this.suiteSecret;
|
|
22
|
+
}
|
|
23
|
+
getToken() {
|
|
24
|
+
return this.token;
|
|
25
|
+
}
|
|
26
|
+
getAesKey() {
|
|
27
|
+
return this.aesKey;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
module.exports = Account;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import ProviderInterface from 'node-socialite/dist/Core/ProviderInterface';
|
|
2
|
+
import ConfigInterface from '../Core/Contracts/ConfigInterface';
|
|
3
|
+
import Encryptor from './Encryptor';
|
|
4
|
+
import AccessTokenAwareClient from '../Core/HttpClient/AccessTokenAwareClient';
|
|
5
|
+
import CacheMixin from '../Core/Mixins/CacheMixin';
|
|
6
|
+
import ClientMixin from '../Core/Mixins/ClientMixin';
|
|
7
|
+
import ConfigMixin from '../Core/Mixins/ConfigMixin';
|
|
8
|
+
import HttpClientMixin from '../Core/Mixins/HttpClientMixin';
|
|
9
|
+
import ServerRequestMixin from '../Core/Mixins/ServerRequestMixin';
|
|
10
|
+
import { OpenWorkConfig } from '../Types/global';
|
|
11
|
+
import AccountInterface from './Contracts/AccountInterface';
|
|
12
|
+
import ApplicationInterface from './Contracts/ApplicationInterface';
|
|
13
|
+
import Server from './Server';
|
|
14
|
+
import SuiteTicketInterface from './Contracts/SuiteTicketInterface';
|
|
15
|
+
import SuiteEncryptor from './SuiteEncryptor';
|
|
16
|
+
import SuiteAccessToken from './SuiteAccessToken';
|
|
17
|
+
import Authorization from './Authorization';
|
|
18
|
+
import AuthorizerAccessToken from './AuthorizerAccessToken';
|
|
19
|
+
import ProviderAccessToken from './ProviderAccessToken';
|
|
20
|
+
import JsApiTicket from './JsApiTicket';
|
|
21
|
+
/**
|
|
22
|
+
* 企业微信开放平台应用
|
|
23
|
+
*/
|
|
24
|
+
declare class Application implements ApplicationInterface {
|
|
25
|
+
constructor(config: ConfigInterface | OpenWorkConfig);
|
|
26
|
+
protected account: AccountInterface;
|
|
27
|
+
protected encryptor: Encryptor;
|
|
28
|
+
protected server: Server;
|
|
29
|
+
protected accessToken: ProviderAccessToken;
|
|
30
|
+
protected suiteEncryptor: SuiteEncryptor;
|
|
31
|
+
protected suiteAccessToken: SuiteAccessToken;
|
|
32
|
+
protected suiteTicket: SuiteTicketInterface;
|
|
33
|
+
protected authorizerAccessToken: AuthorizerAccessToken;
|
|
34
|
+
getAccount(): AccountInterface;
|
|
35
|
+
/**
|
|
36
|
+
* 设置当前账户实例
|
|
37
|
+
* @param account
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
setAccount(account: AccountInterface): this;
|
|
41
|
+
getEncryptor(): Encryptor;
|
|
42
|
+
/**
|
|
43
|
+
* 设置加密机实例
|
|
44
|
+
* @param encryptor
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
setEncryptor(encryptor: Encryptor): this;
|
|
48
|
+
getSuiteEncryptor(): SuiteEncryptor;
|
|
49
|
+
/**
|
|
50
|
+
* 设置授权应用的加密机实例
|
|
51
|
+
* @param suiteEncryptor
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
setSuiteEncryptor(suiteEncryptor: SuiteEncryptor): this;
|
|
55
|
+
getServer(): Server;
|
|
56
|
+
/**
|
|
57
|
+
* 设置服务端实例
|
|
58
|
+
* @param server
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
setServer(server: Server): this;
|
|
62
|
+
getProviderAccessToken(): ProviderAccessToken;
|
|
63
|
+
/**
|
|
64
|
+
* 设置开放平台应用的AccessToken实例
|
|
65
|
+
* @param accessToken
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
setProviderAccessToken(accessToken: ProviderAccessToken): this;
|
|
69
|
+
getSuiteAccessToken(): SuiteAccessToken;
|
|
70
|
+
/**
|
|
71
|
+
* 设置授权应用的AccessToken实例
|
|
72
|
+
* @param suiteAccessToken
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
setSuiteAccessToken(suiteAccessToken: SuiteAccessToken): this;
|
|
76
|
+
getSuiteTicket(): SuiteTicketInterface;
|
|
77
|
+
/**
|
|
78
|
+
* 设置授权应用的Ticket实例
|
|
79
|
+
* @param suiteTicket
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
setSuiteTicket(suiteTicket: SuiteTicketInterface): this;
|
|
83
|
+
/**
|
|
84
|
+
* 获取企业授权信息
|
|
85
|
+
* @see https://developer.work.weixin.qq.com/document/10975#获取企业授权信息
|
|
86
|
+
* @param corpId 授权方corpid
|
|
87
|
+
* @param permanentCode 永久授权码,通过get_permanent_code获取
|
|
88
|
+
* @param suiteAccessToken
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
getAuthorization(corpId: string, permanentCode: string, suiteAccessToken?: SuiteAccessToken): Promise<Authorization>;
|
|
92
|
+
/**
|
|
93
|
+
* 获取预授权码
|
|
94
|
+
* @see https://developer.work.weixin.qq.com/document/10975#获取预授权码
|
|
95
|
+
* @param suiteAccessToken
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
createPreAuthorizationCode(suiteAccessToken?: SuiteAccessToken): Promise<import("../Types/global").WeixinResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* 获取企业授权令牌
|
|
101
|
+
* @param corpId
|
|
102
|
+
* @param permanentCode
|
|
103
|
+
* @param suiteAccessToken
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
getAuthorizerAccessToken(corpId: string, permanentCode: string, suiteAccessToken?: SuiteAccessToken): Promise<AuthorizerAccessToken>;
|
|
107
|
+
createClient(): AccessTokenAwareClient;
|
|
108
|
+
getAuthorizerClient(corpId: string, permanentCode: string, suiteAccessToken?: SuiteAccessToken): Promise<AccessTokenAwareClient>;
|
|
109
|
+
getJsApiTicket(corpId: string, permanentCode: string, suiteAccessToken?: SuiteAccessToken): Promise<JsApiTicket>;
|
|
110
|
+
getOAuth(suiteId: string, suiteAccessToken?: SuiteAccessToken): Promise<ProviderInterface>;
|
|
111
|
+
getCorpOAuth(corpId: string, suiteAccessToken?: SuiteAccessToken): Promise<ProviderInterface>;
|
|
112
|
+
/**
|
|
113
|
+
* 获取请求默认配置
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
protected getHttpClientDefaultOptions(): Record<string, any>;
|
|
117
|
+
}
|
|
118
|
+
interface Application extends ConfigMixin, CacheMixin, ClientMixin, ServerRequestMixin, HttpClientMixin {
|
|
119
|
+
}
|
|
120
|
+
export = Application;
|