node-nim 10.4.0-beta.1 → 10.6.0-beta.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 (189) hide show
  1. package/README.md +58 -44
  2. package/dist/chatroom/chatroom.js +482 -0
  3. package/dist/chatroom/chatroom.js.map +1 -0
  4. package/dist/chatroom_def/chatroom_def.js +146 -73
  5. package/dist/chatroom_def/chatroom_def.js.map +1 -1
  6. package/dist/loader.js +2 -2
  7. package/dist/loader.js.map +1 -1
  8. package/dist/nim/ai.js +44 -0
  9. package/dist/nim/ai.js.map +1 -0
  10. package/dist/nim/client.js +4 -4
  11. package/dist/nim/client.js.map +1 -1
  12. package/dist/nim/data_sync.js.map +1 -1
  13. package/dist/nim/friend.js +9 -9
  14. package/dist/nim/friend.js.map +1 -1
  15. package/dist/nim/global.js.map +1 -1
  16. package/dist/nim/msglog.js +9 -1
  17. package/dist/nim/msglog.js.map +1 -1
  18. package/dist/nim/nos.js.map +1 -1
  19. package/dist/nim/online_session.js.map +1 -1
  20. package/dist/nim/pass_through_proxy.js +7 -7
  21. package/dist/nim/pass_through_proxy.js.map +1 -1
  22. package/dist/nim/plugin.js +3 -3
  23. package/dist/nim/plugin.js.map +1 -1
  24. package/dist/nim/session.js +52 -52
  25. package/dist/nim/session.js.map +1 -1
  26. package/dist/nim/subscribe_event.js +15 -15
  27. package/dist/nim/subscribe_event.js.map +1 -1
  28. package/dist/nim/super_team.js +63 -63
  29. package/dist/nim/super_team.js.map +1 -1
  30. package/dist/nim/sysmsg.js +14 -14
  31. package/dist/nim/sysmsg.js.map +1 -1
  32. package/dist/nim/talk.js +31 -10
  33. package/dist/nim/talk.js.map +1 -1
  34. package/dist/nim/talkex.js +27 -27
  35. package/dist/nim/talkex.js.map +1 -1
  36. package/dist/nim/team.js +86 -86
  37. package/dist/nim/team.js.map +1 -1
  38. package/dist/nim/tool.js +1 -1
  39. package/dist/nim/tool.js.map +1 -1
  40. package/dist/nim/user.js +2 -2
  41. package/dist/nim/user.js.map +1 -1
  42. package/dist/nim_def/ai_def.js +25 -0
  43. package/dist/nim_def/ai_def.js.map +1 -0
  44. package/dist/nim_def/client_def.js +145 -118
  45. package/dist/nim_def/client_def.js.map +1 -1
  46. package/dist/nim_def/data_sync_def.js +18 -9
  47. package/dist/nim_def/data_sync_def.js.map +1 -1
  48. package/dist/nim_def/doc_trans_def.js +10 -5
  49. package/dist/nim_def/doc_trans_def.js.map +1 -1
  50. package/dist/nim_def/friend_def.js +28 -14
  51. package/dist/nim_def/friend_def.js.map +1 -1
  52. package/dist/nim_def/global_def.js +32 -16
  53. package/dist/nim_def/global_def.js.map +1 -1
  54. package/dist/nim_def/msglog_def.js +203 -117
  55. package/dist/nim_def/msglog_def.js.map +1 -1
  56. package/dist/nim_def/nos_def.js +12 -6
  57. package/dist/nim_def/nos_def.js.map +1 -1
  58. package/dist/nim_def/pass_through_proxy_def.js +5 -0
  59. package/dist/nim_def/pass_through_proxy_def.js.map +1 -1
  60. package/dist/nim_def/session_def.js +30 -15
  61. package/dist/nim_def/session_def.js.map +1 -1
  62. package/dist/nim_def/subscribe_event_def.js +32 -15
  63. package/dist/nim_def/subscribe_event_def.js.map +1 -1
  64. package/dist/nim_def/super_team_def.js +52 -27
  65. package/dist/nim_def/super_team_def.js.map +1 -1
  66. package/dist/nim_def/sysmsg_def.js +32 -17
  67. package/dist/nim_def/sysmsg_def.js.map +1 -1
  68. package/dist/nim_def/team_def.js +56 -29
  69. package/dist/nim_def/team_def.js.map +1 -1
  70. package/dist/nim_def/tool_def.js +8 -4
  71. package/dist/nim_def/tool_def.js.map +1 -1
  72. package/dist/nim_def/user_def.js +16 -8
  73. package/dist/nim_def/user_def.js.map +1 -1
  74. package/dist/node-nim.js +32 -1
  75. package/dist/node-nim.js.map +1 -1
  76. package/dist/qchat/attachment.js.map +1 -1
  77. package/dist/qchat/channel.js.map +1 -1
  78. package/dist/qchat/channel_category.js.map +1 -1
  79. package/dist/qchat/instance.js.map +1 -1
  80. package/dist/qchat/message.js.map +1 -1
  81. package/dist/qchat/role.js.map +1 -1
  82. package/dist/qchat/server.js.map +1 -1
  83. package/dist/qchat/system_notification.js.map +1 -1
  84. package/dist/qchat_def/public_def.js +9 -2
  85. package/dist/qchat_def/public_def.js.map +1 -1
  86. package/dist/v2/v2_nim_ai_service.js.map +1 -1
  87. package/dist/v2/v2_nim_chatroom_client.js +160 -39
  88. package/dist/v2/v2_nim_chatroom_client.js.map +1 -1
  89. package/dist/v2/v2_nim_chatroom_queue_service.js +148 -0
  90. package/dist/v2/v2_nim_chatroom_queue_service.js.map +1 -0
  91. package/dist/v2/v2_nim_chatroom_service.js +201 -65
  92. package/dist/v2/v2_nim_chatroom_service.js.map +1 -1
  93. package/dist/v2/v2_nim_client.js +126 -24
  94. package/dist/v2/v2_nim_client.js.map +1 -1
  95. package/dist/v2/v2_nim_conversation_group_service.js +57 -9
  96. package/dist/v2/v2_nim_conversation_group_service.js.map +1 -1
  97. package/dist/v2/v2_nim_conversation_service.js +149 -27
  98. package/dist/v2/v2_nim_conversation_service.js.map +1 -1
  99. package/dist/v2/v2_nim_friend_service.js +152 -36
  100. package/dist/v2/v2_nim_friend_service.js.map +1 -1
  101. package/dist/v2/v2_nim_login_service.js +72 -13
  102. package/dist/v2/v2_nim_login_service.js.map +1 -1
  103. package/dist/v2/v2_nim_message_service.js +335 -93
  104. package/dist/v2/v2_nim_message_service.js.map +1 -1
  105. package/dist/v2/v2_nim_notification_service.js +11 -4
  106. package/dist/v2/v2_nim_notification_service.js.map +1 -1
  107. package/dist/v2/v2_nim_passthrough_service.js +39 -0
  108. package/dist/v2/v2_nim_passthrough_service.js.map +1 -0
  109. package/dist/v2/v2_nim_setting_service.js +81 -29
  110. package/dist/v2/v2_nim_setting_service.js.map +1 -1
  111. package/dist/v2/v2_nim_signalling_service.js +172 -44
  112. package/dist/v2/v2_nim_signalling_service.js.map +1 -1
  113. package/dist/v2/v2_nim_storage_service.js +116 -37
  114. package/dist/v2/v2_nim_storage_service.js.map +1 -1
  115. package/dist/v2/v2_nim_subscription_service.js +42 -12
  116. package/dist/v2/v2_nim_subscription_service.js.map +1 -1
  117. package/dist/v2/v2_nim_team_service.js +367 -130
  118. package/dist/v2/v2_nim_team_service.js.map +1 -1
  119. package/dist/v2/v2_nim_user_service.js +62 -19
  120. package/dist/v2/v2_nim_user_service.js.map +1 -1
  121. package/dist/v2/v2_nim_utilities.js +313 -125
  122. package/dist/v2/v2_nim_utilities.js.map +1 -1
  123. package/dist/v2_def/v2_nim_enum_def.js +76 -62
  124. package/dist/v2_def/v2_nim_enum_def.js.map +1 -1
  125. package/dist/v2_def/v2_nim_struct_def.js +0 -2
  126. package/dist/v2_def/v2_nim_struct_def.js.map +1 -1
  127. package/package.json +9 -6
  128. package/script/download-sdk.js +1 -1
  129. package/types/chatroom/chatroom.d.ts +274 -0
  130. package/types/chatroom_def/chatroom_def.d.ts +150 -74
  131. package/types/nim/ai.d.ts +25 -0
  132. package/types/nim/client.d.ts +8 -8
  133. package/types/nim/friend.d.ts +9 -9
  134. package/types/nim/msglog.d.ts +8 -2
  135. package/types/nim/pass_through_proxy.d.ts +7 -7
  136. package/types/nim/plugin.d.ts +3 -3
  137. package/types/nim/session.d.ts +50 -50
  138. package/types/nim/subscribe_event.d.ts +15 -15
  139. package/types/nim/super_team.d.ts +63 -63
  140. package/types/nim/sysmsg.d.ts +14 -14
  141. package/types/nim/talk.d.ts +28 -11
  142. package/types/nim/talkex.d.ts +27 -27
  143. package/types/nim/team.d.ts +86 -86
  144. package/types/nim/tool.d.ts +1 -1
  145. package/types/nim/user.d.ts +2 -2
  146. package/types/nim_def/ai_def.d.ts +79 -0
  147. package/types/nim_def/client_def.d.ts +322 -127
  148. package/types/nim_def/data_sync_def.d.ts +18 -9
  149. package/types/nim_def/doc_trans_def.d.ts +10 -5
  150. package/types/nim_def/friend_def.d.ts +52 -26
  151. package/types/nim_def/global_def.d.ts +32 -16
  152. package/types/nim_def/msglog_def.d.ts +466 -217
  153. package/types/nim_def/nos_def.d.ts +62 -31
  154. package/types/nim_def/online_session_def.d.ts +21 -9
  155. package/types/nim_def/pass_through_proxy_def.d.ts +5 -0
  156. package/types/nim_def/session_def.d.ts +92 -46
  157. package/types/nim_def/subscribe_event_def.d.ts +75 -35
  158. package/types/nim_def/super_team_def.d.ts +75 -37
  159. package/types/nim_def/sysmsg_def.d.ts +78 -40
  160. package/types/nim_def/talk_def.d.ts +85 -20
  161. package/types/nim_def/talkex_def.d.ts +92 -46
  162. package/types/nim_def/team_def.d.ts +93 -39
  163. package/types/nim_def/tool_def.d.ts +16 -8
  164. package/types/nim_def/user_def.d.ts +52 -26
  165. package/types/node-nim.d.ts +29 -2
  166. package/types/qchat_def/message_def.d.ts +1 -1
  167. package/types/qchat_def/public_def.d.ts +6 -0
  168. package/types/qchat_def/role_def.d.ts +3 -1
  169. package/types/v2/v2_nim_ai_service.d.ts +3 -3
  170. package/types/v2/v2_nim_chatroom_client.d.ts +158 -41
  171. package/types/v2/v2_nim_chatroom_queue_service.d.ts +96 -0
  172. package/types/v2/v2_nim_chatroom_service.d.ts +204 -67
  173. package/types/v2/v2_nim_client.d.ts +124 -30
  174. package/types/v2/v2_nim_conversation_group_service.d.ts +59 -11
  175. package/types/v2/v2_nim_conversation_service.d.ts +152 -29
  176. package/types/v2/v2_nim_friend_service.d.ts +140 -39
  177. package/types/v2/v2_nim_login_service.d.ts +75 -14
  178. package/types/v2/v2_nim_message_service.d.ts +337 -95
  179. package/types/v2/v2_nim_notification_service.d.ts +13 -6
  180. package/types/v2/v2_nim_passthrough_service.d.ts +25 -0
  181. package/types/v2/v2_nim_setting_service.d.ts +84 -31
  182. package/types/v2/v2_nim_signalling_service.d.ts +174 -46
  183. package/types/v2/v2_nim_storage_service.d.ts +119 -40
  184. package/types/v2/v2_nim_subscription_service.d.ts +44 -14
  185. package/types/v2/v2_nim_team_service.d.ts +338 -132
  186. package/types/v2/v2_nim_user_service.d.ts +64 -21
  187. package/types/v2/v2_nim_utilities.d.ts +311 -125
  188. package/types/v2_def/v2_nim_enum_def.d.ts +72 -62
  189. package/types/v2_def/v2_nim_struct_def.d.ts +56 -7
