node-nim 9.14.2 → 10.2.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/README.md +7 -1
- package/dist/loader.js +35 -35
- package/dist/nim/client.js +184 -184
- package/dist/nim/client.js.map +1 -1
- package/dist/nim/data_sync.js +19 -19
- package/dist/nim/friend.js +150 -150
- package/dist/nim/global.js +131 -131
- package/dist/nim/msglog.js +687 -687
- package/dist/nim/nos.js +216 -180
- package/dist/nim/nos.js.map +1 -1
- package/dist/nim/online_session.js +85 -85
- package/dist/nim/pass_through_proxy.js +39 -39
- package/dist/nim/plugin.js +65 -65
- package/dist/nim/session.js +392 -392
- package/dist/nim/subscribe_event.js +142 -142
- package/dist/nim/super_team.js +592 -592
- package/dist/nim/sysmsg.js +194 -194
- package/dist/nim/talk.js +209 -209
- package/dist/nim/talk.js.map +1 -1
- package/dist/nim/talkex.js +191 -191
- package/dist/nim/team.js +818 -818
- package/dist/nim/tool.js +119 -119
- package/dist/nim/user.js +201 -201
- package/dist/nim_def/client_def.js +245 -245
- package/dist/nim_def/client_def.js.map +1 -1
- package/dist/nim_def/data_sync_def.js +20 -20
- package/dist/nim_def/doc_trans_def.js +16 -16
- package/dist/nim_def/friend_def.js +37 -37
- package/dist/nim_def/global_def.js +39 -39
- package/dist/nim_def/msglog_def.js +148 -148
- package/dist/nim_def/nos_def.js +16 -16
- package/dist/nim_def/online_session_def.js +2 -2
- package/dist/nim_def/pass_through_proxy_def.js +10 -10
- package/dist/nim_def/plugin_def.js +2 -2
- package/dist/nim_def/session_def.js +26 -26
- package/dist/nim_def/subscribe_event_def.js +52 -52
- package/dist/nim_def/super_team_def.js +64 -64
- package/dist/nim_def/sysmsg_def.js +28 -28
- package/dist/nim_def/talk_def.js +2 -2
- package/dist/nim_def/talkex_def.js +2 -2
- package/dist/nim_def/team_def.js +69 -69
- package/dist/nim_def/tool_def.js +11 -11
- package/dist/nim_def/user_def.js +22 -22
- package/dist/node-nim.js +171 -171
- package/dist/node-nim.js.map +1 -1
- package/dist/qchat/attachment.js +63 -63
- package/dist/qchat/channel.js +314 -314
- package/dist/qchat/channel_category.js +187 -187
- package/dist/qchat/instance.js +77 -77
- package/dist/qchat/message.js +285 -285
- package/dist/qchat/role.js +423 -423
- package/dist/qchat/server.js +453 -453
- package/dist/qchat/system_notification.js +74 -74
- package/dist/qchat_def/attachment_def.js +2 -2
- package/dist/qchat_def/channel_def.js +2 -2
- package/dist/qchat_def/instance_def.js +2 -2
- package/dist/qchat_def/message_def.js +2 -2
- package/dist/qchat_def/public_def.js +649 -649
- package/dist/qchat_def/public_def.js.map +1 -1
- package/dist/qchat_def/role_def.js +2 -2
- package/dist/qchat_def/server_def.js +2 -2
- package/dist/qchat_def/system_notification_def.js +2 -2
- package/dist/v2/v2_nim_chatroom_client.js +135 -0
- package/dist/v2/v2_nim_chatroom_client.js.map +1 -0
- package/dist/v2/v2_nim_chatroom_service.js +244 -0
- package/dist/v2/v2_nim_chatroom_service.js.map +1 -0
- package/dist/v2/v2_nim_client.js +138 -0
- package/dist/v2/v2_nim_client.js.map +1 -0
- package/dist/v2/v2_nim_conversation_group_service.js +116 -0
- package/dist/v2/v2_nim_conversation_group_service.js.map +1 -0
- package/dist/v2/v2_nim_conversation_service.js +236 -0
- package/dist/v2/v2_nim_conversation_service.js.map +1 -0
- package/dist/v2/v2_nim_friend_service.js +128 -0
- package/dist/v2/v2_nim_friend_service.js.map +1 -0
- package/dist/v2/v2_nim_login_service.js +119 -123
- package/dist/v2/v2_nim_login_service.js.map +1 -1
- package/dist/v2/v2_nim_message_service.js +382 -0
- package/dist/v2/v2_nim_message_service.js.map +1 -0
- package/dist/v2/v2_nim_notification_service.js +30 -0
- package/dist/v2/v2_nim_notification_service.js.map +1 -0
- package/dist/v2/v2_nim_setting_service.js +86 -0
- package/dist/v2/v2_nim_setting_service.js.map +1 -0
- package/dist/v2/v2_nim_storage_service.js +58 -0
- package/dist/v2/v2_nim_storage_service.js.map +1 -0
- package/dist/v2/v2_nim_team_service.js +360 -0
- package/dist/v2/v2_nim_team_service.js.map +1 -0
- package/dist/v2/v2_nim_user_service.js +76 -0
- package/dist/v2/v2_nim_user_service.js.map +1 -0
- package/dist/v2/v2_nim_utilities.js +276 -0
- package/dist/v2/v2_nim_utilities.js.map +1 -0
- package/dist/v2_def/v2_nim_callback_def.js +2 -2
- package/dist/v2_def/v2_nim_enum_def.js +1087 -325
- package/dist/v2_def/v2_nim_enum_def.js.map +1 -1
- package/dist/v2_def/v2_nim_struct_def.js +2 -2
- package/package.json +74 -74
- package/script/download-sdk.js +78 -78
- package/script/exec-node-nim-tester.js +17 -17
- package/script/publish-to-netease-npm.js +3 -2
- package/types/loader.d.ts +2 -2
- package/types/nim/client.d.ts +123 -123
- package/types/nim/data_sync.d.ts +12 -12
- package/types/nim/friend.d.ts +82 -82
- package/types/nim/global.d.ts +69 -69
- package/types/nim/msglog.d.ts +392 -392
- package/types/nim/nos.d.ts +118 -118
- package/types/nim/online_session.d.ts +44 -44
- package/types/nim/pass_through_proxy.d.ts +24 -24
- package/types/nim/plugin.d.ts +39 -39
- package/types/nim/session.d.ts +212 -212
- package/types/nim/subscribe_event.d.ts +87 -87
- package/types/nim/super_team.d.ts +331 -331
- package/types/nim/sysmsg.d.ts +105 -105
- package/types/nim/talk.d.ts +94 -94
- package/types/nim/talkex.d.ts +95 -95
- package/types/nim/team.d.ts +461 -461
- package/types/nim/tool.d.ts +77 -77
- package/types/nim/user.d.ts +111 -111
- package/types/nim_def/client_def.d.ts +284 -284
- package/types/nim_def/data_sync_def.d.ts +19 -19
- package/types/nim_def/doc_trans_def.d.ts +11 -11
- package/types/nim_def/friend_def.d.ts +65 -65
- package/types/nim_def/global_def.d.ts +62 -62
- package/types/nim_def/msglog_def.d.ts +373 -373
- package/types/nim_def/nos_def.d.ts +72 -72
- package/types/nim_def/online_session_def.d.ts +34 -34
- package/types/nim_def/pass_through_proxy_def.d.ts +13 -13
- package/types/nim_def/plugin_def.d.ts +8 -8
- package/types/nim_def/session_def.d.ts +114 -114
- package/types/nim_def/subscribe_event_def.d.ts +83 -83
- package/types/nim_def/super_team_def.d.ts +144 -137
- package/types/nim_def/sysmsg_def.d.ts +70 -70
- package/types/nim_def/talk_def.d.ts +96 -96
- package/types/nim_def/talkex_def.d.ts +112 -112
- package/types/nim_def/team_def.d.ts +167 -167
- package/types/nim_def/tool_def.d.ts +28 -28
- package/types/nim_def/user_def.d.ts +59 -59
- package/types/node-nim.d.ts +90 -93
- package/types/qchat/attachment.d.ts +40 -40
- package/types/qchat/channel.d.ts +139 -139
- package/types/qchat/channel_category.d.ts +82 -82
- package/types/qchat/instance.d.ts +46 -46
- package/types/qchat/message.d.ts +128 -128
- package/types/qchat/role.d.ts +166 -166
- package/types/qchat/server.d.ts +198 -198
- package/types/qchat/system_notification.d.ts +39 -39
- package/types/qchat_def/attachment_def.d.ts +71 -71
- package/types/qchat_def/channel_def.d.ts +643 -643
- package/types/qchat_def/instance_def.d.ts +214 -214
- package/types/qchat_def/message_def.d.ts +565 -565
- package/types/qchat_def/public_def.d.ts +754 -754
- package/types/qchat_def/role_def.d.ts +413 -413
- package/types/qchat_def/server_def.d.ts +529 -529
- package/types/qchat_def/system_notification_def.d.ts +172 -172
- package/types/v2/v2_nim_chatroom_client.d.ts +73 -0
- package/types/v2/v2_nim_chatroom_service.d.ts +114 -0
- package/types/v2/v2_nim_client.d.ts +75 -0
- package/types/v2/v2_nim_conversation_group_service.d.ts +54 -0
- package/types/v2/v2_nim_conversation_service.d.ts +110 -0
- package/types/v2/v2_nim_friend_service.d.ts +58 -0
- package/types/v2/v2_nim_login_service.d.ts +80 -96
- package/types/v2/v2_nim_message_service.d.ts +143 -0
- package/types/v2/v2_nim_notification_service.d.ts +18 -0
- package/types/v2/v2_nim_setting_service.d.ts +43 -0
- package/types/v2/v2_nim_storage_service.d.ts +28 -0
- package/types/v2/v2_nim_team_service.d.ts +184 -0
- package/types/v2/v2_nim_user_service.d.ts +34 -0
- package/types/v2/v2_nim_utilities.d.ts +168 -0
- package/types/v2_def/v2_nim_callback_def.d.ts +7 -20
- package/types/v2_def/v2_nim_enum_def.d.ts +1009 -300
- package/types/v2_def/v2_nim_struct_def.d.ts +1539 -338
- package/dist/chatroom/chatroom.js +0 -263
- package/dist/chatroom/chatroom.js.map +0 -1
- package/dist/chatroom_def/chatroom_def.js +0 -120
- package/dist/chatroom_def/chatroom_def.js.map +0 -1
- package/dist/v2/v2_nim_instance.js +0 -44
- package/dist/v2/v2_nim_instance.js.map +0 -1
- package/types/chatroom/chatroom.d.ts +0 -55
- package/types/chatroom_def/chatroom_def.d.ts +0 -448
- package/types/v2/v2_nim_instance.d.ts +0 -25
package/dist/nim/sysmsg.js
CHANGED
|
@@ -1,195 +1,195 @@
|
|
|
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
|
-
exports.NIMSysMsg = void 0;
|
|
7
|
-
const loader_1 = __importDefault(require("../loader"));
|
|
8
|
-
const eventemitter3_1 = require("eventemitter3");
|
|
9
|
-
class NIMSysMsg extends eventemitter3_1.EventEmitter {
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
this.sysmsg = new loader_1.default.NIMSystemMsg({ emit: this.emit.bind(this) });
|
|
13
|
-
}
|
|
14
|
-
/** 注册全局回调 */
|
|
15
|
-
initEventHandlers() {
|
|
16
|
-
return this.sysmsg.InitEventHandlers();
|
|
17
|
-
}
|
|
18
|
-
/** 发送自定义通知消息
|
|
19
|
-
* @param json_msg 消息体Json, 可以通过CreateCustomNotificationMsg方法自动创建
|
|
20
|
-
* @return void 无返回值
|
|
21
|
-
*/
|
|
22
|
-
sendCustomNotificationMsg(msg) {
|
|
23
|
-
return this.sysmsg.SendCustomNotificationMsg(msg);
|
|
24
|
-
}
|
|
25
|
-
/** 查询本地系统消息
|
|
26
|
-
* @param limit_count 一次查询数量,建议20
|
|
27
|
-
* @param last_time 上次查询最后一条消息的时间戳
|
|
28
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
29
|
-
* @param cb 查询本地系统消息的回调函数
|
|
30
|
-
* @return boolean 检查参数如果不符合要求则返回失败
|
|
31
|
-
*/
|
|
32
|
-
queryMsgAsync(limit_count, last_time, cb, jsonExtension) {
|
|
33
|
-
return new Promise((resolve) => {
|
|
34
|
-
if (!this.sysmsg.QueryMsgAsync(limit_count, last_time, (count, unreadCount, result) => {
|
|
35
|
-
if (cb) {
|
|
36
|
-
cb(count, unreadCount, result);
|
|
37
|
-
}
|
|
38
|
-
resolve([count, unreadCount, result]);
|
|
39
|
-
}, jsonExtension)) {
|
|
40
|
-
resolve(null);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/** 查询未读消息数
|
|
45
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
46
|
-
* @param cb 查询未读消息数的回调函数
|
|
47
|
-
* @return void 无返回值
|
|
48
|
-
* @note
|
|
49
|
-
* <pre>
|
|
50
|
-
* 200:成功
|
|
51
|
-
* </pre>
|
|
52
|
-
*/
|
|
53
|
-
queryUnreadCount(cb, jsonExtension) {
|
|
54
|
-
return new Promise((resolve) => {
|
|
55
|
-
this.sysmsg.QueryUnreadCount((rescode, unreadCount) => {
|
|
56
|
-
if (cb) {
|
|
57
|
-
cb(rescode, unreadCount);
|
|
58
|
-
}
|
|
59
|
-
resolve([rescode, unreadCount]);
|
|
60
|
-
}, jsonExtension);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/** 设置消息状态
|
|
64
|
-
* @param msg_id 消息id
|
|
65
|
-
* @param status 消息状态
|
|
66
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
67
|
-
* @param cb 设置消息状态的回调函数
|
|
68
|
-
* @return void 无返回值
|
|
69
|
-
* @note
|
|
70
|
-
* <pre>
|
|
71
|
-
* 200:成功
|
|
72
|
-
* </pre>
|
|
73
|
-
*/
|
|
74
|
-
setStatusAsync(msg_id, status, cb, jsonExtension) {
|
|
75
|
-
return new Promise((resolve) => {
|
|
76
|
-
if (!this.sysmsg.SetStatusAsync(msg_id, status, (rescode, msgId, unreadCount) => {
|
|
77
|
-
if (cb) {
|
|
78
|
-
cb(rescode, msgId, unreadCount);
|
|
79
|
-
}
|
|
80
|
-
resolve([rescode, msgId, unreadCount]);
|
|
81
|
-
}, jsonExtension)) {
|
|
82
|
-
resolve(null);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
/** 设置全部消息为已读
|
|
87
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
88
|
-
* @param cb 设置全部消息为已读的回调函数
|
|
89
|
-
* @return void 无返回值
|
|
90
|
-
* @note
|
|
91
|
-
* <pre>
|
|
92
|
-
* 200:成功
|
|
93
|
-
* </pre>
|
|
94
|
-
*/
|
|
95
|
-
readAllAsync(cb, jsonExtension) {
|
|
96
|
-
return new Promise((resolve) => {
|
|
97
|
-
this.sysmsg.ReadAllAsync((rescode, unreadCount) => {
|
|
98
|
-
if (cb) {
|
|
99
|
-
cb(rescode, unreadCount);
|
|
100
|
-
}
|
|
101
|
-
resolve([rescode, unreadCount]);
|
|
102
|
-
}, jsonExtension);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
/** 删除消息
|
|
106
|
-
* @param msg_id 消息id
|
|
107
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
108
|
-
* @param cb 删除消息的回调函数
|
|
109
|
-
* @return boolean 检查参数如果不符合要求则返回失败
|
|
110
|
-
* @note
|
|
111
|
-
* <pre>
|
|
112
|
-
* 200:成功
|
|
113
|
-
* </pre>
|
|
114
|
-
*/
|
|
115
|
-
deleteAsync(msg_id, cb, jsonExtension) {
|
|
116
|
-
return new Promise((resolve) => {
|
|
117
|
-
if (!this.sysmsg.DeleteAsync(msg_id, (rescode, msgId, unreadCount) => {
|
|
118
|
-
if (cb) {
|
|
119
|
-
cb(rescode, msgId, unreadCount);
|
|
120
|
-
}
|
|
121
|
-
resolve([rescode, msgId, unreadCount]);
|
|
122
|
-
}, jsonExtension)) {
|
|
123
|
-
resolve(null);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/** 全部删除
|
|
128
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
129
|
-
* @param cb 删除消息的回调函数
|
|
130
|
-
* @return void 无返回值
|
|
131
|
-
* @note
|
|
132
|
-
* <pre>
|
|
133
|
-
* 200:成功
|
|
134
|
-
* </pre>
|
|
135
|
-
*/
|
|
136
|
-
deleteAllAsync(cb, jsonExtension) {
|
|
137
|
-
return new Promise((resolve) => {
|
|
138
|
-
if (!this.sysmsg.DeleteAllAsync((rescode, unreadCount) => {
|
|
139
|
-
if (cb) {
|
|
140
|
-
cb(rescode, unreadCount);
|
|
141
|
-
}
|
|
142
|
-
resolve([rescode, unreadCount]);
|
|
143
|
-
}, jsonExtension)) {
|
|
144
|
-
resolve(null);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
/** 按类型设置系统通知状态
|
|
149
|
-
* @param type 类型
|
|
150
|
-
* @param status 状态
|
|
151
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
152
|
-
* @param cb 回调函数
|
|
153
|
-
* @return void 无返回值
|
|
154
|
-
* @note
|
|
155
|
-
* <pre>
|
|
156
|
-
* 200:成功
|
|
157
|
-
* </pre>
|
|
158
|
-
*/
|
|
159
|
-
setStatusByTypeAsync(type, status, cb, jsonExtension) {
|
|
160
|
-
return new Promise((resolve) => {
|
|
161
|
-
if (!this.sysmsg.SetStatusByTypeAsync(type, status, (rescode, unreadCount) => {
|
|
162
|
-
if (cb) {
|
|
163
|
-
cb(rescode, unreadCount);
|
|
164
|
-
}
|
|
165
|
-
resolve([rescode, unreadCount]);
|
|
166
|
-
}, jsonExtension)) {
|
|
167
|
-
resolve(null);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/** 按类型删除系统通知
|
|
172
|
-
* @param type 类型
|
|
173
|
-
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
174
|
-
* @param cb 回调函数
|
|
175
|
-
* @return void 无返回值
|
|
176
|
-
* @note
|
|
177
|
-
* <pre>
|
|
178
|
-
* 200:成功
|
|
179
|
-
* </pre>
|
|
180
|
-
*/
|
|
181
|
-
deleteByTypeAsync(type, cb, jsonExtension) {
|
|
182
|
-
return new Promise((resolve) => {
|
|
183
|
-
if (!this.sysmsg.DeleteByTypeAsync(type, (rescode, unreadCount) => {
|
|
184
|
-
if (cb) {
|
|
185
|
-
cb(rescode, unreadCount);
|
|
186
|
-
}
|
|
187
|
-
resolve([rescode, unreadCount]);
|
|
188
|
-
}, jsonExtension)) {
|
|
189
|
-
resolve(null);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
exports.NIMSysMsg = NIMSysMsg;
|
|
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
|
+
exports.NIMSysMsg = void 0;
|
|
7
|
+
const loader_1 = __importDefault(require("../loader"));
|
|
8
|
+
const eventemitter3_1 = require("eventemitter3");
|
|
9
|
+
class NIMSysMsg extends eventemitter3_1.EventEmitter {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.sysmsg = new loader_1.default.NIMSystemMsg({ emit: this.emit.bind(this) });
|
|
13
|
+
}
|
|
14
|
+
/** 注册全局回调 */
|
|
15
|
+
initEventHandlers() {
|
|
16
|
+
return this.sysmsg.InitEventHandlers();
|
|
17
|
+
}
|
|
18
|
+
/** 发送自定义通知消息
|
|
19
|
+
* @param json_msg 消息体Json, 可以通过CreateCustomNotificationMsg方法自动创建
|
|
20
|
+
* @return void 无返回值
|
|
21
|
+
*/
|
|
22
|
+
sendCustomNotificationMsg(msg) {
|
|
23
|
+
return this.sysmsg.SendCustomNotificationMsg(msg);
|
|
24
|
+
}
|
|
25
|
+
/** 查询本地系统消息
|
|
26
|
+
* @param limit_count 一次查询数量,建议20
|
|
27
|
+
* @param last_time 上次查询最后一条消息的时间戳
|
|
28
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
29
|
+
* @param cb 查询本地系统消息的回调函数
|
|
30
|
+
* @return boolean 检查参数如果不符合要求则返回失败
|
|
31
|
+
*/
|
|
32
|
+
queryMsgAsync(limit_count, last_time, cb, jsonExtension) {
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
if (!this.sysmsg.QueryMsgAsync(limit_count, last_time, (count, unreadCount, result) => {
|
|
35
|
+
if (cb) {
|
|
36
|
+
cb(count, unreadCount, result);
|
|
37
|
+
}
|
|
38
|
+
resolve([count, unreadCount, result]);
|
|
39
|
+
}, jsonExtension)) {
|
|
40
|
+
resolve(null);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** 查询未读消息数
|
|
45
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
46
|
+
* @param cb 查询未读消息数的回调函数
|
|
47
|
+
* @return void 无返回值
|
|
48
|
+
* @note
|
|
49
|
+
* <pre>
|
|
50
|
+
* 200:成功
|
|
51
|
+
* </pre>
|
|
52
|
+
*/
|
|
53
|
+
queryUnreadCount(cb, jsonExtension) {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
this.sysmsg.QueryUnreadCount((rescode, unreadCount) => {
|
|
56
|
+
if (cb) {
|
|
57
|
+
cb(rescode, unreadCount);
|
|
58
|
+
}
|
|
59
|
+
resolve([rescode, unreadCount]);
|
|
60
|
+
}, jsonExtension);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** 设置消息状态
|
|
64
|
+
* @param msg_id 消息id
|
|
65
|
+
* @param status 消息状态
|
|
66
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
67
|
+
* @param cb 设置消息状态的回调函数
|
|
68
|
+
* @return void 无返回值
|
|
69
|
+
* @note
|
|
70
|
+
* <pre>
|
|
71
|
+
* 200:成功
|
|
72
|
+
* </pre>
|
|
73
|
+
*/
|
|
74
|
+
setStatusAsync(msg_id, status, cb, jsonExtension) {
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
if (!this.sysmsg.SetStatusAsync(msg_id, status, (rescode, msgId, unreadCount) => {
|
|
77
|
+
if (cb) {
|
|
78
|
+
cb(rescode, msgId, unreadCount);
|
|
79
|
+
}
|
|
80
|
+
resolve([rescode, msgId, unreadCount]);
|
|
81
|
+
}, jsonExtension)) {
|
|
82
|
+
resolve(null);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** 设置全部消息为已读
|
|
87
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
88
|
+
* @param cb 设置全部消息为已读的回调函数
|
|
89
|
+
* @return void 无返回值
|
|
90
|
+
* @note
|
|
91
|
+
* <pre>
|
|
92
|
+
* 200:成功
|
|
93
|
+
* </pre>
|
|
94
|
+
*/
|
|
95
|
+
readAllAsync(cb, jsonExtension) {
|
|
96
|
+
return new Promise((resolve) => {
|
|
97
|
+
this.sysmsg.ReadAllAsync((rescode, unreadCount) => {
|
|
98
|
+
if (cb) {
|
|
99
|
+
cb(rescode, unreadCount);
|
|
100
|
+
}
|
|
101
|
+
resolve([rescode, unreadCount]);
|
|
102
|
+
}, jsonExtension);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** 删除消息
|
|
106
|
+
* @param msg_id 消息id
|
|
107
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
108
|
+
* @param cb 删除消息的回调函数
|
|
109
|
+
* @return boolean 检查参数如果不符合要求则返回失败
|
|
110
|
+
* @note
|
|
111
|
+
* <pre>
|
|
112
|
+
* 200:成功
|
|
113
|
+
* </pre>
|
|
114
|
+
*/
|
|
115
|
+
deleteAsync(msg_id, cb, jsonExtension) {
|
|
116
|
+
return new Promise((resolve) => {
|
|
117
|
+
if (!this.sysmsg.DeleteAsync(msg_id, (rescode, msgId, unreadCount) => {
|
|
118
|
+
if (cb) {
|
|
119
|
+
cb(rescode, msgId, unreadCount);
|
|
120
|
+
}
|
|
121
|
+
resolve([rescode, msgId, unreadCount]);
|
|
122
|
+
}, jsonExtension)) {
|
|
123
|
+
resolve(null);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/** 全部删除
|
|
128
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
129
|
+
* @param cb 删除消息的回调函数
|
|
130
|
+
* @return void 无返回值
|
|
131
|
+
* @note
|
|
132
|
+
* <pre>
|
|
133
|
+
* 200:成功
|
|
134
|
+
* </pre>
|
|
135
|
+
*/
|
|
136
|
+
deleteAllAsync(cb, jsonExtension) {
|
|
137
|
+
return new Promise((resolve) => {
|
|
138
|
+
if (!this.sysmsg.DeleteAllAsync((rescode, unreadCount) => {
|
|
139
|
+
if (cb) {
|
|
140
|
+
cb(rescode, unreadCount);
|
|
141
|
+
}
|
|
142
|
+
resolve([rescode, unreadCount]);
|
|
143
|
+
}, jsonExtension)) {
|
|
144
|
+
resolve(null);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** 按类型设置系统通知状态
|
|
149
|
+
* @param type 类型
|
|
150
|
+
* @param status 状态
|
|
151
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
152
|
+
* @param cb 回调函数
|
|
153
|
+
* @return void 无返回值
|
|
154
|
+
* @note
|
|
155
|
+
* <pre>
|
|
156
|
+
* 200:成功
|
|
157
|
+
* </pre>
|
|
158
|
+
*/
|
|
159
|
+
setStatusByTypeAsync(type, status, cb, jsonExtension) {
|
|
160
|
+
return new Promise((resolve) => {
|
|
161
|
+
if (!this.sysmsg.SetStatusByTypeAsync(type, status, (rescode, unreadCount) => {
|
|
162
|
+
if (cb) {
|
|
163
|
+
cb(rescode, unreadCount);
|
|
164
|
+
}
|
|
165
|
+
resolve([rescode, unreadCount]);
|
|
166
|
+
}, jsonExtension)) {
|
|
167
|
+
resolve(null);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/** 按类型删除系统通知
|
|
172
|
+
* @param type 类型
|
|
173
|
+
* @param jsonExtension json扩展参数(备用,目前不需要)
|
|
174
|
+
* @param cb 回调函数
|
|
175
|
+
* @return void 无返回值
|
|
176
|
+
* @note
|
|
177
|
+
* <pre>
|
|
178
|
+
* 200:成功
|
|
179
|
+
* </pre>
|
|
180
|
+
*/
|
|
181
|
+
deleteByTypeAsync(type, cb, jsonExtension) {
|
|
182
|
+
return new Promise((resolve) => {
|
|
183
|
+
if (!this.sysmsg.DeleteByTypeAsync(type, (rescode, unreadCount) => {
|
|
184
|
+
if (cb) {
|
|
185
|
+
cb(rescode, unreadCount);
|
|
186
|
+
}
|
|
187
|
+
resolve([rescode, unreadCount]);
|
|
188
|
+
}, jsonExtension)) {
|
|
189
|
+
resolve(null);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.NIMSysMsg = NIMSysMsg;
|
|
195
195
|
//# sourceMappingURL=sysmsg.js.map
|