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.
Files changed (179) hide show
  1. package/README.md +7 -1
  2. package/dist/loader.js +35 -35
  3. package/dist/nim/client.js +184 -184
  4. package/dist/nim/client.js.map +1 -1
  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 +216 -180
  10. package/dist/nim/nos.js.map +1 -1
  11. package/dist/nim/online_session.js +85 -85
  12. package/dist/nim/pass_through_proxy.js +39 -39
  13. package/dist/nim/plugin.js +65 -65
  14. package/dist/nim/session.js +392 -392
  15. package/dist/nim/subscribe_event.js +142 -142
  16. package/dist/nim/super_team.js +592 -592
  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 +818 -818
  22. package/dist/nim/tool.js +119 -119
  23. package/dist/nim/user.js +201 -201
  24. package/dist/nim_def/client_def.js +245 -245
  25. package/dist/nim_def/client_def.js.map +1 -1
  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 +64 -64
  38. package/dist/nim_def/sysmsg_def.js +28 -28
  39. package/dist/nim_def/talk_def.js +2 -2
  40. package/dist/nim_def/talkex_def.js +2 -2
  41. package/dist/nim_def/team_def.js +69 -69
  42. package/dist/nim_def/tool_def.js +11 -11
  43. package/dist/nim_def/user_def.js +22 -22
  44. package/dist/node-nim.js +171 -171
  45. package/dist/node-nim.js.map +1 -1
  46. package/dist/qchat/attachment.js +63 -63
  47. package/dist/qchat/channel.js +314 -314
  48. package/dist/qchat/channel_category.js +187 -187
  49. package/dist/qchat/instance.js +77 -77
  50. package/dist/qchat/message.js +285 -285
  51. package/dist/qchat/role.js +423 -423
  52. package/dist/qchat/server.js +453 -453
  53. package/dist/qchat/system_notification.js +74 -74
  54. package/dist/qchat_def/attachment_def.js +2 -2
  55. package/dist/qchat_def/channel_def.js +2 -2
  56. package/dist/qchat_def/instance_def.js +2 -2
  57. package/dist/qchat_def/message_def.js +2 -2
  58. package/dist/qchat_def/public_def.js +649 -649
  59. package/dist/qchat_def/public_def.js.map +1 -1
  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_chatroom_client.js +135 -0
  64. package/dist/v2/v2_nim_chatroom_client.js.map +1 -0
  65. package/dist/v2/v2_nim_chatroom_service.js +244 -0
  66. package/dist/v2/v2_nim_chatroom_service.js.map +1 -0
  67. package/dist/v2/v2_nim_client.js +138 -0
  68. package/dist/v2/v2_nim_client.js.map +1 -0
  69. package/dist/v2/v2_nim_conversation_group_service.js +116 -0
  70. package/dist/v2/v2_nim_conversation_group_service.js.map +1 -0
  71. package/dist/v2/v2_nim_conversation_service.js +236 -0
  72. package/dist/v2/v2_nim_conversation_service.js.map +1 -0
  73. package/dist/v2/v2_nim_friend_service.js +128 -0
  74. package/dist/v2/v2_nim_friend_service.js.map +1 -0
  75. package/dist/v2/v2_nim_login_service.js +119 -123
  76. package/dist/v2/v2_nim_login_service.js.map +1 -1
  77. package/dist/v2/v2_nim_message_service.js +382 -0
  78. package/dist/v2/v2_nim_message_service.js.map +1 -0
  79. package/dist/v2/v2_nim_notification_service.js +30 -0
  80. package/dist/v2/v2_nim_notification_service.js.map +1 -0
  81. package/dist/v2/v2_nim_setting_service.js +86 -0
  82. package/dist/v2/v2_nim_setting_service.js.map +1 -0
  83. package/dist/v2/v2_nim_storage_service.js +58 -0
  84. package/dist/v2/v2_nim_storage_service.js.map +1 -0
  85. package/dist/v2/v2_nim_team_service.js +360 -0
  86. package/dist/v2/v2_nim_team_service.js.map +1 -0
  87. package/dist/v2/v2_nim_user_service.js +76 -0
  88. package/dist/v2/v2_nim_user_service.js.map +1 -0
  89. package/dist/v2/v2_nim_utilities.js +276 -0
  90. package/dist/v2/v2_nim_utilities.js.map +1 -0
  91. package/dist/v2_def/v2_nim_callback_def.js +2 -2
  92. package/dist/v2_def/v2_nim_enum_def.js +1087 -325
  93. package/dist/v2_def/v2_nim_enum_def.js.map +1 -1
  94. package/dist/v2_def/v2_nim_struct_def.js +2 -2
  95. package/package.json +74 -74
  96. package/script/download-sdk.js +78 -78
  97. package/script/exec-node-nim-tester.js +17 -17
  98. package/script/publish-to-netease-npm.js +3 -2
  99. package/types/loader.d.ts +2 -2
  100. package/types/nim/client.d.ts +123 -123
  101. package/types/nim/data_sync.d.ts +12 -12
  102. package/types/nim/friend.d.ts +82 -82
  103. package/types/nim/global.d.ts +69 -69
  104. package/types/nim/msglog.d.ts +392 -392
  105. package/types/nim/nos.d.ts +118 -118
  106. package/types/nim/online_session.d.ts +44 -44
  107. package/types/nim/pass_through_proxy.d.ts +24 -24
  108. package/types/nim/plugin.d.ts +39 -39
  109. package/types/nim/session.d.ts +212 -212
  110. package/types/nim/subscribe_event.d.ts +87 -87
  111. package/types/nim/super_team.d.ts +331 -331
  112. package/types/nim/sysmsg.d.ts +105 -105
  113. package/types/nim/talk.d.ts +94 -94
  114. package/types/nim/talkex.d.ts +95 -95
  115. package/types/nim/team.d.ts +461 -461
  116. package/types/nim/tool.d.ts +77 -77
  117. package/types/nim/user.d.ts +111 -111
  118. package/types/nim_def/client_def.d.ts +284 -284
  119. package/types/nim_def/data_sync_def.d.ts +19 -19
  120. package/types/nim_def/doc_trans_def.d.ts +11 -11
  121. package/types/nim_def/friend_def.d.ts +65 -65
  122. package/types/nim_def/global_def.d.ts +62 -62
  123. package/types/nim_def/msglog_def.d.ts +373 -373
  124. package/types/nim_def/nos_def.d.ts +72 -72
  125. package/types/nim_def/online_session_def.d.ts +34 -34
  126. package/types/nim_def/pass_through_proxy_def.d.ts +13 -13
  127. package/types/nim_def/plugin_def.d.ts +8 -8
  128. package/types/nim_def/session_def.d.ts +114 -114
  129. package/types/nim_def/subscribe_event_def.d.ts +83 -83
  130. package/types/nim_def/super_team_def.d.ts +144 -137
  131. package/types/nim_def/sysmsg_def.d.ts +70 -70
  132. package/types/nim_def/talk_def.d.ts +96 -96
  133. package/types/nim_def/talkex_def.d.ts +112 -112
  134. package/types/nim_def/team_def.d.ts +167 -167
  135. package/types/nim_def/tool_def.d.ts +28 -28
  136. package/types/nim_def/user_def.d.ts +59 -59
  137. package/types/node-nim.d.ts +90 -93
  138. package/types/qchat/attachment.d.ts +40 -40
  139. package/types/qchat/channel.d.ts +139 -139
  140. package/types/qchat/channel_category.d.ts +82 -82
  141. package/types/qchat/instance.d.ts +46 -46
  142. package/types/qchat/message.d.ts +128 -128
  143. package/types/qchat/role.d.ts +166 -166
  144. package/types/qchat/server.d.ts +198 -198
  145. package/types/qchat/system_notification.d.ts +39 -39
  146. package/types/qchat_def/attachment_def.d.ts +71 -71
  147. package/types/qchat_def/channel_def.d.ts +643 -643
  148. package/types/qchat_def/instance_def.d.ts +214 -214
  149. package/types/qchat_def/message_def.d.ts +565 -565
  150. package/types/qchat_def/public_def.d.ts +754 -754
  151. package/types/qchat_def/role_def.d.ts +413 -413
  152. package/types/qchat_def/server_def.d.ts +529 -529
  153. package/types/qchat_def/system_notification_def.d.ts +172 -172
  154. package/types/v2/v2_nim_chatroom_client.d.ts +73 -0
  155. package/types/v2/v2_nim_chatroom_service.d.ts +114 -0
  156. package/types/v2/v2_nim_client.d.ts +75 -0
  157. package/types/v2/v2_nim_conversation_group_service.d.ts +54 -0
  158. package/types/v2/v2_nim_conversation_service.d.ts +110 -0
  159. package/types/v2/v2_nim_friend_service.d.ts +58 -0
  160. package/types/v2/v2_nim_login_service.d.ts +80 -96
  161. package/types/v2/v2_nim_message_service.d.ts +143 -0
  162. package/types/v2/v2_nim_notification_service.d.ts +18 -0
  163. package/types/v2/v2_nim_setting_service.d.ts +43 -0
  164. package/types/v2/v2_nim_storage_service.d.ts +28 -0
  165. package/types/v2/v2_nim_team_service.d.ts +184 -0
  166. package/types/v2/v2_nim_user_service.d.ts +34 -0
  167. package/types/v2/v2_nim_utilities.d.ts +168 -0
  168. package/types/v2_def/v2_nim_callback_def.d.ts +7 -20
  169. package/types/v2_def/v2_nim_enum_def.d.ts +1009 -300
  170. package/types/v2_def/v2_nim_struct_def.d.ts +1539 -338
  171. package/dist/chatroom/chatroom.js +0 -263
  172. package/dist/chatroom/chatroom.js.map +0 -1
  173. package/dist/chatroom_def/chatroom_def.js +0 -120
  174. package/dist/chatroom_def/chatroom_def.js.map +0 -1
  175. package/dist/v2/v2_nim_instance.js +0 -44
  176. package/dist/v2/v2_nim_instance.js.map +0 -1
  177. package/types/chatroom/chatroom.d.ts +0 -55
  178. package/types/chatroom_def/chatroom_def.d.ts +0 -448
  179. package/types/v2/v2_nim_instance.d.ts +0 -25
