node-nim 10.5.2 → 10.6.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 (67) hide show
  1. package/dist/nim/msglog.js +8 -0
  2. package/dist/nim/msglog.js.map +1 -1
  3. package/dist/v2/v2_nim_ai_service.js.map +1 -1
  4. package/dist/v2/v2_nim_chatroom_client.js +153 -40
  5. package/dist/v2/v2_nim_chatroom_client.js.map +1 -1
  6. package/dist/v2/v2_nim_chatroom_queue_service.js +148 -0
  7. package/dist/v2/v2_nim_chatroom_queue_service.js.map +1 -0
  8. package/dist/v2/v2_nim_chatroom_service.js +201 -65
  9. package/dist/v2/v2_nim_chatroom_service.js.map +1 -1
  10. package/dist/v2/v2_nim_client.js +116 -25
  11. package/dist/v2/v2_nim_client.js.map +1 -1
  12. package/dist/v2/v2_nim_conversation_group_service.js +57 -9
  13. package/dist/v2/v2_nim_conversation_group_service.js.map +1 -1
  14. package/dist/v2/v2_nim_conversation_service.js +149 -27
  15. package/dist/v2/v2_nim_conversation_service.js.map +1 -1
  16. package/dist/v2/v2_nim_friend_service.js +152 -36
  17. package/dist/v2/v2_nim_friend_service.js.map +1 -1
  18. package/dist/v2/v2_nim_login_service.js +66 -14
  19. package/dist/v2/v2_nim_login_service.js.map +1 -1
  20. package/dist/v2/v2_nim_message_service.js +335 -93
  21. package/dist/v2/v2_nim_message_service.js.map +1 -1
  22. package/dist/v2/v2_nim_notification_service.js +11 -4
  23. package/dist/v2/v2_nim_notification_service.js.map +1 -1
  24. package/dist/v2/v2_nim_passthrough_service.js +39 -0
  25. package/dist/v2/v2_nim_passthrough_service.js.map +1 -0
  26. package/dist/v2/v2_nim_setting_service.js +81 -29
  27. package/dist/v2/v2_nim_setting_service.js.map +1 -1
  28. package/dist/v2/v2_nim_signalling_service.js +172 -44
  29. package/dist/v2/v2_nim_signalling_service.js.map +1 -1
  30. package/dist/v2/v2_nim_storage_service.js +116 -37
  31. package/dist/v2/v2_nim_storage_service.js.map +1 -1
  32. package/dist/v2/v2_nim_subscription_service.js +42 -12
  33. package/dist/v2/v2_nim_subscription_service.js.map +1 -1
  34. package/dist/v2/v2_nim_team_service.js +349 -140
  35. package/dist/v2/v2_nim_team_service.js.map +1 -1
  36. package/dist/v2/v2_nim_user_service.js +62 -19
  37. package/dist/v2/v2_nim_user_service.js.map +1 -1
  38. package/dist/v2/v2_nim_utilities.js +306 -129
  39. package/dist/v2/v2_nim_utilities.js.map +1 -1
  40. package/dist/v2_def/v2_nim_enum_def.js +14 -3
  41. package/dist/v2_def/v2_nim_enum_def.js.map +1 -1
  42. package/dist/v2_def/v2_nim_struct_def.js +0 -2
  43. package/dist/v2_def/v2_nim_struct_def.js.map +1 -1
  44. package/package.json +1 -1
  45. package/types/nim/msglog.d.ts +7 -1
  46. package/types/nim_def/msglog_def.d.ts +2 -0
  47. package/types/v2/v2_nim_ai_service.d.ts +3 -3
  48. package/types/v2/v2_nim_chatroom_client.d.ts +153 -42
  49. package/types/v2/v2_nim_chatroom_queue_service.d.ts +96 -0
  50. package/types/v2/v2_nim_chatroom_service.d.ts +203 -67
  51. package/types/v2/v2_nim_client.d.ts +117 -30
  52. package/types/v2/v2_nim_conversation_group_service.d.ts +59 -11
  53. package/types/v2/v2_nim_conversation_service.d.ts +151 -29
  54. package/types/v2/v2_nim_friend_service.d.ts +139 -39
  55. package/types/v2/v2_nim_login_service.d.ts +70 -15
  56. package/types/v2/v2_nim_message_service.d.ts +337 -95
  57. package/types/v2/v2_nim_notification_service.d.ts +13 -6
  58. package/types/v2/v2_nim_passthrough_service.d.ts +25 -0
  59. package/types/v2/v2_nim_setting_service.d.ts +83 -31
  60. package/types/v2/v2_nim_signalling_service.d.ts +174 -46
  61. package/types/v2/v2_nim_storage_service.d.ts +119 -40
  62. package/types/v2/v2_nim_subscription_service.d.ts +44 -14
  63. package/types/v2/v2_nim_team_service.d.ts +335 -142
  64. package/types/v2/v2_nim_user_service.d.ts +64 -21
  65. package/types/v2/v2_nim_utilities.d.ts +306 -129
  66. package/types/v2_def/v2_nim_enum_def.d.ts +10 -0
  67. package/types/v2_def/v2_nim_struct_def.d.ts +48 -8
