node-easywechat 2.9.5 → 2.10.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/CHANGELOG.md +20 -0
- package/README.md +4 -4
- package/dist/BaseService/Application.js +0 -5
- package/dist/Core/BaseAccessToken.d.ts +3 -3
- package/dist/Core/BaseAccessToken.js +6 -3
- package/dist/Core/Types.d.ts +1 -1
- package/dist/MicroMerchant/Application.js +0 -6
- package/dist/MiniProgram/Application.js +0 -38
- package/dist/OfficialAccount/Application.js +0 -29
- package/dist/OpenPlatform/Application.d.ts +7 -7
- package/dist/OpenPlatform/Application.js +14 -21
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.d.ts +7 -1
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.js +14 -8
- package/dist/OpenPlatform/Authorizer/MiniProgram/Material/MaterialClient.d.ts +8 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Material/MaterialClient.js +45 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Privacy/PrivacyClient.d.ts +22 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Privacy/PrivacyClient.js +37 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Security/SecurityClient.d.ts +14 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Security/SecurityClient.js +24 -0
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.d.ts +1 -1
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.js +2 -4
- package/dist/OpenWork/Application.js +0 -9
- package/dist/OpenWork/Corp/CorpClient.d.ts +9 -0
- package/dist/OpenWork/Corp/CorpClient.js +15 -0
- package/dist/Payment/Application.js +0 -15
- package/dist/Work/Application.d.ts +4 -0
- package/dist/Work/Application.js +8 -35
- package/dist/Work/ExternalContact/Client.d.ts +1 -0
- package/dist/Work/ExternalContact/Client.js +1 -0
- package/dist/Work/ExternalContact/InterceptClient.d.ts +30 -0
- package/dist/Work/ExternalContact/InterceptClient.js +48 -0
- package/dist/Work/ExternalContact/ProductClient.d.ts +39 -0
- package/dist/Work/ExternalContact/ProductClient.js +62 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## v2.10.0 (2022-05-18)
|
|
5
|
+
|
|
6
|
+
- Feat: 开放平台代理小程序新增小程序用户隐私保护指引相关接口
|
|
7
|
+
- Feat: 开放平台代理小程序新增获取永久素材接口
|
|
8
|
+
- Feat: 企业微信新增商品图册相关接口
|
|
9
|
+
- Feat: 企业微信新增敏感词相关接口
|
|
10
|
+
- Feat: 新增新版企业微信开发平台根据unionid查询external_userid方法
|
|
11
|
+
|
|
12
|
+
- Fix: 企业微信注册敏感词管理、产品图册管理两个模块
|
|
13
|
+
|
|
14
|
+
## v2.9.7 (2022-05-16)
|
|
15
|
+
|
|
16
|
+
- Fix: 修复开放平台代理的小程序、公众号实例中没有开放平台专属API的问题 (#22)
|
|
17
|
+
|
|
18
|
+
## v2.9.6 (2022-05-16)
|
|
19
|
+
|
|
20
|
+
- Fix: 修复第三方平台获取代理的小程序、公众号实例后,无对应方法和token的 (#22)
|
|
21
|
+
|
|
22
|
+
- Docs: 更新企业微信支付证书说明
|
|
23
|
+
|
|
4
24
|
## v2.9.5 (2022-04-23)
|
|
5
25
|
|
|
6
26
|
- Fix: 修复企业微信获取注册定制化URL接口未自动获取到注册码的问题
|
package/README.md
CHANGED
|
@@ -107,8 +107,8 @@ let app = EasyWechat.Factory.getInstance('OficialAccount', {
|
|
|
107
107
|
key: 'key-for-signature',
|
|
108
108
|
// 默认回调地址,也可以在下单时单独设置来覆盖它,完整URL,不带参数
|
|
109
109
|
notify_url: 'http://xxx.com/pay/notify',
|
|
110
|
-
// 证书地址,Node.js 只需要 .
|
|
111
|
-
cert_path: 'path/to/your/
|
|
110
|
+
// 证书地址,Node.js 只需要 apiclient_cert.p12 证书文件即可
|
|
111
|
+
cert_path: 'path/to/your/apiclient_cert.p12', // XXX: 绝对路径!!!!
|
|
112
112
|
}
|
|
113
113
|
```
|
|
114
114
|
|
|
@@ -143,8 +143,8 @@ let app = EasyWechat.Factory.getInstance('OficialAccount', {
|
|
|
143
143
|
key: 'key-for-signature',
|
|
144
144
|
// V3版本签名密钥
|
|
145
145
|
apiv3_key: 'apiv3_key-for-signature',
|
|
146
|
-
// 证书地址,Node.js 只需要 .
|
|
147
|
-
cert_path: 'path/to/your/
|
|
146
|
+
// 证书地址,Node.js 只需要 apiclient_cert.p12 证书文件即可
|
|
147
|
+
cert_path: 'path/to/your/apiclient_cert.p12', // XXX: 绝对路径!!!!
|
|
148
148
|
|
|
149
149
|
// 以下两项配置在获取证书接口时可为空,在调用入驻接口前请先调用获取证书接口获取以下两项配置,如果获取过证书可以直接在这里配置,也可参照本文档获取平台证书章节中示例
|
|
150
150
|
// serial_no: '获取证书接口获取到的平台证书序列号',
|
|
@@ -16,11 +16,6 @@ class BaseService extends BaseApplication_1.default {
|
|
|
16
16
|
app_id: '',
|
|
17
17
|
secret: '',
|
|
18
18
|
};
|
|
19
|
-
this.jssdk = null;
|
|
20
|
-
this.media = null;
|
|
21
|
-
this.qrcode = null;
|
|
22
|
-
this.url = null;
|
|
23
|
-
this.content_security = null;
|
|
24
19
|
this.registerProviders();
|
|
25
20
|
}
|
|
26
21
|
registerProviders() {
|
|
@@ -63,7 +63,7 @@ declare abstract class BaseAccessToken implements HttpMixin {
|
|
|
63
63
|
protected getCredentials(): Promise<object>;
|
|
64
64
|
getEndpoint(): Promise<string>;
|
|
65
65
|
getCacheKey(): Promise<string>;
|
|
66
|
-
requestToken(credentials: object): Promise<any
|
|
66
|
+
requestToken(credentials: object): Promise<Record<string, any>>;
|
|
67
67
|
/**
|
|
68
68
|
* 获取Token
|
|
69
69
|
* @param refresh 为true时表示强制刷新
|
|
@@ -77,10 +77,10 @@ declare abstract class BaseAccessToken implements HttpMixin {
|
|
|
77
77
|
protected warpAccessToken(token: Record<string, any>): AccessToken;
|
|
78
78
|
/**
|
|
79
79
|
* 设置Token
|
|
80
|
-
* @param access_token
|
|
80
|
+
* @param access_token Record<string, any>
|
|
81
81
|
* @param expires_in 有效时间,单位:秒
|
|
82
82
|
*/
|
|
83
|
-
setToken(
|
|
83
|
+
setToken(token: Record<string, any>, expires_in?: number): Promise<this>;
|
|
84
84
|
/**
|
|
85
85
|
* 刷新Token
|
|
86
86
|
*/
|
|
@@ -151,6 +151,9 @@ class BaseAccessToken {
|
|
|
151
151
|
return this.warpAccessToken(token);
|
|
152
152
|
}
|
|
153
153
|
let res = yield this.requestToken(yield this.getCredentials());
|
|
154
|
+
if (res.errcode) {
|
|
155
|
+
throw new Error(res.errmsg);
|
|
156
|
+
}
|
|
154
157
|
yield this.setToken(res, res.expires_in || 7200);
|
|
155
158
|
return this.warpAccessToken(res);
|
|
156
159
|
});
|
|
@@ -165,14 +168,14 @@ class BaseAccessToken {
|
|
|
165
168
|
}
|
|
166
169
|
/**
|
|
167
170
|
* 设置Token
|
|
168
|
-
* @param access_token
|
|
171
|
+
* @param access_token Record<string, any>
|
|
169
172
|
* @param expires_in 有效时间,单位:秒
|
|
170
173
|
*/
|
|
171
|
-
setToken(
|
|
174
|
+
setToken(token, expires_in = 7200) {
|
|
172
175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
173
176
|
let cacheKey = yield this.getCacheKey();
|
|
174
177
|
let cache = this.app.getCache();
|
|
175
|
-
yield cache.set(cacheKey,
|
|
178
|
+
yield cache.set(cacheKey, token, expires_in);
|
|
176
179
|
if (!cache.has(cacheKey)) {
|
|
177
180
|
throw new Error('Failed to cache access token.');
|
|
178
181
|
}
|
package/dist/Core/Types.d.ts
CHANGED
|
@@ -23,12 +23,6 @@ class MicroMerchant extends BaseApplication_1.default {
|
|
|
23
23
|
baseURL: 'https://api.mch.weixin.qq.com/',
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
this.base = null;
|
|
27
|
-
this.certficates = null;
|
|
28
|
-
this.media = null;
|
|
29
|
-
this.merchantConfig = null;
|
|
30
|
-
this.material = null;
|
|
31
|
-
this.withdraw = null;
|
|
32
26
|
this.registerProviders();
|
|
33
27
|
}
|
|
34
28
|
registerProviders() {
|
|
@@ -54,44 +54,6 @@ const UnionClient_1 = __importDefault(require("./Union/UnionClient"));
|
|
|
54
54
|
class MiniProgram extends BaseApplication_1.default {
|
|
55
55
|
constructor(config = {}, prepends = {}, id = null) {
|
|
56
56
|
super(config, prepends, id);
|
|
57
|
-
this.access_token = null;
|
|
58
|
-
this.auth = null;
|
|
59
|
-
this.encryptor = null;
|
|
60
|
-
this.server = null;
|
|
61
|
-
this.data_cube = null;
|
|
62
|
-
this.app_code = null;
|
|
63
|
-
this.template_message = null;
|
|
64
|
-
this.customer_service = null;
|
|
65
|
-
this.uniform_message = null;
|
|
66
|
-
this.activity_message = null;
|
|
67
|
-
this.open_data = null;
|
|
68
|
-
this.phone_number = null;
|
|
69
|
-
this.plugin = null;
|
|
70
|
-
this.plugin_dev = null;
|
|
71
|
-
this.base = null;
|
|
72
|
-
this.express = null;
|
|
73
|
-
this.nearby_poi = null;
|
|
74
|
-
this.ocr = null;
|
|
75
|
-
this.soter = null;
|
|
76
|
-
this.subscribe_message = null;
|
|
77
|
-
this.realtime_log = null;
|
|
78
|
-
this.search = null;
|
|
79
|
-
this.shop_account = null;
|
|
80
|
-
this.shop_aftersale = null;
|
|
81
|
-
this.shop_basic = null;
|
|
82
|
-
this.shop_delivery = null;
|
|
83
|
-
this.shop_order = null;
|
|
84
|
-
this.shop_register = null;
|
|
85
|
-
this.shop_spu = null;
|
|
86
|
-
this.short_link = null;
|
|
87
|
-
this.media = null;
|
|
88
|
-
this.content_security = null;
|
|
89
|
-
this.url_link = null;
|
|
90
|
-
this.url_scheme = null;
|
|
91
|
-
this.risk_control = null;
|
|
92
|
-
this.live = null;
|
|
93
|
-
this.broadcast = null;
|
|
94
|
-
this.union = null;
|
|
95
57
|
this.registerProviders();
|
|
96
58
|
}
|
|
97
59
|
registerProviders() {
|
|
@@ -54,35 +54,6 @@ class OfficialAccount extends BaseApplication_1.default {
|
|
|
54
54
|
callback: '',
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
|
-
this.access_token = null;
|
|
58
|
-
this.encryptor = null;
|
|
59
|
-
this.server = null;
|
|
60
|
-
this.user = null;
|
|
61
|
-
this.user_tag = null;
|
|
62
|
-
this.oauth = null;
|
|
63
|
-
this.menu = null;
|
|
64
|
-
this.template_message = null;
|
|
65
|
-
this.subscribe_message = null;
|
|
66
|
-
this.material = null;
|
|
67
|
-
this.customer_service = null;
|
|
68
|
-
this.customer_service_session = null;
|
|
69
|
-
this.semantic = null;
|
|
70
|
-
this.data_cube = null;
|
|
71
|
-
this.poi = null;
|
|
72
|
-
this.auto_reply = null;
|
|
73
|
-
this.broadcasting = null;
|
|
74
|
-
this.card = null;
|
|
75
|
-
this.device = null;
|
|
76
|
-
this.shake_around = null;
|
|
77
|
-
this.store = null;
|
|
78
|
-
this.comment = null;
|
|
79
|
-
this.base = null;
|
|
80
|
-
this.ocr = null;
|
|
81
|
-
this.goods = null;
|
|
82
|
-
this.jssdk = null;
|
|
83
|
-
this.media = null;
|
|
84
|
-
this.qrcode = null;
|
|
85
|
-
this.url = null;
|
|
86
57
|
this.registerProviders();
|
|
87
58
|
}
|
|
88
59
|
registerProviders() {
|
|
@@ -52,37 +52,37 @@ export default class OpenPlatform extends BaseApplication {
|
|
|
52
52
|
* 使用授权码换取接口调用凭据和授权信息
|
|
53
53
|
* @param authCode 授权码, 会在授权成功的回调返回给第三方平台
|
|
54
54
|
*/
|
|
55
|
-
handleAuthorize(): Promise<any>;
|
|
55
|
+
handleAuthorize(...arg: any[]): Promise<any>;
|
|
56
56
|
/**
|
|
57
57
|
* 获取授权方的帐号基本信息
|
|
58
58
|
* @param appId 授权方app_id
|
|
59
59
|
*/
|
|
60
|
-
getAuthorizer(): Promise<any>;
|
|
60
|
+
getAuthorizer(...arg: any[]): Promise<any>;
|
|
61
61
|
/**
|
|
62
62
|
* 设置授权方的选项信息
|
|
63
63
|
* @param appId 授权方app_id
|
|
64
64
|
* @param name 选项名称
|
|
65
65
|
*/
|
|
66
|
-
getAuthorizerOption(): Promise<any>;
|
|
66
|
+
getAuthorizerOption(...arg: any[]): Promise<any>;
|
|
67
67
|
/**
|
|
68
68
|
* 设置授权方的选项信息
|
|
69
69
|
* @param appId 授权方app_id
|
|
70
70
|
* @param name 选项名称
|
|
71
71
|
* @param value 选项值
|
|
72
72
|
*/
|
|
73
|
-
setAuthorizerOption(): Promise<any>;
|
|
73
|
+
setAuthorizerOption(...arg: any[]): Promise<any>;
|
|
74
74
|
/**
|
|
75
75
|
* 获取已授权的授权方列表
|
|
76
76
|
* @param offset 起始位置,从0开始
|
|
77
77
|
* @param count 获取记录数,最大500
|
|
78
78
|
*/
|
|
79
|
-
getAuthorizers(): Promise<any>;
|
|
79
|
+
getAuthorizers(...arg: any[]): Promise<any>;
|
|
80
80
|
/**
|
|
81
81
|
* 获取预授权码
|
|
82
82
|
*/
|
|
83
|
-
createPreAuthorizationCode(): Promise<any>;
|
|
83
|
+
createPreAuthorizationCode(...arg: any[]): Promise<any>;
|
|
84
84
|
/**
|
|
85
85
|
* 清零调用次数
|
|
86
86
|
*/
|
|
87
|
-
clearQuota(): Promise<any>;
|
|
87
|
+
clearQuota(...arg: any[]): Promise<any>;
|
|
88
88
|
}
|
|
@@ -30,13 +30,6 @@ const ComponentClient_1 = __importDefault(require("./Component/ComponentClient")
|
|
|
30
30
|
class OpenPlatform extends BaseApplication_1.default {
|
|
31
31
|
constructor(config = {}, prepends = {}, id = null) {
|
|
32
32
|
super(config, prepends, id);
|
|
33
|
-
this.verify_ticket = null;
|
|
34
|
-
this.access_token = null;
|
|
35
|
-
this.base = null;
|
|
36
|
-
this.encryptor = null;
|
|
37
|
-
this.server = null;
|
|
38
|
-
this.code_template = null;
|
|
39
|
-
this.component = null;
|
|
40
33
|
this.registerProviders();
|
|
41
34
|
}
|
|
42
35
|
registerProviders() {
|
|
@@ -171,23 +164,23 @@ class OpenPlatform extends BaseApplication_1.default {
|
|
|
171
164
|
* 使用授权码换取接口调用凭据和授权信息
|
|
172
165
|
* @param authCode 授权码, 会在授权成功的回调返回给第三方平台
|
|
173
166
|
*/
|
|
174
|
-
handleAuthorize() {
|
|
175
|
-
return this.base.handleAuthorize.apply(this.base,
|
|
167
|
+
handleAuthorize(...arg) {
|
|
168
|
+
return this.base.handleAuthorize.apply(this.base, arg);
|
|
176
169
|
}
|
|
177
170
|
/**
|
|
178
171
|
* 获取授权方的帐号基本信息
|
|
179
172
|
* @param appId 授权方app_id
|
|
180
173
|
*/
|
|
181
|
-
getAuthorizer() {
|
|
182
|
-
return this.base.getAuthorizer.apply(this.base,
|
|
174
|
+
getAuthorizer(...arg) {
|
|
175
|
+
return this.base.getAuthorizer.apply(this.base, arg);
|
|
183
176
|
}
|
|
184
177
|
/**
|
|
185
178
|
* 设置授权方的选项信息
|
|
186
179
|
* @param appId 授权方app_id
|
|
187
180
|
* @param name 选项名称
|
|
188
181
|
*/
|
|
189
|
-
getAuthorizerOption() {
|
|
190
|
-
return this.base.getAuthorizerOption.apply(this.base,
|
|
182
|
+
getAuthorizerOption(...arg) {
|
|
183
|
+
return this.base.getAuthorizerOption.apply(this.base, arg);
|
|
191
184
|
}
|
|
192
185
|
/**
|
|
193
186
|
* 设置授权方的选项信息
|
|
@@ -195,28 +188,28 @@ class OpenPlatform extends BaseApplication_1.default {
|
|
|
195
188
|
* @param name 选项名称
|
|
196
189
|
* @param value 选项值
|
|
197
190
|
*/
|
|
198
|
-
setAuthorizerOption() {
|
|
199
|
-
return this.base.setAuthorizerOption.apply(this.base,
|
|
191
|
+
setAuthorizerOption(...arg) {
|
|
192
|
+
return this.base.setAuthorizerOption.apply(this.base, arg);
|
|
200
193
|
}
|
|
201
194
|
/**
|
|
202
195
|
* 获取已授权的授权方列表
|
|
203
196
|
* @param offset 起始位置,从0开始
|
|
204
197
|
* @param count 获取记录数,最大500
|
|
205
198
|
*/
|
|
206
|
-
getAuthorizers() {
|
|
207
|
-
return this.base.getAuthorizers.apply(this.base,
|
|
199
|
+
getAuthorizers(...arg) {
|
|
200
|
+
return this.base.getAuthorizers.apply(this.base, arg);
|
|
208
201
|
}
|
|
209
202
|
/**
|
|
210
203
|
* 获取预授权码
|
|
211
204
|
*/
|
|
212
|
-
createPreAuthorizationCode() {
|
|
213
|
-
return this.base.createPreAuthorizationCode.apply(this.base,
|
|
205
|
+
createPreAuthorizationCode(...arg) {
|
|
206
|
+
return this.base.createPreAuthorizationCode.apply(this.base, arg);
|
|
214
207
|
}
|
|
215
208
|
/**
|
|
216
209
|
* 清零调用次数
|
|
217
210
|
*/
|
|
218
|
-
clearQuota() {
|
|
219
|
-
return this.base.clearQuota.apply(this.base,
|
|
211
|
+
clearQuota(...arg) {
|
|
212
|
+
return this.base.clearQuota.apply(this.base, arg);
|
|
220
213
|
}
|
|
221
214
|
}
|
|
222
215
|
exports.default = OpenPlatform;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import BaseApplication from '../../../MiniProgram/Application';
|
|
2
2
|
import CodeClient from './Code/CodeClient';
|
|
3
3
|
import DomainClient from './Domain/DomainClient';
|
|
4
|
+
import MaterialClient from './Material/MaterialClient';
|
|
5
|
+
import PrivacyClient from './Privacy/PrivacyClient';
|
|
6
|
+
import SecurityClient from './Security/SecurityClient';
|
|
4
7
|
import AccountClient from './Account/AccountClient';
|
|
5
8
|
import SettingClient from './Setting/SettingClient';
|
|
6
9
|
import TesterClient from './Tester/TesterClient';
|
|
7
10
|
export default class MiniProgram extends BaseApplication {
|
|
8
11
|
code: CodeClient;
|
|
9
12
|
domain: DomainClient;
|
|
13
|
+
material: MaterialClient;
|
|
14
|
+
privacy: PrivacyClient;
|
|
15
|
+
security: SecurityClient;
|
|
10
16
|
account: AccountClient;
|
|
11
17
|
setting: SettingClient;
|
|
12
18
|
tester: TesterClient;
|
|
13
19
|
constructor(config?: Object, prepends?: Object, id?: String);
|
|
14
|
-
|
|
20
|
+
registerExtraProviders(): void;
|
|
15
21
|
}
|
|
@@ -6,27 +6,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const Application_1 = __importDefault(require("../../../MiniProgram/Application"));
|
|
7
7
|
const CodeClient_1 = __importDefault(require("./Code/CodeClient"));
|
|
8
8
|
const DomainClient_1 = __importDefault(require("./Domain/DomainClient"));
|
|
9
|
+
const MaterialClient_1 = __importDefault(require("./Material/MaterialClient"));
|
|
10
|
+
const PrivacyClient_1 = __importDefault(require("./Privacy/PrivacyClient"));
|
|
11
|
+
const SecurityClient_1 = __importDefault(require("./Security/SecurityClient"));
|
|
9
12
|
const AccountClient_1 = __importDefault(require("./Account/AccountClient"));
|
|
10
13
|
const SettingClient_1 = __importDefault(require("./Setting/SettingClient"));
|
|
11
14
|
const TesterClient_1 = __importDefault(require("./Tester/TesterClient"));
|
|
12
15
|
class MiniProgram extends Application_1.default {
|
|
13
16
|
constructor(config = {}, prepends = {}, id = null) {
|
|
14
17
|
super(config, prepends, id);
|
|
15
|
-
this.
|
|
16
|
-
this.domain = null;
|
|
17
|
-
this.account = null;
|
|
18
|
-
this.setting = null;
|
|
19
|
-
this.tester = null;
|
|
20
|
-
this.registerProviders();
|
|
18
|
+
this.registerExtraProviders();
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
this.registerCommonProviders();
|
|
20
|
+
registerExtraProviders() {
|
|
24
21
|
this.offsetSet('code', function (app) {
|
|
25
22
|
return new CodeClient_1.default(app);
|
|
26
23
|
});
|
|
27
24
|
this.offsetSet('domain', function (app) {
|
|
28
25
|
return new DomainClient_1.default(app);
|
|
29
26
|
});
|
|
27
|
+
this.offsetSet('material', function (app) {
|
|
28
|
+
return new MaterialClient_1.default(app);
|
|
29
|
+
});
|
|
30
|
+
this.offsetSet('privacy', function (app) {
|
|
31
|
+
return new PrivacyClient_1.default(app);
|
|
32
|
+
});
|
|
33
|
+
this.offsetSet('security', function (app) {
|
|
34
|
+
return new SecurityClient_1.default(app);
|
|
35
|
+
});
|
|
30
36
|
this.offsetSet('account', function (app) {
|
|
31
37
|
return new AccountClient_1.default(app);
|
|
32
38
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseClient_1 = __importDefault(require("../../../../Core/BaseClient"));
|
|
16
|
+
const StreamResponse_1 = __importDefault(require("../../../../Core/Http/StreamResponse"));
|
|
17
|
+
class MaterialClient extends BaseClient_1.default {
|
|
18
|
+
/**
|
|
19
|
+
* 获取永久素材
|
|
20
|
+
* @param media_id 素材media_id
|
|
21
|
+
*/
|
|
22
|
+
get(media_id) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
let res = yield this.requestRaw({
|
|
25
|
+
url: 'cgi-bin/material/get_material',
|
|
26
|
+
method: 'POST',
|
|
27
|
+
data: {
|
|
28
|
+
media_id,
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (res.getHeader('content-disposition').indexOf('attachment') > -1) {
|
|
32
|
+
return StreamResponse_1.default.buildFromResponse(res);
|
|
33
|
+
}
|
|
34
|
+
let content = res.getContent();
|
|
35
|
+
if (typeof content === 'string') {
|
|
36
|
+
try {
|
|
37
|
+
content = JSON.parse(content);
|
|
38
|
+
}
|
|
39
|
+
catch (e) { }
|
|
40
|
+
}
|
|
41
|
+
return content;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = MaterialClient;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import BaseClient from '../../../../Core/BaseClient';
|
|
3
|
+
import Stream from 'stream';
|
|
4
|
+
export default class PrivacyClient extends BaseClient {
|
|
5
|
+
/**
|
|
6
|
+
* 查询小程序用户隐私保护指引
|
|
7
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html
|
|
8
|
+
*/
|
|
9
|
+
get(): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 配置小程序用户隐私保护指引
|
|
12
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
|
|
13
|
+
* @param params
|
|
14
|
+
*/
|
|
15
|
+
set(params: object): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 上传小程序用户隐私保护指引
|
|
18
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/upload_privacy_exfile.html
|
|
19
|
+
* @param file 文件路径或可读stream
|
|
20
|
+
*/
|
|
21
|
+
upload(file: string | Stream.Readable): Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../../../Core/BaseClient"));
|
|
7
|
+
class PrivacyClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 查询小程序用户隐私保护指引
|
|
10
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html
|
|
11
|
+
*/
|
|
12
|
+
get() {
|
|
13
|
+
return this.httpPostJson('cgi-bin/component/getprivacysetting');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 配置小程序用户隐私保护指引
|
|
17
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
set(params) {
|
|
21
|
+
return this.httpPostJson('wxa/setwebviewdomain', params);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 上传小程序用户隐私保护指引
|
|
25
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/upload_privacy_exfile.html
|
|
26
|
+
* @param file 文件路径或可读stream
|
|
27
|
+
*/
|
|
28
|
+
upload(file) {
|
|
29
|
+
if (!file) {
|
|
30
|
+
throw new Error(`File does not exist, or the file is unreadable: '${file}'`);
|
|
31
|
+
}
|
|
32
|
+
return this.httpUpload('media/upload', {
|
|
33
|
+
media: file
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = PrivacyClient;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import BaseClient from '../../../../Core/BaseClient';
|
|
2
|
+
export default class SecurityClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取接口列表
|
|
5
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
|
|
6
|
+
*/
|
|
7
|
+
get(): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* 申请接口
|
|
10
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/apply_privacy_interface.html
|
|
11
|
+
* @param params
|
|
12
|
+
*/
|
|
13
|
+
set(params: object): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../../../Core/BaseClient"));
|
|
7
|
+
class SecurityClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取接口列表
|
|
10
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
|
|
11
|
+
*/
|
|
12
|
+
get() {
|
|
13
|
+
return this.httpGet('wxa/security/get_privacy_interface');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 申请接口
|
|
17
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/apply_privacy_interface.html
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
set(params) {
|
|
21
|
+
return this.httpPostJson('wxa/security/apply_privacy_interface', params);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = SecurityClient;
|
|
@@ -3,5 +3,5 @@ import MiniProgramClient from './MiniProgram/MiniProgramClient';
|
|
|
3
3
|
export default class OfficialAccount extends BaseApplication {
|
|
4
4
|
mini_program: MiniProgramClient;
|
|
5
5
|
constructor(config?: Object, prepends?: Object, id?: String);
|
|
6
|
-
|
|
6
|
+
registerExtraProviders(): void;
|
|
7
7
|
}
|
|
@@ -8,11 +8,9 @@ const MiniProgramClient_1 = __importDefault(require("./MiniProgram/MiniProgramCl
|
|
|
8
8
|
class OfficialAccount extends Application_1.default {
|
|
9
9
|
constructor(config = {}, prepends = {}, id = null) {
|
|
10
10
|
super(config, prepends, id);
|
|
11
|
-
this.
|
|
12
|
-
this.registerProviders();
|
|
11
|
+
this.registerExtraProviders();
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
this.registerCommonProviders();
|
|
13
|
+
registerExtraProviders() {
|
|
16
14
|
this.offsetSet('mini_program', function (app) {
|
|
17
15
|
return new MiniProgramClient_1.default(app);
|
|
18
16
|
});
|
|
@@ -35,15 +35,6 @@ class OpenWork extends BaseApplication_1.default {
|
|
|
35
35
|
baseURL: 'https://qyapi.weixin.qq.com/',
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
|
-
this.provider_access_token = null;
|
|
39
|
-
this.suite_access_token = null;
|
|
40
|
-
this.suite_ticket = null;
|
|
41
|
-
this.corp = null;
|
|
42
|
-
this.mini_program = null;
|
|
43
|
-
this.provider = null;
|
|
44
|
-
this.encryptor_corp = null;
|
|
45
|
-
this.encryptor = null;
|
|
46
|
-
this.server = null;
|
|
47
38
|
this.registerProviders();
|
|
48
39
|
}
|
|
49
40
|
registerProviders() {
|
|
@@ -69,4 +69,13 @@ export default class CorpClient extends BaseClient {
|
|
|
69
69
|
* @returns
|
|
70
70
|
*/
|
|
71
71
|
getUserByTicket(userTicket: string): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* 第三方根据unionid查询external_userid
|
|
74
|
+
* @see https://developer.work.weixin.qq.com/document/path/95327
|
|
75
|
+
* @param unionid 微信用户的unionid
|
|
76
|
+
* @param openid 微信用户的openid
|
|
77
|
+
* @param corpid 需要换取的企业corpid,不填则拉取所有企业
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
unionidToExternalUserid(unionid: string, openid: string, corpid?: string): Promise<any>;
|
|
72
81
|
}
|
|
@@ -146,5 +146,20 @@ class CorpClient extends BaseClient_1.default {
|
|
|
146
146
|
user_ticket: userTicket,
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* 第三方根据unionid查询external_userid
|
|
151
|
+
* @see https://developer.work.weixin.qq.com/document/path/95327
|
|
152
|
+
* @param unionid 微信用户的unionid
|
|
153
|
+
* @param openid 微信用户的openid
|
|
154
|
+
* @param corpid 需要换取的企业corpid,不填则拉取所有企业
|
|
155
|
+
* @returns
|
|
156
|
+
*/
|
|
157
|
+
unionidToExternalUserid(unionid, openid, corpid = '') {
|
|
158
|
+
return this.httpPostJson('cgi-bin/service/externalcontact/unionid_to_external_userid_3rd', {
|
|
159
|
+
unionid,
|
|
160
|
+
openid,
|
|
161
|
+
corpid,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
149
164
|
}
|
|
150
165
|
exports.default = CorpClient;
|
|
@@ -44,21 +44,6 @@ class Payment extends BaseApplication_1.default {
|
|
|
44
44
|
baseURL: 'https://api.mch.weixin.qq.com/',
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
-
this.base = null;
|
|
48
|
-
this.bill = null;
|
|
49
|
-
this.coupon = null;
|
|
50
|
-
this.jssdk = null;
|
|
51
|
-
this.merchant = null;
|
|
52
|
-
this.order = null;
|
|
53
|
-
this.redpack = null;
|
|
54
|
-
this.refund = null;
|
|
55
|
-
this.reverse = null;
|
|
56
|
-
this.sandbox = null;
|
|
57
|
-
this.transfer = null;
|
|
58
|
-
this.security = null;
|
|
59
|
-
this.profit_sharing = null;
|
|
60
|
-
this.access_token = null;
|
|
61
|
-
this.url = null;
|
|
62
47
|
this.registerProviders();
|
|
63
48
|
}
|
|
64
49
|
registerProviders() {
|
|
@@ -32,6 +32,8 @@ import ExternalGroupChatWayClient from './ExternalContact/GroupChatWayClient';
|
|
|
32
32
|
import ExternalStatisticsClient from './ExternalContact/StatisticsClient';
|
|
33
33
|
import ExternalMessageClient from './ExternalContact/MessageClient';
|
|
34
34
|
import ExternalMessageTemplateClient from './ExternalContact/MessageTemplateClient';
|
|
35
|
+
import ExternalInterceptClient from './ExternalContact/InterceptClient';
|
|
36
|
+
import ExternalProductClient from './ExternalContact/ProductClient';
|
|
35
37
|
import ExternalSchoolClient from './ExternalContact/SchoolClient';
|
|
36
38
|
import ExternalMomentClient from './ExternalContact/MomentClient';
|
|
37
39
|
import CorpGroupClient from './CorpGroup/CorpGroupClient';
|
|
@@ -53,6 +55,8 @@ export default class Work extends BaseApplication {
|
|
|
53
55
|
external_contact_statistics: ExternalStatisticsClient;
|
|
54
56
|
external_contact_message: ExternalMessageClient;
|
|
55
57
|
external_contact_message_template: ExternalMessageTemplateClient;
|
|
58
|
+
external_contact_intercept: ExternalInterceptClient;
|
|
59
|
+
external_contact_product: ExternalProductClient;
|
|
56
60
|
school: ExternalSchoolClient;
|
|
57
61
|
external_contact_moment: ExternalMomentClient;
|
|
58
62
|
group_robot: GroupRobotClient;
|
package/dist/Work/Application.js
CHANGED
|
@@ -46,6 +46,8 @@ const GroupChatWayClient_1 = __importDefault(require("./ExternalContact/GroupCha
|
|
|
46
46
|
const StatisticsClient_1 = __importDefault(require("./ExternalContact/StatisticsClient"));
|
|
47
47
|
const MessageClient_2 = __importDefault(require("./ExternalContact/MessageClient"));
|
|
48
48
|
const MessageTemplateClient_1 = __importDefault(require("./ExternalContact/MessageTemplateClient"));
|
|
49
|
+
const InterceptClient_1 = __importDefault(require("./ExternalContact/InterceptClient"));
|
|
50
|
+
const ProductClient_1 = __importDefault(require("./ExternalContact/ProductClient"));
|
|
49
51
|
const SchoolClient_1 = __importDefault(require("./ExternalContact/SchoolClient"));
|
|
50
52
|
const MomentClient_1 = __importDefault(require("./ExternalContact/MomentClient"));
|
|
51
53
|
const CorpGroupClient_1 = __importDefault(require("./CorpGroup/CorpGroupClient"));
|
|
@@ -58,41 +60,6 @@ class Work extends BaseApplication_1.default {
|
|
|
58
60
|
baseURL: 'https://qyapi.weixin.qq.com/',
|
|
59
61
|
},
|
|
60
62
|
};
|
|
61
|
-
this.oa = null;
|
|
62
|
-
this.access_token = null;
|
|
63
|
-
this.agent = null;
|
|
64
|
-
this.agent_workbench = null;
|
|
65
|
-
this.base = null;
|
|
66
|
-
this.calendar = null;
|
|
67
|
-
this.chat = null;
|
|
68
|
-
this.corp_group = null;
|
|
69
|
-
this.department = null;
|
|
70
|
-
this.external_contact = null;
|
|
71
|
-
this.contact_way = null;
|
|
72
|
-
this.group_chat_way = null;
|
|
73
|
-
this.external_contact_statistics = null;
|
|
74
|
-
this.external_contact_message = null;
|
|
75
|
-
this.external_contact_message_template = null;
|
|
76
|
-
this.school = null;
|
|
77
|
-
this.external_contact_moment = null;
|
|
78
|
-
this.group_robot = null;
|
|
79
|
-
this.group_robot_messenger = null;
|
|
80
|
-
this.invoice = null;
|
|
81
|
-
this.jssdk = null;
|
|
82
|
-
this.kf_account = null;
|
|
83
|
-
this.kf_message = null;
|
|
84
|
-
this.kf_servicer = null;
|
|
85
|
-
this.live = null;
|
|
86
|
-
this.media = null;
|
|
87
|
-
this.menu = null;
|
|
88
|
-
this.message = null;
|
|
89
|
-
this.messenger = null;
|
|
90
|
-
this.msg_audit = null;
|
|
91
|
-
this.encryptor = null;
|
|
92
|
-
this.server = null;
|
|
93
|
-
this.user = null;
|
|
94
|
-
this.tag = null;
|
|
95
|
-
this.oauth = null;
|
|
96
63
|
this.registerProviders();
|
|
97
64
|
}
|
|
98
65
|
registerProviders() {
|
|
@@ -144,6 +111,12 @@ class Work extends BaseApplication_1.default {
|
|
|
144
111
|
this.offsetSet('external_contact_message_template', function (app) {
|
|
145
112
|
return new MessageTemplateClient_1.default(app);
|
|
146
113
|
});
|
|
114
|
+
this.offsetSet('external_contact_intercept', function (app) {
|
|
115
|
+
return new InterceptClient_1.default(app);
|
|
116
|
+
});
|
|
117
|
+
this.offsetSet('external_contact_product', function (app) {
|
|
118
|
+
return new ProductClient_1.default(app);
|
|
119
|
+
});
|
|
147
120
|
this.offsetSet('school', function (app) {
|
|
148
121
|
return new SchoolClient_1.default(app);
|
|
149
122
|
});
|
|
@@ -196,6 +196,7 @@ export default class ExternalContactClient extends BaseClient {
|
|
|
196
196
|
finishExternalUseridMigration(corpid: string): Promise<any>;
|
|
197
197
|
/**
|
|
198
198
|
* unionid查询external_userid
|
|
199
|
+
* @deprecated 使用新方法 `(new EasyWechat.Factory.OpenWork).crop.unionidToExternalUserid()`
|
|
199
200
|
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#4.2%20unionid%E6%9F%A5%E8%AF%A2external_userid
|
|
200
201
|
* @param unionid
|
|
201
202
|
* @param openid
|
|
@@ -321,6 +321,7 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* unionid查询external_userid
|
|
324
|
+
* @deprecated 使用新方法 `(new EasyWechat.Factory.OpenWork).crop.unionidToExternalUserid()`
|
|
324
325
|
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#4.2%20unionid%E6%9F%A5%E8%AF%A2external_userid
|
|
325
326
|
* @param unionid
|
|
326
327
|
* @param openid
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class InterceptClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 新建敏感词规则
|
|
5
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#新建敏感词规则
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
create(params: object): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取敏感词规则列表
|
|
12
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则列表
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
gets(): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 获取敏感词规则详情
|
|
18
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则详情
|
|
19
|
+
* @param ruleId 规则id
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
getDetails(ruleId: string): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* 删除敏感词规则
|
|
25
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#删除敏感词规则
|
|
26
|
+
* @param ruleId
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
delete(ruleId: string): Promise<any>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
+
class InterceptClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 新建敏感词规则
|
|
10
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#新建敏感词规则
|
|
11
|
+
* @param params
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
create(params) {
|
|
15
|
+
return this.httpPostJson('cgi-bin/externalcontact/add_intercept_rule', params);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 获取敏感词规则列表
|
|
19
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则列表
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
gets() {
|
|
23
|
+
return this.httpGet('cgi-bin/externalcontact/get_intercept_rule_list');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 获取敏感词规则详情
|
|
27
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则详情
|
|
28
|
+
* @param ruleId 规则id
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
getDetails(ruleId) {
|
|
32
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_intercept_rule', {
|
|
33
|
+
rule_id: ruleId,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 删除敏感词规则
|
|
38
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#删除敏感词规则
|
|
39
|
+
* @param ruleId
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
delete(ruleId) {
|
|
43
|
+
return this.httpPostJson('cgi-bin/externalcontact/del_intercept_rule', {
|
|
44
|
+
rule_id: ruleId,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = InterceptClient;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class ProductClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 创建商品图册
|
|
5
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#创建商品图册
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
create(params: object): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取商品图册
|
|
12
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册
|
|
13
|
+
* @param productId 商品id
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
get(productId: string): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* 获取商品图册列表
|
|
19
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册列表
|
|
20
|
+
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
|
21
|
+
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
getList(limit: number, cursor: string): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* 编辑商品图册
|
|
27
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#编辑商品图册
|
|
28
|
+
* @param params
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
update(params: object): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* 删除商品图册
|
|
34
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#删除商品图册
|
|
35
|
+
* @param productId 商品id
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
delete(productId: string): Promise<any>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
+
class ProductClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 创建商品图册
|
|
10
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#创建商品图册
|
|
11
|
+
* @param params
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
create(params) {
|
|
15
|
+
return this.httpPostJson('cgi-bin/externalcontact/add_product_album', params);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 获取商品图册
|
|
19
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册
|
|
20
|
+
* @param productId 商品id
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
get(productId) {
|
|
24
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_product_album', {
|
|
25
|
+
product_id: productId,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 获取商品图册列表
|
|
30
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册列表
|
|
31
|
+
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
|
32
|
+
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
getList(limit, cursor) {
|
|
36
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_product_album_list', {
|
|
37
|
+
limit,
|
|
38
|
+
cursor,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 编辑商品图册
|
|
43
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#编辑商品图册
|
|
44
|
+
* @param params
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
update(params) {
|
|
48
|
+
return this.httpPostJson('cgi-bin/externalcontact/update_product_album', params);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 删除商品图册
|
|
52
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#删除商品图册
|
|
53
|
+
* @param productId 商品id
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
delete(productId) {
|
|
57
|
+
return this.httpPostJson('cgi-bin/externalcontact/delete_product_album', {
|
|
58
|
+
product_id: productId,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.default = ProductClient;
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-easywechat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "EasyWechat SDK for Node.js (NOT OFFICIAL)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"release": "npx package-release",
|
|
8
8
|
"build": "rm -rf dist && npx tsc",
|
|
9
|
+
"dev": "npx tsc -w",
|
|
9
10
|
"test": "npx mocha ./test/**/*.js"
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|