node-easywechat 2.9.1 → 2.9.2

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/README.md CHANGED
@@ -20,8 +20,6 @@
20
20
 
21
21
  绝大部分API都可以根据 [EasyWechat 的文档](https://www.easywechat.com/5.x/) 来使用。小部分(如获取请求相关数据、返回响应数据、支付证书等)的操作,由于语言环境的不同,会有不同处理。具体可以查看 [node-easywechat-demo](https://github.com/hpyer/node-easywechat-demo/) 以及下方的[自定义模块说明](#自定义模块模块替换使用方法) 。如果仍有疑问,请提issue,谢谢~
22
22
 
23
- 更多信息详见:[API文档](docs/README.md)
24
-
25
23
  ```js
26
24
  // 公众号
27
25
  let officialAccount = new EasyWechat.Factory.OfficialAccount({
@@ -1,5 +1,9 @@
1
1
  import BaseClient from '../../Core/BaseClient';
2
2
  export default class ExpressClient extends BaseClient {
3
+ /**
4
+ * 绑定、解绑物流账号
5
+ */
6
+ bind(params: object): Promise<any>;
3
7
  /**
4
8
  * 获取支持的快递公司列表
5
9
  */
@@ -44,4 +48,18 @@ export default class ExpressClient extends BaseClient {
44
48
  * @param openid 用户openid
45
49
  */
46
50
  unbindPrinter(openid?: string): Promise<any>;
51
+ /**
52
+ * 创建退货 ID
53
+ */
54
+ createReturn(params?: object): Promise<any>;
55
+ /**
56
+ * 查询退货 ID 状态
57
+ * @param returnId 退货id
58
+ */
59
+ getReturn(returnId?: string): Promise<any>;
60
+ /**
61
+ * 解绑退货 ID
62
+ * @param returnId 退货id
63
+ */
64
+ unbindReturn(returnId?: string): Promise<any>;
47
65
  }
@@ -5,6 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
7
7
  class ExpressClient extends BaseClient_1.default {
8
+ /**
9
+ * 绑定、解绑物流账号
10
+ */
11
+ bind(params) {
12
+ if (!params['type'] || !params['biz_id'] || !params['delivery_id']) {
13
+ throw new Error('Missing parameter.');
14
+ }
15
+ return this.httpPostJson('cgi-bin/express/business/account/bind', params);
16
+ }
8
17
  /**
9
18
  * 获取支持的快递公司列表
10
19
  */
@@ -76,5 +85,29 @@ class ExpressClient extends BaseClient_1.default {
76
85
  openid: openid,
77
86
  });
78
87
  }
88
+ /**
89
+ * 创建退货 ID
90
+ */
91
+ createReturn(params = {}) {
92
+ return this.httpPostJson('cgi-bin/express/delivery/return/add', params);
93
+ }
94
+ /**
95
+ * 查询退货 ID 状态
96
+ * @param returnId 退货id
97
+ */
98
+ getReturn(returnId = '') {
99
+ return this.httpPostJson('cgi-bin/express/delivery/return/get', {
100
+ return_id: returnId,
101
+ });
102
+ }
103
+ /**
104
+ * 解绑退货 ID
105
+ * @param returnId 退货id
106
+ */
107
+ unbindReturn(returnId = '') {
108
+ return this.httpPostJson('cgi-bin/express/delivery/return/unbind', {
109
+ return_id: returnId,
110
+ });
111
+ }
79
112
  }
80
113
  exports.default = ExpressClient;
@@ -22,6 +22,13 @@ export default class OrderClient extends BaseClient {
22
22
  * @returns
23
23
  */
24
24
  get(openid: string, orderIds: object): Promise<any>;
25
+ /**
26
+ * 获取订单列表
27
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/get_order_list.html
28
+ * @param params 查询参数
29
+ * @returns
30
+ */
31
+ getList(params: object): Promise<any>;
25
32
  /**
26
33
  * 同步订单支付结果
27
34
  * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/pay_order.html
@@ -38,6 +38,15 @@ class OrderClient extends BaseClient_1.default {
38
38
  openid,
39
39
  }));
40
40
  }
41
+ /**
42
+ * 获取订单列表
43
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/get_order_list.html
44
+ * @param params 查询参数
45
+ * @returns
46
+ */
47
+ getList(params) {
48
+ return this.httpPostJson('shop/order/get_list', params);
49
+ }
41
50
  /**
42
51
  * 同步订单支付结果
43
52
  * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/pay_order.html
@@ -1,5 +1,10 @@
1
1
  import BaseClient from '../../Core/BaseClient';
2
2
  export default class OfficialAccountBase extends BaseClient {
3
+ /**
4
+ * 查询openAPI调用次数
5
+ * @param cgiPath api的请求地址,例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会76003的报错
6
+ */
7
+ getQuota(cgiPath: string): Promise<any>;
3
8
  /**
4
9
  * 清理接口调用次数
5
10
  * 此接口官方有每月调用限制,不可随意调用
@@ -6,6 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
7
7
  const Utils_1 = require("../../Core/Utils");
8
8
  class OfficialAccountBase extends BaseClient_1.default {
9
+ /**
10
+ * 查询openAPI调用次数
11
+ * @param cgiPath api的请求地址,例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会76003的报错
12
+ */
13
+ getQuota(cgiPath) {
14
+ return this.httpPostJson('cgi-bin/openapi/quota/get', {
15
+ cgi_path: cgiPath,
16
+ });
17
+ }
9
18
  /**
10
19
  * 清理接口调用次数
11
20
  * 此接口官方有每月调用限制,不可随意调用
@@ -28,6 +28,7 @@ import TagClient from './User/TagClient';
28
28
  import MiniProgram from './MiniProgram/Application';
29
29
  import ExternalContactClient from './ExternalContact/Client';
30
30
  import ExternalContactWayClient from './ExternalContact/ContactWayClient';
31
+ import ExternalGroupChatWayClient from './ExternalContact/GroupChatWayClient';
31
32
  import ExternalStatisticsClient from './ExternalContact/StatisticsClient';
32
33
  import ExternalMessageClient from './ExternalContact/MessageClient';
33
34
  import ExternalMessageTemplateClient from './ExternalContact/MessageTemplateClient';
@@ -48,6 +49,7 @@ export default class Work extends BaseApplication {
48
49
  department: DepartmentClient;
49
50
  external_contact: ExternalContactClient;
50
51
  contact_way: ExternalContactWayClient;
52
+ group_chat_way: ExternalGroupChatWayClient;
51
53
  external_contact_statistics: ExternalStatisticsClient;
52
54
  external_contact_message: ExternalMessageClient;
53
55
  external_contact_message_template: ExternalMessageTemplateClient;
@@ -42,6 +42,7 @@ const FinallResult_1 = __importDefault(require("../Core/Decorators/FinallResult"
42
42
  const Application_1 = __importDefault(require("./MiniProgram/Application"));
43
43
  const Client_1 = __importDefault(require("./ExternalContact/Client"));
44
44
  const ContactWayClient_1 = __importDefault(require("./ExternalContact/ContactWayClient"));
45
+ const GroupChatWayClient_1 = __importDefault(require("./ExternalContact/GroupChatWayClient"));
45
46
  const StatisticsClient_1 = __importDefault(require("./ExternalContact/StatisticsClient"));
46
47
  const MessageClient_2 = __importDefault(require("./ExternalContact/MessageClient"));
47
48
  const MessageTemplateClient_1 = __importDefault(require("./ExternalContact/MessageTemplateClient"));
@@ -68,6 +69,7 @@ class Work extends BaseApplication_1.default {
68
69
  this.department = null;
69
70
  this.external_contact = null;
70
71
  this.contact_way = null;
72
+ this.group_chat_way = null;
71
73
  this.external_contact_statistics = null;
72
74
  this.external_contact_message = null;
73
75
  this.external_contact_message_template = null;
@@ -130,6 +132,9 @@ class Work extends BaseApplication_1.default {
130
132
  this.offsetSet('contact_way', function (app) {
131
133
  return new ContactWayClient_1.default(app);
132
134
  });
135
+ this.offsetSet('group_chat_way', function (app) {
136
+ return new GroupChatWayClient_1.default(app);
137
+ });
133
138
  this.offsetSet('external_contact_statistics', function (app) {
134
139
  return new StatisticsClient_1.default(app);
135
140
  });
@@ -0,0 +1,32 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class GroupChatWayClient extends BaseClient {
3
+ /**
4
+ * 配置客户群进群方式
5
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E9%85%8D%E7%BD%AE%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F
6
+ * @param params
7
+ * @returns
8
+ */
9
+ create(params: object): Promise<any>;
10
+ /**
11
+ * 获取客户群进群方式配置
12
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
13
+ * @param configId
14
+ * @returns
15
+ */
16
+ get(configId: string): Promise<any>;
17
+ /**
18
+ * 更新客户群进群方式配置
19
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E6%9B%B4%E6%96%B0%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
20
+ * @param configId
21
+ * @param config
22
+ * @returns
23
+ */
24
+ update(configId: string, config: object): Promise<any>;
25
+ /**
26
+ * 删除客户群进群方式配置
27
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E5%88%A0%E9%99%A4%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
28
+ * @param configId
29
+ * @returns
30
+ */
31
+ delete(configId: string): Promise<any>;
32
+ }
@@ -0,0 +1,54 @@
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
+ const Utils_1 = require("../../Core/Utils");
8
+ class GroupChatWayClient extends BaseClient_1.default {
9
+ /**
10
+ * 配置客户群进群方式
11
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E9%85%8D%E7%BD%AE%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F
12
+ * @param params
13
+ * @returns
14
+ */
15
+ create(params) {
16
+ return this.httpPostJson('cgi-bin/externalcontact/groupchat/add_join_way', params);
17
+ }
18
+ /**
19
+ * 获取客户群进群方式配置
20
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
21
+ * @param configId
22
+ * @returns
23
+ */
24
+ get(configId) {
25
+ return this.httpGet('cgi-bin/externalcontact/groupchat/get_join_way', {
26
+ config_id: configId,
27
+ });
28
+ }
29
+ /**
30
+ * 更新客户群进群方式配置
31
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E6%9B%B4%E6%96%B0%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
32
+ * @param configId
33
+ * @param config
34
+ * @returns
35
+ */
36
+ update(configId, config) {
37
+ let params = (0, Utils_1.merge)({
38
+ config_id: configId,
39
+ }, config);
40
+ return this.httpPostJson('cgi-bin/externalcontact/groupchat/update_join_way', params);
41
+ }
42
+ /**
43
+ * 删除客户群进群方式配置
44
+ * @see https://developer.work.weixin.qq.com/document/path/92229#%E5%88%A0%E9%99%A4%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
45
+ * @param configId
46
+ * @returns
47
+ */
48
+ delete(configId) {
49
+ return this.httpGet('cgi-bin/externalcontact/groupchat/del_join_way', {
50
+ config_id: configId,
51
+ });
52
+ }
53
+ }
54
+ exports.default = GroupChatWayClient;
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "node-easywechat",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "EasyWechat SDK for Node.js (NOT OFFICIAL)",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "rm -rf dist && npx tsc",
8
- "docs": "rm -rf doc && npx typedoc --out docs --plugin typedoc-plugin-markdown ./src/",
9
8
  "test": "npx mocha ./test/**/*.js"
10
9
  },
11
10
  "repository": {
@@ -22,8 +21,6 @@
22
21
  "@types/node": "^17.0.8",
23
22
  "mocha": "^9.2.0",
24
23
  "sinon": "^12.0.1",
25
- "typedoc": "^0.22.11",
26
- "typedoc-plugin-markdown": "^3.11.9",
27
24
  "typescript": "^4.5.4"
28
25
  },
29
26
  "dependencies": {