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.
- package/README.md +58 -44
- package/dist/chatroom/chatroom.js +482 -0
- package/dist/chatroom/chatroom.js.map +1 -0
- package/dist/chatroom_def/chatroom_def.js +146 -73
- package/dist/chatroom_def/chatroom_def.js.map +1 -1
- package/dist/loader.js +2 -2
- package/dist/loader.js.map +1 -1
- package/dist/nim/ai.js +44 -0
- package/dist/nim/ai.js.map +1 -0
- package/dist/nim/client.js +4 -4
- package/dist/nim/client.js.map +1 -1
- package/dist/nim/data_sync.js.map +1 -1
- package/dist/nim/friend.js +9 -9
- package/dist/nim/friend.js.map +1 -1
- package/dist/nim/global.js.map +1 -1
- package/dist/nim/msglog.js +9 -1
- package/dist/nim/msglog.js.map +1 -1
- package/dist/nim/nos.js.map +1 -1
- package/dist/nim/online_session.js.map +1 -1
- package/dist/nim/pass_through_proxy.js +7 -7
- package/dist/nim/pass_through_proxy.js.map +1 -1
- package/dist/nim/plugin.js +3 -3
- package/dist/nim/plugin.js.map +1 -1
- package/dist/nim/session.js +52 -52
- package/dist/nim/session.js.map +1 -1
- package/dist/nim/subscribe_event.js +15 -15
- package/dist/nim/subscribe_event.js.map +1 -1
- package/dist/nim/super_team.js +63 -63
- package/dist/nim/super_team.js.map +1 -1
- package/dist/nim/sysmsg.js +14 -14
- package/dist/nim/sysmsg.js.map +1 -1
- package/dist/nim/talk.js +31 -10
- package/dist/nim/talk.js.map +1 -1
- package/dist/nim/talkex.js +27 -27
- package/dist/nim/talkex.js.map +1 -1
- package/dist/nim/team.js +86 -86
- package/dist/nim/team.js.map +1 -1
- package/dist/nim/tool.js +1 -1
- package/dist/nim/tool.js.map +1 -1
- package/dist/nim/user.js +2 -2
- package/dist/nim/user.js.map +1 -1
- package/dist/nim_def/ai_def.js +25 -0
- package/dist/nim_def/ai_def.js.map +1 -0
- package/dist/nim_def/client_def.js +145 -118
- package/dist/nim_def/client_def.js.map +1 -1
- package/dist/nim_def/data_sync_def.js +18 -9
- package/dist/nim_def/data_sync_def.js.map +1 -1
- package/dist/nim_def/doc_trans_def.js +10 -5
- package/dist/nim_def/doc_trans_def.js.map +1 -1
- package/dist/nim_def/friend_def.js +28 -14
- package/dist/nim_def/friend_def.js.map +1 -1
- package/dist/nim_def/global_def.js +32 -16
- package/dist/nim_def/global_def.js.map +1 -1
- package/dist/nim_def/msglog_def.js +203 -117
- package/dist/nim_def/msglog_def.js.map +1 -1
- package/dist/nim_def/nos_def.js +12 -6
- package/dist/nim_def/nos_def.js.map +1 -1
- package/dist/nim_def/pass_through_proxy_def.js +5 -0
- package/dist/nim_def/pass_through_proxy_def.js.map +1 -1
- package/dist/nim_def/session_def.js +30 -15
- package/dist/nim_def/session_def.js.map +1 -1
- package/dist/nim_def/subscribe_event_def.js +32 -15
- package/dist/nim_def/subscribe_event_def.js.map +1 -1
- package/dist/nim_def/super_team_def.js +52 -27
- package/dist/nim_def/super_team_def.js.map +1 -1
- package/dist/nim_def/sysmsg_def.js +32 -17
- package/dist/nim_def/sysmsg_def.js.map +1 -1
- package/dist/nim_def/team_def.js +56 -29
- package/dist/nim_def/team_def.js.map +1 -1
- package/dist/nim_def/tool_def.js +8 -4
- package/dist/nim_def/tool_def.js.map +1 -1
- package/dist/nim_def/user_def.js +16 -8
- package/dist/nim_def/user_def.js.map +1 -1
- package/dist/node-nim.js +32 -1
- package/dist/node-nim.js.map +1 -1
- package/dist/qchat/attachment.js.map +1 -1
- package/dist/qchat/channel.js.map +1 -1
- package/dist/qchat/channel_category.js.map +1 -1
- package/dist/qchat/instance.js.map +1 -1
- package/dist/qchat/message.js.map +1 -1
- package/dist/qchat/role.js.map +1 -1
- package/dist/qchat/server.js.map +1 -1
- package/dist/qchat/system_notification.js.map +1 -1
- package/dist/qchat_def/public_def.js +9 -2
- package/dist/qchat_def/public_def.js.map +1 -1
- package/dist/v2/v2_nim_ai_service.js.map +1 -1
- package/dist/v2/v2_nim_chatroom_client.js +160 -39
- package/dist/v2/v2_nim_chatroom_client.js.map +1 -1
- package/dist/v2/v2_nim_chatroom_queue_service.js +148 -0
- package/dist/v2/v2_nim_chatroom_queue_service.js.map +1 -0
- package/dist/v2/v2_nim_chatroom_service.js +201 -65
- package/dist/v2/v2_nim_chatroom_service.js.map +1 -1
- package/dist/v2/v2_nim_client.js +126 -24
- package/dist/v2/v2_nim_client.js.map +1 -1
- package/dist/v2/v2_nim_conversation_group_service.js +57 -9
- package/dist/v2/v2_nim_conversation_group_service.js.map +1 -1
- package/dist/v2/v2_nim_conversation_service.js +149 -27
- package/dist/v2/v2_nim_conversation_service.js.map +1 -1
- package/dist/v2/v2_nim_friend_service.js +152 -36
- package/dist/v2/v2_nim_friend_service.js.map +1 -1
- package/dist/v2/v2_nim_login_service.js +72 -13
- package/dist/v2/v2_nim_login_service.js.map +1 -1
- package/dist/v2/v2_nim_message_service.js +335 -93
- package/dist/v2/v2_nim_message_service.js.map +1 -1
- package/dist/v2/v2_nim_notification_service.js +11 -4
- package/dist/v2/v2_nim_notification_service.js.map +1 -1
- package/dist/v2/v2_nim_passthrough_service.js +39 -0
- package/dist/v2/v2_nim_passthrough_service.js.map +1 -0
- package/dist/v2/v2_nim_setting_service.js +81 -29
- package/dist/v2/v2_nim_setting_service.js.map +1 -1
- package/dist/v2/v2_nim_signalling_service.js +172 -44
- package/dist/v2/v2_nim_signalling_service.js.map +1 -1
- package/dist/v2/v2_nim_storage_service.js +116 -37
- package/dist/v2/v2_nim_storage_service.js.map +1 -1
- package/dist/v2/v2_nim_subscription_service.js +42 -12
- package/dist/v2/v2_nim_subscription_service.js.map +1 -1
- package/dist/v2/v2_nim_team_service.js +367 -130
- package/dist/v2/v2_nim_team_service.js.map +1 -1
- package/dist/v2/v2_nim_user_service.js +62 -19
- package/dist/v2/v2_nim_user_service.js.map +1 -1
- package/dist/v2/v2_nim_utilities.js +313 -125
- package/dist/v2/v2_nim_utilities.js.map +1 -1
- package/dist/v2_def/v2_nim_enum_def.js +76 -62
- package/dist/v2_def/v2_nim_enum_def.js.map +1 -1
- package/dist/v2_def/v2_nim_struct_def.js +0 -2
- package/dist/v2_def/v2_nim_struct_def.js.map +1 -1
- package/package.json +9 -6
- package/script/download-sdk.js +1 -1
- package/types/chatroom/chatroom.d.ts +274 -0
- package/types/chatroom_def/chatroom_def.d.ts +150 -74
- package/types/nim/ai.d.ts +25 -0
- package/types/nim/client.d.ts +8 -8
- package/types/nim/friend.d.ts +9 -9
- package/types/nim/msglog.d.ts +8 -2
- package/types/nim/pass_through_proxy.d.ts +7 -7
- package/types/nim/plugin.d.ts +3 -3
- package/types/nim/session.d.ts +50 -50
- package/types/nim/subscribe_event.d.ts +15 -15
- package/types/nim/super_team.d.ts +63 -63
- package/types/nim/sysmsg.d.ts +14 -14
- package/types/nim/talk.d.ts +28 -11
- package/types/nim/talkex.d.ts +27 -27
- package/types/nim/team.d.ts +86 -86
- package/types/nim/tool.d.ts +1 -1
- package/types/nim/user.d.ts +2 -2
- package/types/nim_def/ai_def.d.ts +79 -0
- package/types/nim_def/client_def.d.ts +322 -127
- package/types/nim_def/data_sync_def.d.ts +18 -9
- package/types/nim_def/doc_trans_def.d.ts +10 -5
- package/types/nim_def/friend_def.d.ts +52 -26
- package/types/nim_def/global_def.d.ts +32 -16
- package/types/nim_def/msglog_def.d.ts +466 -217
- package/types/nim_def/nos_def.d.ts +62 -31
- package/types/nim_def/online_session_def.d.ts +21 -9
- package/types/nim_def/pass_through_proxy_def.d.ts +5 -0
- package/types/nim_def/session_def.d.ts +92 -46
- package/types/nim_def/subscribe_event_def.d.ts +75 -35
- package/types/nim_def/super_team_def.d.ts +75 -37
- package/types/nim_def/sysmsg_def.d.ts +78 -40
- package/types/nim_def/talk_def.d.ts +85 -20
- package/types/nim_def/talkex_def.d.ts +92 -46
- package/types/nim_def/team_def.d.ts +93 -39
- package/types/nim_def/tool_def.d.ts +16 -8
- package/types/nim_def/user_def.d.ts +52 -26
- package/types/node-nim.d.ts +29 -2
- package/types/qchat_def/message_def.d.ts +1 -1
- package/types/qchat_def/public_def.d.ts +6 -0
- package/types/qchat_def/role_def.d.ts +3 -1
- package/types/v2/v2_nim_ai_service.d.ts +3 -3
- package/types/v2/v2_nim_chatroom_client.d.ts +158 -41
- package/types/v2/v2_nim_chatroom_queue_service.d.ts +96 -0
- package/types/v2/v2_nim_chatroom_service.d.ts +204 -67
- package/types/v2/v2_nim_client.d.ts +124 -30
- package/types/v2/v2_nim_conversation_group_service.d.ts +59 -11
- package/types/v2/v2_nim_conversation_service.d.ts +152 -29
- package/types/v2/v2_nim_friend_service.d.ts +140 -39
- package/types/v2/v2_nim_login_service.d.ts +75 -14
- package/types/v2/v2_nim_message_service.d.ts +337 -95
- package/types/v2/v2_nim_notification_service.d.ts +13 -6
- package/types/v2/v2_nim_passthrough_service.d.ts +25 -0
- package/types/v2/v2_nim_setting_service.d.ts +84 -31
- package/types/v2/v2_nim_signalling_service.d.ts +174 -46
- package/types/v2/v2_nim_storage_service.d.ts +119 -40
- package/types/v2/v2_nim_subscription_service.d.ts +44 -14
- package/types/v2/v2_nim_team_service.d.ts +338 -132
- package/types/v2/v2_nim_user_service.d.ts +64 -21
- package/types/v2/v2_nim_utilities.d.ts +311 -125
- package/types/v2_def/v2_nim_enum_def.d.ts +72 -62
- package/types/v2_def/v2_nim_struct_def.d.ts +56 -7
|
@@ -2,7 +2,8 @@ import { V2NIMInitOption, V2NIMError, V2NIMChatroomEnterParams, V2NIMChatroomEnt
|
|
|
2
2
|
import { EventEmitter } from 'eventemitter3';
|
|
3
3
|
import { V2NIMChatroomService } from './v2_nim_chatroom_service';
|
|
4
4
|
import { V2NIMStorageService } from './v2_nim_storage_service';
|
|
5
|
-
|
|
5
|
+
import { V2NIMChatroomQueueService } from './v2_nim_chatroom_queue_service';
|
|
6
|
+
export declare interface V2NIMChatroomClientListener {
|
|
6
7
|
/** @brief 聊天室状态 */
|
|
7
8
|
chatroomStatus: (status: number, error: V2NIMError) => void;
|
|
8
9
|
/** @brief 进入聊天室 */
|
|
@@ -12,62 +13,178 @@ export declare interface V2NIMChatroomClientEvents {
|
|
|
12
13
|
/** @brief 自己被踢出聊天室 */
|
|
13
14
|
chatroomKicked: (kickedInfo: V2NIMChatroomKickedInfo) => void;
|
|
14
15
|
}
|
|
15
|
-
export declare class V2NIMChatroomClient extends EventEmitter<
|
|
16
|
+
export declare class V2NIMChatroomClient extends EventEmitter<V2NIMChatroomClientListener> {
|
|
16
17
|
instance: any;
|
|
17
18
|
chatroomService: V2NIMChatroomService;
|
|
19
|
+
chatroomQueueService: V2NIMChatroomQueueService;
|
|
18
20
|
storageService: V2NIMStorageService;
|
|
19
21
|
static chatroomSdk: any;
|
|
20
22
|
constructor(instanceId?: number);
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @brief 初始化
|
|
25
|
+
* @param option 初始化选项
|
|
26
|
+
* @returns V2NIMError
|
|
27
|
+
* @example
|
|
28
|
+
* ```javascript
|
|
29
|
+
* const result = await V2NIMChatroomClient.init({
|
|
30
|
+
* appKey: 'your app key'
|
|
31
|
+
* })
|
|
32
|
+
* if (result) {
|
|
33
|
+
* console.error(result)
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
24
37
|
static init(option: V2NIMInitOption): V2NIMError | null;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
/**
|
|
39
|
+
* @brief 反初始化
|
|
40
|
+
* @returns void
|
|
41
|
+
* @warning 请在退出程序前调用此方法
|
|
42
|
+
* @example
|
|
43
|
+
* ```javascript
|
|
44
|
+
* V2NIMChatroomClient.uninit()
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
28
47
|
static uninit(): void;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @brief 创建聊天室客户端实例
|
|
50
|
+
* @returns V2NIMChatroomClient
|
|
51
|
+
* @pre 必须在调用此方法前调用 V2NIMChatroomClient::init
|
|
52
|
+
* @note 建议保存持有实例 ID 而不是实例本身
|
|
53
|
+
* @example
|
|
54
|
+
* ```javascript
|
|
55
|
+
* const chatroomClient = V2NIMChatroomClient.newInstance()
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
33
58
|
static newInstance(): V2NIMChatroomClient;
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
59
|
+
/**
|
|
60
|
+
* @brief 销毁聊天室客户端实例
|
|
61
|
+
* @param instanceId 聊天室客户端实例 ID
|
|
62
|
+
* @returns void
|
|
63
|
+
* @pre 必须在调用此方法前调用 V2NIMChatroomClient::init
|
|
64
|
+
* @warning 严禁在调用此方法后访问对应的聊天室客户端实例
|
|
65
|
+
* @example
|
|
66
|
+
* ```javascript
|
|
67
|
+
* V2NIMChatroomClient.destroyInstance(instanceId)
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
39
70
|
static destroyInstance(instanceId: number): void;
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
/**
|
|
72
|
+
* @param instanceId 聊天室客户端实例 ID
|
|
73
|
+
* @returns V2NIMChatroomClient
|
|
74
|
+
* @pre 必须在调用此方法前调用 V2NIMChatroomClient::init
|
|
75
|
+
* @example
|
|
76
|
+
* ```javascript
|
|
77
|
+
* const chatroomClient = V2NIMChatroomClient.getInstance(instanceId)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
43
80
|
static getInstance(instanceId: number): V2NIMChatroomClient | null;
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
81
|
+
/**
|
|
82
|
+
* @brief 获取聊天室实例列表
|
|
83
|
+
* @returns Array<V2NIMChatroomClient>
|
|
84
|
+
* @pre 必须在调用此方法前调用 V2NIMChatroomClient::init
|
|
85
|
+
* @example
|
|
86
|
+
* ```javascript
|
|
87
|
+
* const instanceList = V2NIMChatroomClient.getInstanceList()
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
47
90
|
static getInstanceList(): Array<V2NIMChatroomClient>;
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
91
|
+
/**
|
|
92
|
+
* @brief 销毁所有聊天室客户端实例
|
|
93
|
+
* @returns void
|
|
94
|
+
* @pre 必须在调用此方法前调用 V2NIMChatroomClient::init
|
|
95
|
+
* @warning 严禁在调用此方法后访问任何聊天室客户端实例, 此方法会退出聊天室, 耗时可能较长
|
|
96
|
+
* @example
|
|
97
|
+
* ```javascript
|
|
98
|
+
* V2NIMChatroomClient.destroyAll()
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
52
101
|
static destroyAll(): void;
|
|
53
|
-
/**
|
|
54
|
-
|
|
102
|
+
/**
|
|
103
|
+
* @brief 获取聊天室客户端实例 ID
|
|
104
|
+
* @returns size_t
|
|
105
|
+
* @example
|
|
106
|
+
* ```javascript
|
|
107
|
+
* const instanceId = chatroomClient.getInstanceId()
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
55
110
|
getInstanceId(): number;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
111
|
+
/**
|
|
112
|
+
* @brief 更新 appKey
|
|
113
|
+
* @param appKey - 新的 App key
|
|
114
|
+
* @returns V2NIMError | null
|
|
115
|
+
* @example
|
|
116
|
+
* ```javascript
|
|
117
|
+
* const result = chatroomClient.updateAppKey('your new app key')
|
|
118
|
+
* if (result) {
|
|
119
|
+
* console.error(result)
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
updateAppKey(appKey: string): V2NIMError | null;
|
|
124
|
+
/**
|
|
125
|
+
* @brief 进入聊天室
|
|
126
|
+
* @param roomId 聊天室 ID
|
|
127
|
+
* @param enterParams 进入聊天室相关参数
|
|
128
|
+
* @returns Promise<V2NIMChatroomEnterResult>
|
|
129
|
+
* @example
|
|
130
|
+
* ```javascript
|
|
131
|
+
* const result = await chatroomClient.enter('your room id', {
|
|
132
|
+
* accountId: 'your account id',
|
|
133
|
+
* token: 'your token',
|
|
134
|
+
* roomNick: 'your room nick',
|
|
135
|
+
* linkProvider: (roomId, account) => {
|
|
136
|
+
* return ['chatroom link...']
|
|
137
|
+
* }
|
|
138
|
+
* })
|
|
139
|
+
* if (result) {
|
|
140
|
+
* console.error(result)
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
60
144
|
enter(roomId: string, enterParams: V2NIMChatroomEnterParams): Promise<V2NIMChatroomEnterResult>;
|
|
61
|
-
/**
|
|
62
|
-
|
|
145
|
+
/**
|
|
146
|
+
* @brief 退出聊天室
|
|
147
|
+
* @returns void
|
|
148
|
+
* @example
|
|
149
|
+
* ```javascript
|
|
150
|
+
* chatroomClient.exit()
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
63
153
|
exit(): void;
|
|
64
|
-
/**
|
|
65
|
-
|
|
154
|
+
/**
|
|
155
|
+
* @brief 查询聊天室信息
|
|
156
|
+
* @returns V2NIMChatroomInfo
|
|
157
|
+
* @example
|
|
158
|
+
* ```javascript
|
|
159
|
+
* const chatroomInfo = chatroomClient.getChatroomInfo()
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
66
162
|
getChatroomInfo(): V2NIMChatroomInfo;
|
|
67
|
-
/**
|
|
68
|
-
|
|
163
|
+
/**
|
|
164
|
+
* @brief 获取聊天室服务
|
|
165
|
+
* @returns V2NIMChatroomService
|
|
166
|
+
* @example
|
|
167
|
+
* ```javascript
|
|
168
|
+
* const chatroomService = chatroomClient.getChatroomService()
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
69
171
|
getChatroomService(): V2NIMChatroomService;
|
|
70
|
-
/**
|
|
71
|
-
|
|
172
|
+
/**
|
|
173
|
+
* @brief 获取聊天室队列服务
|
|
174
|
+
* @returns V2NIMChatroomQueueService
|
|
175
|
+
* @example
|
|
176
|
+
* ```javascript
|
|
177
|
+
* const chatroomQueueService = chatroomClient.getChatroomQueueService()
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
getChatroomQueueService(): V2NIMChatroomQueueService;
|
|
181
|
+
/**
|
|
182
|
+
* @brief 获取存储服务
|
|
183
|
+
* @returns V2NIMStorageService
|
|
184
|
+
* @example
|
|
185
|
+
* ```javascript
|
|
186
|
+
* const storageService = chatroomClient.getStorageService()
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
72
189
|
getStorageService(): V2NIMStorageService;
|
|
73
190
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
import { V2NIMChatroomQueueElement, V2NIMChatroomQueueOfferParams } from 'ts/v2_def/v2_nim_struct_def';
|
|
3
|
+
export declare interface V2NIMChatroomQueueListener {
|
|
4
|
+
/** 聊天室新增队列元素 */
|
|
5
|
+
chatroomQueueOffered: [V2NIMChatroomQueueElement];
|
|
6
|
+
/** 聊天室移除队列元素 */
|
|
7
|
+
chatroomQueuePolled: [V2NIMChatroomQueueElement];
|
|
8
|
+
/** 聊天室清空队列元素 */
|
|
9
|
+
chatroomQueueDropped: [];
|
|
10
|
+
/** 聊天室清理部分队列元素 */
|
|
11
|
+
chatroomQueuePartCleared: [Array<V2NIMChatroomQueueElement>];
|
|
12
|
+
/** 聊天室批量更新队列元素 */
|
|
13
|
+
chatroomQueueBatchUpdated: [Array<V2NIMChatroomQueueElement>];
|
|
14
|
+
/** 聊天室批量添加队列元素 */
|
|
15
|
+
chatroomQueueBatchOffered: [Array<V2NIMChatroomQueueElement>];
|
|
16
|
+
}
|
|
17
|
+
export declare class V2NIMChatroomQueueService extends EventEmitter<V2NIMChatroomQueueListener> {
|
|
18
|
+
instance: any;
|
|
19
|
+
constructor(instanceId: number);
|
|
20
|
+
/**
|
|
21
|
+
* @brief 初始化队列
|
|
22
|
+
* @param size 初始化队列的长度,长度限制:0~1000
|
|
23
|
+
* @returns Promise<void>
|
|
24
|
+
* @example
|
|
25
|
+
* ```javascript
|
|
26
|
+
* await chatroomQueueService.queueInit(100)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
queueInit(size: number): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* @brief 清空队列,仅管理员/创建者可以操作
|
|
32
|
+
* @returns Promise<void>
|
|
33
|
+
* @example
|
|
34
|
+
* ```javascript
|
|
35
|
+
* await chatroomQueueService.queueDrop()
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
queueDrop(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* @brief 聊天室队列新增或更新元素
|
|
41
|
+
* @param params 新增或更新元素参数
|
|
42
|
+
* @returns Promise<void>
|
|
43
|
+
* @example
|
|
44
|
+
* ```javascript
|
|
45
|
+
* await chatroomQueueService.queueOffer({
|
|
46
|
+
* elementKey: 'your element key',
|
|
47
|
+
* elementValue: 'your element value'
|
|
48
|
+
* })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
queueOffer(params: V2NIMChatroomQueueOfferParams): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* @brief 取出头元素或者指定的元素
|
|
54
|
+
* @param elementKey 指定的元素 key
|
|
55
|
+
* @returns Promise<V2NIMChatroomQueueElement>
|
|
56
|
+
* @example
|
|
57
|
+
* ```javascript
|
|
58
|
+
* const element = await chatroomQueueService.queuePoll('your element key')
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
queuePoll(elementKey: string): Promise<V2NIMChatroomQueueElement>;
|
|
62
|
+
/**
|
|
63
|
+
* @brief 查看队头元素, 不删除
|
|
64
|
+
* @returns Promise<V2NIMChatroomQueueElement>
|
|
65
|
+
* @example
|
|
66
|
+
* ```javascript
|
|
67
|
+
* const element = await chatroomQueueService.queuePeek()
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
queuePeek(): Promise<V2NIMChatroomQueueElement>;
|
|
71
|
+
/**
|
|
72
|
+
* @brief 排序列出所有元素
|
|
73
|
+
* @return Promise<Array<V2NIMChatroomQueueElement>>
|
|
74
|
+
* @example
|
|
75
|
+
* ```javascript
|
|
76
|
+
* const elements = await chatroomQueueService.queueList()
|
|
77
|
+
* console.log(elements)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
queueList(): Promise<Array<V2NIMChatroomQueueElement>>;
|
|
81
|
+
/**
|
|
82
|
+
* @brief 批量更新队列元素
|
|
83
|
+
* @param elements 需要更新的元素列表
|
|
84
|
+
* @param notificationEnabled 是否发送通知
|
|
85
|
+
* @param notificationExtension 通知扩展字段
|
|
86
|
+
* @return Promise<string[]>
|
|
87
|
+
* @example
|
|
88
|
+
* ```javascript
|
|
89
|
+
* const elementKeys = await chatroomQueueService.queueBatchUpdate([{
|
|
90
|
+
* elementKey: 'your element key',
|
|
91
|
+
* elementValue: 'your element value'
|
|
92
|
+
* }], true, 'your notification extension')
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
queueBatchUpdate(elements: any[], notificationEnabled: boolean, notificationExtension: string): Promise<string[]>;
|
|
96
|
+
}
|
|
@@ -1,6 +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 V2NIMChatroomListener {
|
|
4
5
|
/** 收到新消息 */
|
|
5
6
|
receiveMessages: [V2NIMChatroomMessage[]];
|
|
6
7
|
/** 聊天室成员进入 */
|
|
@@ -27,90 +28,226 @@ export declare interface V2NIMChatroomServiceEvents {
|
|
|
27
28
|
sendMessage: [V2NIMChatroomMessage];
|
|
28
29
|
}
|
|
29
30
|
/** @brief 聊天室服务 */
|
|
30
|
-
export declare class V2NIMChatroomService extends EventEmitter<
|
|
31
|
+
export declare class V2NIMChatroomService extends EventEmitter<V2NIMChatroomListener> {
|
|
31
32
|
instance: any;
|
|
32
33
|
constructor(instanceId: number);
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
*/
|
|
37
45
|
sendMessage(message: V2NIMChatroomMessage, params: V2NIMSendChatroomMessageParams): Promise<V2NIMSendChatroomMessageResult>;
|
|
38
|
-
/**
|
|
39
|
-
|
|
46
|
+
/**
|
|
47
|
+
* @brief 取消上传消息附件
|
|
48
|
+
* @param message 要取消上传的文件消息
|
|
49
|
+
* @returns void
|
|
50
|
+
* @example
|
|
51
|
+
* ```javascript
|
|
52
|
+
* await chatroomService.cancelMessageAttachmentUpload(message)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
40
55
|
cancelMessageAttachmentUpload(message: V2NIMChatroomMessage): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
*/
|
|
44
68
|
getMemberListByOption(queryOption: V2NIMChatroomMemberQueryOption): Promise<V2NIMChatroomMemberListResult>;
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
*/
|
|
48
81
|
getMessageList(option: V2NIMChatroomMessageListOption): Promise<Array<V2NIMChatroomMessage>>;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
*/
|
|
53
94
|
updateMemberRole(accountId: string, upadateParams: V2NIMChatroomMemberRoleUpdateParams): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
+
*/
|
|
59
106
|
setMemberBlockedStatus(accountId: string, blocked: boolean, notificationExtension: string): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
*/
|
|
65
118
|
setMemberChatBannedStatus(accountId: string, chatBanned: boolean, notificationExtension: string): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
*/
|
|
72
131
|
setMemberTempChatBanned(accountId: string, tempChatBannedDuration: number, notificationEnabled: boolean, notificationExtension: string): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
*/
|
|
77
144
|
updateChatroomInfo(updateParams: V2NIMChatroomUpdateParams, antispamConfig: V2NIMAntispamConfig): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
+
*/
|
|
82
157
|
updateSelfMemberInfo(updateParams: V2NIMChatroomSelfMemberUpdateParams, antispamConfig: V2NIMAntispamConfig): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
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
|
+
*/
|
|
86
167
|
getMemberByIds(accountIds: Array<string>): Promise<Array<V2NIMChatroomMember>>;
|
|
87
|
-
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
+
*/
|
|
91
178
|
kickMember(accountId: string, notificationExtension: string): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
*/
|
|
95
191
|
setTempChatBannedByTag(params: V2NIMChatroomTagTempChatBannedParams): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
|
|
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
|
+
*/
|
|
99
204
|
getMemberListByTag(option: V2NIMChatroomTagMemberOption): Promise<V2NIMChatroomMemberListResult>;
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
|
|
205
|
+
/**
|
|
206
|
+
* @brief 查询某个标签下的成员人数
|
|
207
|
+
* @param tag 标签
|
|
208
|
+
* @returns number
|
|
209
|
+
* @example
|
|
210
|
+
* ```javascript
|
|
211
|
+
* const count = await chatroomService.getMemberCountByTag('tag')
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
103
214
|
getMemberCountByTag(tag: string): Promise<number>;
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
|
|
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
|
+
*/
|
|
107
227
|
updateChatroomLocationInfo(locationConfig: V2NIMChatroomLocationConfig): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
|
|
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
|
+
*/
|
|
111
239
|
updateChatroomTags(updateParams: V2NIMChatroomTagsUpdateParams): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
|
|
114
|
-
|
|
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
|
+
*/
|
|
115
252
|
getMessageListByTag(messageOption: V2NIMChatroomTagMessageOption): Promise<Array<V2NIMChatroomMessage>>;
|
|
116
253
|
}
|