package/dist/nim/team.js CHANGED
@@ -1,819 +1,819 @@
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.NIMTeam = void 0;
7
- const loader_1 = __importDefault(require("../loader"));
8
- const eventemitter3_1 = require("eventemitter3");
9
- class NIMTeam extends eventemitter3_1.EventEmitter {
10
- constructor() {
11
- super();
12
- this.team = new loader_1.default.NIMTeam({ emit: this.emit.bind(this) });
13
- }
14
- /** 注册全局回调 */
15
- initEventHandlers() {
16
- return this.team.InitEventHandlers();
17
- }
18
- /** 创建群组
19
- * @param team_info 群组信息
20
- * @param ids 邀请对象id
21
- * @param invitation_postscript 邀请附言
22
- * @param jsonExtension json扩展参数(备用,目前不需要)
23
- * @param cb 群通知的回调函数
24
- * @return boolean 检查参数如果不符合要求则返回失败
25
- * @deprecated 该接口已过时,请使用 createTeamAsyncEx 创建群组
26
- * @note
27
- * <pre>
28
- * 200:成功
29
- * 810:如果创建的是高级群,返回810表示邀请成功并带上tinfo
30
- * 414:成员不足
31
- * 801:成员数超限制
32
- * 404:成员中有非法用户
33
- * </pre>
34
- */
35
- createTeamAsync(info, ids, invitationPostscript, cb, jsonExtension) {
36
- return new Promise((resolve) => {
37
- if (!this.team.CreateTeamAsync(info, ids, invitationPostscript, (event) => {
38
- if (cb) {
39
- cb(event);
40
- }
41
- resolve([event]);
42
- }, jsonExtension)) {
43
- resolve(null);
44
- }
45
- });
46
- }
47
- /** 创建群组
48
- * @param team_info 群组信息
49
- * @param ids 邀请对象id
50
- * @param invitation_postscript 邀请附言
51
- * @param jsonExtension json扩展参数(备用,目前不需要)
52
- * @param cb 群通知的回调函数
53
- * @return boolean 检查参数如果不符合要求则返回失败
54
- * @note
55
- * <pre>
56
- * 200:成功
57
- * 810:如果创建的是高级群,返回810表示邀请成功并带上tinfo
58
- * 414:成员不足
59
- * 801:成员数超限制
60
- * 404:成员中有非法用户
61
- * </pre>
62
- */
63
- createTeamAsyncEx(info, ids, invitationPostscript, cb, jsonExtension) {
64
- return new Promise((resolve) => {
65
- if (!this.team.CreateTeamAsyncEx(info, ids, invitationPostscript, (event) => {
66
- if (cb) {
67
- cb(event);
68
- }
69
- resolve([event]);
70
- }, jsonExtension)) {
71
- resolve(null);
72
- }
73
- });
74
- }
75
- /** 解散群
76
- * @param tid 群组id
77
- * @param jsonExtension json扩展参数(备用,目前不需要)
78
- * @param cb 解散群的回调函数
79
- * @return boolean 检查参数如果不符合要求则返回失败
80
- * @note
81
- * <pre>
82
- * 200:成功
83
- * 802:没有权限
84
- * 803:群不存在
85
- * </pre>
86
- */
87
- dismissAsync(tid, cb, jsonExtension) {
88
- return new Promise((resolve) => {
89
- if (!this.team.DismissAsync(tid, (event) => {
90
- if (cb) {
91
- cb(event);
92
- }
93
- resolve([event]);
94
- }, jsonExtension)) {
95
- resolve(null);
96
- }
97
- });
98
- }
99
- /** 邀请
100
- * @param tid 群组id
101
- * @param ids 邀请对象id
102
- * @param invitation_postscript 邀请附言
103
- * @param invitation_attachment 用户可自定义的补充邀请信息
104
- * @param jsonExtension json扩展参数(备用,目前不需要)
105
- * @param cb 邀请的回调函数
106
- * @return boolean 检查参数如果不符合要求则返回失败
107
- * @note
108
- * <pre>
109
- * 200:成功
110
- * 810:如果是高级群,返回810表示邀请成功并带上timetag
111
- * 404:非法用户
112
- * 801:群人数超限
113
- * 802:没有权限
114
- * 803:群不存在
115
- * </pre>
116
- */
117
- inviteAsync(tid, ids, invitationPostscript, invitationAttachment, cb, jsonExtension) {
118
- return new Promise((resolve) => {
119
- if (!this.team.InviteAsync(tid, ids, invitationPostscript, invitationAttachment, (event) => {
120
- if (cb) {
121
- cb(event);
122
- }
123
- resolve([event]);
124
- }, jsonExtension)) {
125
- resolve(null);
126
- }
127
- });
128
- }
129
- /** 踢人
130
- * @param tid 群组id
131
- * @param ids 被踢对象id
132
- * @param jsonExtension json扩展参数(备用,目前不需要)
133
- * @param cb 踢人的回调函数
134
- * @return boolean 检查参数如果不符合要求则返回失败
135
- * @note
136
- * <pre>
137
- * 200:成功
138
- * 403:无超大群功能
139
- * 414:踢人数量超限
140
- * 802:群人数超限、不能踢自己
141
- * 803:群不存在
142
- * 804:用户不在群里面
143
- * </pre>
144
- */
145
- kickAsync(tid, ids, cb, jsonExtension) {
146
- return new Promise((resolve) => {
147
- if (!this.team.KickAsync(tid, ids, (event) => {
148
- if (cb) {
149
- cb(event);
150
- }
151
- resolve([event]);
152
- }, jsonExtension)) {
153
- resolve(null);
154
- }
155
- });
156
- }
157
- /** 离开群
158
- * @param tid 群组id
159
- * @param jsonExtension json扩展参数(备用,目前不需要)
160
- * @param cb 离开群的回调函数
161
- * @return boolean 检查参数如果不符合要求则返回失败
162
- * @note
163
- * <pre>
164
- * 200:成功
165
- * 403:无超大群功能
166
- * 802:没有群权限、群主不能退群
167
- * 803:群不存在
168
- * 804:用户不在群里
169
- * </pre>
170
- */
171
- leaveAsync(tid, cb, jsonExtension) {
172
- return new Promise((resolve) => {
173
- if (!this.team.LeaveAsync(tid, (event) => {
174
- if (cb) {
175
- cb(event);
176
- }
177
- resolve([event]);
178
- }, jsonExtension)) {
179
- resolve(null);
180
- }
181
- });
182
- }
183
- /** 更新群信息
184
- * @param tid 群组id
185
- * @param team_info 群组信息
186
- * @param jsonExtension json扩展参数(备用,目前不需要)
187
- * @param cb 更新群信息的回调函数
188
- * @return boolean 检查参数如果不符合要求则返回失败
189
- * @note
190
- * <pre>
191
- * 200:成功
192
- * 802:没有群权限、群主不能退群
193
- * 803:群不存在
194
- * </pre>
195
- */
196
- updateTeamInfoAsync(tid, info, cb, jsonExtension) {
197
- return new Promise((resolve) => {
198
- if (!this.team.UpdateTeamInfoAsync(tid, info, (event) => {
199
- if (cb) {
200
- cb(event);
201
- }
202
- resolve([event]);
203
- }, jsonExtension)) {
204
- resolve(null);
205
- }
206
- });
207
- }
208
- /** 申请入群
209
- * @param tid 群组id
210
- * @param reason 附言
211
- * @param jsonExtension json扩展参数(备用,目前不需要)
212
- * @param cb 申请入群的回调函数
213
- * @return boolean 检查参数如果不符合要求则返回失败
214
- * @note
215
- * <pre>
216
- * 200:成功
217
- * 802:群验证方式为拒绝所有人申请
218
- * 808:申请成功,等待验证
219
- * 809:已经在群里
220
- * 801:人数限制
221
- * 803:群不存在
222
- * 805:群类型不对
223
- * </pre>
224
- */
225
- applyJoinAsync(tid, reason, cb, jsonExtension) {
226
- return new Promise((resolve) => {
227
- if (!this.team.ApplyJoinAsync(tid, reason, (event) => {
228
- if (cb) {
229
- cb(event);
230
- }
231
- resolve([event]);
232
- }, jsonExtension)) {
233
- resolve(null);
234
- }
235
- });
236
- }
237
- /** 同意入群申请
238
- * @param tid 群组id
239
- * @param applicant_id 申请者id
240
- * @param jsonExtension json扩展参数(备用,目前不需要)
241
- * @param cb 同意入群申请的回调函数
242
- * @return boolean 检查参数如果不符合要求则返回失败
243
- * @note
244
- * <pre>
245
- * 200:成功
246
- * 509:操作已失效
247
- * 809:已经在群里
248
- * 801:人数限制
249
- * 802:没有权限
250
- * 803:群不存在
251
- * 805:群类型不对
252
- * </pre>
253
- */
254
- passJoinApplyAsync(tid, applicantId, cb, jsonExtension) {
255
- return new Promise((resolve) => {
256
- if (!this.team.PassJoinApplyAsync(tid, applicantId, (event) => {
257
- if (cb) {
258
- cb(event);
259
- }
260
- resolve([event]);
261
- }, jsonExtension)) {
262
- resolve(null);
263
- }
264
- });
265
- }
266
- /** 拒绝入群申请
267
- * @param tid 群组id
268
- * @param applicant_id 申请者id
269
- * @param reason 附言
270
- * @param jsonExtension json扩展参数(备用,目前不需要)
271
- * @param cb 拒绝入群申请的回调函数
272
- * @return boolean 检查参数如果不符合要求则返回失败
273
- * @note
274
- * <pre>
275
- * 200:成功,如果用户处于申请状态则会通知申请用户被拒绝
276
- * 509:操作已失效
277
- * 802:没有权限
278
- * 803:群不存在
279
- * 805:群类型不对
280
- * </pre>
281
- */
282
- rejectJoinApplyAsync(tid, applicantId, reason, cb, jsonExtension) {
283
- return new Promise((resolve) => {
284
- if (!this.team.RejectJoinApplyAsync(tid, applicantId, reason, (event) => {
285
- if (cb) {
286
- cb(event);
287
- }
288
- resolve([event]);
289
- }, jsonExtension)) {
290
- resolve(null);
291
- }
292
- });
293
- }
294
- /** 添加管理员
295
- * @param tid 群组id
296
- * @param ids 管理员id
297
- * @param jsonExtension json扩展参数(备用,目前不需要)
298
- * @param cb 添加管理员的回调函数
299
- * @return boolean 检查参数如果不符合要求则返回失败
300
- * @note
301
- * <pre>
302
- * 200:成功
303
- * 802:没有权限
304
- * 803:群不存在
305
- * 805:群类型不对
306
- * </pre>
307
- */
308
- addManagersAsync(tid, ids, cb, jsonExtension) {
309
- return new Promise((resolve) => {
310
- if (!this.team.AddManagersAsync(tid, ids, (event) => {
311
- if (cb) {
312
- cb(event);
313
- }
314
- resolve([event]);
315
- }, jsonExtension)) {
316
- resolve(null);
317
- }
318
- });
319
- }
320
- /** 删除管理员
321
- * @param tid 群组id
322
- * @param ids 管理员id
323
- * @param jsonExtension json扩展参数(备用,目前不需要)
324
- * @param cb 删除管理员的回调函数
325
- * @return boolean 检查参数如果不符合要求则返回失败
326
- * @note
327
- * <pre>
328
- * 200:成功
329
- * 802:没有权限
330
- * 803:群不存在
331
- * 805:群类型不对
332
- * </pre>
333
- */
334
- removeManagersAsync(tid, ids, cb, jsonExtension) {
335
- return new Promise((resolve) => {
336
- if (!this.team.RemoveManagersAsync(tid, ids, (event) => {
337
- if (cb) {
338
- cb(event);
339
- }
340
- resolve([event]);
341
- }, jsonExtension)) {
342
- resolve(null);
343
- }
344
- });
345
- }
346
- /** 移交群主
347
- * @param tid 群组id
348
- * @param new_owner_id 移交对象id
349
- * @param is_leave 是否同时退出群
350
- * @param jsonExtension json扩展参数(备用,目前不需要)
351
- * @param cb 移交群主的回调函数
352
- * @return boolean 检查参数如果不符合要求则返回失败
353
- * @note
354
- * <pre>
355
- * 200:成功
356
- * 802:没有权限
357
- * 803:群不存在
358
- * 805:群类型不对
359
- * 806:群数量上限
360
- * </pre>
361
- */
362
- transferTeamAsync(tid, newOwnerId, isLeave, cb, jsonExtension) {
363
- return new Promise((resolve) => {
364
- if (!this.team.TransferTeamAsync(tid, newOwnerId, isLeave, (event) => {
365
- if (cb) {
366
- cb(event);
367
- }
368
- resolve([event]);
369
- }, jsonExtension)) {
370
- resolve(null);
371
- }
372
- });
373
- }
374
- /** 更新自己的群属性
375
- * @param prop 群成员属性
376
- * @param jsonExtension json扩展参数(备用,目前不需要)
377
- * @param cb 更新自己的群属性的回调函数
378
- * @return boolean 检查参数如果不符合要求则返回失败
379
- * @note
380
- * <pre>
381
- * 200:成功
382
- * 803:群不存在
383
- * 804:不在群里
384
- * 805:群类型不对
385
- * </pre>
386
- */
387
- updateMyPropertyAsync(prop, cb, jsonExtension) {
388
- return new Promise((resolve) => {
389
- if (!this.team.UpdateMyPropertyAsync(prop, (event) => {
390
- if (cb) {
391
- cb(event);
392
- }
393
- resolve([event]);
394
- }, jsonExtension)) {
395
- resolve(null);
396
- }
397
- });
398
- }
399
- /** 修改别人的群昵称
400
- * @param prop 群成员属性
401
- * @param jsonExtension json扩展参数(备用,目前不需要)
402
- * @param cb 修改别人的群昵称的回调函数
403
- * @return boolean 检查参数如果不符合要求则返回失败
404
- * @note
405
- * <pre>
406
- * 200:成功
407
- * 802:没有权限
408
- * 803:群不存在
409
- * 804:不在群里
410
- * 805:群类型不对
411
- * </pre>
412
- */
413
- updateOtherNickAsync(prop, cb, jsonExtension) {
414
- return new Promise((resolve) => {
415
- if (!this.team.UpdateOtherNickAsync(prop, (event) => {
416
- if (cb) {
417
- cb(event);
418
- }
419
- resolve([event]);
420
- }, jsonExtension)) {
421
- resolve(null);
422
- }
423
- });
424
- }
425
- /** 接受邀请
426
- * @param tid 群组id
427
- * @param invitor_id 邀请者id
428
- * @param jsonExtension json扩展参数(备用,目前不需要)
429
- * @param cb 接受邀请的回调函数
430
- * @return boolean 检查参数如果不符合要求则返回失败
431
- * @note
432
- * <pre>
433
- * 200:成功
434
- * 802:没有权限
435
- * 803:群不存在
436
- * 805:群类型不对
437
- * </pre>
438
- */
439
- acceptInvitationAsync(tid, inviterId, cb, jsonExtension) {
440
- return new Promise((resolve) => {
441
- if (!this.team.AcceptInvitationAsync(tid, inviterId, (event) => {
442
- if (cb) {
443
- cb(event);
444
- }
445
- resolve([event]);
446
- }, jsonExtension)) {
447
- resolve(null);
448
- }
449
- });
450
- }
451
- /** 拒绝邀请
452
- * @param tid 群组id
453
- * @param invitor_id 邀请者id
454
- * @param reason 附言
455
- * @param jsonExtension json扩展参数(备用,目前不需要)
456
- * @param cb 拒绝邀请的回调函数
457
- * @return boolean 检查参数如果不符合要求则返回失败
458
- * @note
459
- * <pre>
460
- * 200:成功
461
- * 802:没有权限
462
- * 803:群不存在
463
- * 805:群类型不对
464
- * </pre>
465
- */
466
- rejectInvitationAsync(tid, inviterId, reason, cb, jsonExtension) {
467
- return new Promise((resolve) => {
468
- if (!this.team.RejectInvitationAsync(tid, inviterId, reason, (event) => {
469
- if (cb) {
470
- cb(event);
471
- }
472
- resolve([event]);
473
- }, jsonExtension)) {
474
- resolve(null);
475
- }
476
- });
477
- }
478
- /** 查询所有群
479
- * @param jsonExtension json扩展参数(备用,目前不需要)
480
- * @param cb 查询所有群的回调函数
481
- * @return void 无返回值
482
- */
483
- queryAllMyTeamsAsync(cb, jsonExtension) {
484
- return new Promise((resolve) => {
485
- this.team.QueryAllMyTeamsAsync((count, result) => {
486
- if (cb) {
487
- cb(count, result);
488
- }
489
- resolve([count, result]);
490
- }, jsonExtension);
491
- });
492
- }
493
- /** 查询所有群信息
494
- * @param jsonExtension json扩展参数(备用,目前不需要)
495
- * @param cb 查询所有群信息的回调函数
496
- * @return void 无返回值
497
- */
498
- queryAllMyTeamsInfoAsync(cb, jsonExtension) {
499
- return new Promise((resolve) => {
500
- this.team.QueryAllMyTeamsInfoAsync((count, result) => {
501
- if (cb) {
502
- cb(count, result);
503
- }
504
- resolve([count, result]);
505
- }, jsonExtension);
506
- });
507
- }
508
- /** 查询所有群里我的成员信息(使用场景:获取了所有群列表后,需要查询自己在每个群里自己的成员信息,使用成员信息里的bits字段,可以判断当某个群发来消息后,是否做消息通知)
509
- * @param jsonExtension json扩展参数(备用,目前不需要)
510
- * @param cb 查询所有群里我的成员信息的回调函数
511
- * @return void 无返回值
512
- */
513
- queryMyAllMemberInfosAsync(cb, jsonExtension) {
514
- return new Promise((resolve) => {
515
- this.team.QueryMyAllMemberInfosAsync((count, result) => {
516
- if (cb) {
517
- cb(count, result);
518
- }
519
- resolve([count, result]);
520
- }, jsonExtension);
521
- });
522
- }
523
- /** 查询群成员
524
- * @param tid 群组id
525
- * @param jsonExtension json扩展参数(备用,目前不需要)
526
- * @param cb 查询群成员的回调函数
527
- * @return boolean 检查参数如果不符合要求则返回失败
528
- * @note
529
- * <pre>
530
- * 200:成功
531
- * 406:没有变化
532
- * 802:没有权限
533
- * </pre>
534
- */
535
- queryTeamMembersAsync(tid, cb, jsonExtension) {
536
- return new Promise((resolve) => {
537
- if (!this.team.QueryTeamMembersAsync(tid, (tid, count, result) => {
538
- if (cb) {
539
- cb(tid, count, result);
540
- }
541
- resolve([tid, count, result]);
542
- }, jsonExtension)) {
543
- resolve(null);
544
- }
545
- });
546
- }
547
- /** 查询(单个)群成员信息
548
- * @param tid 群组id
549
- * @param id 群成员id
550
- * @param jsonExtension json扩展参数(备用,目前不需要)
551
- * @param cb 查询群成员的回调函数
552
- * @return boolean 检查参数如果不符合要求则返回失败
553
- */
554
- queryTeamMemberAsync(tid, id, cb, jsonExtension) {
555
- return new Promise((resolve) => {
556
- this.team.QueryTeamMemberAsync(tid, id, (result) => {
557
- if (cb) {
558
- cb(result);
559
- }
560
- resolve([result]);
561
- }, jsonExtension);
562
- });
563
- }
564
- /** 查询群信息
565
- * @param tid 群组id
566
- * @param jsonExtension json扩展参数(备用,目前不需要)
567
- * @param cb 查询群信息的回调函数
568
- * @return boolean 检查参数如果不符合要求则返回失败
569
- */
570
- queryTeamInfoAsync(tid, cb, jsonExtension) {
571
- return new Promise((resolve) => {
572
- if (!this.team.QueryTeamInfoAsync(tid, (tid, result) => {
573
- if (cb) {
574
- cb(tid, result);
575
- }
576
- resolve([tid, result]);
577
- }, jsonExtension)) {
578
- resolve(null);
579
- }
580
- });
581
- }
582
- /** 获取群信息(从服务器获取)
583
- * @param tid 群组id
584
- * @param jsonExtension json扩展参数(备用,目前不需要)
585
- * @param cb 获取群信息的回调函数
586
- * @return boolean 检查参数如果不符合要求则返回失败
587
- * @note
588
- * <pre>
589
- * 200:成功
590
- * 803:群不存在
591
- * </pre>
592
- */
593
- queryTeamInfoOnlineAsync(tid, cb, jsonExtension) {
594
- return new Promise((resolve) => {
595
- if (!this.team.QueryTeamInfoOnlineAsync(tid, (result) => {
596
- if (cb) {
597
- cb(result);
598
- }
599
- resolve([result]);
600
- }, jsonExtension)) {
601
- resolve(null);
602
- }
603
- });
604
- }
605
- /** 禁言/解除禁言
606
- * @param tid 群组id
607
- * @param member_id 操作对象id
608
- * @param set_mute 禁言/解除禁言
609
- * @param jsonExtension json扩展参数(备用,目前不需要)
610
- * @param cb 踢人的回调函数
611
- * @return boolean 检查参数如果不符合要求则返回失败
612
- * @note
613
- * <pre>
614
- * 200:成功
615
- * 404:禁言对象不存在
616
- * 414:参数错误
617
- * 803:群不存在
618
- * 802:没有权限
619
- * </pre>
620
- */
621
- muteMemberAsync(tid, member_id, set_mute, cb, jsonExtension) {
622
- return new Promise((resolve) => {
623
- if (!this.team.MuteMemberAsync(tid, member_id, set_mute, (result) => {
624
- if (cb) {
625
- cb(result);
626
- }
627
- resolve([result]);
628
- }, jsonExtension)) {
629
- resolve(null);
630
- }
631
- });
632
- }
633
- /** 群禁言/解除群禁言
634
- * @param tid 群组id
635
- * @param set_mute 禁言/解除禁言
636
- * @param jsonExtension json扩展参数(备用,目前不需要)
637
- * @param cb 踢人的回调函数
638
- * @return boolean 检查参数如果不符合要求则返回失败
639
- * @note
640
- * <pre>
641
- * 200:成功
642
- * 414:参数错误
643
- * </pre>
644
- */
645
- muteAsync(tid, set_mute, cb, jsonExtension) {
646
- return new Promise((resolve) => {
647
- if (!this.team.MuteAsync(tid, set_mute, (result) => {
648
- if (cb) {
649
- cb(result);
650
- }
651
- resolve([result]);
652
- }, jsonExtension)) {
653
- resolve(null);
654
- }
655
- });
656
- }
657
- /** 获取群禁言成员列表
658
- * @param tid 群组id
659
- * @param cb 回调函数
660
- * @param jsonExtension json扩展参数(备用,目前不需要)
661
- * @return boolean 检查参数如果不符合要求则返回失败
662
- * @note
663
- * <pre>
664
- * 200:成功
665
- * 802:没有权限
666
- * 803:群不存在
667
- * </pre>
668
- */
669
- queryMuteListOnlineAsync(tid, cb, jsonExtension) {
670
- return new Promise((resolve) => {
671
- if (!this.team.QueryMuteListOnlineAsync(tid, (rescode, count, result) => {
672
- if (cb) {
673
- cb(rescode, count, result);
674
- }
675
- resolve([rescode, count, result]);
676
- }, jsonExtension)) {
677
- resolve(null);
678
- }
679
- });
680
- }
681
- /** 群消息回执
682
- * @param tid 群组id
683
- * @param msgs 需要发送消息回执的群消息
684
- * @param jsonExtension json扩展参数(备用,目前不需要)
685
- * @param cb 回调函数
686
- * @return void 无返回值
687
- * @note
688
- * <pre>
689
- * 200:成功
690
- * 414:参数错误
691
- * </pre>
692
- */
693
- teamMsgAckRead(tid, msgs, cb, jsonExtension) {
694
- return new Promise((resolve) => {
695
- this.team.TeamMsgAckRead(tid, msgs, (tid, success_ids, failure_ids, ignored_ids) => {
696
- if (cb) {
697
- cb(tid, success_ids, failure_ids, ignored_ids);
698
- }
699
- resolve([tid, success_ids, failure_ids, ignored_ids]);
700
- }, jsonExtension);
701
- });
702
- }
703
- /** 根据指定 ID 获取群组消息已读未读情况
704
- * @param[in] tid 群组id
705
- * @param[in] msg 群消息
706
- * @param[in] accids 要查询的 ID 列表
707
- * @param[in] jsonExtension json扩展参数(备用,目前不需要)
708
- * @param[in] cb 回调函数
709
- * @return void 无返回值
710
- * @note
711
- * <pre>
712
- * 200:成功
713
- * 414:参数错误
714
- * </pre>
715
- */
716
- teamMsgQueryUnreadList(tid, msg, accids, cb, jsonExtension) {
717
- return new Promise((resolve) => {
718
- this.team.TeamMsgQueryUnreadList(tid, msg, accids, (result) => {
719
- if (cb) {
720
- cb(result);
721
- }
722
- resolve([result]);
723
- }, jsonExtension);
724
- });
725
- }
726
- /** 查询群成员的邀请人 accid 由接口 原 TeamQueryTeamMembersInvitor方法
727
- * @param tid 群组id
728
- * @param members 要查询 的群成员accid列表
729
- * @param cb 回调函数
730
- * @return void 无返回值
731
- * @note
732
- * <pre>
733
- * 200:成功
734
- * </pre>
735
- */
736
- queryTeamMembersInvitor(tid, members, cb) {
737
- return new Promise((resolve) => {
738
- this.team.QueryTeamMembersInvitor(tid, members, (rescode, count, result) => {
739
- if (cb) {
740
- cb(rescode, count, result);
741
- }
742
- resolve([rescode, count, result]);
743
- });
744
- });
745
- }
746
- /** 查询群信息
747
- * @param keyword 要查询的关键字
748
- * @param cb 查询群信息的回调函数
749
- * @param jsonExtension json扩展参数(备用,目前不需要)
750
- * @return boolean 检查参数如果不符合要求则返回失败
751
- */
752
- queryTeamInfoByKeywordAsync(keyword, cb, jsonExtension) {
753
- return new Promise((resolve) => {
754
- this.team.QueryTeamInfoByKeywordAsync(keyword, (count, result) => {
755
- if (cb) {
756
- cb(count, result);
757
- }
758
- resolve([count, result]);
759
- }, jsonExtension);
760
- });
761
- }
762
- /** 更新群信息
763
- * @param tid 群组id
764
- * @param team_infos 群组信息
765
- * @param notify_event 更新后是否触发事件以通知应用层
766
- * @param cb 更新群信息的回调函数,回调中会指明更新成功与失败的群ID
767
- * @param jsonExtension json扩展参数(备用,目前不需要)
768
- * @return void
769
- */
770
- updateTInfoLocal(infos, cb, jsonExtension) {
771
- return new Promise((resolve) => {
772
- this.team.UpdateTInfoLocal(infos, (success_ids, failure_ids) => {
773
- if (cb) {
774
- cb(success_ids, failure_ids);
775
- }
776
- resolve([success_ids, failure_ids]);
777
- }, jsonExtension);
778
- });
779
- }
780
- /** 查询所有群
781
- * @param cb 查询所有群的回调函数
782
- * @param time_tag 时间戳,没有特殊需求此参数赋0
783
- * @param jsonExtension json扩展参数(备用,目前不需要)
784
- * @return void 无返回值
785
- */
786
- getTeamInfoBatchTrans(cb, time_tag, jsonExtension) {
787
- return new Promise((resolve) => {
788
- this.team.GetTeamInfoBatchSFTrans((count, result) => {
789
- if (cb) {
790
- cb(count, result);
791
- }
792
- resolve([count, result]);
793
- }, time_tag, jsonExtension);
794
- });
795
- }
796
- /** 查询给定的一组群ID详细信息
797
- * @param tid_list 群组id列表,最多10个
798
- * @param cb 查询给定的一组群ID详细信息的回调模板
799
- * @return void 无返回值
800
- * @note
801
- * <pre>
802
- * 200:成功
803
- * 414:参数错误
804
- * 816:部分成功
805
- * </pre>
806
- */
807
- getTeaminfoList(tids, cb) {
808
- return new Promise((resolve) => {
809
- this.team.GetTeaminfoList(tids, (rescode, infos, failure_ids) => {
810
- if (cb) {
811
- cb(rescode, infos, failure_ids);
812
- }
813
- resolve([rescode, infos, failure_ids]);
814
- });
815
- });
816
- }
817
- }
818
- exports.NIMTeam = NIMTeam;
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.NIMTeam = void 0;
7
+ const loader_1 = __importDefault(require("../loader"));
8
+ const eventemitter3_1 = require("eventemitter3");
9
+ class NIMTeam extends eventemitter3_1.EventEmitter {
10
+ constructor() {
11
+ super();
12
+ this.team = new loader_1.default.NIMTeam({ emit: this.emit.bind(this) });
13
+ }
14
+ /** 注册全局回调 */
15
+ initEventHandlers() {
16
+ return this.team.InitEventHandlers();
17
+ }
18
+ /** 创建群组
19
+ * @param team_info 群组信息
20
+ * @param ids 邀请对象id
21
+ * @param invitation_postscript 邀请附言
22
+ * @param jsonExtension json扩展参数(备用,目前不需要)
23
+ * @param cb 群通知的回调函数
24
+ * @return boolean 检查参数如果不符合要求则返回失败
25
+ * @deprecated 该接口已过时,请使用 createTeamAsyncEx 创建群组
26
+ * @note
27
+ * <pre>
28
+ * 200:成功
29
+ * 810:如果创建的是高级群,返回810表示邀请成功并带上tinfo
30
+ * 414:成员不足
31
+ * 801:成员数超限制
32
+ * 404:成员中有非法用户
33
+ * </pre>
34
+ */
35
+ createTeamAsync(info, ids, invitationPostscript, cb, jsonExtension) {
36
+ return new Promise((resolve) => {
37
+ if (!this.team.CreateTeamAsync(info, ids, invitationPostscript, (event) => {
38
+ if (cb) {
39
+ cb(event);
40
+ }
41
+ resolve([event]);
42
+ }, jsonExtension)) {
43
+ resolve(null);
44
+ }
45
+ });
46
+ }
47
+ /** 创建群组
48
+ * @param team_info 群组信息
49
+ * @param ids 邀请对象id
50
+ * @param invitation_postscript 邀请附言
51
+ * @param jsonExtension json扩展参数(备用,目前不需要)
52
+ * @param cb 群通知的回调函数
53
+ * @return boolean 检查参数如果不符合要求则返回失败
54
+ * @note
55
+ * <pre>
56
+ * 200:成功
57
+ * 810:如果创建的是高级群,返回810表示邀请成功并带上tinfo
58
+ * 414:成员不足
59
+ * 801:成员数超限制
60
+ * 404:成员中有非法用户
61
+ * </pre>
62
+ */
63
+ createTeamAsyncEx(info, ids, invitationPostscript, cb, jsonExtension) {
64
+ return new Promise((resolve) => {
65
+ if (!this.team.CreateTeamAsyncEx(info, ids, invitationPostscript, (event) => {
66
+ if (cb) {
67
+ cb(event);
68
+ }
69
+ resolve([event]);
70
+ }, jsonExtension)) {
71
+ resolve(null);
72
+ }
73
+ });
74
+ }
75
+ /** 解散群
76
+ * @param tid 群组id
77
+ * @param jsonExtension json扩展参数(备用,目前不需要)
78
+ * @param cb 解散群的回调函数
79
+ * @return boolean 检查参数如果不符合要求则返回失败
80
+ * @note
81
+ * <pre>
82
+ * 200:成功
83
+ * 802:没有权限
84
+ * 803:群不存在
85
+ * </pre>
86
+ */
87
+ dismissAsync(tid, cb, jsonExtension) {
88
+ return new Promise((resolve) => {
89
+ if (!this.team.DismissAsync(tid, (event) => {
90
+ if (cb) {
91
+ cb(event);
92
+ }
93
+ resolve([event]);
94
+ }, jsonExtension)) {
95
+ resolve(null);
96
+ }
97
+ });
98
+ }
99
+ /** 邀请
100
+ * @param tid 群组id
101
+ * @param ids 邀请对象id
102
+ * @param invitation_postscript 邀请附言
103
+ * @param invitation_attachment 用户可自定义的补充邀请信息
104
+ * @param jsonExtension json扩展参数(备用,目前不需要)
105
+ * @param cb 邀请的回调函数
106
+ * @return boolean 检查参数如果不符合要求则返回失败
107
+ * @note
108
+ * <pre>
109
+ * 200:成功
110
+ * 810:如果是高级群,返回810表示邀请成功并带上timetag
111
+ * 404:非法用户
112
+ * 801:群人数超限
113
+ * 802:没有权限
114
+ * 803:群不存在
115
+ * </pre>
116
+ */
117
+ inviteAsync(tid, ids, invitationPostscript, invitationAttachment, cb, jsonExtension) {
118
+ return new Promise((resolve) => {
119
+ if (!this.team.InviteAsync(tid, ids, invitationPostscript, invitationAttachment, (event) => {
120
+ if (cb) {
121
+ cb(event);
122
+ }
123
+ resolve([event]);
124
+ }, jsonExtension)) {
125
+ resolve(null);
126
+ }
127
+ });
128
+ }
129
+ /** 踢人
130
+ * @param tid 群组id
131
+ * @param ids 被踢对象id
132
+ * @param jsonExtension json扩展参数(备用,目前不需要)
133
+ * @param cb 踢人的回调函数
134
+ * @return boolean 检查参数如果不符合要求则返回失败
135
+ * @note
136
+ * <pre>
137
+ * 200:成功
138
+ * 403:无超大群功能
139
+ * 414:踢人数量超限
140
+ * 802:群人数超限、不能踢自己
141
+ * 803:群不存在
142
+ * 804:用户不在群里面
143
+ * </pre>
144
+ */
145
+ kickAsync(tid, ids, cb, jsonExtension) {
146
+ return new Promise((resolve) => {
147
+ if (!this.team.KickAsync(tid, ids, (event) => {
148
+ if (cb) {
149
+ cb(event);
150
+ }
151
+ resolve([event]);
152
+ }, jsonExtension)) {
153
+ resolve(null);
154
+ }
155
+ });
156
+ }
157
+ /** 离开群
158
+ * @param tid 群组id
159
+ * @param jsonExtension json扩展参数(备用,目前不需要)
160
+ * @param cb 离开群的回调函数
161
+ * @return boolean 检查参数如果不符合要求则返回失败
162
+ * @note
163
+ * <pre>
164
+ * 200:成功
165
+ * 403:无超大群功能
166
+ * 802:没有群权限、群主不能退群
167
+ * 803:群不存在
168
+ * 804:用户不在群里
169
+ * </pre>
170
+ */
171
+ leaveAsync(tid, cb, jsonExtension) {
172
+ return new Promise((resolve) => {
173
+ if (!this.team.LeaveAsync(tid, (event) => {
174
+ if (cb) {
175
+ cb(event);
176
+ }
177
+ resolve([event]);
178
+ }, jsonExtension)) {
179
+ resolve(null);
180
+ }
181
+ });
182
+ }
183
+ /** 更新群信息
184
+ * @param tid 群组id
185
+ * @param team_info 群组信息
186
+ * @param jsonExtension json扩展参数(备用,目前不需要)
187
+ * @param cb 更新群信息的回调函数
188
+ * @return boolean 检查参数如果不符合要求则返回失败
189
+ * @note
190
+ * <pre>
191
+ * 200:成功
192
+ * 802:没有群权限、群主不能退群
193
+ * 803:群不存在
194
+ * </pre>
195
+ */
196
+ updateTeamInfoAsync(tid, info, cb, jsonExtension) {
197
+ return new Promise((resolve) => {
198
+ if (!this.team.UpdateTeamInfoAsync(tid, info, (event) => {
199
+ if (cb) {
200
+ cb(event);
201
+ }
202
+ resolve([event]);
203
+ }, jsonExtension)) {
204
+ resolve(null);
205
+ }
206
+ });
207
+ }
208
+ /** 申请入群
209
+ * @param tid 群组id
210
+ * @param reason 附言
211
+ * @param jsonExtension json扩展参数(备用,目前不需要)
212
+ * @param cb 申请入群的回调函数
213
+ * @return boolean 检查参数如果不符合要求则返回失败
214
+ * @note
215
+ * <pre>
216
+ * 200:成功
217
+ * 802:群验证方式为拒绝所有人申请
218
+ * 808:申请成功,等待验证
219
+ * 809:已经在群里
220
+ * 801:人数限制
221
+ * 803:群不存在
222
+ * 805:群类型不对
223
+ * </pre>
224
+ */
225
+ applyJoinAsync(tid, reason, cb, jsonExtension) {
226
+ return new Promise((resolve) => {
227
+ if (!this.team.ApplyJoinAsync(tid, reason, (event) => {
228
+ if (cb) {
229
+ cb(event);
230
+ }
231
+ resolve([event]);
232
+ }, jsonExtension)) {
233
+ resolve(null);
234
+ }
235
+ });
236
+ }
237
+ /** 同意入群申请
238
+ * @param tid 群组id
239
+ * @param applicant_id 申请者id
240
+ * @param jsonExtension json扩展参数(备用,目前不需要)
241
+ * @param cb 同意入群申请的回调函数
242
+ * @return boolean 检查参数如果不符合要求则返回失败
243
+ * @note
244
+ * <pre>
245
+ * 200:成功
246
+ * 509:操作已失效
247
+ * 809:已经在群里
248
+ * 801:人数限制
249
+ * 802:没有权限
250
+ * 803:群不存在
251
+ * 805:群类型不对
252
+ * </pre>
253
+ */
254
+ passJoinApplyAsync(tid, applicantId, cb, jsonExtension) {
255
+ return new Promise((resolve) => {
256
+ if (!this.team.PassJoinApplyAsync(tid, applicantId, (event) => {
257
+ if (cb) {
258
+ cb(event);
259
+ }
260
+ resolve([event]);
261
+ }, jsonExtension)) {
262
+ resolve(null);
263
+ }
264
+ });
265
+ }
266
+ /** 拒绝入群申请
267
+ * @param tid 群组id
268
+ * @param applicant_id 申请者id
269
+ * @param reason 附言
270
+ * @param jsonExtension json扩展参数(备用,目前不需要)
271
+ * @param cb 拒绝入群申请的回调函数
272
+ * @return boolean 检查参数如果不符合要求则返回失败
273
+ * @note
274
+ * <pre>
275
+ * 200:成功,如果用户处于申请状态则会通知申请用户被拒绝
276
+ * 509:操作已失效
277
+ * 802:没有权限
278
+ * 803:群不存在
279
+ * 805:群类型不对
280
+ * </pre>
281
+ */
282
+ rejectJoinApplyAsync(tid, applicantId, reason, cb, jsonExtension) {
283
+ return new Promise((resolve) => {
284
+ if (!this.team.RejectJoinApplyAsync(tid, applicantId, reason, (event) => {
285
+ if (cb) {
286
+ cb(event);
287
+ }
288
+ resolve([event]);
289
+ }, jsonExtension)) {
290
+ resolve(null);
291
+ }
292
+ });
293
+ }
294
+ /** 添加管理员
295
+ * @param tid 群组id
296
+ * @param ids 管理员id
297
+ * @param jsonExtension json扩展参数(备用,目前不需要)
298
+ * @param cb 添加管理员的回调函数
299
+ * @return boolean 检查参数如果不符合要求则返回失败
300
+ * @note
301
+ * <pre>
302
+ * 200:成功
303
+ * 802:没有权限
304
+ * 803:群不存在
305
+ * 805:群类型不对
306
+ * </pre>
307
+ */
308
+ addManagersAsync(tid, ids, cb, jsonExtension) {
309
+ return new Promise((resolve) => {
310
+ if (!this.team.AddManagersAsync(tid, ids, (event) => {
311
+ if (cb) {
312
+ cb(event);
313
+ }
314
+ resolve([event]);
315
+ }, jsonExtension)) {
316
+ resolve(null);
317
+ }
318
+ });
319
+ }
320
+ /** 删除管理员
321
+ * @param tid 群组id
322
+ * @param ids 管理员id
323
+ * @param jsonExtension json扩展参数(备用,目前不需要)
324
+ * @param cb 删除管理员的回调函数
325
+ * @return boolean 检查参数如果不符合要求则返回失败
326
+ * @note
327
+ * <pre>
328
+ * 200:成功
329
+ * 802:没有权限
330
+ * 803:群不存在
331
+ * 805:群类型不对
332
+ * </pre>
333
+ */
334
+ removeManagersAsync(tid, ids, cb, jsonExtension) {
335
+ return new Promise((resolve) => {
336
+ if (!this.team.RemoveManagersAsync(tid, ids, (event) => {
337
+ if (cb) {
338
+ cb(event);
339
+ }
340
+ resolve([event]);
341
+ }, jsonExtension)) {
342
+ resolve(null);
343
+ }
344
+ });
345
+ }
346
+ /** 移交群主
347
+ * @param tid 群组id
348
+ * @param new_owner_id 移交对象id
349
+ * @param is_leave 是否同时退出群
350
+ * @param jsonExtension json扩展参数(备用,目前不需要)
351
+ * @param cb 移交群主的回调函数
352
+ * @return boolean 检查参数如果不符合要求则返回失败
353
+ * @note
354
+ * <pre>
355
+ * 200:成功
356
+ * 802:没有权限
357
+ * 803:群不存在
358
+ * 805:群类型不对
359
+ * 806:群数量上限
360
+ * </pre>
361
+ */
362
+ transferTeamAsync(tid, newOwnerId, isLeave, cb, jsonExtension) {
363
+ return new Promise((resolve) => {
364
+ if (!this.team.TransferTeamAsync(tid, newOwnerId, isLeave, (event) => {
365
+ if (cb) {
366
+ cb(event);
367
+ }
368
+ resolve([event]);
369
+ }, jsonExtension)) {
370
+ resolve(null);
371
+ }
372
+ });
373
+ }
374
+ /** 更新自己的群属性
375
+ * @param prop 群成员属性
376
+ * @param jsonExtension json扩展参数(备用,目前不需要)
377
+ * @param cb 更新自己的群属性的回调函数
378
+ * @return boolean 检查参数如果不符合要求则返回失败
379
+ * @note
380
+ * <pre>
381
+ * 200:成功
382
+ * 803:群不存在
383
+ * 804:不在群里
384
+ * 805:群类型不对
385
+ * </pre>
386
+ */
387
+ updateMyPropertyAsync(prop, cb, jsonExtension) {
388
+ return new Promise((resolve) => {
389
+ if (!this.team.UpdateMyPropertyAsync(prop, (event) => {
390
+ if (cb) {
391
+ cb(event);
392
+ }
393
+ resolve([event]);
394
+ }, jsonExtension)) {
395
+ resolve(null);
396
+ }
397
+ });
398
+ }
399
+ /** 修改别人的群昵称
400
+ * @param prop 群成员属性
401
+ * @param jsonExtension json扩展参数(备用,目前不需要)
402
+ * @param cb 修改别人的群昵称的回调函数
403
+ * @return boolean 检查参数如果不符合要求则返回失败
404
+ * @note
405
+ * <pre>
406
+ * 200:成功
407
+ * 802:没有权限
408
+ * 803:群不存在
409
+ * 804:不在群里
410
+ * 805:群类型不对
411
+ * </pre>
412
+ */
413
+ updateOtherNickAsync(prop, cb, jsonExtension) {
414
+ return new Promise((resolve) => {
415
+ if (!this.team.UpdateOtherNickAsync(prop, (event) => {
416
+ if (cb) {
417
+ cb(event);
418
+ }
419
+ resolve([event]);
420
+ }, jsonExtension)) {
421
+ resolve(null);
422
+ }
423
+ });
424
+ }
425
+ /** 接受邀请
426
+ * @param tid 群组id
427
+ * @param invitor_id 邀请者id
428
+ * @param jsonExtension json扩展参数(备用,目前不需要)
429
+ * @param cb 接受邀请的回调函数
430
+ * @return boolean 检查参数如果不符合要求则返回失败
431
+ * @note
432
+ * <pre>
433
+ * 200:成功
434
+ * 802:没有权限
435
+ * 803:群不存在
436
+ * 805:群类型不对
437
+ * </pre>
438
+ */
439
+ acceptInvitationAsync(tid, inviterId, cb, jsonExtension) {
440
+ return new Promise((resolve) => {
441
+ if (!this.team.AcceptInvitationAsync(tid, inviterId, (event) => {
442
+ if (cb) {
443
+ cb(event);
444
+ }
445
+ resolve([event]);
446
+ }, jsonExtension)) {
447
+ resolve(null);
448
+ }
449
+ });
450
+ }
451
+ /** 拒绝邀请
452
+ * @param tid 群组id
453
+ * @param invitor_id 邀请者id
454
+ * @param reason 附言
455
+ * @param jsonExtension json扩展参数(备用,目前不需要)
456
+ * @param cb 拒绝邀请的回调函数
457
+ * @return boolean 检查参数如果不符合要求则返回失败
458
+ * @note
459
+ * <pre>
460
+ * 200:成功
461
+ * 802:没有权限
462
+ * 803:群不存在
463
+ * 805:群类型不对
464
+ * </pre>
465
+ */
466
+ rejectInvitationAsync(tid, inviterId, reason, cb, jsonExtension) {
467
+ return new Promise((resolve) => {
468
+ if (!this.team.RejectInvitationAsync(tid, inviterId, reason, (event) => {
469
+ if (cb) {
470
+ cb(event);
471
+ }
472
+ resolve([event]);
473
+ }, jsonExtension)) {
474
+ resolve(null);
475
+ }
476
+ });
477
+ }
478
+ /** 查询所有群
479
+ * @param jsonExtension json扩展参数(备用,目前不需要)
480
+ * @param cb 查询所有群的回调函数
481
+ * @return void 无返回值
482
+ */
483
+ queryAllMyTeamsAsync(cb, jsonExtension) {
484
+ return new Promise((resolve) => {
485
+ this.team.QueryAllMyTeamsAsync((count, result) => {
486
+ if (cb) {
487
+ cb(count, result);
488
+ }
489
+ resolve([count, result]);
490
+ }, jsonExtension);
491
+ });
492
+ }
493
+ /** 查询所有群信息
494
+ * @param jsonExtension json扩展参数(备用,目前不需要)
495
+ * @param cb 查询所有群信息的回调函数
496
+ * @return void 无返回值
497
+ */
498
+ queryAllMyTeamsInfoAsync(cb, jsonExtension) {
499
+ return new Promise((resolve) => {
500
+ this.team.QueryAllMyTeamsInfoAsync((count, result) => {
501
+ if (cb) {
502
+ cb(count, result);
503
+ }
504
+ resolve([count, result]);
505
+ }, jsonExtension);
506
+ });
507
+ }
508
+ /** 查询所有群里我的成员信息(使用场景:获取了所有群列表后,需要查询自己在每个群里自己的成员信息,使用成员信息里的bits字段,可以判断当某个群发来消息后,是否做消息通知)
509
+ * @param jsonExtension json扩展参数(备用,目前不需要)
510
+ * @param cb 查询所有群里我的成员信息的回调函数
511
+ * @return void 无返回值
512
+ */
513
+ queryMyAllMemberInfosAsync(cb, jsonExtension) {
514
+ return new Promise((resolve) => {
515
+ this.team.QueryMyAllMemberInfosAsync((count, result) => {
516
+ if (cb) {
517
+ cb(count, result);
518
+ }
519
+ resolve([count, result]);
520
+ }, jsonExtension);
521
+ });
522
+ }
523
+ /** 查询群成员
524
+ * @param tid 群组id
525
+ * @param jsonExtension json扩展参数(备用,目前不需要)
526
+ * @param cb 查询群成员的回调函数
527
+ * @return boolean 检查参数如果不符合要求则返回失败
528
+ * @note
529
+ * <pre>
530
+ * 200:成功
531
+ * 406:没有变化
532
+ * 802:没有权限
533
+ * </pre>
534
+ */
535
+ queryTeamMembersAsync(tid, cb, jsonExtension) {
536
+ return new Promise((resolve) => {
537
+ if (!this.team.QueryTeamMembersAsync(tid, (tid, count, result) => {
538
+ if (cb) {
539
+ cb(tid, count, result);
540
+ }
541
+ resolve([tid, count, result]);
542
+ }, jsonExtension)) {
543
+ resolve(null);
544
+ }
545
+ });
546
+ }
547
+ /** 查询(单个)群成员信息
548
+ * @param tid 群组id
549
+ * @param id 群成员id
550
+ * @param jsonExtension json扩展参数(备用,目前不需要)
551
+ * @param cb 查询群成员的回调函数
552
+ * @return boolean 检查参数如果不符合要求则返回失败
553
+ */
554
+ queryTeamMemberAsync(tid, id, cb, jsonExtension) {
555
+ return new Promise((resolve) => {
556
+ this.team.QueryTeamMemberAsync(tid, id, (result) => {
557
+ if (cb) {
558
+ cb(result);
559
+ }
560
+ resolve([result]);
561
+ }, jsonExtension);
562
+ });
563
+ }
564
+ /** 查询群信息
565
+ * @param tid 群组id
566
+ * @param jsonExtension json扩展参数(备用,目前不需要)
567
+ * @param cb 查询群信息的回调函数
568
+ * @return boolean 检查参数如果不符合要求则返回失败
569
+ */
570
+ queryTeamInfoAsync(tid, cb, jsonExtension) {
571
+ return new Promise((resolve) => {
572
+ if (!this.team.QueryTeamInfoAsync(tid, (tid, result) => {
573
+ if (cb) {
574
+ cb(tid, result);
575
+ }
576
+ resolve([tid, result]);
577
+ }, jsonExtension)) {
578
+ resolve(null);
579
+ }
580
+ });
581
+ }
582
+ /** 获取群信息(从服务器获取)
583
+ * @param tid 群组id
584
+ * @param jsonExtension json扩展参数(备用,目前不需要)
585
+ * @param cb 获取群信息的回调函数
586
+ * @return boolean 检查参数如果不符合要求则返回失败
587
+ * @note
588
+ * <pre>
589
+ * 200:成功
590
+ * 803:群不存在
591
+ * </pre>
592
+ */
593
+ queryTeamInfoOnlineAsync(tid, cb, jsonExtension) {
594
+ return new Promise((resolve) => {
595
+ if (!this.team.QueryTeamInfoOnlineAsync(tid, (result) => {
596
+ if (cb) {
597
+ cb(result);
598
+ }
599
+ resolve([result]);
600
+ }, jsonExtension)) {
601
+ resolve(null);
602
+ }
603
+ });
604
+ }
605
+ /** 禁言/解除禁言
606
+ * @param tid 群组id
607
+ * @param member_id 操作对象id
608
+ * @param set_mute 禁言/解除禁言
609
+ * @param jsonExtension json扩展参数(备用,目前不需要)
610
+ * @param cb 踢人的回调函数
611
+ * @return boolean 检查参数如果不符合要求则返回失败
612
+ * @note
613
+ * <pre>
614
+ * 200:成功
615
+ * 404:禁言对象不存在
616
+ * 414:参数错误
617
+ * 803:群不存在
618
+ * 802:没有权限
619
+ * </pre>
620
+ */
621
+ muteMemberAsync(tid, member_id, set_mute, cb, jsonExtension) {
622
+ return new Promise((resolve) => {
623
+ if (!this.team.MuteMemberAsync(tid, member_id, set_mute, (result) => {
624
+ if (cb) {
625
+ cb(result);
626
+ }
627
+ resolve([result]);
628
+ }, jsonExtension)) {
629
+ resolve(null);
630
+ }
631
+ });
632
+ }
633
+ /** 群禁言/解除群禁言
634
+ * @param tid 群组id
635
+ * @param set_mute 禁言/解除禁言
636
+ * @param jsonExtension json扩展参数(备用,目前不需要)
637
+ * @param cb 踢人的回调函数
638
+ * @return boolean 检查参数如果不符合要求则返回失败
639
+ * @note
640
+ * <pre>
641
+ * 200:成功
642
+ * 414:参数错误
643
+ * </pre>
644
+ */
645
+ muteAsync(tid, set_mute, cb, jsonExtension) {
646
+ return new Promise((resolve) => {
647
+ if (!this.team.MuteAsync(tid, set_mute, (result) => {
648
+ if (cb) {
649
+ cb(result);
650
+ }
651
+ resolve([result]);
652
+ }, jsonExtension)) {
653
+ resolve(null);
654
+ }
655
+ });
656
+ }
657
+ /** 获取群禁言成员列表
658
+ * @param tid 群组id
659
+ * @param cb 回调函数
660
+ * @param jsonExtension json扩展参数(备用,目前不需要)
661
+ * @return boolean 检查参数如果不符合要求则返回失败
662
+ * @note
663
+ * <pre>
664
+ * 200:成功
665
+ * 802:没有权限
666
+ * 803:群不存在
667
+ * </pre>
668
+ */
669
+ queryMuteListOnlineAsync(tid, cb, jsonExtension) {
670
+ return new Promise((resolve) => {
671
+ if (!this.team.QueryMuteListOnlineAsync(tid, (rescode, count, result) => {
672
+ if (cb) {
673
+ cb(rescode, count, result);
674
+ }
675
+ resolve([rescode, count, result]);
676
+ }, jsonExtension)) {
677
+ resolve(null);
678
+ }
679
+ });
680
+ }
681
+ /** 群消息回执
682
+ * @param tid 群组id
683
+ * @param msgs 需要发送消息回执的群消息
684
+ * @param jsonExtension json扩展参数(备用,目前不需要)
685
+ * @param cb 回调函数
686
+ * @return void 无返回值
687
+ * @note
688
+ * <pre>
689
+ * 200:成功
690
+ * 414:参数错误
691
+ * </pre>
692
+ */
693
+ teamMsgAckRead(tid, msgs, cb, jsonExtension) {
694
+ return new Promise((resolve) => {
695
+ this.team.TeamMsgAckRead(tid, msgs, (tid, success_ids, failure_ids, ignored_ids) => {
696
+ if (cb) {
697
+ cb(tid, success_ids, failure_ids, ignored_ids);
698
+ }
699
+ resolve([tid, success_ids, failure_ids, ignored_ids]);
700
+ }, jsonExtension);
701
+ });
702
+ }
703
+ /** 根据指定 ID 获取群组消息已读未读情况
704
+ * @param[in] tid 群组id
705
+ * @param[in] msg 群消息
706
+ * @param[in] accids 要查询的 ID 列表
707
+ * @param[in] jsonExtension json扩展参数(备用,目前不需要)
708
+ * @param[in] cb 回调函数
709
+ * @return void 无返回值
710
+ * @note
711
+ * <pre>
712
+ * 200:成功
713
+ * 414:参数错误
714
+ * </pre>
715
+ */
716
+ teamMsgQueryUnreadList(tid, msg, accids, cb, jsonExtension) {
717
+ return new Promise((resolve) => {
718
+ this.team.TeamMsgQueryUnreadList(tid, msg, accids, (result) => {
719
+ if (cb) {
720
+ cb(result);
721
+ }
722
+ resolve([result]);
723
+ }, jsonExtension);
724
+ });
725
+ }
726
+ /** 查询群成员的邀请人 accid 由接口 原 TeamQueryTeamMembersInvitor方法
727
+ * @param tid 群组id
728
+ * @param members 要查询 的群成员accid列表
729
+ * @param cb 回调函数
730
+ * @return void 无返回值
731
+ * @note
732
+ * <pre>
733
+ * 200:成功
734
+ * </pre>
735
+ */
736
+ queryTeamMembersInvitor(tid, members, cb) {
737
+ return new Promise((resolve) => {
738
+ this.team.QueryTeamMembersInvitor(tid, members, (rescode, count, result) => {
739
+ if (cb) {
740
+ cb(rescode, count, result);
741
+ }
742
+ resolve([rescode, count, result]);
743
+ });
744
+ });
745
+ }
746
+ /** 查询群信息
747
+ * @param keyword 要查询的关键字
748
+ * @param cb 查询群信息的回调函数
749
+ * @param jsonExtension json扩展参数(备用,目前不需要)
750
+ * @return boolean 检查参数如果不符合要求则返回失败
751
+ */
752
+ queryTeamInfoByKeywordAsync(keyword, cb, jsonExtension) {
753
+ return new Promise((resolve) => {
754
+ this.team.QueryTeamInfoByKeywordAsync(keyword, (count, result) => {
755
+ if (cb) {
756
+ cb(count, result);
757
+ }
758
+ resolve([count, result]);
759
+ }, jsonExtension);
760
+ });
761
+ }
762
+ /** 更新群信息
763
+ * @param tid 群组id
764
+ * @param team_infos 群组信息
765
+ * @param notify_event 更新后是否触发事件以通知应用层
766
+ * @param cb 更新群信息的回调函数,回调中会指明更新成功与失败的群ID
767
+ * @param jsonExtension json扩展参数(备用,目前不需要)
768
+ * @return void
769
+ */
770
+ updateTInfoLocal(infos, cb, jsonExtension) {
771
+ return new Promise((resolve) => {
772
+ this.team.UpdateTInfoLocal(infos, (success_ids, failure_ids) => {
773
+ if (cb) {
774
+ cb(success_ids, failure_ids);
775
+ }
776
+ resolve([success_ids, failure_ids]);
777
+ }, jsonExtension);
778
+ });
779
+ }
780
+ /** 查询所有群
781
+ * @param cb 查询所有群的回调函数
782
+ * @param time_tag 时间戳,没有特殊需求此参数赋0
783
+ * @param jsonExtension json扩展参数(备用,目前不需要)
784
+ * @return void 无返回值
785
+ */
786
+ getTeamInfoBatchTrans(cb, time_tag, jsonExtension) {
787
+ return new Promise((resolve) => {
788
+ this.team.GetTeamInfoBatchSFTrans((count, result) => {
789
+ if (cb) {
790
+ cb(count, result);
791
+ }
792
+ resolve([count, result]);
793
+ }, time_tag, jsonExtension);
794
+ });
795
+ }
796
+ /** 查询给定的一组群ID详细信息
797
+ * @param tid_list 群组id列表,最多10个
798
+ * @param cb 查询给定的一组群ID详细信息的回调模板
799
+ * @return void 无返回值
800
+ * @note
801
+ * <pre>
802
+ * 200:成功
803
+ * 414:参数错误
804
+ * 816:部分成功
805
+ * </pre>
806
+ */
807
+ getTeaminfoList(tids, cb) {
808
+ return new Promise((resolve) => {
809
+ this.team.GetTeaminfoList(tids, (rescode, infos, failure_ids) => {
810
+ if (cb) {
811
+ cb(rescode, infos, failure_ids);
812
+ }
813
+ resolve([rescode, infos, failure_ids]);
814
+ });
815
+ });
816
+ }
817
+ }
818
+ exports.NIMTeam = NIMTeam;
819
819
  //# sourceMappingURL=team.js.map