node-nim 9.14.2 → 9.14.4

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.
Files changed (132) hide show
  1. package/dist/chatroom/chatroom.js +262 -262
  2. package/dist/chatroom_def/chatroom_def.js +119 -119
  3. package/dist/loader.js +35 -35
  4. package/dist/nim/client.js +184 -184
  5. package/dist/nim/data_sync.js +19 -19
  6. package/dist/nim/friend.js +150 -150
  7. package/dist/nim/global.js +131 -131
  8. package/dist/nim/msglog.js +687 -687
  9. package/dist/nim/nos.js +180 -180
  10. package/dist/nim/online_session.js +85 -85
  11. package/dist/nim/pass_through_proxy.js +39 -39
  12. package/dist/nim/plugin.js +65 -65
  13. package/dist/nim/session.js +392 -392
  14. package/dist/nim/subscribe_event.js +142 -142
  15. package/dist/nim/super_team.js +651 -592
  16. package/dist/nim/super_team.js.map +1 -1
  17. package/dist/nim/sysmsg.js +194 -194
  18. package/dist/nim/talk.js +209 -209
  19. package/dist/nim/talk.js.map +1 -1
  20. package/dist/nim/talkex.js +191 -191
  21. package/dist/nim/team.js +866 -818
  22. package/dist/nim/team.js.map +1 -1
  23. package/dist/nim/tool.js +119 -119
  24. package/dist/nim/user.js +201 -201
  25. package/dist/nim_def/client_def.js +245 -245
  26. package/dist/nim_def/data_sync_def.js +20 -20
  27. package/dist/nim_def/doc_trans_def.js +16 -16
  28. package/dist/nim_def/friend_def.js +37 -37
  29. package/dist/nim_def/global_def.js +39 -39
  30. package/dist/nim_def/msglog_def.js +148 -148
  31. package/dist/nim_def/nos_def.js +16 -16
  32. package/dist/nim_def/online_session_def.js +2 -2
  33. package/dist/nim_def/pass_through_proxy_def.js +10 -10
  34. package/dist/nim_def/plugin_def.js +2 -2
  35. package/dist/nim_def/session_def.js +26 -26
  36. package/dist/nim_def/subscribe_event_def.js +52 -52
  37. package/dist/nim_def/super_team_def.js +71 -64
  38. package/dist/nim_def/super_team_def.js.map +1 -1
  39. package/dist/nim_def/sysmsg_def.js +28 -28
  40. package/dist/nim_def/talk_def.js +2 -2
  41. package/dist/nim_def/talkex_def.js +2 -2
  42. package/dist/nim_def/team_def.js +76 -69
  43. package/dist/nim_def/team_def.js.map +1 -1
  44. package/dist/nim_def/tool_def.js +11 -11
  45. package/dist/nim_def/user_def.js +22 -22
  46. package/dist/node-nim.js +171 -171
  47. package/dist/qchat/attachment.js +63 -63
  48. package/dist/qchat/channel.js +314 -314
  49. package/dist/qchat/channel_category.js +187 -187
  50. package/dist/qchat/instance.js +77 -77
  51. package/dist/qchat/message.js +285 -285
  52. package/dist/qchat/role.js +423 -423
  53. package/dist/qchat/server.js +453 -453
  54. package/dist/qchat/system_notification.js +74 -74
  55. package/dist/qchat_def/attachment_def.js +2 -2
  56. package/dist/qchat_def/channel_def.js +2 -2
  57. package/dist/qchat_def/instance_def.js +2 -2
  58. package/dist/qchat_def/message_def.js +2 -2
  59. package/dist/qchat_def/public_def.js +649 -649
  60. package/dist/qchat_def/role_def.js +2 -2
  61. package/dist/qchat_def/server_def.js +2 -2
  62. package/dist/qchat_def/system_notification_def.js +2 -2
  63. package/dist/v2/v2_nim_instance.js +43 -43
  64. package/dist/v2/v2_nim_login_service.js +123 -123
  65. package/dist/v2_def/v2_nim_callback_def.js +2 -2
  66. package/dist/v2_def/v2_nim_enum_def.js +325 -325
  67. package/dist/v2_def/v2_nim_struct_def.js +2 -2
  68. package/package.json +74 -74
  69. package/script/download-sdk.js +78 -78
  70. package/script/exec-node-nim-tester.js +17 -17
  71. package/types/chatroom/chatroom.d.ts +55 -55
  72. package/types/chatroom_def/chatroom_def.d.ts +448 -448
  73. package/types/loader.d.ts +2 -2
  74. package/types/nim/client.d.ts +123 -123
  75. package/types/nim/data_sync.d.ts +12 -12
  76. package/types/nim/friend.d.ts +82 -82
  77. package/types/nim/global.d.ts +69 -69
  78. package/types/nim/msglog.d.ts +392 -392
  79. package/types/nim/nos.d.ts +118 -118
  80. package/types/nim/online_session.d.ts +44 -44
  81. package/types/nim/pass_through_proxy.d.ts +24 -24
  82. package/types/nim/plugin.d.ts +39 -39
  83. package/types/nim/session.d.ts +212 -212
  84. package/types/nim/subscribe_event.d.ts +87 -87
  85. package/types/nim/super_team.d.ts +356 -331
  86. package/types/nim/sysmsg.d.ts +105 -105
  87. package/types/nim/talk.d.ts +94 -94
  88. package/types/nim/talkex.d.ts +95 -95
  89. package/types/nim/team.d.ts +481 -461
  90. package/types/nim/tool.d.ts +77 -77
  91. package/types/nim/user.d.ts +111 -111
  92. package/types/nim_def/client_def.d.ts +284 -284
  93. package/types/nim_def/data_sync_def.d.ts +19 -19
  94. package/types/nim_def/doc_trans_def.d.ts +11 -11
  95. package/types/nim_def/friend_def.d.ts +65 -65
  96. package/types/nim_def/global_def.d.ts +62 -62
  97. package/types/nim_def/msglog_def.d.ts +373 -373
  98. package/types/nim_def/nos_def.d.ts +72 -72
  99. package/types/nim_def/online_session_def.d.ts +34 -34
  100. package/types/nim_def/pass_through_proxy_def.d.ts +13 -13
  101. package/types/nim_def/plugin_def.d.ts +8 -8
  102. package/types/nim_def/session_def.d.ts +114 -114
  103. package/types/nim_def/subscribe_event_def.d.ts +83 -83
  104. package/types/nim_def/super_team_def.d.ts +165 -137
  105. package/types/nim_def/sysmsg_def.d.ts +70 -70
  106. package/types/nim_def/talk_def.d.ts +96 -96
  107. package/types/nim_def/talkex_def.d.ts +112 -112
  108. package/types/nim_def/team_def.d.ts +186 -167
  109. package/types/nim_def/tool_def.d.ts +28 -28
  110. package/types/nim_def/user_def.d.ts +59 -59
  111. package/types/node-nim.d.ts +93 -93
  112. package/types/qchat/attachment.d.ts +40 -40
  113. package/types/qchat/channel.d.ts +139 -139
  114. package/types/qchat/channel_category.d.ts +82 -82
  115. package/types/qchat/instance.d.ts +46 -46
  116. package/types/qchat/message.d.ts +128 -128
  117. package/types/qchat/role.d.ts +166 -166
  118. package/types/qchat/server.d.ts +198 -198
  119. package/types/qchat/system_notification.d.ts +39 -39
  120. package/types/qchat_def/attachment_def.d.ts +71 -71
  121. package/types/qchat_def/channel_def.d.ts +643 -643
  122. package/types/qchat_def/instance_def.d.ts +214 -214
  123. package/types/qchat_def/message_def.d.ts +565 -565
  124. package/types/qchat_def/public_def.d.ts +754 -754
  125. package/types/qchat_def/role_def.d.ts +413 -413
  126. package/types/qchat_def/server_def.d.ts +529 -529
  127. package/types/qchat_def/system_notification_def.d.ts +172 -172
  128. package/types/v2/v2_nim_instance.d.ts +25 -25
  129. package/types/v2/v2_nim_login_service.d.ts +96 -96
  130. package/types/v2_def/v2_nim_callback_def.d.ts +20 -20
  131. package/types/v2_def/v2_nim_enum_def.d.ts +300 -300
  132. package/types/v2_def/v2_nim_struct_def.d.ts +338 -338