@@ -1,7 +1,7 @@
1
1
  import EventEmitter from 'eventemitter3';
2
2
  import { V2NIMChatroomMessage, V2NIMChatroomMember, V2NIMChatroomInfo, V2NIMSendChatroomMessageParams, V2NIMSendChatroomMessageResult, V2NIMChatroomMemberQueryOption, V2NIMChatroomMemberListResult, V2NIMChatroomMessageListOption, V2NIMChatroomMemberRoleUpdateParams, V2NIMChatroomUpdateParams, V2NIMAntispamConfig, V2NIMChatroomSelfMemberUpdateParams, V2NIMChatroomTagTempChatBannedParams, V2NIMChatroomTagMemberOption, V2NIMChatroomLocationConfig, V2NIMChatroomTagsUpdateParams, V2NIMChatroomTagMessageOption } from 'ts/v2_def/v2_nim_struct_def';
3
3
  import { V2NIMChatroomMemberRole } from 'ts/v2_def/v2_nim_enum_def';
4
- export declare interface V2NIMChatroomServiceEvents {
4
+ export declare interface V2NIMChatroomListener {
5
5
  /** 收到新消息 */
6
6
  receiveMessages: [V2NIMChatroomMessage[]];
7
7
  /** 聊天室成员进入 */
@@ -28,90 +28,226 @@ export declare interface V2NIMChatroomServiceEvents {
28
28
  sendMessage: [V2NIMChatroomMessage];
29
29
  }
30
30
  /** @brief 聊天室服务 */
31
- export declare class V2NIMChatroomService extends EventEmitter<V2NIMChatroomServiceEvents> {
31
+ export declare class V2NIMChatroomService extends EventEmitter<V2NIMChatroomListener> {
32
32
  instance: any;
33
33
  constructor(instanceId: number);
34
- /** @brief 发送消息 */
35
- /** @param message 需要发送的消息体 */
36
- /** @param params 发送消息相关配置参数 */
37
- /** @return void */
34
+ /**
35
+ * @brief 发送消息
36
+ * @param message 需要发送的消息体
37
+ * @param params 发送消息相关配置参数
38
+ * @returns void
39
+ * @example
40
+ * ```javascript
41
+ * const message = V2NIMChatroomMessageCreator.createTextMessage('Hello NTES IM')
42
+ * await chatroomService.sendMessage(message, {})
43
+ * ```
44
+ */
38
45
  sendMessage(message: V2NIMChatroomMessage, params: V2NIMSendChatroomMessageParams): Promise<V2NIMSendChatroomMessageResult>;
39
- /** @brief 取消文件消息附件上传 */
40
- /** @param message 要取消上传的文件消息 */
46
+ /**
47
+ * @brief 取消上传消息附件
48
+ * @param message 要取消上传的文件消息
49
+ * @returns void
50
+ * @example
51
+ * ```javascript
52
+ * await chatroomService.cancelMessageAttachmentUpload(message)
53
+ * ```
54
+ */
41
55
  cancelMessageAttachmentUpload(message: V2NIMChatroomMessage): Promise<void>;
42
- /** @brief 分页获取聊天室成员列表 */
43
- /** @param queryOption 查询选项 */
44
- /** @return void */
56
+ /**
57
+ * @brief 查询聊天室成员列表
58
+ * @param queryOption 查询选项
59
+ * @returns V2NIMChatroomMemberListResult
60
+ * @example
61
+ * ```javascript
62
+ * const result = await chatroomService.getMemberListByOption({
63
+ * limit: 10
64
+ * })
65
+ * console.log(result)
66
+ * ```
67
+ */
45
68
  getMemberListByOption(queryOption: V2NIMChatroomMemberQueryOption): Promise<V2NIMChatroomMemberListResult>;
46
- /** @brief 查询历史消息 */
47
- /** @param option 查询选项 */
48
- /** @return void */
69
+ /**
70
+ * @brief 查询聊天室消息列表
71
+ * @param option 查询选项
72
+ * @returns Array<V2NIMChatroomMessage>
73
+ * @example
74
+ * ```javascript
75
+ * const result = await chatroomService.getMessageList({
76
+ * limit: 10
77
+ * })
78
+ * console.log(result)
79
+ * ```
80
+ */
49
81
  getMessageList(option: V2NIMChatroomMessageListOption): Promise<Array<V2NIMChatroomMessage>>;
50
- /** @brief 更新聊天室成员角色 */
51
- /** @param accountId 聊天室成员 id */
52
- /** @param upadateParams 更新参数 */
53
- /** @return void */
82
+ /**
83
+ * @brief 更新聊天室成员角色
84
+ * @param accountId 聊天室成员 id
85
+ * @param upadateParams 更新参数
86
+ * @returns void
87
+ * @example
88
+ * ```javascript
89
+ * await chatroomService.updateMemberRole('accountId', {
90
+ * memberRole: 2
91
+ * })
92
+ * ```
93
+ */
54
94
  updateMemberRole(accountId: string, upadateParams: V2NIMChatroomMemberRoleUpdateParams): Promise<void>;
55
- /** @brief 设置聊天室成员黑名单状态 */
56
- /** @param accountId 聊天室成员 id */
57
- /** @param blocked 黑名单状态 */
58
- /** @param notificationExtension 通知扩展字段 */
59
- /** @return void */
95
+ /**
96
+ * @brief 设置聊天室成员黑名单状态
97
+ * @param accountId 聊天室成员 id
98
+ * @param blocked 黑名单状态
99
+ * @param notificationExtension 通知扩展字段
100
+ * @returns void
101
+ * @example
102
+ * ```javascript
103
+ * await chatroomService.setMemberBlockedStatus('accountId', true, 'your notification extension')
104
+ * ```
105
+ */
60
106
  setMemberBlockedStatus(accountId: string, blocked: boolean, notificationExtension: string): Promise<void>;
61
- /** @brief 设置聊天室成员禁言状态 */
62
- /** @param accountId 聊天室成员 id */
63
- /** @param chatBanned 禁言状态 */
64
- /** @param notificationExtension 通知扩展字段 */
65
- /** @return void */
107
+ /**
108
+ * @brief 设置聊天室成员禁言状态
109
+ * @param accountId 聊天室成员 id
110
+ * @param chatBanned 禁言状态
111
+ * @param notificationExtension 通知扩展字段
112
+ * @returns void
113
+ * @example
114
+ * ```javascript
115
+ * await chatroomService.setMemberChatBannedStatus('accountId', true, 'your notification extension')
116
+ * ```
117
+ */
66
118
  setMemberChatBannedStatus(accountId: string, chatBanned: boolean, notificationExtension: string): Promise<void>;
67
- /** @brief 设置聊天室成员临时禁言状态 */
68
- /** @param accountId 聊天室成员 id */
69
- /** @param tempChatBannedDuration 临时禁言时长, 单位秒, 0 表示取消临时禁言 */
70
- /** @param notificationEnabled 是否发送通知 */
71
- /** @param notificationExtension 通知扩展字段 */
72
- /** @return void */
119
+ /**
120
+ * @brief 设置聊天室成员临时禁言状态
121
+ * @param accountId 聊天室成员 id
122
+ * @param tempChatBannedDuration 临时禁言时长, 单位秒, 0 表示取消临时禁言
123
+ * @param notificationEnabled 是否发送通知
124
+ * @param notificationExtension 通知扩展字段
125
+ * @returns void
126
+ * @example
127
+ * ```javascript
128
+ * await chatroomService.setMemberTempChatBanned('accountId', 10, true, 'your notification extension')
129
+ * ```
130
+ */
73
131
  setMemberTempChatBanned(accountId: string, tempChatBannedDuration: number, notificationEnabled: boolean, notificationExtension: string): Promise<void>;
74
- /** @brief 更新聊天室信息 */
75
- /** @param updateParams 更新参数 */
76
- /** @param antispamConfig 反垃圾配置 */
77
- /** @return void */
132
+ /**
133
+ * @brief 更新聊天室信息
134
+ * @param updateParams 更新参数
135
+ * @param antispamConfig 反垃圾配置
136
+ * @returns void
137
+ * @example
138
+ * ```javascript
139
+ * await chatroomService.updateChatroomInfo({
140
+ * roomName: 'new room name'
141
+ * }, {})
142
+ * ```
143
+ */
78
144
  updateChatroomInfo(updateParams: V2NIMChatroomUpdateParams, antispamConfig: V2NIMAntispamConfig): Promise<void>;
79
- /** @brief 更新自己在聊天室的成员信息 */
80
- /** @param updateParams 更新参数 */
81
- /** @param antispamConfig 反垃圾配置 */
82
- /** @return void */
145
+ /**
146
+ * @brief 更新自己在聊天室的成员信息
147
+ * @param updateParams 更新参数
148
+ * @param antispamConfig 反垃圾配置
149
+ * @returns void
150
+ * @example
151
+ * ```javascript
152
+ * await chatroomService.updateSelfMemberInfo({
153
+ * roomNick: 'new room nickname'
154
+ * }, {})
155
+ * ```
156
+ */
83
157
  updateSelfMemberInfo(updateParams: V2NIMChatroomSelfMemberUpdateParams, antispamConfig: V2NIMAntispamConfig): Promise<void>;
84
- /** @brief 根据账号列表查询成员信息 */
85
- /** @param accountIds 账号列表 */
86
- /** @return void */
158
+ /**
159
+ * @param accountIds 账号列表
160
+ * @returns Array<V2NIMChatroomMember>
161
+ * @example
162
+ * ```javascript
163
+ * const result = await chatroomService.getMemberByIds(['accountId1', 'accountId2'])
164
+ * console.log(result)
165
+ * ```
166
+ */
87
167
  getMemberByIds(accountIds: Array<string>): Promise<Array<V2NIMChatroomMember>>;
88
- /** @brief 踢出聊天室成员 */
89
- /** @param accountId 聊天室成员 id */
90
- /** @param notificationExtension 通知扩展字段 */
91
- /** @return void */
168
+ /**
169
+ * @brief 踢出聊天室成员
170
+ * @param accountId 聊天室成员 id
171
+ * @param notificationExtension 通知扩展字段
172
+ * @returns void
173
+ * @example
174
+ * ```javascript
175
+ * await chatroomService.kickMember('accountId', 'your notification extension')
176
+ * ```
177
+ */
92
178
  kickMember(accountId: string, notificationExtension: string): Promise<void>;
93
- /** @brief 按聊天室标签临时禁言 */
94
- /** @param params 设置标签禁言的参数 */
95
- /** @return void */
179
+ /**
180
+ * @brief 按聊天室标签临时禁言
181
+ * @param params 设置标签禁言的参数
182
+ * @returns void
183
+ * @example
184
+ * ```javascript
185
+ * await chatroomService.setTempChatBannedByTag({
186
+ * targetTag: 'tag',
187
+ * duration: 10
188
+ * })
189
+ * ```
190
+ */
96
191
  setTempChatBannedByTag(params: V2NIMChatroomTagTempChatBannedParams): Promise<void>;
97
- /** @brief 根据标签查询成员列表 */
98
- /** @param option 查询成员列表的参数 */
99
- /** @return void */
192
+ /**
193
+ * @brief 根据标签查询成员列表
194
+ * @param option 查询成员列表的参数
195
+ * @returns V2NIMChatroomMemberListResult
196
+ * @example
197
+ * ```javascript
198
+ * const result = await chatroomService.getMemberListByTag({
199
+ * tag: 'tag',
200
+ * limit: 10
201
+ * })
202
+ * ```
203
+ */
100
204
  getMemberListByTag(option: V2NIMChatroomTagMemberOption): Promise<V2NIMChatroomMemberListResult>;
101
- /** @brief 查询某个标签下的成员人数 */
102
- /** @param tag 标签 */
103
- /** @return void */
205
+ /**
206
+ * @brief 查询某个标签下的成员人数
207
+ * @param tag 标签
208
+ * @returns number
209
+ * @example
210
+ * ```javascript
211
+ * const count = await chatroomService.getMemberCountByTag('tag')
212
+ * ```
213
+ */
104
214
  getMemberCountByTag(tag: string): Promise<number>;
105
- /** @brief 更新坐标信息 */
106
- /** @param locationConfig 坐标信息 */
107
- /** @return void */
215
+ /**
216
+ * @brief 更新坐标信息
217
+ * @param locationConfig 坐标信息
218
+ * @returns void
219
+ * @example
220
+ * ```javascript
221
+ * await chatroomService.updateChatroomLocationInfo({
222
+ * latitude: 30.5,
223
+ * longitude: 120.5
224
+ * })
225
+ * ```
226
+ */
108
227
  updateChatroomLocationInfo(locationConfig: V2NIMChatroomLocationConfig): Promise<void>;
109
- /** @brief 更新聊天室 tag 信息 */
110
- /** @param updateParams tag 更新的参数 */
111
- /** @return void */
228
+ /**
229
+ * @brief 更新聊天室 tag 信息
230
+ * @param updateParams tag 更新的参数
231
+ * @returns void
232
+ * @example
233
+ * ```javascript
234
+ * await chatroomService.updateChatroomTags({
235
+ * tags: ['tag1', 'tag2']
236
+ * })
237
+ * ```
238
+ */
112
239
  updateChatroomTags(updateParams: V2NIMChatroomTagsUpdateParams): Promise<void>;
113
- /** @brief 根据标签查询消息列表 */
114
- /** @param messageOption 查询参数 */
115
- /** @return void */
240
+ /**
241
+ * @brief 根据标签查询消息列表
242
+ * @param messageOption 查询参数
243
+ * @returns Array<V2NIMChatroomMessage>
244
+ * @example
245
+ * ```javascript
246
+ * const result = await chatroomService.getMessageListByTag({
247
+ * tags: ['tag1', 'tag2'],
248
+ * limit: 10
249
+ * })
250
+ * ```
251
+ */
116
252
  getMessageListByTag(messageOption: V2NIMChatroomTagMessageOption): Promise<Array<V2NIMChatroomMessage>>;
117
253
  }
@@ -10,13 +10,14 @@ import { V2NIMTeamService } from './v2_nim_team_service';
10
10
  import { V2NIMSettingService } from './v2_nim_setting_service';
11
11
  import { V2NIMFriendService } from './v2_nim_friend_service';
12
12
  import { V2NIMUserService } from './v2_nim_user_service';
13
- import { V2NIMAIService } from "./v2_nim_ai_service";
14
- import { V2NIMSignallingService } from "./v2_nim_signalling_service";
15
- import { V2NIMSubscriptionService } from "./v2_nim_subscription_service";
13
+ import { V2NIMAIService } from './v2_nim_ai_service';
14
+ import { V2NIMSignallingService } from './v2_nim_signalling_service';
15
+ import { V2NIMSubscriptionService } from './v2_nim_subscription_service';
16
+ import { V2NIMPassthroughService } from './v2_nim_passthrough_service';
16
17
  import { V2NIMConversationIdUtil, V2NIMMessageCreator, V2NIMMessageConverter, V2NIMClientAntispamUtil, V2NIMStorageUtil, V2NIMMessageAttachmentCreator } from './v2_nim_utilities';
17
- export declare interface V2NIMClientEvents {
18
+ export declare interface V2NIMClientListener {
18
19
  }
19
- export declare class V2NIMClient extends EventEmitter<V2NIMClientEvents> {
20
+ export declare class V2NIMClient extends EventEmitter<V2NIMClientListener> {
20
21
  instance: any;
21
22
  conversationIdUtil: V2NIMConversationIdUtil | null;
22
23
  messageCreator: V2NIMMessageCreator | null;
@@ -37,68 +38,154 @@ export declare class V2NIMClient extends EventEmitter<V2NIMClientEvents> {
37
38
  aiService: V2NIMAIService | null;
38
39
  signallingService: V2NIMSignallingService | null;
39
40
  subscriptionService: V2NIMSubscriptionService | null;
41
+ passthroughService: V2NIMPassthroughService | null;
40
42
  constructor();
41
43
  /**
42
- * 初始化
44
+ * @brief 初始化
43
45
  * @param option - 初始化选项
44
46
  * @returns V2NIMError | null
45
47
  * @example
48
+ * ```javascript
49
+ * await client.init({
50
+ * appkey: 'your app key'
51
+ * })
52
+ * if (error) {
53
+ * console.error(error)
54
+ * }
55
+ * ```
46
56
  */
47
57
  init(option: V2NIMInitOption): V2NIMError | null;
48
- /** @brief 反初始化
49
- * @return V2NIMError | null
58
+ /**
59
+ * @brief 反初始化
60
+ * @returns V2NIMError | null
61
+ * @example
62
+ * ```javascript
63
+ * await client.uninit()
64
+ * if (error) {
65
+ * console.error(error)
66
+ * }
67
+ * ```
50
68
  */
51
69
  uninit(): V2NIMError | null;
52
70
  /**
53
71
  * @brief 更新 appKey
54
72
  * @param appKey - 新的 App key
55
- * @return V2NIMError | null
73
+ * @returns V2NIMError | null
74
+ * @example
75
+ * ```javascript
76
+ * await client.updateAppKey('your new app key')
77
+ * if (error) {
78
+ * console.error(error)
79
+ * }
80
+ * ```
56
81
  */
57
82
  updateAppKey(appKey: string): V2NIMError | null;
58
- /** @brief 获取登录服务
59
- * @return V2NIMLoginService
83
+ /**
84
+ * @brief 获取登录服务
85
+ * @returns V2NIMLoginService
86
+ * @example
87
+ * ```javascript
88
+ * const loginService = client.getLoginService()
89
+ * ```
60
90
  */
61
91
  getLoginService(): V2NIMLoginService | null;
62
- /** @brief 获取会话服务
63
- /* @return V2NIMConversationService
64
- */
92
+ /**
93
+ * @brief 获取会话服务
94
+ * @returns V2NIMConversationService
95
+ * @example
96
+ * ```javascript
97
+ * const conversationService = client.getConversationService()
98
+ * ```
99
+ */
65
100
  getConversationService(): V2NIMConversationService | null;
66
- /** @brief 获取会话分组服务
67
- * @return V2NIMConversationGroupService
101
+ /**
102
+ * @brief 获取会话分组服务
103
+ * @returns V2NIMConversationGroupService
104
+ * @example
105
+ * ```javascript
106
+ * const conversationGroupService = client.getConversationGroupService()
107
+ * ```
68
108
  */
69
109
  getConversationGroupService(): V2NIMConversationGroupService | null;
70
- /** @brief 获取消息服务
71
- * @return V2NIMMessageService
110
+ /**
111
+ * @brief 获取消息服务
112
+ * @returns V2NIMMessageService
113
+ * @example
114
+ * ```javascript
115
+ * const messageService = client.getMessageService()
116
+ * ```
72
117
  */
73
118
  getMessageService(): V2NIMMessageService | null;
74
- /** @brief 获取ai服务
75
- * @return V2NIMAIService
119
+ /**
120
+ * @brief 获取ai服务
121
+ * @returns V2NIMAIService
122
+ * @example
123
+ * ```javascript
124
+ * const aiService = client.getAIService()
125
+ * ```
76
126
  */
77
127
  getAIService(): V2NIMAIService | null;
78
- /** @brief 获取通知服务
79
- * @return V2NIMNotificationService
128
+ /**
129
+ * @brief 获取通知服务
130
+ * @returns V2NIMNotificationService
131
+ * @example
132
+ * ```javascript
133
+ * const notificationService = client.getNotificationService()
134
+ * ```
80
135
  */
81
136
  getNotificationService(): V2NIMNotificationService | null;
82
- /** @brief 获取存储服务
83
- * @return V2NIMStorageService
137
+ /**
138
+ * @brief 获取存储服务
139
+ * @returns V2NIMStorageService
140
+ * @example
141
+ * ```javascript
142
+ * const storageService = client.getStorageService()
143
+ * ```
84
144
  */
85
145
  getStorageService(): V2NIMStorageService | null;
86
- /** @brief 获取群组服务
87
- * @return V2NIMTeamService
146
+ /**
147
+ * @brief 获取群组服务
148
+ * @returns V2NIMTeamService
149
+ * @example
150
+ * ```javascript
151
+ * const teamService = client.getTeamService()
152
+ * ```
88
153
  */
89
154
  getTeamService(): V2NIMTeamService | null;
90
- /** @brief 获取设置服务
91
- * @return V2NIMSettingService
155
+ /**
156
+ * @brief 获取设置服务
157
+ * @returns V2NIMSettingService
158
+ * @example
159
+ * ```javascript
160
+ * const settingService = client.getSettingService()
161
+ * ```
92
162
  */
93
163
  getSettingService(): V2NIMSettingService | null;
94
164
  /**
95
165
  * @brief 获取独立信令服务
96
- * @return V2NIMSignallingService
166
+ * @returns V2NIMSignallingService
167
+ * @example
168
+ * ```javascript
169
+ * const signallingService = client.getSignallingService()
170
+ * ```
97
171
  */
98
172
  getSignallingService(): V2NIMSignallingService | null;
99
173
  /**
100
174
  * @brief 获取订阅服务
101
- * @return V2NIMSubscriptionService
175
+ * @returns V2NIMSubscriptionService
176
+ * @example
177
+ * ```javascript
178
+ * const subscriptionService = client.getSubscriptionService()
179
+ * ```
102
180
  */
103
181
  getSubscriptionService(): V2NIMSubscriptionService | null;
182
+ /**
183
+ * @brief 获取透传服务
184
+ * @returns V2NIMPassthroughService
185
+ * @example
186
+ * ```javascript
187
+ * const passthroughService = client.getPasseThroughService()
188
+ * ```
189
+ */
190
+ getPasseThroughService(): V2NIMPassthroughService | null;
104
191
  }
@@ -1,6 +1,6 @@
1
1
  import { V2NIMConversationGroup, V2NIMConversation, V2NIMConversationGroupResult, V2NIMConversationOperationResult } from 'ts/v2_def/v2_nim_struct_def';
2
2
  import { EventEmitter } from 'eventemitter3';
3
- export declare interface V2NIMConversationGroupServiceEvents {
3
+ export declare interface V2NIMConversationGroupListener {
4
4
  /** 会话分组创建通知 */
5
5
  conversationGroupCreated: [V2NIMConversationGroup];
6
6
  /** 会话分组删除通知 */
@@ -12,43 +12,91 @@ export declare interface V2NIMConversationGroupServiceEvents {
12
12
  /** 会话移出会话分组通知 */
13
13
  conversationsRemovedFromGroup: [string, string[]];
14
14
  }
15
- export declare class V2NIMConversationGroupService extends EventEmitter<V2NIMConversationGroupServiceEvents> {
15
+ export declare class V2NIMConversationGroupService extends EventEmitter<V2NIMConversationGroupListener> {
16
16
  instance: any;
17
17
  constructor();
18
- /** @brief 创建会话分组
18
+ /**
19
+ * @brief 创建会话分组
19
20
  * @param name 会话分组名称
20
21
  * @param conversationIds 会话 ID 列表
22
+ * @returns V2NIMConversationGroupResult
23
+ * @example
24
+ * ```javascript
25
+ * const result = await v2.conversationGroupService.createConversationGroup('group1', 'extension', ['conversation1', 'conversation2'])
26
+ * ```
21
27
  */
22
28
  createConversationGroup(name: string, serverExtension?: string, conversationIds?: string[]): Promise<V2NIMConversationGroupResult>;
23
- /** @brief 删除会话分组
29
+ /**
30
+ * @brief 删除会话分组
24
31
  * @param groupId 会话分组 ID
32
+ * @returns void
33
+ * @example
34
+ * ```javascript
35
+ * await v2.conversationGroupService.deleteConversationGroup('group1')
36
+ * ```
25
37
  */
26
38
  deleteConversationGroup(groupId: string): Promise<void>;
27
- /** @brief 更新会话分组
39
+ /**
40
+ * @brief 更新会话分组
28
41
  * @param groupId 会话分组 ID
29
42
  * @param name 新的会话分组名称
30
43
  * @param serverExtension 扩展字段
44
+ * @returns void
45
+ * @example
46
+ * ```javascript
47
+ * await v2.conversationGroupService.updateConversationGroup('group1', 'newName', 'newExtension')
48
+ * ```
31
49
  */
32
50
  updateConversationGroup(groupId: string, name?: string, serverExtension?: string): Promise<void>;
33
- /** @brief 添加会话到会话分组
51
+ /**
52
+ * @brief 添加会话到会话分组
34
53
  * @param groupId 会话分组 ID
35
54
  * @param conversationIds 会话 ID 列表
55
+ * @returns Array<V2NIMConversationOperationResult>
56
+ * @example
57
+ * ```javascript
58
+ * const result = await v2.conversationGroupService.addConversationsToGroup('group1', ['conversation1', 'conversation2'])
59
+ * ```
36
60
  */
37
61
  addConversationsToGroup(groupId: string, conversationIds: string[]): Promise<Array<V2NIMConversationOperationResult>>;
38
- /** @brief 从会话分组中移除会话
62
+ /**
63
+ * @brief 从会话分组中移除会话
39
64
  * @param groupId 会话分组 ID
40
65
  * @param conversationIds 会话 ID 列表
66
+ * @returns Array<V2NIMConversationOperationResult>
67
+ * @example
68
+ * ```javascript
69
+ * const result = await v2.conversationGroupService.removeConversationsFromGroup('group1', ['conversation1', 'conversation2'])
70
+ * ```
41
71
  */
42
72
  removeConversationsFromGroup(groupId: string, conversationIds: string[]): Promise<Array<V2NIMConversationOperationResult>>;
43
- /** @brief 获取会话分组信息
73
+ /**
74
+ * @brief 获取会话分组信息
44
75
  * @param groupId 会话分组 ID
76
+ * @returns V2NIMConversationGroup
77
+ * @example
78
+ * ```javascript
79
+ * const group = await v2.conversationGroupService.getConversationGroup('group1')
80
+ * ```
45
81
  */
46
82
  getConversationGroup(groupId: string): Promise<V2NIMConversationGroup>;
47
- /** @brief 获取会话分组列表
83
+ /**
84
+ * @brief 获取会话分组列表
85
+ * @returns Array<V2NIMConversationGroup>
86
+ * @example
87
+ * ```javascript
88
+ * const list = await v2.conversationGroupService.getConversationGroupList()
89
+ * ```
48
90
  */
49
91
  getConversationGroupList(): Promise<Array<V2NIMConversationGroup>>;
50
- /** @brief 根据会话分组 ID 获取会话分组
51
- * @param groupId 会话分组 ID
92
+ /**
93
+ * @brief 根据会话分组 ID 获取会话分组
94
+ * @param groupIds 会话分组 ID 列表
95
+ * @returns Array<V2NIMConversationGroup>
96
+ * @example
97
+ * ```javascript
98
+ * const list = await v2.conversationGroupService.getConversationGroupListByIds(['group1', 'group2'])
99
+ * ```
52
100
  */
53
101
  getConversationGroupListByIds(groupIds: string[]): Promise<Array<V2NIMConversationGroup>>;
54
102
  }