@@ -10,17 +10,19 @@ 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";
16
- import { V2NIMConversationIdUtil, V2NIMMessageCreator, V2NIMMessageConverter, V2NIMClientAntispamUtil, V2NIMStorageUtil } from './v2_nim_utilities';
17
- export declare interface V2NIMClientEvents {
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';
17
+ import { V2NIMConversationIdUtil, V2NIMMessageCreator, V2NIMMessageConverter, V2NIMClientAntispamUtil, V2NIMStorageUtil, V2NIMMessageAttachmentCreator } from './v2_nim_utilities';
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;
23
24
  messageConverter: V2NIMMessageConverter | null;
25
+ messageAttachmentCreator: V2NIMMessageAttachmentCreator | null;
24
26
  clientAntispamUtil: V2NIMClientAntispamUtil | null;
25
27
  storageUtil: V2NIMStorageUtil | null;
26
28
  loginService: V2NIMLoginService | null;
@@ -36,62 +38,154 @@ export declare class V2NIMClient extends EventEmitter<V2NIMClientEvents> {
36
38
  aiService: V2NIMAIService | null;
37
39
  signallingService: V2NIMSignallingService | null;
38
40
  subscriptionService: V2NIMSubscriptionService | null;
41
+ passthroughService: V2NIMPassthroughService | null;
39
42
  constructor();
40
43
  /**
41
- * 初始化
44
+ * @brief 初始化
42
45
  * @param option - 初始化选项
43
46
  * @returns V2NIMError | null
44
47
  * @example
48
+ * ```javascript
49
+ * await client.init({
50
+ * appkey: 'your app key'
51
+ * })
52
+ * if (error) {
53
+ * console.error(error)
54
+ * }
55
+ * ```
45
56
  */
46
57
  init(option: V2NIMInitOption): V2NIMError | null;
47
- /** @brief 反初始化
48
- * @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
+ * ```
49
68
  */
50
69
  uninit(): V2NIMError | null;
51
- /** @brief 获取登录服务
52
- * @return V2NIMLoginService
70
+ /**
71
+ * @brief 更新 appKey
72
+ * @param appKey - 新的 App key
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
+ * ```
81
+ */
82
+ updateAppKey(appKey: string): V2NIMError | null;
83
+ /**
84
+ * @brief 获取登录服务
85
+ * @returns V2NIMLoginService
86
+ * @example
87
+ * ```javascript
88
+ * const loginService = client.getLoginService()
89
+ * ```
53
90
  */
54
91
  getLoginService(): V2NIMLoginService | null;
55
- /** @brief 获取会话服务
56
- /* @return V2NIMConversationService
57
- */
92
+ /**
93
+ * @brief 获取会话服务
94
+ * @returns V2NIMConversationService
95
+ * @example
96
+ * ```javascript
97
+ * const conversationService = client.getConversationService()
98
+ * ```
99
+ */
58
100
  getConversationService(): V2NIMConversationService | null;
59
- /** @brief 获取会话分组服务
60
- * @return V2NIMConversationGroupService
101
+ /**
102
+ * @brief 获取会话分组服务
103
+ * @returns V2NIMConversationGroupService
104
+ * @example
105
+ * ```javascript
106
+ * const conversationGroupService = client.getConversationGroupService()
107
+ * ```
61
108
  */
62
109
  getConversationGroupService(): V2NIMConversationGroupService | null;
63
- /** @brief 获取消息服务
64
- * @return V2NIMMessageService
110
+ /**
111
+ * @brief 获取消息服务
112
+ * @returns V2NIMMessageService
113
+ * @example
114
+ * ```javascript
115
+ * const messageService = client.getMessageService()
116
+ * ```
65
117
  */
66
118
  getMessageService(): V2NIMMessageService | null;
67
- /** @brief 获取ai服务
68
- * @return V2NIMAIService
119
+ /**
120
+ * @brief 获取ai服务
121
+ * @returns V2NIMAIService
122
+ * @example
123
+ * ```javascript
124
+ * const aiService = client.getAIService()
125
+ * ```
69
126
  */
70
127
  getAIService(): V2NIMAIService | null;
71
- /** @brief 获取通知服务
72
- * @return V2NIMNotificationService
128
+ /**
129
+ * @brief 获取通知服务
130
+ * @returns V2NIMNotificationService
131
+ * @example
132
+ * ```javascript
133
+ * const notificationService = client.getNotificationService()
134
+ * ```
73
135
  */
74
136
  getNotificationService(): V2NIMNotificationService | null;
75
- /** @brief 获取存储服务
76
- * @return V2NIMStorageService
137
+ /**
138
+ * @brief 获取存储服务
139
+ * @returns V2NIMStorageService
140
+ * @example
141
+ * ```javascript
142
+ * const storageService = client.getStorageService()
143
+ * ```
77
144
  */
78
145
  getStorageService(): V2NIMStorageService | null;
79
- /** @brief 获取群组服务
80
- * @return V2NIMTeamService
146
+ /**
147
+ * @brief 获取群组服务
148
+ * @returns V2NIMTeamService
149
+ * @example
150
+ * ```javascript
151
+ * const teamService = client.getTeamService()
152
+ * ```
81
153
  */
82
154
  getTeamService(): V2NIMTeamService | null;
83
- /** @brief 获取设置服务
84
- * @return V2NIMSettingService
155
+ /**
156
+ * @brief 获取设置服务
157
+ * @returns V2NIMSettingService
158
+ * @example
159
+ * ```javascript
160
+ * const settingService = client.getSettingService()
161
+ * ```
85
162
  */
86
163
  getSettingService(): V2NIMSettingService | null;
87
164
  /**
88
165
  * @brief 获取独立信令服务
89
- * @return V2NIMSignallingService
166
+ * @returns V2NIMSignallingService
167
+ * @example
168
+ * ```javascript
169
+ * const signallingService = client.getSignallingService()
170
+ * ```
90
171
  */
91
172
  getSignallingService(): V2NIMSignallingService | null;
92
173
  /**
93
174
  * @brief 获取订阅服务
94
- * @return V2NIMSubscriptionService
175
+ * @returns V2NIMSubscriptionService
176
+ * @example
177
+ * ```javascript
178
+ * const subscriptionService = client.getSubscriptionService()
179
+ * ```
95
180
  */
96
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;
97
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
  }
@@ -1,6 +1,7 @@
1
1
  import { V2NIMError, V2NIMConversation, V2NIMConversationFilter, V2NIMConversationOperationResult, V2NIMConversationUpdate, V2NIMConversationResult, V2NIMConversationOption } from 'ts/v2_def/v2_nim_struct_def';
2
2
  import { EventEmitter } from 'eventemitter3';
3
- export declare interface V2NIMConversationServiceEvents {
3
+ import { V2NIMConversationType } from 'ts/v2_def/v2_nim_enum_def';
4
+ export declare interface V2NIMConversationListener {
4
5
  /** 会话同步开始通知 */
5
6
  syncStarted: [];
6
7
  /** 会话同步完成通知 */
@@ -20,101 +21,223 @@ export declare interface V2NIMConversationServiceEvents {
20
21
  /** 同账号多端标记会话 ACK 通知时间戳变更 */
21
22
  conversationReadTimeUpdated: [string, number];
22
23
  }
23
- export declare class V2NIMConversationService extends EventEmitter<V2NIMConversationServiceEvents> {
24
+ export declare class V2NIMConversationService extends EventEmitter<V2NIMConversationListener> {
24
25
  instance: any;
25
26
  constructor();
26
- /** @brief 创建空会话
27
+ /**
28
+ * @brief 创建空会话
27
29
  * @param conversationId 会话 ID
30
+ * @returns V2NIMConversation
31
+ * @example
32
+ * ```javascript
33
+ * const conversation = await v2.conversationService.createConversation('conversation1')
34
+ * ```
28
35
  */
29
36
  createConversation(conversationId: string): Promise<V2NIMConversation>;
30
- /** @brief 删除会话
37
+ /**
38
+ * @brief 删除会话
31
39
  * @param conversationId 会话 ID
32
40
  * @param clearMessage 是否清除会话消息
41
+ * @returns void
42
+ * @example
43
+ * ```javascript
44
+ * await v2.conversationService.deleteConversation('conversation1', true)
45
+ * ```
33
46
  */
34
47
  deleteConversation(conversationId: string, clearMessage: boolean): Promise<void>;
35
- /** @brief 批量删除会话
48
+ /**
49
+ * @brief 批量删除会话
36
50
  * @param conversationIds 会话ID列表
37
51
  * @param clearMessage 是否清除会话消息
52
+ * @returns Array<V2NIMConversationOperationResult>
53
+ * @example
54
+ * ```javascript
55
+ * const result = await v2.conversationService.deleteConversationListByIds(['conversation1', 'conversation2'], true)
56
+ * ```
38
57
  */
39
58
  deleteConversationListByIds(conversationIds: string[], clearMessage: boolean): Promise<Array<V2NIMConversationOperationResult>>;
40
- /** @brief 置顶会话
59
+ /**
60
+ * @brief 置顶会话
41
61
  * @param conversationId 会话 ID
42
62
  * @param stickTop 是否置顶
63
+ * @returns void
64
+ * @example
65
+ * ```javascript
66
+ * await v2.conversationService.stickTopConversation('conversation1', true)
67
+ * ```
43
68
  */
44
69
  stickTopConversation(conversationId: string, stickTop: boolean): Promise<void>;
45
- /** @brief 更新会话
70
+ /**
71
+ * @brief 更新会话
46
72
  * @param conversationId 会话 ID
47
73
  * @param updateInfo 更新参数
74
+ * @returns void
75
+ * @example
76
+ * ```javascript
77
+ * await v2.conversationService.updateConversation('conversation1', { name: 'newName' })
78
+ * ```
48
79
  */
49
80
  updateConversation(conversationId: string, updateInfo: V2NIMConversationUpdate): Promise<void>;
50
- /** @brief 更新会话本地扩展
81
+ /**
82
+ * @brief 更新会话本地扩展
51
83
  * @param conversationId 会话 ID
52
84
  * @param localExtension 本地扩展
85
+ * @returns void
86
+ * @example
87
+ * ```javascript
88
+ * await v2.conversationService.updateConversationLocalExtension('conversation1', 'newExtension')
89
+ * ```
53
90
  */
54
91
  updateConversationLocalExtension(conversationId: string, localExtension: string): Promise<void>;
55
92
  /** @brief 获取会话
56
93
  * @param conversationId 会话 ID
94
+ * @returns V2NIMConversation
95
+ * @example
96
+ * ```javascript
97
+ * const conversation = await v2.conversationService.getConversation('conversation1')
98
+ * ```
57
99
  */
58
100
  getConversation(conversationId: string): Promise<V2NIMConversation>;
59
- /** @brief 分页获取会话列表
101
+ /**
102
+ * @brief 分页获取会话列表
60
103
  * @param offset 分页偏移, 首页传 0, 后续拉取采用上一次返还的 offset
61
104
  * @param limit 分页数量
105
+ * @returns V2NIMConversationResult
106
+ * @example
107
+ * ```javascript
108
+ * const result = await v2.conversationService.getConversationList(0, 10)
109
+ * ```
62
110
  */
63
111
  getConversationList(offset: number, limit: number): Promise<V2NIMConversationResult>;
64
- /** @brief 根据会话ID获取会话列表
112
+ /**
113
+ * @brief 根据会话ID获取会话列表
65
114
  * @param conversationIds 会话ID列表
115
+ * @returns Array<V2NIMConversation>
116
+ * @example
117
+ * ```javascript
118
+ * const list = await v2.conversationService.getConversationListByIds(['conversation1', 'conversation2'])
119
+ * ```
66
120
  */
67
121
  getConversationListByIds(conversationIds: string[]): Promise<Array<V2NIMConversation>>;
68
- /** @brief 根据条件筛选分页获取会话列表
122
+ /**
123
+ * @brief 根据条件筛选分页获取会话列表
69
124
  * @param offset 分页偏移, 首页传 0, 后续拉取采用上一次返还的 offset
70
125
  * @param limit 分页数量
71
126
  * @param option 查询参数
127
+ * @returns V2NIMConversationResult
128
+ * @example
129
+ * ```javascript
130
+ * const result = await v2.conversationService.getConversationListByOption(0, 10, {
131
+ * conversationTypes: [1, 2]
132
+ * })
133
+ * ```
72
134
  */
73
135
  getConversationListByOption(offset: number, limit: number, option: V2NIMConversationOption): Promise<V2NIMConversationResult>;
74
- /** @brief 获取会话未读总数
75
- * @param conversationId 会话 ID
76
- * @return uint32_t 未读总数
136
+ /**
137
+ * @brief 获取会话未读总数
138
+ * @returns number
139
+ * @example
140
+ * ```javascript
141
+ * const count = await v2.conversationService.getTotalUnreadCount()
142
+ * ```
77
143
  */
78
144
  getTotalUnreadCount(): number;
79
145
  /** @brief 根据会话 ID 列表获取未读总数
80
146
  * @param conversationIds 会话 ID 列表
147
+ * @returns number
148
+ * @example
149
+ * ```javascript
150
+ * const count = await v2.conversationService.getUnreadCountByIds(['conversation1', 'conversation2'])
151
+ * ```
81
152
  */
82
153
  getUnreadCountByIds(conversationIds: string[]): Promise<number>;
83
- /** @brief 根据过滤条件获取会话未读总数
154
+ /**
155
+ * @brief 根据过滤条件获取会话未读总数
84
156
  * @param filter 过滤条件
157
+ * @returns number
158
+ * @example
159
+ * ```javascript
160
+ * const count = await v2.conversationService.getUnreadCountByFilter({ conversationTypes: [1, 2] })
161
+ * ```
85
162
  */
86
163
  getUnreadCountByFilter(filter: V2NIMConversationFilter): Promise<number>;
87
- /** @brief 清除会话总未读数
164
+ /**
165
+ * @brief 清除会话总未读数
166
+ * @returns void
167
+ * @example
168
+ * ```javascript
169
+ * await v2.conversationService.clearTotalUnreadCount()
170
+ * ```
88
171
  */
89
172
  clearTotalUnreadCount(): Promise<void>;
90
- /** @brief 根据会话 ID 列表清除会话未读数
173
+ /**
174
+ * @brief 根据会话 ID 列表清除会话未读数
91
175
  * @param conversationIds 会话 ID 列表
176
+ * @returns Array<V2NIMConversationOperationResult>
177
+ * @example
178
+ * ```javascript
179
+ * const result = await v2.conversationService.clearUnreadCountByIds(['conversation1', 'conversation2'])
180
+ * ```
92
181
  */
93
182
  clearUnreadCountByIds(conversationIds: string[]): Promise<Array<V2NIMConversationOperationResult>>;
94
- /** @brief 根据会话类型清除会话未读数
183
+ /**
184
+ * @brief 根据会话类型清除会话未读数
95
185
  * @param conversationTypes 会话类型列表
186
+ * @returns void
187
+ * @example
188
+ * ```javascript
189
+ * await v2.conversationService.clearUnreadCountByTypes([1, 2])
190
+ * ```
96
191
  */
97
192
  clearUnreadCountByTypes(conversationTypes: V2NIMConversationType[]): Promise<void>;
98
- /** @brief 根据会话分组清除会话未读数
193
+ /**
194
+ * @brief 根据会话分组清除会话未读数
99
195
  * @param groupId 会话分组ID
196
+ * @returns void
197
+ * @example
198
+ * ```javascript
199
+ * await v2.conversationService.clearUnreadCountByGroupId('groupId')
200
+ * ```
100
201
  */
101
202
  clearUnreadCountByGroupId(groupId: string): Promise<void>;
102
- /** @brief 标记会话已读时间戳 */
103
- /** @param conversationId 要标记的会话 ID */
104
- /** @return void */
203
+ /**
204
+ * @brief 标记会话已读时间戳
205
+ * @param conversationId 要标记的会话 ID
206
+ * @returns number
207
+ * @example
208
+ * ```javascript
209
+ * const time = await v2.conversationService.markConversationRead('conversation1')
210
+ * ```
211
+ */
105
212
  markConversationRead(conversationId: string): Promise<number>;
106
- /** 获取会话已读时间戳 */
107
- /** @param conversationId 会话 ID */
108
- /** @return Promise<number> 时间戳 */
213
+ /**
214
+ * @brief 获取会话已读时间戳
215
+ * @param conversationId 会话 ID
216
+ * @returns Promise<number> 时间戳
217
+ * @example
218
+ * ```javascript
219
+ * const time = await v2.conversationService.getConversationReadTime('conversation1')
220
+ * ```
221
+ */
109
222
  getConversationReadTime(conversationId: string): Promise<number>;
110
- /** @brief 订阅指定过滤条件的会话未读数
223
+ /**
224
+ * @brief 订阅指定过滤条件的会话未读数
111
225
  * @param filter 过滤条件
112
- * @return void
226
+ * @returns null | V2NIMError
227
+ * @example
228
+ * ```javascript
229
+ * await v2.conversationService.subscribeUnreadCountByFilter({ conversationTypes: [1, 2] })
230
+ * ```
113
231
  */
114
232
  subscribeUnreadCountByFilter(filter: V2NIMConversationFilter): null | V2NIMError;
115
- /** @brief 取消订阅指定过滤条件的会话未读数
233
+ /**
234
+ * @brief 取消订阅指定过滤条件的会话未读数
116
235
  * @param filter 过滤条件
117
- * @return void
236
+ * @returns null | V2NIMError
237
+ * @example
238
+ * ```javascript
239
+ * await v2.conversationService.unsubscribeUnreadCountByFilter({ conversationTypes: [1, 2] })
240
+ * ```
118
241
  */
119
242
  unsubscribeUnreadCountByFilter(filter: V2NIMConversationFilter): null | V2NIMError;
120
243
  }