@@ -1,393 +1,393 @@
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.NIMSession = void 0;
7
- const loader_1 = __importDefault(require("../loader"));
8
- const eventemitter3_1 = require("eventemitter3");
9
- class NIMSession extends eventemitter3_1.EventEmitter {
10
- constructor() {
11
- super();
12
- this.session = new loader_1.default.NIMSession({ emit: this.emit.bind(this) });
13
- }
14
- /** 注册全局回调 */
15
- initEventHandlers() {
16
- return this.session.InitEventHandlers();
17
- }
18
- /** 查询置顶会话列表
19
- * @param cb 置顶会话列表查询结果的回调函数
20
- * @return void 无返回值
21
- * @note
22
- * <pre>
23
- * 200:成功
24
- * </pre>
25
- */
26
- queryStickTopSessionList(cb) {
27
- return new Promise((resolve) => {
28
- this.session.QueryStickTopSessionList((rescode, result) => {
29
- if (cb) {
30
- cb(rescode, result);
31
- }
32
- resolve([rescode, result]);
33
- });
34
- });
35
- }
36
- /** 设置置顶会话
37
- * @param session_id 会话id
38
- * @param to_type 会话类型
39
- * @param ext 扩展字段
40
- * @param cb 置顶会话设置结果的回调函数
41
- * @return void 无返回值
42
- * @note
43
- * <pre>
44
- * 200:成功
45
- * </pre>
46
- */
47
- setToStickTopSession(session_id, to_type, ext, cb) {
48
- return new Promise((resolve) => {
49
- this.session.SetToStickTopSession(session_id, to_type, ext, (rescode, result) => {
50
- if (cb) {
51
- cb(rescode, result);
52
- }
53
- resolve([rescode, result]);
54
- });
55
- });
56
- }
57
- /** 更新置顶会话列表
58
- * @param session_id 会话id
59
- * @param to_type 会话类型
60
- * @param ext 扩展字段
61
- * @param cb 更新置顶会话设置结果的回调函数
62
- * @return void 无返回值
63
- * @note
64
- * <pre>
65
- * 200:成功
66
- * </pre>
67
- */
68
- updateToStickTopSession(session_id, to_type, ext, cb) {
69
- return new Promise((resolve) => {
70
- this.session.UpdateToStickTopSession(session_id, to_type, ext, (rescode, result) => {
71
- if (cb) {
72
- cb(rescode, result);
73
- }
74
- resolve([rescode, result]);
75
- });
76
- });
77
- }
78
- /** 取消置顶会话列表
79
- * @param session_id 会话id
80
- * @param to_type 会话类型
81
- * @param cb 取消置顶会话设置结果的回调函数
82
- * @return void 无返回值
83
- * @note
84
- * <pre>
85
- * 200:成功
86
- * </pre>
87
- */
88
- cancelToStickTopSession(session_id, to_type, cb) {
89
- return new Promise((resolve) => {
90
- this.session.CancelToStickTopSession(session_id, to_type, (rescode, session_id, session_type) => {
91
- if (cb) {
92
- cb(rescode, session_id, session_type);
93
- }
94
- resolve([rescode, session_id, session_type]);
95
- });
96
- });
97
- }
98
- /** 查询指定数量的最后会话数据
99
- * @param limit 要返回的最大数量
100
- * @param cb 查询会话列表的回调函数
101
- * @param jsonExtension json扩展参数(备用,目前不需要)
102
- * @return void 无返回值
103
- */
104
- queryLastFewSessionAsync(limit, cb, jsonExtension) {
105
- return new Promise((resolve) => {
106
- this.session.QueryLastFewSessionAsync(limit, (rescode, result) => {
107
- if (cb) {
108
- cb(rescode, result);
109
- }
110
- resolve([rescode, result]);
111
- }, jsonExtension);
112
- });
113
- }
114
- /** 查询会话列表,可指定最后一条会话消息要排除掉的类型(列表)
115
- * @param msg_excluded_type_list 最后一条会话消息要排除掉的类型(列表),如果不排除任何消息,传入空列表
116
- * @param cb 查询会话列表的回调函数
117
- * @param jsonExtension json扩展参数(备用,目前不需要)
118
- * @return void 无返回值
119
- */
120
- queryAllRecentSessionAsync(msg_excluded_type_list, cb, jsonExtension) {
121
- return new Promise((resolve) => {
122
- this.session.QueryAllRecentSessionAsync(msg_excluded_type_list, (rescode, result) => {
123
- if (cb) {
124
- cb(rescode, result);
125
- }
126
- resolve([rescode, result]);
127
- }, jsonExtension);
128
- });
129
- }
130
- /** 删除最近联系人
131
- * @param to_type 会话类型,双人0,群组1 (nim_msglog_def.h)
132
- * @param id 对方的account id或者群组tid。
133
- * @param delete_roaming 是否同时删除漫游消息
134
- * @param cb 最近会话列表项变更的回调函数
135
- * @return boolean 检查参数如果不符合要求则返回失败
136
- * @note
137
- * <pre>
138
- * 200:成功
139
- * </pre>
140
- */
141
- deleteRecentSession(type, id, cb, delete_roaming) {
142
- return new Promise((resolve) => {
143
- this.session.DeleteRecentSession(type, id, (rescode, session_data, count) => {
144
- if (cb) {
145
- cb(rescode, session_data, count);
146
- }
147
- resolve([rescode, session_data, count]);
148
- }, delete_roaming);
149
- });
150
- }
151
- /** 删除全部最近联系人
152
- * @param jsonExtension json扩展参数(备用,目前不需要)
153
- * @param cb 最近会话列表项变更的回调函数
154
- * @return void 无返回值
155
- * @note
156
- * <pre>
157
- * 200:成功
158
- * </pre>
159
- */
160
- deleteAllRecentSession(cb, jsonExtension) {
161
- return new Promise((resolve) => {
162
- this.session.DeleteAllRecentSession((rescode, session_data, count) => {
163
- if (cb) {
164
- cb(rescode, session_data, count);
165
- }
166
- resolve([rescode, session_data, count]);
167
- }, jsonExtension);
168
- });
169
- }
170
- /** 删除某会话的漫游消息
171
- * @param to_type 会话类型,双人0,群组1 (nim_msglog_def.h)
172
- * @param id 对方的account id或者群组tid。
173
- * @param jsonExtension json扩展参数(备用,目前不需要)
174
- * @param cb 删除结果 回调回调函数
175
- * @return boolean 检查参数如果不符合要求则返回失败
176
- * @note
177
- * <pre>
178
- * 200:成功
179
- * </pre>
180
- */
181
- deleteSessionRoamingMessage(to_type, session_id, cb, ext) {
182
- return new Promise((resolve) => {
183
- this.session.DeleteSessionRoamingMessage(to_type, session_id, (rescode, to_type, session_id) => {
184
- if (cb) {
185
- cb(rescode, to_type, session_id);
186
- }
187
- resolve([rescode, to_type, session_id]);
188
- }, ext);
189
- });
190
- }
191
- /** 最近联系人项未读数清零
192
- * @param to_type 会话类型,双人0,群组1 (nim_msglog_def.h)
193
- * @param id 对方的account id或者群组tid。
194
- * @param jsonExtension json扩展参数(备用,目前不需要)
195
- * @param cb 最近会话列表项变更的回调函数
196
- * @return boolean 检查参数如果不符合要求则返回失败
197
- * @note
198
- * <pre>
199
- * 200:成功
200
- * </pre>
201
- */
202
- setUnreadCountZeroAsync(type, id, cb, jsonExtension) {
203
- return new Promise((resolve) => {
204
- if (!this.session.SetUnreadCountZeroAsync(type, id, (rescode, session_data, count) => {
205
- if (cb) {
206
- cb(rescode, session_data, count);
207
- }
208
- resolve([rescode, session_data, count]);
209
- }, jsonExtension)) {
210
- resolve(null);
211
- }
212
- });
213
- }
214
- /** 最近联系人项未读数清零
215
- * @param is_super_team 会话列表中的会话是否是超大群会话
216
- * @param zero_list 清零的会话信息列表。
217
- * @param cb 最近会话列表项变更的回调函数
218
- * @return boolean 检查参数如果不符合要求则返回失败
219
- * @note
220
- * <pre>
221
- * 200:成功
222
- * </pre>
223
- */
224
- setMultiUnreadCountZeroAsync(is_super_team, zero_list, cb) {
225
- return new Promise((resolve) => {
226
- if (!this.session.SetMultiUnreadCountZeroAsync(is_super_team, zero_list, (rescode, data_list, unread_count) => {
227
- if (cb) {
228
- cb(rescode, data_list, unread_count);
229
- }
230
- resolve([rescode, data_list, unread_count]);
231
- })) {
232
- resolve(null);
233
- }
234
- });
235
- }
236
- /** 设置会话项是否置顶(置顶属性只保存在本地)
237
- * @param to_type 会话类型
238
- * @param id 对方的account id或者群组tid。
239
- * @param top true - 置顶 false - 取消置顶
240
- * @param cb 回调函数
241
- * @param jsonExtension json扩展参数(备用,目前不需要)
242
- * @return boolean 检查参数如果不符合要求则返回失败
243
- * @note
244
- * <pre>
245
- * 200:成功
246
- * </pre>
247
- */
248
- setSessionTop(type, id, top, cb, jsonExtension) {
249
- return new Promise((resolve) => {
250
- if (!this.session.SetSessionTop(type, id, top, (rescode, session_data, count) => {
251
- if (cb) {
252
- cb(rescode, session_data, count);
253
- }
254
- resolve([rescode, session_data, count]);
255
- }, jsonExtension)) {
256
- resolve(null);
257
- }
258
- });
259
- }
260
- /** 设置会话项扩展数据(扩展数据只保存在本地)
261
- * @param to_type 会话类型
262
- * @param id 对方的account id或者群组tid。
263
- * @param data 扩展数据,建议使用灵活可扩展的数据结构,例如Json
264
- * @param cb 回调函数
265
- * @param jsonExtension json扩展参数(备用,目前不需要)
266
- * @return boolean 检查参数如果不符合要求则返回失败
267
- * @note
268
- * <pre>
269
- * 200:成功
270
- * </pre>
271
- */
272
- setSessionExtendData(type, id, data, cb, jsonExtension) {
273
- return new Promise((resolve) => {
274
- if (!this.session.SetSessionExtendData(type, id, data, (rescode, session_data, count) => {
275
- if (cb) {
276
- cb(rescode, session_data, count);
277
- }
278
- resolve([rescode, session_data, count]);
279
- }, jsonExtension)) {
280
- resolve(null);
281
- }
282
- });
283
- }
284
- /** 最近联系人项全部未读数清零
285
- * @param jsonExtension json扩展参数(备用,目前不需要)
286
- * @param cb 最近会话列表项变更的回调函数
287
- * @return boolean 检查参数如果不符合要求则返回失败
288
- * @note
289
- * <pre>
290
- * 200:成功
291
- * </pre>
292
- */
293
- setAllUnreadCountZeroAsync(cb, jsonExtension) {
294
- return new Promise((resolve) => {
295
- if (!this.session.SetAllUnreadCountZeroAsync((rescode, session_data, count) => {
296
- if (cb) {
297
- cb(rescode, session_data, count);
298
- }
299
- resolve([rescode, session_data, count]);
300
- }, jsonExtension)) {
301
- resolve(null);
302
- }
303
- });
304
- }
305
- /** 根据给定的id查询相应会话的信息
306
- * @param to_type 会话类型
307
- * @param id 对方的account id或者群组tid。
308
- * @param cb 会话信息查询结果的回调函数
309
- * @param jsonExtension json扩展参数(备用,目前不需要)
310
- * @return void 无返回值
311
- * @note
312
- * <pre>
313
- * 200:成功
314
- * </pre>
315
- */
316
- querySessionDataById(type, id, cb, jsonExtension) {
317
- return new Promise((resolve) => {
318
- this.session.QuerySessionDataById(type, id, (rescode, session_data) => {
319
- if (cb) {
320
- cb(rescode, session_data);
321
- }
322
- resolve([rescode, session_data]);
323
- }, jsonExtension);
324
- });
325
- }
326
- /** 查询会话是漫游消息未拉取信息
327
- * @param session_id 会话id
328
- * @param to_type 会话类型
329
- * @param cb 查询会话是漫游消息未拉取信息回调函数
330
- * @return void 无返回值
331
- * @note
332
- * <pre>
333
- * 200:成功
334
- * </pre>
335
- */
336
- queryHasmoreRoammsg(session_id, to_type, cb) {
337
- return new Promise((resolve) => {
338
- this.session.QueryHasmoreRoammsg(session_id, to_type, (rescode, info) => {
339
- if (cb) {
340
- cb(rescode, info);
341
- }
342
- resolve([rescode, info]);
343
- });
344
- });
345
- }
346
- /** 查询所有漫游消息未拉取完全的会话
347
- * @param cb 结果回调
348
- * @return void 无返回值
349
- */
350
- queryAllHasmoreRoammsg(cb) {
351
- return new Promise((resolve) => {
352
- this.session.QueryAllHasmoreRoammsg((rescode, infos) => {
353
- if (cb) {
354
- cb(rescode, infos);
355
- }
356
- resolve([rescode, infos]);
357
- });
358
- });
359
- }
360
- /** 更新会话是漫游消息未拉取信息
361
- * @param msg 对应的消息内容
362
- * @param cb 结果回调
363
- * @return void 无返回值
364
- */
365
- updateHasmoreRoammsg(msg, cb) {
366
- return new Promise((resolve) => {
367
- this.session.UpdateHasmoreRoammsg(msg, (rescode) => {
368
- if (cb) {
369
- cb(rescode);
370
- }
371
- resolve([rescode]);
372
- });
373
- });
374
- }
375
- /** 删除会话是漫游消息未拉取信息
376
- * @param session_id 会话id
377
- * @param to_type 会话类型
378
- * @param cb 结果回调
379
- * @return void 无返回值
380
- */
381
- deleteHasmoreRoammsg(session_id, to_type, cb) {
382
- return new Promise((resolve) => {
383
- this.session.DeleteHasmoreRoammsg(session_id, to_type, (rescode) => {
384
- if (cb) {
385
- cb(rescode);
386
- }
387
- resolve([rescode]);
388
- });
389
- });
390
- }
391
- }
392
- exports.NIMSession = NIMSession;
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.NIMSession = void 0;
7
+ const loader_1 = __importDefault(require("../loader"));
8
+ const eventemitter3_1 = require("eventemitter3");
9
+ class NIMSession extends eventemitter3_1.EventEmitter {
10
+ constructor() {
11
+ super();
12
+ this.session = new loader_1.default.NIMSession({ emit: this.emit.bind(this) });
13
+ }
14
+ /** 注册全局回调 */
15
+ initEventHandlers() {
16
+ return this.session.InitEventHandlers();
17
+ }
18
+ /** 查询置顶会话列表
19
+ * @param cb 置顶会话列表查询结果的回调函数
20
+ * @return void 无返回值
21
+ * @note
22
+ * <pre>
23
+ * 200:成功
24
+ * </pre>
25
+ */
26
+ queryStickTopSessionList(cb) {
27
+ return new Promise((resolve) => {
28
+ this.session.QueryStickTopSessionList((rescode, result) => {
29
+ if (cb) {
30
+ cb(rescode, result);
31
+ }
32
+ resolve([rescode, result]);
33
+ });
34
+ });
35
+ }
36
+ /** 设置置顶会话
37
+ * @param session_id 会话id
38
+ * @param to_type 会话类型
39
+ * @param ext 扩展字段
40
+ * @param cb 置顶会话设置结果的回调函数
41
+ * @return void 无返回值
42
+ * @note
43
+ * <pre>
44
+ * 200:成功
45
+ * </pre>
46
+ */
47
+ setToStickTopSession(session_id, to_type, ext, cb) {
48
+ return new Promise((resolve) => {
49
+ this.session.SetToStickTopSession(session_id, to_type, ext, (rescode, result) => {
50
+ if (cb) {
51
+ cb(rescode, result);
52
+ }
53
+ resolve([rescode, result]);
54
+ });
55
+ });
56
+ }
57
+ /** 更新置顶会话列表
58
+ * @param session_id 会话id
59
+ * @param to_type 会话类型
60
+ * @param ext 扩展字段
61
+ * @param cb 更新置顶会话设置结果的回调函数
62
+ * @return void 无返回值
63
+ * @note
64
+ * <pre>
65
+ * 200:成功
66
+ * </pre>
67
+ */
68
+ updateToStickTopSession(session_id, to_type, ext, cb) {
69
+ return new Promise((resolve) => {
70
+ this.session.UpdateToStickTopSession(session_id, to_type, ext, (rescode, result) => {
71
+ if (cb) {
72
+ cb(rescode, result);
73
+ }
74
+ resolve([rescode, result]);
75
+ });
76
+ });
77
+ }
78
+ /** 取消置顶会话列表
79
+ * @param session_id 会话id
80
+ * @param to_type 会话类型
81
+ * @param cb 取消置顶会话设置结果的回调函数
82
+ * @return void 无返回值
83
+ * @note
84
+ * <pre>
85
+ * 200:成功
86
+ * </pre>
87
+ */
88
+ cancelToStickTopSession(session_id, to_type, cb) {
89
+ return new Promise((resolve) => {
90
+ this.session.CancelToStickTopSession(session_id, to_type, (rescode, session_id, session_type) => {
91
+ if (cb) {
92
+ cb(rescode, session_id, session_type);
93
+ }
94
+ resolve([rescode, session_id, session_type]);
95
+ });
96
+ });
97
+ }
98
+ /** 查询指定数量的最后会话数据
99
+ * @param limit 要返回的最大数量
100
+ * @param cb 查询会话列表的回调函数
101
+ * @param jsonExtension json扩展参数(备用,目前不需要)
102
+ * @return void 无返回值
103
+ */
104
+ queryLastFewSessionAsync(limit, cb, jsonExtension) {
105
+ return new Promise((resolve) => {
106
+ this.session.QueryLastFewSessionAsync(limit, (rescode, result) => {
107
+ if (cb) {
108
+ cb(rescode, result);
109
+ }
110
+ resolve([rescode, result]);
111
+ }, jsonExtension);
112
+ });
113
+ }
114
+ /** 查询会话列表,可指定最后一条会话消息要排除掉的类型(列表)
115
+ * @param msg_excluded_type_list 最后一条会话消息要排除掉的类型(列表),如果不排除任何消息,传入空列表
116
+ * @param cb 查询会话列表的回调函数
117
+ * @param jsonExtension json扩展参数(备用,目前不需要)
118
+ * @return void 无返回值
119
+ */
120
+ queryAllRecentSessionAsync(msg_excluded_type_list, cb, jsonExtension) {
121
+ return new Promise((resolve) => {
122
+ this.session.QueryAllRecentSessionAsync(msg_excluded_type_list, (rescode, result) => {
123
+ if (cb) {
124
+ cb(rescode, result);
125
+ }
126
+ resolve([rescode, result]);
127
+ }, jsonExtension);
128
+ });
129
+ }
130
+ /** 删除最近联系人
131
+ * @param to_type 会话类型,双人0,群组1 (nim_msglog_def.h)
132
+ * @param id 对方的account id或者群组tid。
133
+ * @param delete_roaming 是否同时删除漫游消息
134
+ * @param cb 最近会话列表项变更的回调函数
135
+ * @return boolean 检查参数如果不符合要求则返回失败
136
+ * @note
137
+ * <pre>
138
+ * 200:成功
139
+ * </pre>
140
+ */
141
+ deleteRecentSession(type, id, cb, delete_roaming) {
142
+ return new Promise((resolve) => {
143
+ this.session.DeleteRecentSession(type, id, (rescode, session_data, count) => {
144
+ if (cb) {
145
+ cb(rescode, session_data, count);
146
+ }
147
+ resolve([rescode, session_data, count]);
148
+ }, delete_roaming);
149
+ });
150
+ }
151
+ /** 删除全部最近联系人
152
+ * @param jsonExtension json扩展参数(备用,目前不需要)
153
+ * @param cb 最近会话列表项变更的回调函数
154
+ * @return void 无返回值
155
+ * @note
156
+ * <pre>
157
+ * 200:成功
158
+ * </pre>
159
+ */
160
+ deleteAllRecentSession(cb, jsonExtension) {
161
+ return new Promise((resolve) => {
162
+ this.session.DeleteAllRecentSession((rescode, session_data, count) => {
163
+ if (cb) {
164
+ cb(rescode, session_data, count);
165
+ }
166
+ resolve([rescode, session_data, count]);
167
+ }, jsonExtension);
168
+ });
169
+ }
170
+ /** 删除某会话的漫游消息
171
+ * @param to_type 会话类型,双人0,群组1 (nim_msglog_def.h)
172
+ * @param id 对方的account id或者群组tid。
173
+ * @param jsonExtension json扩展参数(备用,目前不需要)
174
+ * @param cb 删除结果 回调回调函数
175
+ * @return boolean 检查参数如果不符合要求则返回失败
176
+ * @note
177
+ * <pre>
178
+ * 200:成功
179
+ * </pre>
180
+ */
181
+ deleteSessionRoamingMessage(to_type, session_id, cb, ext) {
182
+ return new Promise((resolve) => {
183
+ this.session.DeleteSessionRoamingMessage(to_type, session_id, (rescode, to_type, session_id) => {
184
+ if (cb) {
185
+ cb(rescode, to_type, session_id);
186
+ }
187
+ resolve([rescode, to_type, session_id]);
188
+ }, ext);
189
+ });
190
+ }
191
+ /** 最近联系人项未读数清零
192
+ * @param to_type 会话类型,双人0,群组1 (nim_msglog_def.h)
193
+ * @param id 对方的account id或者群组tid。
194
+ * @param jsonExtension json扩展参数(备用,目前不需要)
195
+ * @param cb 最近会话列表项变更的回调函数
196
+ * @return boolean 检查参数如果不符合要求则返回失败
197
+ * @note
198
+ * <pre>
199
+ * 200:成功
200
+ * </pre>
201
+ */
202
+ setUnreadCountZeroAsync(type, id, cb, jsonExtension) {
203
+ return new Promise((resolve) => {
204
+ if (!this.session.SetUnreadCountZeroAsync(type, id, (rescode, session_data, count) => {
205
+ if (cb) {
206
+ cb(rescode, session_data, count);
207
+ }
208
+ resolve([rescode, session_data, count]);
209
+ }, jsonExtension)) {
210
+ resolve(null);
211
+ }
212
+ });
213
+ }
214
+ /** 最近联系人项未读数清零
215
+ * @param is_super_team 会话列表中的会话是否是超大群会话
216
+ * @param zero_list 清零的会话信息列表。
217
+ * @param cb 最近会话列表项变更的回调函数
218
+ * @return boolean 检查参数如果不符合要求则返回失败
219
+ * @note
220
+ * <pre>
221
+ * 200:成功
222
+ * </pre>
223
+ */
224
+ setMultiUnreadCountZeroAsync(is_super_team, zero_list, cb) {
225
+ return new Promise((resolve) => {
226
+ if (!this.session.SetMultiUnreadCountZeroAsync(is_super_team, zero_list, (rescode, data_list, unread_count) => {
227
+ if (cb) {
228
+ cb(rescode, data_list, unread_count);
229
+ }
230
+ resolve([rescode, data_list, unread_count]);
231
+ })) {
232
+ resolve(null);
233
+ }
234
+ });
235
+ }
236
+ /** 设置会话项是否置顶(置顶属性只保存在本地)
237
+ * @param to_type 会话类型
238
+ * @param id 对方的account id或者群组tid。
239
+ * @param top true - 置顶 false - 取消置顶
240
+ * @param cb 回调函数
241
+ * @param jsonExtension json扩展参数(备用,目前不需要)
242
+ * @return boolean 检查参数如果不符合要求则返回失败
243
+ * @note
244
+ * <pre>
245
+ * 200:成功
246
+ * </pre>
247
+ */
248
+ setSessionTop(type, id, top, cb, jsonExtension) {
249
+ return new Promise((resolve) => {
250
+ if (!this.session.SetSessionTop(type, id, top, (rescode, session_data, count) => {
251
+ if (cb) {
252
+ cb(rescode, session_data, count);
253
+ }
254
+ resolve([rescode, session_data, count]);
255
+ }, jsonExtension)) {
256
+ resolve(null);
257
+ }
258
+ });
259
+ }
260
+ /** 设置会话项扩展数据(扩展数据只保存在本地)
261
+ * @param to_type 会话类型
262
+ * @param id 对方的account id或者群组tid。
263
+ * @param data 扩展数据,建议使用灵活可扩展的数据结构,例如Json
264
+ * @param cb 回调函数
265
+ * @param jsonExtension json扩展参数(备用,目前不需要)
266
+ * @return boolean 检查参数如果不符合要求则返回失败
267
+ * @note
268
+ * <pre>
269
+ * 200:成功
270
+ * </pre>
271
+ */
272
+ setSessionExtendData(type, id, data, cb, jsonExtension) {
273
+ return new Promise((resolve) => {
274
+ if (!this.session.SetSessionExtendData(type, id, data, (rescode, session_data, count) => {
275
+ if (cb) {
276
+ cb(rescode, session_data, count);
277
+ }
278
+ resolve([rescode, session_data, count]);
279
+ }, jsonExtension)) {
280
+ resolve(null);
281
+ }
282
+ });
283
+ }
284
+ /** 最近联系人项全部未读数清零
285
+ * @param jsonExtension json扩展参数(备用,目前不需要)
286
+ * @param cb 最近会话列表项变更的回调函数
287
+ * @return boolean 检查参数如果不符合要求则返回失败
288
+ * @note
289
+ * <pre>
290
+ * 200:成功
291
+ * </pre>
292
+ */
293
+ setAllUnreadCountZeroAsync(cb, jsonExtension) {
294
+ return new Promise((resolve) => {
295
+ if (!this.session.SetAllUnreadCountZeroAsync((rescode, session_data, count) => {
296
+ if (cb) {
297
+ cb(rescode, session_data, count);
298
+ }
299
+ resolve([rescode, session_data, count]);
300
+ }, jsonExtension)) {
301
+ resolve(null);
302
+ }
303
+ });
304
+ }
305
+ /** 根据给定的id查询相应会话的信息
306
+ * @param to_type 会话类型
307
+ * @param id 对方的account id或者群组tid。
308
+ * @param cb 会话信息查询结果的回调函数
309
+ * @param jsonExtension json扩展参数(备用,目前不需要)
310
+ * @return void 无返回值
311
+ * @note
312
+ * <pre>
313
+ * 200:成功
314
+ * </pre>
315
+ */
316
+ querySessionDataById(type, id, cb, jsonExtension) {
317
+ return new Promise((resolve) => {
318
+ this.session.QuerySessionDataById(type, id, (rescode, session_data) => {
319
+ if (cb) {
320
+ cb(rescode, session_data);
321
+ }
322
+ resolve([rescode, session_data]);
323
+ }, jsonExtension);
324
+ });
325
+ }
326
+ /** 查询会话是漫游消息未拉取信息
327
+ * @param session_id 会话id
328
+ * @param to_type 会话类型
329
+ * @param cb 查询会话是漫游消息未拉取信息回调函数
330
+ * @return void 无返回值
331
+ * @note
332
+ * <pre>
333
+ * 200:成功
334
+ * </pre>
335
+ */
336
+ queryHasmoreRoammsg(session_id, to_type, cb) {
337
+ return new Promise((resolve) => {
338
+ this.session.QueryHasmoreRoammsg(session_id, to_type, (rescode, info) => {
339
+ if (cb) {
340
+ cb(rescode, info);
341
+ }
342
+ resolve([rescode, info]);
343
+ });
344
+ });
345
+ }
346
+ /** 查询所有漫游消息未拉取完全的会话
347
+ * @param cb 结果回调
348
+ * @return void 无返回值
349
+ */
350
+ queryAllHasmoreRoammsg(cb) {
351
+ return new Promise((resolve) => {
352
+ this.session.QueryAllHasmoreRoammsg((rescode, infos) => {
353
+ if (cb) {
354
+ cb(rescode, infos);
355
+ }
356
+ resolve([rescode, infos]);
357
+ });
358
+ });
359
+ }
360
+ /** 更新会话是漫游消息未拉取信息
361
+ * @param msg 对应的消息内容
362
+ * @param cb 结果回调
363
+ * @return void 无返回值
364
+ */
365
+ updateHasmoreRoammsg(msg, cb) {
366
+ return new Promise((resolve) => {
367
+ this.session.UpdateHasmoreRoammsg(msg, (rescode) => {
368
+ if (cb) {
369
+ cb(rescode);
370
+ }
371
+ resolve([rescode]);
372
+ });
373
+ });
374
+ }
375
+ /** 删除会话是漫游消息未拉取信息
376
+ * @param session_id 会话id
377
+ * @param to_type 会话类型
378
+ * @param cb 结果回调
379
+ * @return void 无返回值
380
+ */
381
+ deleteHasmoreRoammsg(session_id, to_type, cb) {
382
+ return new Promise((resolve) => {
383
+ this.session.DeleteHasmoreRoammsg(session_id, to_type, (rescode) => {
384
+ if (cb) {
385
+ cb(rescode);
386
+ }
387
+ resolve([rescode]);
388
+ });
389
+ });
390
+ }
391
+ }
392
+ exports.NIMSession = NIMSession;
393
393
  //# sourceMappingURL=session.js.map