node-nim 9.2.8-rc.1 → 9.3.0-rc.2

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