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 { V2NIMError, V2NIMConversation, V2NIMConversationFilter, V2NIMConversationOperationResult, V2NIMConversationUpdate, V2NIMConversationResult, V2NIMConversationOption } from 'ts/v2_def/v2_nim_struct_def';
2
2
  import { EventEmitter } from 'eventemitter3';
3
3
  import { V2NIMConversationType } from 'ts/v2_def/v2_nim_enum_def';
4
- export declare interface V2NIMConversationServiceEvents {
4
+ export declare interface V2NIMConversationListener {
5
5
  /** 会话同步开始通知 */
6
6
  syncStarted: [];
7
7
  /** 会话同步完成通知 */
@@ -21,101 +21,223 @@ export declare interface V2NIMConversationServiceEvents {
21
21
  /** 同账号多端标记会话 ACK 通知时间戳变更 */
22
22
  conversationReadTimeUpdated: [string, number];
23
23
  }
24
- export declare class V2NIMConversationService extends EventEmitter<V2NIMConversationServiceEvents> {
24
+ export declare class V2NIMConversationService extends EventEmitter<V2NIMConversationListener> {
25
25
  instance: any;
26
26
  constructor();
27
- /** @brief 创建空会话
27
+ /**
28
+ * @brief 创建空会话
28
29
  * @param conversationId 会话 ID
30
+ * @returns V2NIMConversation
31
+ * @example
32
+ * ```javascript
33
+ * const conversation = await v2.conversationService.createConversation('conversation1')
34
+ * ```
29
35
  */
30
36
  createConversation(conversationId: string): Promise<V2NIMConversation>;
31
- /** @brief 删除会话
37
+ /**
38
+ * @brief 删除会话
32
39
  * @param conversationId 会话 ID
33
40
  * @param clearMessage 是否清除会话消息
41
+ * @returns void
42
+ * @example
43
+ * ```javascript
44
+ * await v2.conversationService.deleteConversation('conversation1', true)
45
+ * ```
34
46
  */
35
47
  deleteConversation(conversationId: string, clearMessage: boolean): Promise<void>;
36
- /** @brief 批量删除会话
48
+ /**
49
+ * @brief 批量删除会话
37
50
  * @param conversationIds 会话ID列表
38
51
  * @param clearMessage 是否清除会话消息
52
+ * @returns Array<V2NIMConversationOperationResult>
53
+ * @example
54
+ * ```javascript
55
+ * const result = await v2.conversationService.deleteConversationListByIds(['conversation1', 'conversation2'], true)
56
+ * ```
39
57
  */
40
58
  deleteConversationListByIds(conversationIds: string[], clearMessage: boolean): Promise<Array<V2NIMConversationOperationResult>>;
41
- /** @brief 置顶会话
59
+ /**
60
+ * @brief 置顶会话
42
61
  * @param conversationId 会话 ID
43
62
  * @param stickTop 是否置顶
63
+ * @returns void
64
+ * @example
65
+ * ```javascript
66
+ * await v2.conversationService.stickTopConversation('conversation1', true)
67
+ * ```
44
68
  */
45
69
  stickTopConversation(conversationId: string, stickTop: boolean): Promise<void>;
46
- /** @brief 更新会话
70
+ /**
71
+ * @brief 更新会话
47
72
  * @param conversationId 会话 ID
48
73
  * @param updateInfo 更新参数
74
+ * @returns void
75
+ * @example
76
+ * ```javascript
77
+ * await v2.conversationService.updateConversation('conversation1', { name: 'newName' })
78
+ * ```
49
79
  */
50
80
  updateConversation(conversationId: string, updateInfo: V2NIMConversationUpdate): Promise<void>;
51
- /** @brief 更新会话本地扩展
81
+ /**
82
+ * @brief 更新会话本地扩展
52
83
  * @param conversationId 会话 ID
53
84
  * @param localExtension 本地扩展
85
+ * @returns void
86
+ * @example
87
+ * ```javascript
88
+ * await v2.conversationService.updateConversationLocalExtension('conversation1', 'newExtension')
89
+ * ```
54
90
  */
55
91
  updateConversationLocalExtension(conversationId: string, localExtension: string): Promise<void>;
56
92
  /** @brief 获取会话
57
93
  * @param conversationId 会话 ID
94
+ * @returns V2NIMConversation
95
+ * @example
96
+ * ```javascript
97
+ * const conversation = await v2.conversationService.getConversation('conversation1')
98
+ * ```
58
99
  */
59
100
  getConversation(conversationId: string): Promise<V2NIMConversation>;
60
- /** @brief 分页获取会话列表
101
+ /**
102
+ * @brief 分页获取会话列表
61
103
  * @param offset 分页偏移, 首页传 0, 后续拉取采用上一次返还的 offset
62
104
  * @param limit 分页数量
105
+ * @returns V2NIMConversationResult
106
+ * @example
107
+ * ```javascript
108
+ * const result = await v2.conversationService.getConversationList(0, 10)
109
+ * ```
63
110
  */
64
111
  getConversationList(offset: number, limit: number): Promise<V2NIMConversationResult>;
65
- /** @brief 根据会话ID获取会话列表
112
+ /**
113
+ * @brief 根据会话ID获取会话列表
66
114
  * @param conversationIds 会话ID列表
115
+ * @returns Array<V2NIMConversation>
116
+ * @example
117
+ * ```javascript
118
+ * const list = await v2.conversationService.getConversationListByIds(['conversation1', 'conversation2'])
119
+ * ```
67
120
  */
68
121
  getConversationListByIds(conversationIds: string[]): Promise<Array<V2NIMConversation>>;
69
- /** @brief 根据条件筛选分页获取会话列表
122
+ /**
123
+ * @brief 根据条件筛选分页获取会话列表
70
124
  * @param offset 分页偏移, 首页传 0, 后续拉取采用上一次返还的 offset
71
125
  * @param limit 分页数量
72
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
+ * ```
73
134
  */
74
135
  getConversationListByOption(offset: number, limit: number, option: V2NIMConversationOption): Promise<V2NIMConversationResult>;
75
- /** @brief 获取会话未读总数
76
- * @param conversationId 会话 ID
77
- * @return uint32_t 未读总数
136
+ /**
137
+ * @brief 获取会话未读总数
138
+ * @returns number
139
+ * @example
140
+ * ```javascript
141
+ * const count = await v2.conversationService.getTotalUnreadCount()
142
+ * ```
78
143
  */
79
144
  getTotalUnreadCount(): number;
80
145
  /** @brief 根据会话 ID 列表获取未读总数
81
146
  * @param conversationIds 会话 ID 列表
147
+ * @returns number
148
+ * @example
149
+ * ```javascript
150
+ * const count = await v2.conversationService.getUnreadCountByIds(['conversation1', 'conversation2'])
151
+ * ```
82
152
  */
83
153
  getUnreadCountByIds(conversationIds: string[]): Promise<number>;
84
- /** @brief 根据过滤条件获取会话未读总数
154
+ /**
155
+ * @brief 根据过滤条件获取会话未读总数
85
156
  * @param filter 过滤条件
157
+ * @returns number
158
+ * @example
159
+ * ```javascript
160
+ * const count = await v2.conversationService.getUnreadCountByFilter({ conversationTypes: [1, 2] })
161
+ * ```
86
162
  */
87
163
  getUnreadCountByFilter(filter: V2NIMConversationFilter): Promise<number>;
88
- /** @brief 清除会话总未读数
164
+ /**
165
+ * @brief 清除会话总未读数
166
+ * @returns void
167
+ * @example
168
+ * ```javascript
169
+ * await v2.conversationService.clearTotalUnreadCount()
170
+ * ```
89
171
  */
90
172
  clearTotalUnreadCount(): Promise<void>;
91
- /** @brief 根据会话 ID 列表清除会话未读数
173
+ /**
174
+ * @brief 根据会话 ID 列表清除会话未读数
92
175
  * @param conversationIds 会话 ID 列表
176
+ * @returns Array<V2NIMConversationOperationResult>
177
+ * @example
178
+ * ```javascript
179
+ * const result = await v2.conversationService.clearUnreadCountByIds(['conversation1', 'conversation2'])
180
+ * ```
93
181
  */
94
182
  clearUnreadCountByIds(conversationIds: string[]): Promise<Array<V2NIMConversationOperationResult>>;
95
- /** @brief 根据会话类型清除会话未读数
183
+ /**
184
+ * @brief 根据会话类型清除会话未读数
96
185
  * @param conversationTypes 会话类型列表
186
+ * @returns void
187
+ * @example
188
+ * ```javascript
189
+ * await v2.conversationService.clearUnreadCountByTypes([1, 2])
190
+ * ```
97
191
  */
98
192
  clearUnreadCountByTypes(conversationTypes: V2NIMConversationType[]): Promise<void>;
99
- /** @brief 根据会话分组清除会话未读数
193
+ /**
194
+ * @brief 根据会话分组清除会话未读数
100
195
  * @param groupId 会话分组ID
196
+ * @returns void
197
+ * @example
198
+ * ```javascript
199
+ * await v2.conversationService.clearUnreadCountByGroupId('groupId')
200
+ * ```
101
201
  */
102
202
  clearUnreadCountByGroupId(groupId: string): Promise<void>;
103
- /** @brief 标记会话已读时间戳 */
104
- /** @param conversationId 要标记的会话 ID */
105
- /** @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
+ */
106
212
  markConversationRead(conversationId: string): Promise<number>;
107
- /** 获取会话已读时间戳 */
108
- /** @param conversationId 会话 ID */
109
- /** @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
+ */
110
222
  getConversationReadTime(conversationId: string): Promise<number>;
111
- /** @brief 订阅指定过滤条件的会话未读数
223
+ /**
224
+ * @brief 订阅指定过滤条件的会话未读数
112
225
  * @param filter 过滤条件
113
- * @return void
226
+ * @returns null | V2NIMError
227
+ * @example
228
+ * ```javascript
229
+ * await v2.conversationService.subscribeUnreadCountByFilter({ conversationTypes: [1, 2] })
230
+ * ```
114
231
  */
115
232
  subscribeUnreadCountByFilter(filter: V2NIMConversationFilter): null | V2NIMError;
116
- /** @brief 取消订阅指定过滤条件的会话未读数
233
+ /**
234
+ * @brief 取消订阅指定过滤条件的会话未读数
117
235
  * @param filter 过滤条件
118
- * @return void
236
+ * @returns null | V2NIMError
237
+ * @example
238
+ * ```javascript
239
+ * await v2.conversationService.unsubscribeUnreadCountByFilter({ conversationTypes: [1, 2] })
240
+ * ```
119
241
  */
120
242
  unsubscribeUnreadCountByFilter(filter: V2NIMConversationFilter): null | V2NIMError;
121
243
  }
@@ -1,7 +1,7 @@
1
- import { V2NIMFriend, V2NIMFriendAddApplication, V2NIMFriendAddParams, V2NIMFriendDeleteParams, V2NIMFriendSetParams, V2NIMFriendAddApplicationQueryOption, V2NIMFriendAddApplicationResult, V2NIMFriendSearchOption } from 'ts/v2_def/v2_nim_struct_def';
1
+ import { V2NIMFriend, V2NIMFriendAddApplication, V2NIMFriendAddApplicationQueryOption, V2NIMFriendAddApplicationResult, V2NIMFriendAddParams, V2NIMFriendDeleteParams, V2NIMFriendSearchOption, V2NIMFriendSetParams } from 'ts/v2_def/v2_nim_struct_def';
2
2
  import { EventEmitter } from 'eventemitter3';
3
3
  import { V2NIMFriendDeletionType } from 'ts/v2_def/v2_nim_enum_def';
4
- export declare interface V2NIMFriendServiceEvents {
4
+ export declare interface V2NIMFriendListener {
5
5
  /** 添加好友 */
6
6
  friendAdded: [V2NIMFriend];
7
7
  /** 删除好友 */
@@ -14,58 +14,158 @@ export declare interface V2NIMFriendServiceEvents {
14
14
  friendInfoChanged: [V2NIMFriend];
15
15
  }
16
16
  /** @brief 好友服务 */
17
- export declare class V2NIMFriendService extends EventEmitter<V2NIMFriendServiceEvents> {
17
+ export declare class V2NIMFriendService extends EventEmitter<V2NIMFriendListener> {
18
18
  instance: any;
19
19
  constructor();
20
- /** @brief 添加好友 */
21
- /** @param accountId 账号 ID */
22
- /** @param params 添加好友参数 */
23
- /** @return void */
20
+ /**
21
+ * @brief 添加好友
22
+ * @param accountId 账号 ID
23
+ * @param params 添加好友参数
24
+ * @returns void
25
+ * @example
26
+ * ```javascript
27
+ * await v2.friendService.addFriend('accountId', {
28
+ * addMode: 1
29
+ * })
30
+ * ```
31
+ */
24
32
  addFriend(accountId: string, params: V2NIMFriendAddParams): Promise<void>;
25
- /** @brief 删除好友 */
26
- /** @param accountId 账号 ID */
27
- /** @param params 删除好友参数 */
28
- /** @return void */
33
+ /**
34
+ * @brief 删除好友
35
+ * @param accountId 账号 ID
36
+ * @param params 删除好友参数
37
+ * @returns void
38
+ * @example
39
+ * ```javascript
40
+ * await v2.friendService.deleteFriend('accountId', {
41
+ * deleteAlias: true
42
+ * })
43
+ * ```
44
+ */
29
45
  deleteFriend(accountId: string, params: V2NIMFriendDeleteParams): Promise<void>;
30
- /** @brief 接受好友申请 */
31
- /** @param application 好友申请 */
32
- /** @return void */
46
+ /**
47
+ * @brief 接受好友申请
48
+ * @param application 好友申请
49
+ * @returns void
50
+ * @example
51
+ * ```javascript
52
+ * await v2.friendService.acceptAddApplication(application)
53
+ * ```
54
+ */
33
55
  acceptAddApplication(application: V2NIMFriendAddApplication): Promise<void>;
34
- /** @brief 拒绝好友申请 */
35
- /** @param application 好友申请 */
36
- /** @param postscript 拒绝理由 */
37
- /** @return void */
56
+ /**
57
+ * @brief 拒绝好友申请
58
+ * @param application 好友申请
59
+ * @param postscript 拒绝理由
60
+ * @returns void
61
+ * @example
62
+ * ```javascript
63
+ * await v2.friendService.rejectAddApplication(application, 'reason')
64
+ * ```
65
+ */
38
66
  rejectAddApplication(application: V2NIMFriendAddApplication, postscript: String): Promise<void>;
39
- /** @brief 设置好友信息 */
40
- /** @param accountId 账号 ID */
41
- /** @param params 设置好友信息参数 */
42
- /** @return void */
67
+ /**
68
+ * @brief 设置好友信息
69
+ * @param accountId 账号 ID
70
+ * @param params 设置好友信息参数
71
+ * @returns void
72
+ * @example
73
+ * ```javascript
74
+ * await v2.friendService.setFriendInfo('accountId', {
75
+ * alias: 'alias'
76
+ * })
77
+ * ```
78
+ */
43
79
  setFriendInfo(accountId: string, params: V2NIMFriendSetParams): Promise<void>;
44
- /** @brief 获取好友列表 */
45
- /** @return void */
80
+ /**
81
+ * @brief 获取好友列表
82
+ * @returns void
83
+ * @example
84
+ * ```javascript
85
+ * await v2.friendService.getFriendList()
86
+ * ```
87
+ */
46
88
  getFriendList(): Promise<Array<V2NIMFriend>>;
47
- /** @brief 根据账号 ID 获取好友信息 */
48
- /** @param accountIds 账号 ID 列表 */
49
- /** @return void */
89
+ /**
90
+ * @brief 根据账号 ID 获取好友信息
91
+ * @param accountIds 账号 ID 列表
92
+ * @returns void
93
+ * @example
94
+ * ```javascript
95
+ * await v2.friendService.getFriendByIds(['accountId1', 'accountId2'])
96
+ * ```
97
+ */
50
98
  getFriendByIds(accountIds: Array<string>): Promise<Array<V2NIMFriend>>;
51
- /** @brief 根据账号 ID 检查好友状态 */
52
- /** @param accountIds 账号 ID 列表 */
53
- /** @return void */
99
+ /**
100
+ * @brief 根据账号 ID 检查好友状态
101
+ * @param accountIds 账号 ID 列表
102
+ * @returns void
103
+ * @example
104
+ * ```javascript
105
+ * await v2.friendService.checkFriend(['accountId1', 'accountId2'])
106
+ * ```
107
+ */
54
108
  checkFriend(accountIds: Array<string>): Promise<Map<string, boolean>>;
55
- /** @brief 获取申请添加好友信息列表 */
56
- /** @param option 查询申请添加好友相关信息参数 */
57
- /** @return void */
109
+ /**
110
+ * @brief 获取申请添加好友信息列表
111
+ * @param option 查询申请添加好友相关信息参数
112
+ * @returns void
113
+ * @example
114
+ * ```javascript
115
+ * await v2.friendService.getAddApplicationList({
116
+ * offset: 0,
117
+ * limit: 10
118
+ * })
119
+ * ```
120
+ */
58
121
  getAddApplicationList(option: V2NIMFriendAddApplicationQueryOption): Promise<V2NIMFriendAddApplicationResult>;
59
- /** @brief 获取申请添加好友未读数量 */
60
- /** @return void */
122
+ /**
123
+ * @brief 获取申请添加好友未读数量
124
+ * @returns void
125
+ * @example
126
+ * ```javascript
127
+ * await v2.friendService.getAddApplicationUnreadCount()
128
+ * ```
129
+ */
61
130
  getAddApplicationUnreadCount(): Promise<number>;
62
- /** @brief 设置申请添加好友已读 */
63
- /** @return void */
131
+ /**
132
+ * @brief 设置申请添加好友已读
133
+ * @returns void
134
+ * @example
135
+ * ```javascript
136
+ * await v2.friendService.setAddApplicationRead()
137
+ * ```
138
+ */
64
139
  setAddApplicationRead(): Promise<void>;
65
140
  /**
66
- * 根据关键字搜索用户信息
141
+ * @brief 根据关键字搜索用户信息
67
142
  * @param option 搜索选项 @see V2NIMFriendSearchOption
68
- * @return Promise<Array<V2NIMFriend>>
143
+ * @returns Promise<Array<V2NIMFriend>>
144
+ * @example
145
+ * ```javascript
146
+ * await v2.friendService.searchFriendByOption({
147
+ * keyword: 'keyword'
148
+ * })
149
+ * ```
69
150
  */
70
151
  searchFriendByOption(option: V2NIMFriendSearchOption): Promise<Array<V2NIMFriend>>;
152
+ /**
153
+ * @brief 清空所有添加好友申请
154
+ * @returns Promise<void>
155
+ * @example
156
+ * ```javascript
157
+ * await v2.friendService.clearAllAddApplication()
158
+ * ```
159
+ */
160
+ clearAllAddApplication(): Promise<void>;
161
+ /**
162
+ * @brief 删除添加好友申请
163
+ * @param application 添加好友申请
164
+ * @returns Promise<void>
165
+ * @example
166
+ * ```javascript
167
+ * await v2.friendService.deleteAddApplication(application)
168
+ * ```
169
+ */
170
+ deleteAddApplication(application: V2NIMFriendAddApplication): Promise<void>;
71
171
  }
@@ -2,7 +2,7 @@ import { V2NIMDataSyncDetail, V2NIMError, V2NIMKickedOfflineDetail, V2NIMLoginCl
2
2
  import { EventEmitter } from 'eventemitter3';
3
3
  import { V2NIMReconnectDelayProvider } from 'ts/v2_def/v2_nim_callback_def';
4
4
  import { V2NIMConnectStatus, V2NIMDataSyncState, V2NIMDataSyncType, V2NIMLoginClientChange, V2NIMLoginStatus } from 'ts/v2_def/v2_nim_enum_def';
5
- export declare interface V2NIMLoginServiceEvents {
5
+ export declare interface V2NIMLoginListener {
6
6
  /** 登录状态变更回调 */
7
7
  loginStatus: [V2NIMLoginStatus];
8
8
  /** 登录失败回调 */
@@ -20,67 +20,122 @@ export declare interface V2NIMLoginServiceEvents {
20
20
  /** 数据同步回调 */
21
21
  dataSync: [V2NIMDataSyncType, V2NIMDataSyncState, V2NIMError | null];
22
22
  }
23
- export declare class V2NIMLoginService extends EventEmitter<V2NIMLoginServiceEvents> {
23
+ export declare class V2NIMLoginService extends EventEmitter<V2NIMLoginListener> {
24
24
  instance: any;
25
25
  constructor();
26
26
  /**
27
- * 登录接口
27
+ * @brief 登录接口
28
28
  * @param accountId 账号
29
29
  * @param token 密码
30
30
  * @param option 登录选项
31
31
  * @returns Promise<void>
32
+ * @example
33
+ * ```javascript
34
+ * await v2.loginService.login('accountId', 'token', {})
35
+ * ```
32
36
  */
33
37
  login(accountId: string, token: string, option: V2NIMLoginOption): Promise<void>;
34
38
  /**
35
- * 登出接口
39
+ * @brief 登出接口
36
40
  * @returns Promise<void>
41
+ * @example
42
+ * ```javascript
43
+ * await v2.loginService.logout()
44
+ * ```
37
45
  */
38
46
  logout(): Promise<void>;
39
47
  /**
40
- * 获取当前登录用户
48
+ * @brief 获取当前登录用户
41
49
  * @returns string 当前登录用户
50
+ * @example
51
+ * ```javascript
52
+ * const user = v2.loginService.getLoginUser()
53
+ * ```
42
54
  */
43
55
  getLoginUser(): string;
44
56
  /**
45
- * 获取登录状态
57
+ * @brief 获取登录状态
46
58
  * @returns V2NIMLoginStatus 登录状态
59
+ * @example
60
+ * ```javascript
61
+ * const status = v2.loginService.getLoginStatus()
62
+ * ```
47
63
  */
48
64
  getLoginStatus(): V2NIMLoginStatus;
49
65
  /**
50
- * 获取登录客户端列表
66
+ * @brief 获取登录客户端列表
51
67
  * @returns V2NIMLoginClient[] 登录客户端列表
68
+ * @example
69
+ * ```javascript
70
+ * const clients = v2.loginService.getLoginClients()
71
+ * ```
52
72
  */
53
73
  getLoginClients(): V2NIMLoginClient[];
54
74
  /**
55
- * 获取当前登录客户端
75
+ * @brief 获取当前登录客户端
56
76
  * @returns V2NIMLoginClient 当前登录客户端
77
+ * @example
78
+ * ```javascript
79
+ * const client = v2.loginService.getCurrentLoginClient()
80
+ * ```
57
81
  */
58
82
  getCurrentLoginClient(): V2NIMLoginClient;
59
83
  /**
60
- * 踢掉登录客户端下线
84
+ * @brief 踢掉登录客户端下线
61
85
  * @param client 登录客户端
62
86
  * @returns Promise<void>
87
+ * @example
88
+ * ```javascript
89
+ * const otherClients = v2.loginService.getLoginClients()
90
+ * await v2.loginService.kickOffline(otherClients[0])
91
+ * ```
63
92
  */
64
93
  kickOffline(client: V2NIMLoginClient): Promise<void>;
65
94
  /**
66
- * 获取被踢下线原因
95
+ * @brief 获取被踢下线原因
67
96
  * @returns V2NIMKickedOfflineDetail 被踢下线原因
97
+ * @example
98
+ * ```javascript
99
+ * const detail = v2.loginService.getKickedOfflineDetail()
100
+ * ```
68
101
  */
69
102
  getKickedOfflineDetail(): V2NIMKickedOfflineDetail;
103
+ /**
104
+ * @brief 获取连接状态
105
+ * @returns V2NIMConnectStatus 连接状态
106
+ * @example
107
+ * ```javascript
108
+ * const status = v2.loginService.getConnectStatus()
109
+ * ```
110
+ */
70
111
  getConnectStatus(): V2NIMConnectStatus;
71
112
  /**
72
- * 获取数据同步状态
113
+ * @brief 获取数据同步状态
73
114
  * @returns V2NIMDataSyncDetail[] 数据同步状态列表
115
+ * @example
116
+ * ```javascript
117
+ * const details = v2.loginService.getDataSync()
118
+ * ```
74
119
  */
75
120
  getDataSync(): V2NIMDataSyncDetail[];
76
- /** @brief 获取聊天室 link 地址 */
77
- /** @param roomId 聊天室 ID */
78
- /** @return void */
121
+ /**
122
+ * @brief 获取聊天室 link 地址
123
+ * @param roomId 聊天室 ID
124
+ * @returns Promise<Array<string>>
125
+ * @example
126
+ * ```javascript
127
+ * const linkAddresses = await v2.loginService.getChatroomLinkAddress('roomId')
128
+ * ```
129
+ */
79
130
  getChatroomLinkAddress(roomId: string): Promise<Array<string>>;
80
131
  /**
81
- * 设置获取重连延时回调
132
+ * @brief 设置获取重连延时回调
82
133
  * @param provider 获取重连延时回调
83
134
  * @returns void
135
+ * @example
136
+ * ```javascript
137
+ * v2.loginService.setReconnectDelayProvider(provider)
138
+ * ```
84
139
  */
85
140
  setReconnectDelayProvider(provider: V2NIMReconnectDelayProvider): void;
86
141
  }