easemob-websdk 4.0.1-beta3 → 4.0.1

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/Easemob-chat.d.ts CHANGED
@@ -1,1492 +1,3191 @@
1
1
 
2
- import { InputFiles } from "typescript";
3
- declare interface GetChatRoomsParams {
4
- pagenum: number;
5
- pagesize: number;
6
- success?: (data: any) => any;
7
- error?: (error: any) => any;
8
- }
9
- declare interface CreateChatRoomParams {
10
- name: string;
11
- description: string;
12
- maxusers: number;
13
- members: string[];
14
- token: string;
15
- success?: (data: any) => any;
16
- error?: (error: any) => any;
17
- }
18
- declare interface DestroyChatRoomParams {
19
- chatRoomId: string;
20
- token: string;
21
- success?: (data: any) => any;
22
- error?: (error: any) => any;
23
- }
24
- declare interface GetChatRoomDetailsParams {
25
- chatRoomId: string;
26
- success?: (data: any) => any;
27
- error?: (error: any) => any;
28
- }
29
- declare interface ModifyChatRoomParams {
30
- chatRoomId: string;
31
- chatRoomName: string;
32
- description: string;
33
- maxusers: number;
34
- success?: (data: any) => any;
35
- error?: (error: any) => any;
36
- }
37
- declare interface RemoveSingleChatRoomMemberParams {
38
- chatRoomId: string;
39
- username: string;
40
- success?: (data: any) => any;
41
- error?: (error: any) => any;
42
- }
43
- declare interface RemoveMultiChatRoomMemberParams {
44
- chatRoomId: string;
45
- users: string[];
46
- success?: (data: any) => any;
47
- error?: (error: any) => any;
48
- }
49
- declare interface AddUsersToChatRoomParams {
50
- chatRoomId: string;
51
- users: string[];
52
- success?: (data: any) => any;
53
- error?: (error: any) => any;
54
- }
55
- declare interface JoinChatRoomParams {
56
- roomId: string;
57
- message?: string;
58
- success?: (data: any) => any;
59
- error?: (error: any) => any;
60
- }
61
- declare interface QuitChatRoomParams {
62
- roomId: string;
63
- success?: (data: any) => any;
64
- error?: (error: any) => any;
65
- }
66
- declare interface ListChatRoomMemberParams {
67
- pageNum: number;
68
- pageSize: number;
69
- chatRoomId: string;
70
- success?: (data: any) => any;
71
- error?: (error: any) => any;
72
- }
73
- declare interface GetChatRoomAdminParams {
74
- chatRoomId: string;
75
- success?: (data: any) => any;
76
- error?: (error: any) => any;
77
- }
78
- declare interface SetChatRoomAdminParams {
79
- chatRoomId: string;
80
- username: string;
81
- success?: (data: any) => any;
82
- error?: (error: any) => any;
83
- }
84
- declare interface RemoveChatRoomAdminParams {
85
- chatRoomId: string;
86
- username: string;
87
- success?: (data: any) => any;
88
- error?: (error: any) => any;
89
- }
90
- declare interface MuteChatRoomMemberParams {
91
- chatRoomId: string;
92
- username: string;
93
- muteDuration: number;
94
- success?: (data: any) => any;
95
- error?: (error: any) => any;
96
- }
97
- declare interface RemoveMuteChatRoomMemberParams {
98
- chatRoomId: string;
99
- username: string;
100
- success?: (data: any) => any;
101
- error?: (error: any) => any;
102
- }
103
- declare interface GetChatRoomMutedParams {
104
- chatRoomId: string;
105
- success?: (data: any) => any;
106
- error?: (error: any) => any;
107
- }
108
- declare interface ChatRoomBlockSingleParams {
109
- chatRoomId: string;
110
- username: string;
111
- success?: (data: any) => any;
112
- error?: (error: any) => any;
113
- }
114
- declare interface ChatRoomBlockMultiParams {
115
- chatRoomId: string;
116
- usernames: string[];
117
- success?: (data: any) => any;
118
- error?: (error: any) => any;
119
- }
120
- declare interface RemoveChatRoomBlockSingleParams {
121
- chatRoomId: string;
122
- username: string;
123
- success?: (data: any) => any;
124
- error?: (error: any) => any;
125
- }
126
- declare type RemoveChatRoomBlockMultiParams = ChatRoomBlockMultiParams;
127
- declare interface GetChatRoomBlacklistNewParams {
128
- chatRoomId: string;
129
- success?: (data: any) => any;
130
- error?: (error: any) => any;
131
- }
132
- declare interface DisableSendChatRoomMsgParams {
133
- chatRoomId: string;
134
- success?: (data: any) => any;
135
- error?: (error: any) => any;
136
- }
137
- declare type EnableSendChatRoomMsgParams = DisableSendChatRoomMsgParams;
138
- declare interface AddUsersToChatRoomWhitelistParams {
139
- chatRoomId: string;
140
- users: string[];
141
- success?: (data: any) => any;
142
- error?: (error: any) => any;
143
- }
144
- declare interface RmUsersFromChatRoomWhitelistParams {
145
- chatRoomId: string;
146
- userName: string;
147
- success?: (data: any) => any;
148
- error?: (error: any) => any;
149
- }
150
- declare interface GetChatRoomWhitelistParams {
151
- chatRoomId: string;
152
- success?: (data: any) => any;
153
- error?: (error: any) => any;
154
- }
155
- declare interface IsChatRoomWhiteUserParams {
156
- chatRoomId: string;
157
- userName: string;
158
- success?: (data: any) => any;
159
- error?: (error: any) => any;
160
- }
161
- declare interface FetchChatRoomAnnouncementParams {
162
- roomId: string;
163
- success?: (data: any) => any;
164
- error?: (error: any) => any;
165
- }
166
- declare interface UpdateChatRoomAnnouncementParams {
167
- roomId: string;
168
- announcement: string;
169
- success?: (data: any) => any;
170
- error?: (error: any) => any;
171
- }
172
- declare interface UploadChatRoomSharedFileParams {
173
- roomId: string;
174
- file: InputFiles;
175
- onFileUploadProgress?: (data: any) => any;
176
- onFileUploadComplete?: (data: any) => any;
177
- onFileUploadError?: (data: any) => any;
178
- onFileUploadCanceled?: (data: any) => any;
179
- }
180
- declare interface DeleteChatRoomSharedFileParams {
181
- roomId: string;
182
- fileId: string;
183
- success?: (data: any) => any;
184
- error?: (error: any) => any;
185
- }
186
- declare interface FetchChatRoomSharedFileListParams {
187
- roomId: string;
188
- success?: (data: any) => any;
189
- error?: (error: any) => any;
190
- }
191
- export { GetChatRoomsParams, CreateChatRoomParams, DestroyChatRoomParams, GetChatRoomDetailsParams, ModifyChatRoomParams, RemoveSingleChatRoomMemberParams, RemoveMultiChatRoomMemberParams, AddUsersToChatRoomParams, JoinChatRoomParams, QuitChatRoomParams, ListChatRoomMemberParams, GetChatRoomAdminParams, SetChatRoomAdminParams, RemoveChatRoomAdminParams, MuteChatRoomMemberParams, RemoveMuteChatRoomMemberParams, GetChatRoomMutedParams, ChatRoomBlockSingleParams, ChatRoomBlockMultiParams, RemoveChatRoomBlockSingleParams, RemoveChatRoomBlockMultiParams, GetChatRoomBlacklistNewParams, DisableSendChatRoomMsgParams, EnableSendChatRoomMsgParams, AddUsersToChatRoomWhitelistParams, RmUsersFromChatRoomWhitelistParams, GetChatRoomWhitelistParams, IsChatRoomWhiteUserParams, FetchChatRoomAnnouncementParams, UpdateChatRoomAnnouncementParams, UploadChatRoomSharedFileParams, DeleteChatRoomSharedFileParams, FetchChatRoomSharedFileListParams };
192
-
193
- // Group Api
194
- declare interface CreateGroupNewParams {
195
- data: {
196
- groupname: string;
197
- desc: string;
198
- members: string[];
199
- public: boolean;
200
- approval: boolean;
201
- allowinvites: boolean;
202
- inviteNeedConfirm: boolean;
203
- };
204
- success?: (data: any) => any;
205
- error?: (error: any) => any;
206
- }
207
- declare interface BlockGroupParams {
208
- groupId: string;
209
- success?: (data: any) => any;
210
- error?: (error: any) => any;
211
- }
212
- declare interface ListGroupsParams {
213
- limit: number;
214
- cursor?: number | null;
215
- success?: (data: any) => any;
216
- error?: (error: any) => any;
217
- }
218
- declare interface GetGroupParams {
219
- success?: (data: any) => any;
220
- error?: (error: any) => any;
221
- }
222
- declare interface ChangeOwnerParams {
223
- groupId: string;
224
- newOwner: string;
225
- success?: (data: any) => any;
226
- error?: (error: any) => any;
227
- }
228
- declare interface GetGroupInfoParams {
229
- groupId: string;
230
- success?: (data: any) => any;
231
- error?: (error: any) => any;
232
- }
233
- declare interface ModifyGroupParams {
234
- groupId: string;
235
- groupName: string;
236
- description: string;
237
- success?: (data: any) => any;
238
- error?: (error: any) => any;
239
- }
240
- declare interface ListGroupMemberParams {
241
- pageNum: number;
242
- pageSize: number;
243
- groupId: string;
244
- success?: (data: any) => any;
245
- error?: (error: any) => any;
246
- }
247
- declare interface GetGroupAdminParams {
248
- groupId: string;
249
- success?: (data: any) => any;
250
- error?: (error: any) => any;
251
- }
252
- declare interface SetAdminParams {
253
- groupId: string;
254
- username: string;
255
- success?: (data: any) => any;
256
- error?: (error: any) => any;
257
- }
258
- declare type RemoveAdminParams = SetAdminParams;
259
- declare interface DissolveGroupParams {
260
- groupId: string;
261
- success?: (data: any) => any;
262
- error?: (error: any) => any;
263
- }
264
- declare interface QuitGroupParams {
265
- groupId: string;
266
- success?: (data: any) => any;
267
- error?: (error: any) => any;
268
- }
269
- declare interface InviteToGroupParams {
270
- groupId: string;
271
- users: string[];
272
- success?: (data: any) => any;
273
- error?: (error: any) => any;
274
- }
275
- declare interface JoinGroupParams {
276
- groupId: string;
277
- message: string;
278
- success?: (data: any) => any;
279
- error?: (error: any) => any;
280
- }
281
- declare interface AgreeJoinGroupParams {
282
- groupId: string;
283
- applicant: string;
284
- success?: (data: any) => any;
285
- error?: (error: any) => any;
286
- }
287
- declare interface RejectJoinGroupParams {
288
- groupId: string;
289
- applicant: string;
290
- reason: string;
291
- success?: (data: any) => any;
292
- error?: (error: any) => any;
293
- }
294
- declare interface AgreeInviteIntoGroupParams {
295
- groupId: string;
296
- invitee: string;
297
- success?: (data: any) => any;
298
- error?: (error: any) => any;
299
- }
300
- declare type RejectInviteIntoGroupParams = AgreeInviteIntoGroupParams;
301
- declare interface RemoveSingleGroupMemberParams {
302
- groupId: string;
303
- username: string;
304
- success?: (data: any) => any;
305
- error?: (error: any) => any;
306
- }
307
- declare interface RemoveMultiGroupMemberParams {
308
- groupId: string;
309
- users: string[];
310
- success?: (data: any) => any;
311
- error?: (error: any) => any;
312
- }
313
- declare interface MuteParams {
314
- groupId: string;
315
- username: string;
316
- muteDuration: number;
317
- success?: (data: any) => any;
318
- error?: (error: any) => any;
319
- }
320
- declare interface RemoveMuteParams {
321
- groupId: string;
322
- username: string;
323
- success?: (data: any) => any;
324
- error?: (error: any) => any;
325
- }
326
- declare interface GetMutedParams {
327
- groupId: string;
328
- success?: (data: any) => any;
329
- error?: (error: any) => any;
330
- }
331
- declare interface GroupBlockSingleParams {
332
- groupId: string;
333
- username: string;
334
- success?: (data: any) => any;
335
- error?: (error: any) => any;
336
- }
337
- declare interface GroupBlockMultiParams {
338
- groupId: string;
339
- usernames: string[];
340
- success?: (data: any) => any;
341
- error?: (error: any) => any;
342
- }
343
- declare type RemoveGroupBlockSingleParams = GroupBlockSingleParams;
344
- declare type RemoveGroupBlockMultiParams = GroupBlockMultiParams;
345
- declare interface GetGroupBlacklistNew {
346
- groupId: string;
347
- success?: (data: any) => any;
348
- error?: (error: any) => any;
349
- }
350
- declare interface DisableSendGroupMsgParams {
351
- groupId: string;
352
- success?: (data: any) => any;
353
- error?: (error: any) => any;
354
- }
355
- declare type EnableSendGroupMsgParams = DisableSendGroupMsgParams;
356
- declare interface AddUsersToGroupWhitelistParams {
357
- groupId: string;
358
- users: string[];
359
- success?: (data: any) => any;
360
- error?: (error: any) => any;
361
- }
362
- declare interface RmUsersFromGroupWhitelistParams {
363
- groupId: string;
364
- userName: string;
365
- success?: (data: any) => any;
366
- error?: (error: any) => any;
367
- }
368
- declare interface GetGroupWhitelistParams {
369
- groupId: string;
370
- success?: (data: any) => any;
371
- error?: (error: any) => any;
372
- }
373
- declare interface IsGroupWhiteUserParams {
374
- groupId: string;
375
- userName: string;
376
- success?: (data: any) => any;
377
- error?: (error: any) => any;
378
- }
379
- declare interface GetGroupMsgReadUserParams {
380
- groupId: string;
381
- msgId: string;
382
- success?: (data: any) => any;
383
- error?: (error: any) => any;
384
- }
385
- declare interface FetchGroupAnnouncementParams {
386
- groupId: string;
387
- success?: (data: any) => any;
388
- error?: (error: any) => any;
389
- }
390
- declare interface UpdateGroupAnnouncementParams {
391
- groupId: string;
392
- announcement: string;
393
- success?: (data: any) => any;
394
- error?: (error: any) => any;
395
- }
396
- declare interface UploadGroupSharedFileParams {
397
- groupId: string;
398
- file: InputFiles;
399
- onFileUploadProgress?: (data: any) => any;
400
- onFileUploadComplete?: (data: any) => any;
401
- onFileUploadError?: (data: any) => any;
402
- onFileUploadCanceled?: (data: any) => any;
403
- }
404
- declare interface DeleteGroupSharedFileParams {
405
- groupId: string;
406
- fileId: string;
407
- success?: (data: any) => any;
408
- error?: (error: any) => any;
409
- }
410
- declare interface FetchGroupSharedFileListParams {
411
- groupId: string;
412
- success?: (data: any) => any;
413
- error?: (error: any) => any;
414
- }
415
- export { CreateGroupNewParams, BlockGroupParams, ListGroupsParams, GetGroupParams, ChangeOwnerParams, GetGroupInfoParams, ModifyGroupParams, ListGroupMemberParams, GetGroupAdminParams, SetAdminParams, RemoveAdminParams, DissolveGroupParams, QuitGroupParams, InviteToGroupParams, JoinGroupParams, AgreeJoinGroupParams, RejectJoinGroupParams, AgreeInviteIntoGroupParams, RejectInviteIntoGroupParams, RemoveSingleGroupMemberParams, RemoveMultiGroupMemberParams, MuteParams, RemoveMuteParams, GetMutedParams, GroupBlockSingleParams, GroupBlockMultiParams, RemoveGroupBlockSingleParams, RemoveGroupBlockMultiParams, GetGroupBlacklistNew, DisableSendGroupMsgParams, EnableSendGroupMsgParams, AddUsersToGroupWhitelistParams, RmUsersFromGroupWhitelistParams, GetGroupWhitelistParams, IsGroupWhiteUserParams, GetGroupMsgReadUserParams, FetchGroupAnnouncementParams, UpdateGroupAnnouncementParams, UploadGroupSharedFileParams, DeleteGroupSharedFileParams, FetchGroupSharedFileListParams };
2
+ export interface EasemobChatStatic {
3
+ connection: typeof EasemobChat.Connection;
4
+ message: typeof EasemobChat.Message;
5
+ utils: EasemobChat.Utils;
6
+ logger: EasemobChat.Logger;
7
+ statusCode: EasemobChat.Code;
8
+ }
9
+ declare const easemobChat: EasemobChatStatic
10
+ export default easemobChat
11
+ export declare namespace EasemobChat {
12
+ interface AsyncResult<T = any> {
13
+ type: Code,
14
+ data?: T,
15
+ entities?: T,
16
+ message?: string,
17
+ [key: string]: any
18
+ }
416
19
 
417
- // Contact Api
418
- declare interface BaseApiParams {
419
- success?: (data: any) => any;
420
- error?: (error: any) => any;
421
- }
20
+ type UserId = string
422
21
 
423
- declare interface UploadTokenParams {
424
- deviceId: string;
425
- deviceToken: string;
426
- notifierName: string;
427
- success?: (data: any) => any;
428
- error?: (error: any) => any;
429
- }
22
+ interface CommonRequestResult {
23
+ result: boolean,
24
+ action: string,
25
+ reason?: string,
26
+ user: string,
27
+ id: string
28
+ }
430
29
 
431
- declare interface UpdateOwnUserInfoParams {
432
- nickname?: string;
433
- avatarurl?: string;
434
- mail?: string;
435
- phone?: string;
436
- gender?: any;
437
- sign?: string;
438
- birth?: string;
439
- ext?: {
440
- [key: string]: any;
441
- };
442
- }
30
+ interface Jid { appKey: string, clientResource: string, domain: string, name: string }
443
31
 
444
- declare interface Jid { appKey: string, clientResource: string, domain: string, name: string }
445
- declare type ConfigurableKey = 'nickname' | 'avatarurl' | 'mail' | 'phone' | 'gender' | 'sign' | 'birth' | 'ext';
446
- declare interface RosterData {
447
- name: string;
448
- subscription: 'both';
449
- jid: Jid;
450
- }
451
- declare interface UserBlackListParams {
452
- name: string;
453
- }
454
- declare interface SubscribeParams {
455
- to: string;
456
- message?: string;
457
- }
458
- declare interface FetchHistoryMsgsParams {
459
- queue: string;
460
- start?: number | null;
461
- count?: number;
462
- isGroup?: boolean;
463
- success?: (data: any) => any;
464
- fail?: (error?: any) => any;
465
- }
466
- declare interface RecallMessageParams {
467
- mid: string;
468
- to: string;
469
- type?: 'chat' | 'groupchat' | 'chatroom';
470
- chatType?: 'singleChat' | 'groupChat' | 'chatRoom';
471
- success?: () => any;
472
- fail?: () => any;
473
- }
32
+ interface KVString {
33
+ [key: string]: string;
34
+ }
474
35
 
475
- export type { RosterData, UploadTokenParams, UpdateOwnUserInfoParams, ConfigurableKey, UserBlackListParams, SubscribeParams, FetchHistoryMsgsParams, RecallMessageParams };
476
-
477
-
478
- // eventHandle types
479
- declare type OnPresenceMsgType = 'rmChatRoomMute' | 'rmGroupMute' | 'muteChatRoom' | 'muteGroup' | 'rmUserFromChatRoomWhiteList' | 'rmUserFromGroupWhiteList' | 'addUserToChatRoomWhiteList' | 'addUserToGroupWhiteList' | 'deleteFile' | /*delete group file*/ 'uploadFile' | /*upload group file*/ 'deleteAnnouncement' | /*delete group Announcement*/ 'updateAnnouncement' | /*delete group Announcement*/ 'removeMute' | /*Lift a person from the ban in the group*/ 'addMute' | /*Forbid one person in the group*/ 'removeAdmin' | /*Remove a group administrator*/ 'addAdmin' | 'changeOwner' | 'direct_joined' | 'leaveChatRoom' | 'leaveGroup' | 'memberJoinChatRoomSuccess' | 'memberJoinPublicGroupSuccess' | 'unblock' | 'block' | 'update' | 'allow' | 'ban' | 'getBlackList' | 'removedFromGroup' | 'invite_decline' | 'invite_accept' | 'invite' | 'joinPublicGroupDeclined' | 'joinPublicGroupSuccess' | 'joinGroupNotifications' | 'leave' | 'join' | 'deleteGroupChat' | 'subscribe' | 'unsubscribed' | 'subscribed';
480
- declare interface OnPresenceMsg {
481
- type: OnPresenceMsgType;
482
- to: string;
483
- from: string;
484
- status: string;
485
- chatroom?: boolean;
486
- toJid?: string;
487
- fromJid?: string;
488
- gid?: string;
489
- owner?: string;
490
- }
491
- export declare type Event = 'onOpened' | 'onPresence' | 'onTextMessage' | 'onImageMessage' | 'onAudioMessage' | 'onVideoMessage' | 'onFileMessage' | 'onLocationMessage' | 'onCmdMessage' | 'onCustomMessage' | 'onReceivedMessage' | 'onDeliverdMessage' | 'onReadMessage' | 'onRecallMessage' | 'onMutedMessage' | 'onChannelMessage' | 'onError' | 'onOffline' | 'onOnline' | 'onRoster' | 'onStatisticMessage' | 'onContactAgreed' | 'onContactRefuse' | 'onContactDeleted' | 'onContactAdded' | 'onTokenWillExpire' | 'onTokenExpired' | 'onContactInvited' | 'onConnected' | 'onGroupChange' | 'onChatroomChange' | 'onContactChange';
492
- export interface EventHandlerType {
493
- 'onOpened'?: (msg: any) => any;
494
- 'onPresence'?: (msg: OnPresenceMsg) => any;
495
- 'onTextMessage'?: (msg: TextMsgBody) => any;
496
- 'onImageMessage'?: (msg: ImgMsgBody) => any;
497
- 'onAudioMessage'?: (msg: AudioMsgBody) => any;
498
- 'onVideoMessage'?: (msg: VideoMsgBody) => any;
499
- 'onFileMessage'?: (msg: FileMsgBody) => any;
500
- 'onLocationMessage'?: (msg: LocationMsgBody) => any;
501
- 'onCmdMessage'?: (msg: CmdMsgBody) => any;
502
- 'onCustomMessage'?: (msg: CustomMsgBody) => any;
503
- 'onReceivedMessage'?: (msg: ReceivedMsgBody) => any;
504
- 'onDeliverdMessage'?: (msg: DeliveryMsgBody) => any;
505
- 'onReadMessage'?: (msg: ReadMsgBody) => any;
506
- 'onRecallMessage'?: (msg: RecallMsgBody) => any;
507
- 'onMutedMessage'?: (msg: MuteMsgBody) => any;
508
- 'onChannelMessage'?: (msg: ChannelMsgBody) => any;
509
- 'onError'?: (error: ErrorEvent) => any;
510
- 'onOffline'?: (msg: any) => any;
511
- 'onOnline'?: (msg: any) => any;
512
- 'onRoster'?: (rosters: RosterData[]) => any;
513
- 'onStatisticMessage'?: (msg: any) => any;
514
- 'onContactAgreed'?: (msg: ContactMsgBody) => any;
515
- 'onContactRefuse'?: (msg: ContactMsgBody) => any;
516
- 'onContactDeleted'?: (msg: ContactMsgBody) => any;
517
- 'onContactAdded'?: (msg: ContactMsgBody) => any;
518
- 'onTokenWillExpire'?: (msg: any) => any;
519
- 'onTokenExpired'?: (msg: any) => any;
520
- 'onContactInvited'?: (msg: any) => any;
521
- 'onConnected'?: () => any;
522
- 'onGroupChange'?: (msg: any) => any;
523
- 'onChatroomChange'?: (msg: any) => any;
524
- 'onContactChange'?: (msg: any) => any;
525
- }
526
- declare interface HandlerData {
527
- [key: string]: EventHandlerType;
528
- }
36
+ interface RosterData {
37
+ name: string;
38
+ subscription: 'both';
39
+ jid: Jid;
40
+ }
529
41
 
42
+ interface Host {
43
+ protocol: string;
44
+ domain: string;
45
+ ip: string;
46
+ port: string;
47
+ }
530
48
 
49
+ interface SendMsgResult {
50
+ /** The message local ID. */
51
+ localMsgId: string,
52
+ /** The ID of the message on the server. */
53
+ serverMsgId: string
54
+ }
531
55
 
532
- /**
533
- * The connection module is the module where the SDK creates long link, And all about links, friends, groups, and chat apis are all in this module
534
- *
535
- * @module connection
536
- */
56
+ // eventHandle types
57
+ type OnPresenceMsgType = 'rmChatRoomMute' | 'rmGroupMute' | 'muteChatRoom' | 'muteGroup' | 'rmUserFromChatRoomWhiteList' | 'rmUserFromGroupWhiteList' | 'addUserToChatRoomWhiteList' | 'addUserToGroupWhiteList' | 'deleteFile' | 'uploadFile' | 'deleteAnnouncement' | 'updateAnnouncement' | 'removeMute' | 'addMute' | 'removeAdmin' | 'addAdmin' | 'changeOwner' | 'direct_joined' | 'leaveChatRoom' | 'leaveGroup' | 'memberJoinChatRoomSuccess' | 'memberJoinPublicGroupSuccess' | 'unblock' | 'block' | 'update' | 'allow' | 'ban' | 'getBlackList' | 'removedFromGroup' | 'invite_decline' | 'invite_accept' | 'invite' | 'joinPublicGroupDeclined' | 'joinPublicGroupSuccess' | 'joinGroupNotifications' | 'leave' | 'join' | 'deleteGroupChat' | 'subscribe' | 'unsubscribed' | 'subscribed';
58
+
59
+ interface OnPresenceMsg {
60
+ type: OnPresenceMsgType;
61
+ to: string;
62
+ from: string;
63
+ status: string;
64
+ chatroom?: boolean;
65
+ toJid?: string;
66
+ fromJid?: string;
67
+ gid?: string;
68
+ owner?: string;
69
+ }
537
70
 
538
- declare interface ConnectionParameters {
539
- apiUrl?: string;
540
- url?: string;
541
- isDebug?: boolean;
542
- isHttpDNS?: boolean;
543
- heartBeatWait?: number;
544
- appKey: string;
545
- deviceId?: string;
546
- useOwnUploadFun?: boolean;
547
- autoReconnectNumMax?: number;
548
- }
549
- declare interface RegisterUserParameters {
550
- username: string;
551
- password: string;
552
- nickname: string;
553
- success?: (res: any) => any;
554
- error?: (err: ErrorEvent) => any;
555
- apiUrl?: string;
556
- }
557
- declare interface LoginParameters {
558
- user: string;
559
- pwd: string;
560
- accessToken?: string;
561
- agoraToken?: string;
562
- success?: (res: any) => any;
563
- error?: (res: any) => any;
564
- }
565
- declare interface Host {
566
- protocol: string;
567
- domain: string;
568
- ip: string;
569
- port: string;
570
- }
571
71
 
572
- declare interface SendMsgResult {
573
- localMsgId: string, // local message id
574
- srverMsgId: string // server message id
575
- }
576
- /**
577
- * @category Connection
578
- */
579
- declare class Connection {
580
- isDebug: boolean;
581
- isHttpDNS: boolean;
582
- heartBeatWait: number;
583
- appKey: string;
584
- /** @hidden */
585
- appName: string;
586
- /** @hidden */
587
- orgName: string;
588
-
589
- token: string;
590
- autoReconnectNumMax: number;
591
- autoReconnectNumTotal: number;
592
- version: string;
593
- deviceId: string;
594
- osType: number;
595
- useOwnUploadFun: boolean;
596
- apiUrl: string;
597
- url: string;
598
- https: boolean;
599
-
600
- grantType: 'password' | 'accessToken' | 'agoraToken' | '';
601
- context: {
602
- jid: {
603
- appKey: string;
604
- clientResource: string;
605
- domain: string;
606
- name: string;
607
- };
608
- userId: string;
609
- appKey: string;
610
- restTokenData: string;
611
- status: number;
612
- appName: string;
613
- orgName: string;
614
- root: any;
615
- accessToken: string;
616
- };
617
72
 
618
- _msgHash: {
619
- [key: string]: any;
620
- };
621
73
 
622
- eventHandler?: EventHandler;
623
- onOpened?: () => any;
624
74
  /**
625
- * @since 3.0
626
- * @deprecated 4.0
75
+ * The connection module is the module where the SDK creates long link, And all about links, friends, groups, and chat apis are all in this module
76
+ *
77
+ * @module connection
627
78
  */
628
- onPresence?: (msg: PresenceMsg) => any;
629
- onTextMessage?: (msg: TextMsgBody) => any;
630
- onPictureMessage?: (msg: ImgMsgBody) => any;
631
- onAudioMessage?: (msg: AudioMsgBody) => any;
632
- onVideoMessage?: (msg: VideoMsgBody) => any;
633
- onFileMessage?: (msg: FileMsgBody) => any;
634
- onLocationMessage?: (msg: LocationMsgBody) => any;
635
- onCmdMessage?: (msg: CmdMsgBody) => any;
636
- onCustomMessage?: (msg: CustomMsgBody) => any;
637
- onReceivedMessage?: (msg: ReceivedMsgBody) => any;
638
- onDeliverdMessage?: (msg: DeliveryMsgBody) => any;
639
- onReadMessage?: (msg: ReadMsgBody) => any;
640
- onRecallMessage?: (msg: RecallMsgBody) => any;
641
- onMutedMessage?: (msg: MuteMsgBody) => any;
642
- onChannelMessage?: (msg: ChannelMsgBody) => any;
643
- onError?: (error: ErrorEvent) => any;
644
- onOffline?: () => any;
645
- onOnline?: () => any;
646
- onRoster?: (rosters: RosterData[]) => any;
647
- onStatisticMessage?: (msg: any) => any;
648
- onCreateGroup?: (data: any) => any;
649
- onBlacklistUpdate?: (list: {
650
- [key: string]: {
651
- name: string;
652
- };
653
- }) => any;
654
- onContactAgreed?: (msg: ContactMsgBody) => any;
655
- onContactRefuse?: (msg: ContactMsgBody) => any;
656
- onContactDeleted?: (msg: ContactMsgBody) => any;
657
- onContactAdded?: (msg: ContactMsgBody) => any;
658
- onTokenWillExpire?: () => any;
659
- onTokenExpired?: () => any;
660
- /** @hidden */
661
- [key: string]: any;
662
- constructor(options: ConnectionParameters);
663
-
664
- registerUser(this: Connection, params: RegisterUserParameters): Promise<any>;
665
- open(parameters: LoginParameters): void;
666
- isOpened(): boolean;
667
- close(): void;
668
-
669
- getChatToken(agoraToken: string): Promise<any>;
670
-
671
- reconnect(): void;
672
- /** send message */
673
- send(params: MessagesType): Promise<SendMsgResult>;
674
-
675
- // ChatRoom API
676
- getChatRooms(this: Connection, params: GetChatRoomsParams): Promise<Object>;
677
- createChatRoom(this: Connection, params: CreateChatRoomParams): Promise<Object>;
678
- destroyChatRoom(this: Connection, params: DestroyChatRoomParams): Promise<Object>;
679
- getChatRoomDetails(this: Connection, params: GetChatRoomDetailsParams): Promise<Object>;
680
- modifyChatRoom(this: Connection, params: ModifyChatRoomParams): Promise<Object>;
681
- removeSingleChatRoomMember(this: Connection, params: RemoveSingleChatRoomMemberParams): Promise<Object>;
682
- removeMultiChatRoomMember(this: Connection, params: RemoveMultiChatRoomMemberParams): Promise<Object>;
683
- addUsersToChatRoom(this: Connection, params: AddUsersToChatRoomParams): Promise<Object>;
684
- joinChatRoom(this: Connection, params: JoinChatRoomParams): Promise<Object>;
685
- quitChatRoom(this: Connection, params: QuitChatRoomParams): Promise<Object>;
686
- listChatRoomMember(this: Connection, params: ListChatRoomMemberParams): Promise<Object>;
687
- getChatRoomAdmin(this: Connection, params: GetChatRoomAdminParams): Promise<Object>;
688
- setChatRoomAdmin(this: Connection, params: SetChatRoomAdminParams): Promise<Object>;
689
- removeChatRoomAdmin(this: Connection, params: RemoveChatRoomAdminParams): Promise<Object>;
690
- muteChatRoomMember(this: Connection, params: MuteChatRoomMemberParams): Promise<Object>;
691
- removeMuteChatRoomMember(this: Connection, params: RemoveMuteChatRoomMemberParams): Promise<Object>;
692
- getChatRoomMuted(this: Connection, params: GetChatRoomMutedParams): Promise<Object>;
693
- chatRoomBlockSingle(this: Connection, params: ChatRoomBlockSingleParams): Promise<Object>;
694
- chatRoomBlockMulti(this: Connection, params: ChatRoomBlockMultiParams): Promise<Object>;
695
- removeChatRoomBlockSingle(this: Connection, params: RemoveChatRoomBlockSingleParams): Promise<Object>;
696
- removeChatRoomBlockMulti(this: Connection, params: RemoveChatRoomBlockMultiParams): Promise<Object>;
697
- getChatRoomBlacklistNew(this: Connection, params: GetChatRoomBlacklistNewParams): Promise<Object>;
698
- disableSendChatRoomMsg(this: Connection, params: DisableSendChatRoomMsgParams): Promise<Object>;
699
- enableSendChatRoomMsg(this: Connection, params: EnableSendChatRoomMsgParams): Promise<Object>;
700
- addUsersToChatRoomWhitelist(this: Connection, params: AddUsersToChatRoomWhitelistParams): Promise<Object>;
701
- rmUsersFromChatRoomWhitelist(this: Connection, params: RmUsersFromChatRoomWhitelistParams): Promise<Object>;
702
- getChatRoomWhitelist(this: Connection, params: GetChatRoomWhitelistParams): Promise<Object>;
703
- isChatRoomWhiteUser(this: Connection, params: IsChatRoomWhiteUserParams): Promise<Object>;
704
- fetchChatRoomAnnouncement(this: Connection, params: FetchChatRoomAnnouncementParams): Promise<Object>;
705
- updateChatRoomAnnouncement(this: Connection, params: UpdateChatRoomAnnouncementParams): Promise<Object>;
706
- uploadChatRoomSharedFile(this: Connection, params: UploadChatRoomSharedFileParams): void;
707
- deleteChatRoomSharedFile(this: Connection, params: DeleteChatRoomSharedFileParams): Promise<Object>;
708
- fetchChatRoomSharedFileList(this: Connection, params: FetchChatRoomSharedFileListParams): Promise<Object>;
709
-
710
- // Group API
711
- createGroupNew(this: Connection, params: CreateGroupNewParams): Promise<Object>;
712
- blockGroup(this: Connection, params: BlockGroupParams): Promise<Object>;
713
- listGroups(this: Connection, params: ListGroupsParams): Promise<Object>;
714
- getGroup(this: Connection, params?: BaseApiParams): Promise<Object>;
715
- changeOwner(this: Connection, params: ChangeOwnerParams): Promise<Object>;
716
- getGroupInfo(this: Connection, params: GetGroupInfoParams): Promise<Object>;
717
- modifyGroup(this: Connection, params: ModifyGroupParams): Promise<Object>;
718
- listGroupMember(this: Connection, params: ListGroupMemberParams): Promise<Object>;
719
- getGroupAdmin(this: Connection, params: GetGroupAdminParams): Promise<Object>;
720
- setAdmin(this: Connection, params: SetAdminParams): Promise<Object>;
721
- removeAdmin(this: Connection, params: RemoveAdminParams): Promise<Object>;
722
- dissolveGroup(this: Connection, params: DissolveGroupParams): Promise<Object>;
723
- quitGroup(this: Connection, params: QuitGroupParams): Promise<Object>;
724
- inviteToGroup(this: Connection, params: InviteToGroupParams): Promise<Object>;
725
- joinGroup(this: Connection, params: JoinGroupParams): Promise<Object>;
726
- agreeJoinGroup(this: Connection, params: AgreeJoinGroupParams): Promise<Object>;
727
- rejectJoinGroup(this: Connection, params: RejectJoinGroupParams): Promise<Object>;
728
- agreeInviteIntoGroup(this: Connection, params: AgreeInviteIntoGroupParams): Promise<Object>;
729
- rejectInviteIntoGroup(this: Connection, params: RejectInviteIntoGroupParams): Promise<Object>;
730
- removeSingleGroupMember(this: Connection, params: RemoveSingleGroupMemberParams): Promise<Object>;
731
- removeMultiGroupMember(this: Connection, params: RemoveMultiGroupMemberParams): Promise<Object>;
732
- mute(this: Connection, params: MuteParams): Promise<Object>;
733
- removeMute(this: Connection, params: RemoveMuteParams): Promise<Object>;
734
- getMuted(this: Connection, params: GetMutedParams): Promise<Object>;
735
- groupBlockSingle(this: Connection, params: GroupBlockSingleParams): Promise<Object>;
736
- groupBlockMulti(this: Connection, params: GroupBlockMultiParams): Promise<Object>;
737
- removeGroupBlockSingle(this: Connection, params: RemoveGroupBlockSingleParams): Promise<Object>;
738
- removeGroupBlockMulti(this: Connection, params: RemoveGroupBlockMultiParams): Promise<Object>;
739
- getGroupBlacklistNew(this: Connection, params: GetGroupBlacklistNew): Promise<Object>;
740
- disableSendGroupMsg(this: Connection, params: DisableSendGroupMsgParams): Promise<Object>;
741
- enableSendGroupMsg(this: Connection, params: EnableSendGroupMsgParams): Promise<Object>;
742
- addUsersToGroupWhitelist(this: Connection, params: AddUsersToGroupWhitelistParams): Promise<Object>;
743
- rmUsersFromGroupWhitelist(this: Connection, params: RmUsersFromGroupWhitelistParams): Promise<Object>;
744
- getGroupWhitelist(this: Connection, params: GetGroupWhitelistParams): Promise<Object>;
745
- isGroupWhiteUser(this: Connection, params: IsGroupWhiteUserParams): Promise<Object>;
746
- getGroupMsgReadUser(this: Connection, params: GetGroupMsgReadUserParams): Promise<Object>;
747
- fetchGroupAnnouncement(this: Connection, params: FetchGroupAnnouncementParams): Promise<Object>;
748
- updateGroupAnnouncement(this: Connection, params: UpdateGroupAnnouncementParams): Promise<Object>;
749
- uploadGroupSharedFile(this: Connection, params: UploadGroupSharedFileParams): void;
750
- deleteGroupSharedFile(this: Connection, params: DeleteGroupSharedFileParams): Promise<Object>;
751
- fetchGroupSharedFileList(this: Connection, params: FetchGroupSharedFileListParams): Promise<Object>;
752
-
753
- // Contact API
754
- getBlacklist(this: Connection, params?: BaseApiParams): Promise<Object>;
755
- getRoster(this: Connection, params?: BaseApiParams): Promise<Object>;
756
- uploadToken(this: Connection, params: UploadTokenParams): Promise<Object>;
757
- getSessionList(this: Connection, params?: BaseApiParams): Promise<Object>;
758
- updateOwnUserInfo(this: Connection, params: UpdateOwnUserInfoParams | ConfigurableKey, value?: any): Promise<Object>;
759
- fetchUserInfoById(this: Connection, userId: string | string[], properties: ConfigurableKey[] | ConfigurableKey): Promise<Object>;
760
- updateCurrentUserNick(this: Connection, nick: string): Promise<Object>;
761
- getChatToken(this: Connection, agoraToken: string): Promise<Object>;
762
- fetchHistoryMessages(this: Connection, options: FetchHistoryMsgsParams): Promise<any>;
763
- addContact(this: Connection, to: string, message?: string): Promise<Object>;
764
- deleteContact(this: Connection, to: string): Promise<Object>;
765
- acceptInvitation(this: Connection, to: string): Promise<Object>;
766
- declineInvitation(this: Connection, to: string): Promise<Object>;
767
- addToBlackList(this: Connection, options: UserBlackListParams): Promise<Object>;
768
- removeFromBlackList(this: Connection, options: UserBlackListParams): Promise<Object>;
769
- /** @deprecated*/
770
- subscribe(this: Connection, options: SubscribeParams): void;
771
- /** @deprecated*/
772
- subscribed(this: Connection, options: SubscribeParams): void;
773
- /** @deprecated*/
774
- unsubscribed(this: Connection, options: SubscribeParams): void;
775
- /** @deprecated*/
776
- removeRoster(this: Connection, options: SubscribeParams): void;
777
-
778
- recallMessage(this: Connection, option: RecallMessageParams): void;
779
-
780
- // listen @since 3.0
781
- listen(this: Connection, parameters: ListenParameters): void;
782
-
783
- // eventHandler @since 4.0
784
- addEventHandler(id: string, handler: EventHandlerType): void;
785
- removeEventHandler(id: string): void;
786
- }
787
79
 
80
+ interface ConnectionParameters {
81
+ appKey: string;
82
+ apiUrl?: string;
83
+ url?: string;
84
+ delivery?: boolean;
85
+ isDebug?: boolean;
86
+ isHttpDNS?: boolean;
87
+ heartBeatWait?: number;
88
+ deviceId?: string;
89
+ useOwnUploadFun?: boolean;
90
+ autoReconnectNumMax?: number;
91
+ }
788
92
 
789
- /**
790
- * This is the doc comment for file1.ts (can be delete)
791
- *
792
- * Specify this is a module comment and rename it to my-module:
793
- * @module eventHandler
794
- */
795
-
796
- declare type DispatchParameters = MessagesType | OnPresenceMsg | RosterData | ErrorEvent | MuteMsgBody | ReceivedMsgBody | RecallMsgBody | ChannelMsgBody;
797
- declare class EventHandler {
798
- handlerData: HandlerData;
799
- constructor(Connection: any, eventHandlerId: string, eventHandler: EventHandlerType);
800
- addEventHandler(eventHandlerId: string, eventHandler: EventHandlerType): void;
801
- removeEventHandler(eventHandlerId: string): void;
802
- /** @hidden */
803
- dispatch(this: EventHandler, event: Event, parameters?: DispatchParameters): void;
804
- }
805
93
 
806
- /**
807
- * @module listen
808
- */
809
- declare interface ListenParameters {
810
- onOpened?: () => any;
811
- onPresence?: (msg: PresenceMsg) => any;
812
- onTextMessage?: (msg: TextMsgBody) => any;
813
- onPictureMessage?: (msg: ImgMsgBody) => any;
814
- onAudioMessage?: (msg: AudioMsgBody) => any;
815
- onVideoMessage?: (msg: VideoMsgBody) => any;
816
- onFileMessage?: (msg: FileMsgBody) => any;
817
- onLocationMessage?: (msg: LocationMsgBody) => any;
818
- onCmdMessage?: (msg: CmdMsgBody) => any;
819
- onCustomMessage?: (msg: CustomMsgBody) => any;
820
- onReceivedMessage?: (msg: ReceivedMsgBody) => any;
821
- onDeliverdMessage?: (msg: DeliveryMsgBody) => any;
822
- onReadMessage?: (msg: ReadMsgBody) => any;
823
- onRecallMessage?: (msg: RecallMsgBody) => any;
824
- onMutedMessage?: (msg: MuteMsgBody) => any;
825
- onChannelMessage?: (msg: ChannelMsgBody) => any;
826
- onError?: (error: ErrorEvent) => any;
827
- onOffline?: () => any;
828
- onOnline?: () => any;
829
- onRoster?: (rosters: RosterData[]) => any;
830
- onStatisticMessage?: () => any;
831
- onCreateGroup?: () => any;
832
- onBlacklistUpdate?: () => any;
833
- onContactAgreed?: (msg: ContactMsgBody) => any;
834
- onContactRefuse?: (msg: ContactMsgBody) => any;
835
- onContactDeleted?: (msg: ContactMsgBody) => any;
836
- onContactAdded?: (msg: ContactMsgBody) => any;
837
- onTokenWillExpire?: () => any;
838
- onTokenExpired?: () => any;
839
- onClosed?: () => any;
840
- }
94
+ // chat room api result start
95
+ interface ChatRoomBaseInfo {
96
+ /** The total number of existing members. */
97
+ affiliations_count: number,
98
+ /** The chart room ID. */
99
+ id: string,
100
+ /** The chat room name. */
101
+ name: string,
102
+ /** The chat room owner. */
103
+ owner: string
104
+ }
105
+ type GetChatRoomsResult = ChatRoomBaseInfo[]
841
106
 
842
- declare interface ErrorParameters {
843
- type: Code,
844
- message: string;
845
- data?: any
846
- }
847
- declare class ErrorEvent {
848
- type: Code;
849
- message: string;
850
- data?: any;
851
- constructor(parameters: ErrorParameters);
852
- static create(parameters: ErrorParameters): ErrorEvent;
853
- }
107
+ type BaseMembers = { member: string } | { owner: string }
108
+
109
+ interface GetChatRoomDetailsResult {
110
+ /** A list of existing members. */
111
+ affiliations: BaseMembers[],
112
+ /** The total number of existing members. */
113
+ affiliations_count: number,
114
+ /** Whether to allow members of a chat room to invite others to join the group. (Use only in group) */
115
+ allowinvites: boolean,
116
+ /** The Timestamp when the chat room was created. */
117
+ created: number,
118
+ /** The custom information. */
119
+ custom: string,
120
+ /** The chat room description. */
121
+ description: string,
122
+ /** The chat room ID. */
123
+ id: string,
124
+ /** The upper limit of chat room members. */
125
+ maxusers: number,
126
+ /** Whether need to join the chat room requires the approval of the group owner or group administrator. (Use only in group). */
127
+ membersonly: boolean,
128
+ /** Whether to open the forbidden speech of all members. */
129
+ mute: boolean,
130
+ /** The chat room name. */
131
+ name: string,
132
+ /** The chat room owner. */
133
+ owner: string,
134
+ /** Whether it a public group. (Use only in group) */
135
+ public: boolean,
136
+ /** Whether on the blacklist. */
137
+ shieldgroup: boolean
138
+ }
139
+
140
+ interface ModifyChatRoomResult {
141
+ /** Whether to change the description successfully. */
142
+ description: boolean,
143
+ /** Whether to change the maxusers successfully. */
144
+ maxusers: boolean,
145
+ /** Whether to change the groupname successfully. */
146
+ groupname: boolean
147
+ }
148
+
149
+ interface CommonRequestResult {
150
+ /** The result of request. */
151
+ result: boolean,
152
+ /** Action. */
153
+ action: string,
154
+ /** The reason of failure. */
155
+ reason?: string,
156
+ /** The user ID. */
157
+ user: string,
158
+ /** The chat room ID. */
159
+ id: string
160
+ }
161
+
162
+ interface AddUsersToChatRoomResult {
163
+ /** The newly added members. */
164
+ newmembers: string[],
165
+ /** Action. */
166
+ action: 'add_member',
167
+ /** The chat room ID */
168
+ id: string
169
+ }
170
+
171
+ type GetChatRoomAdminResult = UserId[]
172
+
173
+ interface SetChatRoomAdminResult {
174
+ /** The result of request. */
175
+ result: boolean,
176
+ /** The new admin. */
177
+ newadmin: string
178
+ }
179
+
180
+ interface RemoveChatRoomAdminResult {
181
+ /** The result of request. */
182
+ result: boolean,
183
+ /** The admin was removed. */
184
+ oldadmin: string
185
+ }
186
+
187
+ interface MuteChatRoomMemberResult {
188
+ /** The result of request. */
189
+ result: boolean,
190
+ /** The time stamp of forbidden speech expiration. */
191
+ expire: number,
192
+ /** The ID of the forbidden user. */
193
+ user: string
194
+ }
195
+
196
+ interface UnmuteChatRoomMemberResult {
197
+ /** The result of request. */
198
+ result: boolean,
199
+ /** The ID of the unblocked user. */
200
+ user: string
201
+ }
202
+
203
+ interface GetChatRoomMuteListResult {
204
+ /** The time stamp of forbidden speech expiration. */
205
+ expire: number,
206
+ /** The ID of the forbidden user. */
207
+ user: string
208
+ }
209
+
210
+ interface WhetherAbleSendChatRoomMsgResult {
211
+ /** The mute state. */
212
+ mute: boolean
213
+ }
214
+
215
+ interface IsChatRoomWhiteUserResult {
216
+ /** The member */
217
+ member: string,
218
+ /** Whether the member is on the whitelist */
219
+ white: boolean
220
+ }
221
+
222
+ interface FetchChatRoomAnnouncementResult {
223
+ /** The announcement content. */
224
+ announcement: string
225
+ }
226
+
227
+ interface UpdateChatRoomAnnouncementResult {
228
+ /** The chat room ID. */
229
+ id: string,
230
+ /** The result of request. */
231
+ result: boolean
232
+ }
233
+
234
+ interface FetchChatRoomSharedFileListResult {
235
+ /** The file ID. */
236
+ file_id: string,
237
+ /** The file name. */
238
+ file_name: string,
239
+ /** The file owner. */
240
+ file_owner: string,
241
+ /** The file size. */
242
+ file_size: number,
243
+ /** The time stamp of file upload. */
244
+ created: number
245
+ }
246
+
247
+ interface DeleteChatRoomSharedFileResult {
248
+ /** The chat room ID. */
249
+ id: string,
250
+ /** The file ID. */
251
+ file_id: string,
252
+ /** The operation result. */
253
+ result: boolean
254
+ }
255
+
256
+ interface CreateDeleteChatRoomResult {
257
+ /** The chat room ID */
258
+ id: string
259
+ }
260
+ // The chat room api result end.
261
+
262
+ // The group api result start.
263
+ interface BaseGroupInfo {
264
+ /** The group ID. */
265
+ groupid: string,
266
+ /** The group name. */
267
+ groupname: string
268
+ }
269
+
270
+ type GroupAffiliation = {
271
+ /** The group owner. */
272
+ owner: UserId,
273
+ /** Time to join the group. */
274
+ joined_time: number
275
+ } | {
276
+ /** The group member. */
277
+ member: UserId,
278
+ /** Time to join the group. */
279
+ joined_time: number
280
+ }
281
+
282
+ interface CreateGroupResult {
283
+ /** The group ID. */
284
+ groupid: string
285
+ }
286
+
287
+ interface BlockGroupResult {
288
+ /** Whether the current user is enabled. */
289
+ activated: boolean,
290
+ /** The time stamp when the current user was created. */
291
+ created: number,
292
+ /** The time when Finally edit the user information. */
293
+ modified: number,
294
+ /** User nickname for push. */
295
+ nickname: string,
296
+ /** The user type. */
297
+ type: string,
298
+ /** The user ID. */
299
+ username: string,
300
+ /** The user uuid. */
301
+ uuid: string
302
+ }
303
+
304
+ interface ChangeGroupOwnerResult {
305
+ /** The result of changing group owner. */
306
+ newowner: boolean
307
+ }
308
+
309
+ interface GroupDetailInfo {
310
+ /** The list of existing members. */
311
+ affiliations: GroupAffiliation[],
312
+ /** The total number of existing members. */
313
+ affiliations_count: number,
314
+ /** Whether to allow group members to invite others to join the group. */
315
+ allowinvites: boolean,
316
+ /** The time when the group was created. */
317
+ created: number,
318
+ /** The custom information. */
319
+ custom: string,
320
+ /** The group description. */
321
+ description: string,
322
+ /** The group ID. */
323
+ id: string,
324
+ /** The maximum number of group members */
325
+ maxusers: number,
326
+ /** Whether to join a group requires the approval of the group owner or group administrator. True: yes, false: no. */
327
+ membersonly: boolean,
328
+ /** Whether to open the forbidden speech of all members. */
329
+ mute: boolean,
330
+ /** The group name. */
331
+ name: string,
332
+ /** The group owner. */
333
+ owner: UserId,
334
+ /** Whether it is a public group. */
335
+ public: boolean,
336
+ /** Whether on the blacklist. */
337
+ shieldgroup: boolean
338
+ }
339
+
340
+ interface ModifyGroupResult {
341
+ /** Whether the group description is modified successfully. */
342
+ description?: boolean
343
+ /** Whether the upper limit of group members is changed successfully. */
344
+ maxusers?: boolean,
345
+ /** Whether the group name is changed successfully. */
346
+ groupname?: boolean,
347
+ /** Whether needing approve is changed successfully. */
348
+ membersonly?: boolean,
349
+ /** Whether the permission invitation is modified successfully. */
350
+ allowinvites?: boolean
351
+ }
352
+
353
+ type GroupMember = { owner: UserId } | { member: UserId }
354
+
355
+ interface SetGroupAdminResult {
356
+ /** The new admin user ID. */
357
+ newadmin: UserId,
358
+ /** The Result of setting. */
359
+ result: 'success'
360
+ }
361
+
362
+ interface RemoveGroupAdminResult {
363
+ /** The user ID of removed administrator. */
364
+ oldadmin: UserId,
365
+ /** The Result of setting. */
366
+ result: 'success'
367
+ }
368
+
369
+ interface DestroyGroupResult {
370
+ /** The group Id. */
371
+ id: string,
372
+ /** The operation result. */
373
+ success: boolean
374
+ }
375
+
376
+ interface InviteUsersToGroupResult {
377
+ /** Action. */
378
+ action: 'invite',
379
+ /** The group ID. */
380
+ id: string,
381
+ /** The reason for failure. */
382
+ reason?: string,
383
+ /** The result of the invitation. */
384
+ result: boolean,
385
+ /** The ID of the invited user. */
386
+ user: UserId
387
+ }
388
+
389
+ interface JoinGroupResult {
390
+ /** Action. */
391
+ action: string,
392
+ /** The group ID. */
393
+ id: string,
394
+ /** The result of the invitation. */
395
+ result: boolean,
396
+ /** The ID of the user that applies for adding to a group. */
397
+ user: UserId
398
+ }
399
+
400
+ interface RemoveGroupMemberResult {
401
+ /** Action. */
402
+ action: 'remove_member',
403
+ /** The group ID. */
404
+ groupid: string,
405
+ /** The result of the invitation. */
406
+ result: boolean,
407
+ /** The user ID. */
408
+ user: UserId
409
+ }
410
+
411
+ interface MuteGroupMemberResult {
412
+ /** The timestamp when the mute expires. */
413
+ expire: number,
414
+ /** The operation result. */
415
+ result: boolean,
416
+ /** The muted user ID . */
417
+ user: UserId
418
+ }
419
+
420
+ interface UnmuteGroupMemberResult {
421
+ /** The operation result. */
422
+ result: boolean,
423
+ /** The unbanned group member ID. */
424
+ user: UserId
425
+ }
426
+
427
+ interface GetGroupMuteListResult {
428
+ /** The timestamp when the mute expires. */
429
+ expire: number,
430
+ /** The muted user ID . */
431
+ user: UserId
432
+ }
433
+
434
+ interface GroupRequestResult {
435
+ /** Action. */
436
+ action: string,
437
+ /** The group ID. */
438
+ groupid: string,
439
+ /** The result of the invitation. */
440
+ result: boolean,
441
+ /** The user ID. */
442
+ user: UserId
443
+ }
444
+ interface IsInGroupWhiteListResult {
445
+ /** The User ID to query. */
446
+ member: UserId,
447
+ /** Whether the user is on the white list. */
448
+ white: boolean;
449
+ }
450
+
451
+ interface GetGroupMsgReadUserResult {
452
+ /** The message ID of to query. */
453
+ ackmid: string,
454
+ /** Is it the last one. */
455
+ is_last: boolean,
456
+ /** The cursor for the next paging query. */
457
+ next_key: string,
458
+ /** The time of the current query. */
459
+ timestamp: number,
460
+ /** The number of people read. */
461
+ total: number,
462
+ /** The list of people who have read this message. */
463
+ userlist: UserId[]
464
+ }
465
+
466
+ interface UpdateGroupAnnouncementResult {
467
+ /** The group ID. */
468
+ id: string,
469
+ /** The operation result. */
470
+ result: boolean
471
+ }
472
+
473
+ interface DeleteGroupSharedFileResult {
474
+ /** The group ID. */
475
+ group_id: string,
476
+ /** The file ID. */
477
+ file_id: string,
478
+ /** The operation result. */
479
+ result: boolean
480
+ }
481
+
482
+ interface FetchGroupSharedFileListResult {
483
+ /** The file ID. */
484
+ file_id: string,
485
+ /** The file name. */
486
+ file_name: string,
487
+ /** The file owner. */
488
+ file_owner: string,
489
+ /** The file size. */
490
+ file_size: number,
491
+ /** The time stamp of file upload. */
492
+ created: number
493
+ }
494
+ // The group api result end.
495
+
496
+
497
+ // The contact api start.
498
+ interface UpdateOwnUserInfoParams {
499
+ /** The nickname. */
500
+ nickname?: string,
501
+ /** The avatar url. */
502
+ avatarurl?: string,
503
+ /** The email. */
504
+ mail?: string,
505
+ /** The phone number. */
506
+ phone?: string,
507
+ /** Gender. */
508
+ gender?: string | number | boolean,
509
+ /** Sign. */
510
+ sign?: string,
511
+ /** Birthday. */
512
+ birth?: string,
513
+ /** Extension. */
514
+ ext?: { [key: string]: string | number | boolean }
515
+ }
516
+
517
+ /** Configurable field. */
518
+ type ConfigurableKey = 'nickname' | 'avatarurl' | 'mail' | 'phone' | 'gender' | 'sign' | 'birth' | 'ext'
519
+
520
+ interface RosterData { name: string, subscription: 'both', jid: Jid }
521
+
522
+
523
+ interface BaseUserInfo {
524
+ /** Whether the current user is enabled. */
525
+ activated: boolean,
526
+ /** The time stamp when the current user was created. */
527
+ created: number,
528
+ /** The time when Finally edit the user information. */
529
+ modified: number,
530
+ /** User nickname for push. */
531
+ nickname: string,
532
+ /** The user type. */
533
+ type: string,
534
+ /** The user ID. */
535
+ username: string,
536
+ /** The user uuid. */
537
+ uuid: string
538
+ }
539
+
540
+ interface PushInfo {
541
+ /** The device token. */
542
+ device_id: string,
543
+ /** The push token, which can be defined by yourself, is generally used to identify the same device. */
544
+ device_token: string,
545
+ /** The Push service appId, senderID for FCM, "appId+#+AppKey" for Vivo */
546
+ notifier_name: string
547
+ }
548
+
549
+ interface UploadTokenResult extends BaseUserInfo {
550
+ /** The push ionfo. */
551
+ pushInfo: PushInfo[]
552
+ }
553
+
554
+ interface SessionInfo {
555
+ /** The session ID. */
556
+ channel_id: string,
557
+ /** The last message content. */
558
+ meta: {
559
+ /** The message sender. */
560
+ from: string,
561
+ /** The message ID. */
562
+ id: string,
563
+ /** The message content. */
564
+ payload: string,
565
+ /** The time of receiving message. */
566
+ timestamp: number,
567
+ /** Message receiver. */
568
+ to: string
569
+ },
570
+ /** The number of unread messages. */
571
+ unread_num: number
572
+ }
573
+ // The contact api result end.
574
+
575
+
576
+ enum Code {
577
+ REQUEST_SUCCESS = 0,
578
+ REQUEST_TIMEOUT = -1,
579
+ REQUEST_UNKNOWN = -2,
580
+ REQUEST_PARAMETER_ERROR = -3,
581
+ WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR = 0,
582
+ WEBIM_CONNCTION_OPEN_ERROR = 1,
583
+ WEBIM_CONNCTION_AUTH_ERROR = 2,
584
+ WEBIM_CONNCTION_OPEN_USERGRID_ERROR = 3,
585
+ WEBIM_CONNCTION_ATTACH_ERROR = 4, // unused
586
+ WEBIM_CONNCTION_ATTACH_USERGRID_ERROR = 5, // unused
587
+ WEBIM_CONNCTION_REOPEN_ERROR = 6, // unused
588
+ WEBIM_CONNCTION_SERVER_CLOSE_ERROR = 7, //7 = client-side network offline (netE= RR_INTERNET_DISCONNECTED) unused
589
+ WEBIM_CONNCTION_SERVER_ERROR = 8, //8 = offline by multi login unused
590
+ WEBIM_CONNCTION_IQ_ERROR = 9,
591
+ WEBIM_CONNCTION_USER_REMOVED = 207,
592
+ WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE = 206,
593
+ WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD = 216,
594
+ WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE = 217,
595
+ WEBIM_CONNCTION_PING_ERROR = 10,
596
+ WEBIM_CONNCTION_NOTIFYVERSION_ERROR = 11,
597
+ WEBIM_CONNCTION_GETROSTER_ERROR = 12,
598
+ WEBIM_CONNCTION_CROSSDOMAIN_ERROR = 13,
599
+ WEBIM_CONNCTION_LISTENING_OUTOF_MAXRETRIES = 14,
600
+ WEBIM_CONNCTION_RECEIVEMSG_CONTENTERROR = 15,
601
+ WEBIM_CONNCTION_DISCONNECTED = 16, //16 = server-side close the websocket connection
602
+ WEBIM_CONNCTION_AJAX_ERROR = 17, // ajax error
603
+ WEBIM_CONNCTION_JOINROOM_ERROR = 18,
604
+ WEBIM_CONNCTION_GETROOM_ERROR = 19,
605
+ WEBIM_CONNCTION_GETROOMINFO_ERROR = 20, // unused
606
+ WEBIM_CONNCTION_GETROOMMEMBER_ERROR = 21, // unused
607
+ WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR = 22, // unused
608
+ WEBIM_CONNCTION_LOAD_CHATROOM_ERROR = 23, // 获取聊天室失败,拉取历史消息失败(后面去掉)
609
+ WEBIM_CONNCTION_NOT_SUPPORT_CHATROOM_ERROR = 24,
610
+ WEBIM_CONNCTION_JOINCHATROOM_ERROR = 25,
611
+ WEBIM_CONNCTION_QUITCHATROOM_ERROR = 26,
612
+ WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR = 27,
613
+ WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR = 28,
614
+ WEBIM_CONNCTION_SESSIONID_NOT_ASSIGN_ERROR = 29,
615
+ WEBIM_CONNCTION_RID_NOT_ASSIGN_ERROR = 30,
616
+ WEBIM_CONNCTION_CALLBACK_INNER_ERROR = 31, //31 = 处理下行消息出错 try/catch抛出异常
617
+ WEBIM_CONNCTION_CLIENT_OFFLINE = 32, //32 = client offline
618
+ WEBIM_CONNCTION_CLIENT_LOGOUT = 33, //33 = client logout
619
+ WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR = 34, // 34 = Over amount of the tabs a user opened in the same browser
620
+ WEBIM_CONNECTION_ACCEPT_INVITATION_FROM_GROUP = 35,
621
+ WEBIM_CONNECTION_DECLINE_INVITATION_FROM_GROUP = 36,
622
+ WEBIM_CONNECTION_ACCEPT_JOIN_GROUP = 37,
623
+ WEBIM_CONNECTION_DECLINE_JOIN_GROUP = 38,
624
+ WEBIM_CONNECTION_CLOSED = 39,
625
+ WEBIM_CONNECTION_ERROR = 40,
626
+ WEBIM_UPLOADFILE_BROWSER_ERROR = 100,
627
+ WEBIM_UPLOADFILE_ERROR = 101,
628
+ WEBIM_UPLOADFILE_NO_LOGIN = 102,
629
+ WEBIM_UPLOADFILE_NO_FILE = 103,
630
+ WEBIM_DOWNLOADFILE_ERROR = 200, // unused
631
+ WEBIM_DOWNLOADFILE_NO_LOGIN = 201, // unused
632
+ WEBIM_DOWNLOADFILE_BROWSER_ERROR = 202, // unused
633
+ USER_NOT_FOUND = 204, // 用户不存在,如创建群拉人时不存在的用户报次错误
634
+ WEBIM_MESSAGE_REC_TEXT = 300,
635
+ WEBIM_MESSAGE_REC_TEXT_ERROR = 301,
636
+ WEBIM_MESSAGE_REC_EMOTION = 302,
637
+ WEBIM_MESSAGE_REC_PHOTO = 303,
638
+ WEBIM_MESSAGE_REC_AUDIO = 304,
639
+ WEBIM_MESSAGE_REC_AUDIO_FILE = 305,
640
+ WEBIM_MESSAGE_REC_VEDIO = 306,
641
+ WEBIM_MESSAGE_REC_VEDIO_FILE = 307,
642
+ WEBIM_MESSAGE_REC_FILE = 308,
643
+ WEBIM_MESSAGE_SED_TEXT = 309,
644
+ WEBIM_MESSAGE_SED_EMOTION = 310,
645
+ WEBIM_MESSAGE_SED_PHOTO = 311,
646
+ WEBIM_MESSAGE_SED_AUDIO = 312,
647
+ WEBIM_MESSAGE_SED_AUDIO_FILE = 313,
648
+ WEBIM_MESSAGE_SED_VEDIO = 314,
649
+ WEBIM_MESSAGE_SED_VEDIO_FILE = 315,
650
+ WEBIM_MESSAGE_SED_FILE = 316,
651
+ WEBIM_MESSAGE_SED_ERROR = 317,
652
+ STATUS_INIT = 400,
653
+ STATUS_DOLOGIN_USERGRID = 401,
654
+ STATUS_DOLOGIN_IM = 402,
655
+ STATUS_OPENED = 403,
656
+ STATUS_CLOSING = 404,
657
+ STATUS_CLOSED = 405,
658
+ STATUS_ERROR = 406,
659
+ SERVER_BUSY = 500,
660
+ GROUP_NOT_EXIST = 605,
661
+ GROUP_NOT_JOINED = 602, // 禁言等操作的人员不在群组中
662
+ MESSAGE_RECALL_TIME_LIMIT = 504,
663
+ SERVICE_NOT_ENABLED = 505,
664
+ SERVICE_NOT_ALLOW_MESSAGING = 506,
665
+ SERVICE_NOT_ALLOW_MESSAGING_MUTE = 507, // @since 4.0 被禁言
666
+ SERVER_UNKNOWN_ERROR = 503, //未知异常
667
+ MESSAGE_INCLUDE_ILLEGAL_CONTENT = 501, //消息内容包含非法或敏感词
668
+ MESSAGE_EXTERNAL_LOGIC_BLOCKED = 502, // 消息被拦截
669
+ PERMISSION_DENIED = 603, //权限问题
670
+ WEBIM_LOAD_MSG_ERROR = 604, //消息发送失败下行
671
+ GROUP_ALREADY_JOINED = 601, //|已在该群组中|调用 加入群组的 API 时如果已经在该群组中则提示该错误|
672
+ // 700 参数校验
673
+ REST_PARAMS_STATUS = 700,
674
+ CHATROOM_MEMBERS_FULL = 704, // 聊天室人数达到上限
675
+ CHATROOM_NOT_EXIST = 705, // The chat room does not exist
676
+ SDK_RUNTIME_ERROR = 999
677
+ }
854
678
 
855
- // Logger
856
- declare type DefaultLevel = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'SILENT';
857
- declare type LevelNum = 0 | 1 | 2 | 3 | 4 | 5;
858
- declare type Level = DefaultLevel | LevelNum;
859
- declare enum Levels {
860
- "TRACE" = 0,
861
- "DEBUG" = 1,
862
- "INFO" = 2,
863
- "WARN" = 3,
864
- "ERROR" = 4,
865
- "SILENT" = 5
866
- }
867
- declare interface Config {
868
- useCache: boolean;
869
- maxCache: number;
870
- color: string;
871
- background: string;
872
- }
873
- declare class Logger {
874
- name: string;
875
- currentLevel: LevelNum;
876
- useCookiePersist: boolean;
877
- storageLogLevelKey: string;
878
- levels: typeof Levels;
879
- logMethods: string[];
880
- methodFactory: any;
881
- logs: string[];
882
- config: Config;
883
- logBytes: number;
884
- [key: string]: any;
885
- constructor(name: string, defaultLevel: Level, factory?: any);
886
- setConfig(cofig: Config): void;
887
679
  /**
888
- * get current log level
680
+ * @category Connection
889
681
  */
890
- getLevel(): LevelNum;
682
+ class Connection {
683
+ isDebug: boolean;
684
+ isHttpDNS: boolean;
685
+ heartBeatWait: number;
686
+ appKey: string;
687
+ appName: string;
688
+ orgName: string;
689
+ token: string;
690
+ autoReconnectNumMax: number;
691
+ autoReconnectNumTotal: number;
692
+ version: string;
693
+ deviceId: string;
694
+ osType: number;
695
+ useOwnUploadFun: boolean;
696
+ apiUrl: string;
697
+ url: string;
698
+ https: boolean;
699
+ grantType: 'password' | 'accessToken' | 'agoraToken' | '';
700
+ context: {
701
+ jid: {
702
+ appKey: string;
703
+ clientResource: string;
704
+ domain: string;
705
+ name: string;
706
+ };
707
+ userId: string;
708
+ appKey: string;
709
+ restTokenData: string;
710
+ status: number;
711
+ appName: string;
712
+ orgName: string;
713
+ root: any;
714
+ accessToken: string;
715
+ };
716
+
717
+ _msgHash: {
718
+ [key: string]: any;
719
+ };
720
+ /**
721
+ * @since 4.0.1
722
+ */
723
+ eventHandler?: EventHandler;
724
+ /**
725
+ * @deprecated 4.0.1
726
+ */
727
+ onOpened?: () => any;
728
+ /**
729
+ * @deprecated 4.0.1
730
+ */
731
+ onPresence?: (msg: PresenceMsg) => void;
732
+ onTextMessage?: (msg: TextMsgBody) => void;
733
+ onPictureMessage?: (msg: ImgMsgBody) => void;
734
+ onAudioMessage?: (msg: AudioMsgBody) => void;
735
+ onVideoMessage?: (msg: VideoMsgBody) => void;
736
+ onFileMessage?: (msg: FileMsgBody) => void;
737
+ onLocationMessage?: (msg: LocationMsgBody) => void;
738
+ onCmdMessage?: (msg: CmdMsgBody) => void;
739
+ onCustomMessage?: (msg: CustomMsgBody) => void;
740
+ onReceivedMessage?: (msg: ReceivedMsgBody) => void;
741
+ onDeliveredMessage?: (msg: DeliveryMsgBody) => void;
742
+ onReadMessage?: (msg: ReadMsgBody) => void;
743
+ onRecallMessage?: (msg: RecallMsgBody) => void;
744
+ onMutedMessage?: (msg: MuteMsgBody) => void;
745
+ onChannelMessage?: (msg: ChannelMsgBody) => void;
746
+ onError?: (error: ErrorEvent) => void;
747
+ onOffline?: () => void;
748
+ onOnline?: () => void;
749
+ onRoster?: (rosters: RosterData[]) => void;
750
+ onStatisticMessage?: (msg: any) => void;
751
+ onCreateGroup?: (data: any) => void;
752
+ onBlacklistUpdate?: (list: {
753
+ [key: string]: {
754
+ name: string;
755
+ };
756
+ }) => void;
757
+ onContactAgreed?: (msg: ContactMsgBody) => void;
758
+ onContactRefuse?: (msg: ContactMsgBody) => void;
759
+ onContactDeleted?: (msg: ContactMsgBody) => void;
760
+ onContactAdded?: (msg: ContactMsgBody) => void;
761
+ onTokenWillExpire?: () => void;
762
+ onTokenExpired?: () => void;
763
+ [key: string]: any;
764
+ constructor(options: ConnectionParameters);
765
+
766
+ registerUser(this: Connection, params: {
767
+ username: string,
768
+ password: string,
769
+ nickname: string,
770
+ success?: (res: any) => any,
771
+ error?: (err: ErrorEvent) => any,
772
+ apiUrl?: string,
773
+ }): void;
774
+
775
+ open(parameters: {
776
+ user: string,
777
+ pwd: string,
778
+ accessToken?: string,
779
+ agoraToken?: string,
780
+ success?: (res: any) => any,
781
+ error?: (res: any) => any
782
+ }): void;
783
+ isOpened(): boolean;
784
+ close(): void;
785
+ getChatToken(agoraToken: string): Promise<any>;
786
+ reconnect(): void;
787
+ /** send message */
788
+ send(params: MessageBody): Promise<SendMsgResult>;
789
+
790
+ // ChatRoom API
791
+ /**
792
+ * Gets chat room list (paging).
793
+ *
794
+ * ```typescript
795
+ * connection.getChatRooms({pagenum: 1, pagesize: 20})
796
+ * ```
797
+ */
798
+ getChatRooms(this: Connection, params: {
799
+ pagenum: number,
800
+ pagesize: number,
801
+ success?: (res: AsyncResult<GetChatRoomsResult>) => any,
802
+ error?: (error: ErrorEvent) => any
803
+ }): Promise<AsyncResult<GetChatRoomsResult>>;
804
+
805
+ /**
806
+ * Creates a chat room.
807
+ *
808
+ * ```typescript
809
+ * connection.createChatRoom({name: 'myChatRoom', description: 'this is my chatroom', maxusers: 200, members; ['user1']})
810
+ * ```
811
+ */
812
+ createChatRoom(this: Connection, params: {
813
+ name: string,
814
+ description: string,
815
+ maxusers: number,
816
+ members: UserId[],
817
+ token: string,
818
+ success?: (res: AsyncResult<CreateDeleteChatRoomResult>) => any,
819
+ error?: (error: ErrorEvent) => any
820
+ }): Promise<AsyncResult<CreateDeleteChatRoomResult>>;
821
+
822
+ /**
823
+ * Deletes the chat room.
824
+ *
825
+ * ```typescript
826
+ * connection.destroyChatRoom({chatRoomId: 'chatRoomId'})
827
+ * ```
828
+ */
829
+ destroyChatRoom(this: Connection, params: {
830
+ chatRoomId: string,
831
+ token: string,
832
+ success?: (res: AsyncResult<CreateDeleteChatRoomResult>) => any,
833
+ error?: (error: ErrorEvent) => any
834
+ }): Promise<AsyncResult<CreateDeleteChatRoomResult>>;
835
+
836
+ /**
837
+ * Gets specifications of the chat room.
838
+ *
839
+ * ```typescript
840
+ * connection.getChatRoomDetails({chatRoomId: 'chatRoomId'})
841
+ * ```
842
+ */
843
+ getChatRoomDetails(this: Connection, params: {
844
+ chatRoomId: string,
845
+ success?: (res: AsyncResult<GetChatRoomDetailsResult>) => any,
846
+ error?: (error: ErrorEvent) => any
847
+ }): Promise<AsyncResult<GetChatRoomDetailsResult>>;
848
+
849
+ /**
850
+ * Modifies the specifications of the chat room.
851
+ *
852
+ * ```typescript
853
+ * connection.modifyChatRoom({chatRoomId: 'chatRoomId', chatRoomName: 'chatRoomName', description: 'description', maxusers: 5000})
854
+ * ```
855
+ */
856
+ modifyChatRoom(this: Connection, params: {
857
+ chatRoomId: string,
858
+ chatRoomName: string,
859
+ description: string,
860
+ maxusers: number,
861
+ success?: (res: AsyncResult<ModifyChatRoomResult>) => any,
862
+ error?: (error: ErrorEvent) => any,
863
+ }): Promise<AsyncResult<ModifyChatRoomResult>>;
864
+
865
+ /**@deprecated*/
866
+ removeSingleChatRoomMember(this: Connection, params: {
867
+ chatRoomId: string,
868
+ username: string,
869
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
870
+ error?: (error: ErrorEvent) => any
871
+ }): Promise<AsyncResult<CommonRequestResult>>;
872
+
873
+ /**
874
+ * Removes a chat room member.
875
+ *
876
+ * ```typescript
877
+ * connection.removeChatRoomMember({chatRoomId: 'chatRoomId', username: 'username'})
878
+ * ```
879
+ * @since v4.0.1
880
+ */
881
+ removeChatRoomMember(this: Connection, params: {
882
+ chatRoomId: string,
883
+ username: string,
884
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
885
+ error?: (error: ErrorEvent) => any
886
+ }): Promise<AsyncResult<CommonRequestResult>>;
887
+
888
+ /**@deprecated*/
889
+ removeMultiChatRoomMember(this: Connection, params: {
890
+ chatRoomId: string,
891
+ users: string[],
892
+ success?: (res: AsyncResult<CommonRequestResult[]>) => any,
893
+ error?: (error: ErrorEvent) => any,
894
+ }): Promise<AsyncResult<CommonRequestResult[]>>;
895
+
896
+ /**
897
+ * Removes multiple chat room members.
898
+ *
899
+ * ```typescript
900
+ * connection.removeChatRoomMembers({chatRoomId: 'chatRoomId', users: ['user1', 'user2']})
901
+ * ```
902
+ * @since v4.0.1
903
+ */
904
+ removeChatRoomMembers(this: Connection, params: {
905
+ chatRoomId: string,
906
+ users: string[],
907
+ success?: (res: AsyncResult<CommonRequestResult[]>) => any,
908
+ error?: (error: ErrorEvent) => any,
909
+ }): Promise<AsyncResult<CommonRequestResult[]>>;
910
+
911
+ /**
912
+ * Adds chat room members.
913
+ *
914
+ * ```typescript
915
+ * connection.addUsersToChatRoom({chatRoomId: "chatRoomId", users:['user1', 'user2']})
916
+ * ```
917
+ */
918
+ addUsersToChatRoom(this: Connection, params: {
919
+ chatRoomId: string,
920
+ users: string[],
921
+ success?: (res: AsyncResult<AddUsersToChatRoomResult>) => any,
922
+ error?: (error: ErrorEvent) => any,
923
+ }): Promise<AsyncResult<AddUsersToChatRoomResult>>;
924
+
925
+ /**
926
+ * Joins the chat room. After joining successfully, others will receive type: 'memberjoinchatroomsuccess' in the onPresence callback.
927
+ *
928
+ * ```typescript
929
+ * connection.joinChatRoom({roomId: 'roomId'})
930
+ * ```
931
+ */
932
+ joinChatRoom(this: Connection, params: {
933
+ roomId: string,
934
+ message?: string,
935
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
936
+ error?: (error: ErrorEvent) => any,
937
+ }): Promise<AsyncResult<CommonRequestResult>>;
938
+
939
+ /**
940
+ * Exits chat room. And others will receive type: 'leaveChatRoom' in the onPresence callback.
941
+ *
942
+ * ```typescript
943
+ * connection.quitChatRoom({roomId: 'roomId'})
944
+ * ```
945
+ */
946
+ quitChatRoom(this: Connection, params: {
947
+ roomId: string,
948
+ success?: (res: AsyncResult<{ result: boolean }>) => any,
949
+ error?: (error: ErrorEvent) => any
950
+ }): Promise<AsyncResult<{ result: boolean }>>;
951
+
952
+ /** @deprecated */
953
+ listChatRoomMember(this: Connection, params: {
954
+ pageNum: number,
955
+ pageSize: number,
956
+ chatRoomId: string,
957
+ success?: (res: AsyncResult<{ member: string }[]>) => any,
958
+ error?: (error: ErrorEvent) => any,
959
+ }): Promise<AsyncResult<{ member: string }[]>>;
960
+
961
+ /**
962
+ * The list of all the chat room members (paginated).
963
+ *
964
+ * ```typescript
965
+ * connection.listChatRoomMembers({pageNum: 1, pageSize: 20, chatRoomId: 'chatRoomId'})
966
+ * ```
967
+ * @since v4.0.1
968
+ */
969
+ listChatRoomMembers(this: Connection, params: {
970
+ pageNum: number,
971
+ pageSize: number,
972
+ chatRoomId: string,
973
+ success?: (res: AsyncResult<{ member: string }[]>) => any,
974
+ error?: (error: ErrorEvent) => any,
975
+ }): Promise<AsyncResult<{ member: string }[]>>;
976
+
977
+ /**
978
+ * Gets all admins in the chat room.
979
+ *
980
+ * ```typescript
981
+ * connection.getChatRoomAdmin({chatRoomId: 'chatRoomId'})
982
+ * ```
983
+ */
984
+ getChatRoomAdmin(this: Connection, params: {
985
+ chatRoomId: string,
986
+ success?: (res: AsyncResult<GetChatRoomAdminResult>) => any,
987
+ error?: (error: ErrorEvent) => any,
988
+ }): Promise<AsyncResult<GetChatRoomAdminResult>>;
989
+
990
+ /**
991
+ * Sets up chat room admins. Only the chatroom owner can call this method. The members who are set as administrators will receive type: 'addadmin' in the onPresence callback.
992
+ *
993
+ * ```typescript
994
+ * connection.setChatRoomAdmin({chatRoomId: 'chatRoomId', username: 'user1'})
995
+ * ```
996
+ */
997
+ setChatRoomAdmin(this: Connection, params: {
998
+ chatRoomId: string,
999
+ username: string,
1000
+ success?: (res: AsyncResult<SetChatRoomAdminResult>) => any,
1001
+ error?: (error: ErrorEvent) => any
1002
+ }): Promise<AsyncResult<SetChatRoomAdminResult>>;
1003
+
1004
+ /**
1005
+ * Removes the chat room admins. Only the chatroom owner can call this method. The users whose administrator is removed will receive type: 'removeadmin' in the callback of onPresence.
1006
+ *
1007
+ * ```typescript
1008
+ * connection.removeChatRoomAdmin({chatRoomId: 'chatRoomId', username: 'user1'})
1009
+ * ```
1010
+ */
1011
+ removeChatRoomAdmin(this: Connection, params: {
1012
+ chatRoomId: string,
1013
+ username: string,
1014
+ success?: (res: AsyncResult<RemoveChatRoomAdminResult>) => any,
1015
+ error?: (error: ErrorEvent) => any
1016
+ }): Promise<AsyncResult<RemoveChatRoomAdminResult>>;
1017
+
1018
+ /**
1019
+ * Mutes chat room member. Only the chatroom owner can call this method. The members who are muted and others will receive type: 'addmute' in the onPresence callback.
1020
+ *
1021
+ * ```typescript
1022
+ * connection.muteChatRoomMember({username: 'user1', muteDuration: -1, chatRoomId: 'chatRoomId'})
1023
+ * ```
1024
+ * @since 1.4.11
1025
+ */
1026
+ muteChatRoomMember(this: Connection, params: {
1027
+ username: string,
1028
+ muteDuration: number,
1029
+ chatRoomId: string,
1030
+ success?: (res: AsyncResult<MuteChatRoomMemberResult>) => any,
1031
+ error?: (error: ErrorEvent) => any
1032
+ }): Promise<AsyncResult<MuteChatRoomMemberResult>>;
1033
+
1034
+ /** @deprecated */
1035
+ removeMuteChatRoomMember(this: Connection, params: {
1036
+ chatRoomId: string,
1037
+ username: string,
1038
+ success?: (res: AsyncResult<UnmuteChatRoomMemberResult[]>) => any,
1039
+ error?: (error: ErrorEvent) => any
1040
+ }): Promise<AsyncResult<UnmuteChatRoomMemberResult[]>>;
1041
+
1042
+ /**
1043
+ * Unmutes the chat room member. Only the chatroom owner can call this method. The members who are muted and others will receive type: 'removeMute' in the onPresence callback.
1044
+ *
1045
+ * ```typescript
1046
+ * connection.unmuteChatRoomMember({chatRoomId: 'chatRoomId', username: 'user1'})
1047
+ * `
1048
+ * @since v4.0.1
1049
+ */
1050
+ unmuteChatRoomMember(this: Connection, params: {
1051
+ chatRoomId: string,
1052
+ username: string,
1053
+ success?: (res: AsyncResult<UnmuteChatRoomMemberResult[]>) => any,
1054
+ error?: (error: ErrorEvent) => any
1055
+ }): Promise<AsyncResult<UnmuteChatRoomMemberResult[]>>;
1056
+
1057
+ /** @deprecated */
1058
+ getChatRoomMuted(this: Connection, params: {
1059
+ chatRoomId: string,
1060
+ success?: (res: AsyncResult<GetChatRoomMuteListResult[]>) => any,
1061
+ error?: (error: ErrorEvent) => any,
1062
+ }): Promise<AsyncResult<GetChatRoomMuteListResult[]>>;
1063
+
1064
+ /**
1065
+ * Gets all members who are muted in the chat room.
1066
+ *
1067
+ * ```typescript
1068
+ * connection.getChatRoomMuteList({chatRoomId: 'chatRoomId'})
1069
+ * ```
1070
+ *
1071
+ * @since v4.0.1
1072
+ */
1073
+ getChatRoomMuteList(this: Connection, params: {
1074
+ chatRoomId: string,
1075
+ success?: (res: AsyncResult<GetChatRoomMuteListResult[]>) => any,
1076
+ error?: (error: ErrorEvent) => any,
1077
+ }): Promise<AsyncResult<GetChatRoomMuteListResult[]>>;
1078
+
1079
+ /** @deprecated */
1080
+ chatRoomBlockSingle(this: Connection, params: {
1081
+ chatRoomId: string,
1082
+ username: string,
1083
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1084
+ error?: (error: ErrorEvent) => any
1085
+ }): Promise<AsyncResult<CommonRequestResult>>;
1086
+
1087
+ /**
1088
+ * Adds a single user to the chat room blocklist. Only the chatroom owner or admin can call this method.
1089
+ *
1090
+ * ```typescript
1091
+ * connection.blockChatRoomMember({chatRoomId: 'chatRoomId', username: 'user1'})
1092
+ * ```
1093
+ *@since v4.0.1
1094
+ */
1095
+ blockChatRoomMember(this: Connection, params: {
1096
+ chatRoomId: string,
1097
+ username: string,
1098
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1099
+ error?: (error: ErrorEvent) => any
1100
+ }): Promise<AsyncResult<CommonRequestResult>>;
1101
+
1102
+ /** @deprecated */
1103
+ chatRoomBlockMulti(this: Connection, params: {
1104
+ chatRoomId: string,
1105
+ usernames: string[],
1106
+ success?: (res: AsyncResult<CommonRequestResult[]>) => any,
1107
+ error?: (error: ErrorEvent) => any
1108
+ }): Promise<AsyncResult<CommonRequestResult[]>>;
1109
+
1110
+ /**
1111
+ * Adds users to the chat room blocklist. Only the chatroom owner or admin can call this method.
1112
+ *
1113
+ * ```typescript
1114
+ * connection.blockChatRoomMembers({usernames: ['user1', 'user2'], chatRoomId: 'chatRoomId'})
1115
+ * ```
1116
+ *
1117
+ * @since v4.0.1
1118
+ */
1119
+ blockChatRoomMembers(this: Connection, params: {
1120
+ chatRoomId: string,
1121
+ usernames: string[],
1122
+ success?: (res: AsyncResult<CommonRequestResult[]>) => any,
1123
+ error?: (error: ErrorEvent) => any
1124
+ }): Promise<AsyncResult<CommonRequestResult[]>>;
1125
+
1126
+ /** @deprecated */
1127
+ removeChatRoomBlockSingle(this: Connection, params: {
1128
+ chatRoomId: string,
1129
+ username: string,
1130
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1131
+ error?: (error: ErrorEvent) => any,
1132
+ }): Promise<AsyncResult<CommonRequestResult>>;
1133
+
1134
+ /**
1135
+ * Removes an individual user from the chat room blocklist. Only the chatroom owner or admin can call this method.
1136
+ *
1137
+ * ```typescript
1138
+ * connection.unblockChatRoomMember({chatRoomId: 'chatRoomId', username: 'user1'})
1139
+ * ```
1140
+ * @since v4.0.1
1141
+ */
1142
+ unblockChatRoomMember(this: Connection, params: {
1143
+ chatRoomId: string,
1144
+ username: string,
1145
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1146
+ error?: (error: ErrorEvent) => any,
1147
+ }): Promise<AsyncResult<CommonRequestResult>>;
1148
+
1149
+ /** @deprecated */
1150
+ removeChatRoomBlockMulti(this: Connection, params: {
1151
+ chatRoomId: string,
1152
+ usernames: string[],
1153
+ success?: (res: AsyncResult<CommonRequestResult[]>) => any,
1154
+ error?: (error: ErrorEvent) => any
1155
+ }): Promise<AsyncResult<CommonRequestResult[]>>;
1156
+
1157
+ /**
1158
+ * Removes members from the chat room blocklist. Only the chatroom owner or admin can call this method.
1159
+ *
1160
+ * ```typescript
1161
+ * connection.unblockChatRoomMembers({chatRoomId: 'chatRoomId', usernames: ['user1', 'user2']})
1162
+ * ```
1163
+ *
1164
+ * @since v4.0.1
1165
+ */
1166
+ unblockChatRoomMembers(this: Connection, params: {
1167
+ chatRoomId: string,
1168
+ usernames: string[],
1169
+ success?: (res: AsyncResult<CommonRequestResult[]>) => any,
1170
+ error?: (error: ErrorEvent) => any
1171
+ }): Promise<AsyncResult<CommonRequestResult[]>>;
1172
+
1173
+ /** @deprecated */
1174
+ getChatRoomBlacklistNew(this: Connection, params: {
1175
+ chatRoomId: string,
1176
+ success?: (res: AsyncResult<UserId[]>) => any,
1177
+ error?: (error: ErrorEvent) => any
1178
+ }): Promise<AsyncResult<UserId[]>>;
1179
+
1180
+ /**
1181
+ * Gets the blocklist of the chat room.
1182
+ *
1183
+ * ```typescript
1184
+ * connection.getChatRoomBlacklist({chatRoomId: 'chatRoomId'})
1185
+ * ```
1186
+ * @since v4.0.1
1187
+ */
1188
+ getChatRoomBlacklist(this: Connection, params: {
1189
+ chatRoomId: string,
1190
+ success?: (res: AsyncResult<UserId[]>) => any,
1191
+ error?: (error: ErrorEvent) => any
1192
+ }): Promise<AsyncResult<UserId[]>>;
1193
+
1194
+ /**
1195
+ * Mutes all the members in the chatroom. Only the chatroom owner or admin can call this method.
1196
+ *
1197
+ * ```typescript
1198
+ * connection.disableSendChatRoomMsg({chatRoomId: 'chatRoomId'})
1199
+ *
1200
+ */
1201
+ disableSendChatRoomMsg(this: Connection, params: {
1202
+ chatRoomId: string,
1203
+ success?: (res: AsyncResult<WhetherAbleSendChatRoomMsgResult>) => any,
1204
+ error?: (errror: ErrorEvent) => any
1205
+ }): Promise<AsyncResult<WhetherAbleSendChatRoomMsgResult>>;
1206
+
1207
+ /**
1208
+ * Unmutes all the members in the chat room. Only the chatroom owner or admin can call this method.
1209
+ *
1210
+ * ```typescript
1211
+ * connection.enableSendChatRoomMsg({chatRoomId: 'chatRoomId'})
1212
+ * ```
1213
+ */
1214
+ enableSendChatRoomMsg(this: Connection, params: {
1215
+ chatRoomId: string,
1216
+ success?: (res: AsyncResult<WhetherAbleSendChatRoomMsgResult>) => any,
1217
+ error?: (errror: ErrorEvent) => any
1218
+ }): Promise<AsyncResult<WhetherAbleSendChatRoomMsgResult>>;
1219
+
1220
+ /**
1221
+ * Adds members to the allowlist of the chat room. Users added to the allow list of the chat room will receive in onPresence callback type: 'addUserToChatRoomWhiteList'.
1222
+ *
1223
+ * ```typescript
1224
+ * connection.addUsersToGroupWhitelist({groupId: 'groupId'})
1225
+ * ```
1226
+ */
1227
+ addUsersToChatRoomWhitelist(this: Connection, params: {
1228
+ chatRoomId: string,
1229
+ users: string[],
1230
+ success?: (res: AsyncResult<CommonRequestResult | CommonRequestResult[]>) => any,
1231
+ error?: (error: ErrorEvent) => any
1232
+ }): Promise<AsyncResult<CommonRequestResult | CommonRequestResult[]>>;
1233
+
1234
+ /** @deprecated */
1235
+ rmUsersFromChatRoomWhitelist(this: Connection, params: {
1236
+ chatRoomId: string,
1237
+ userName: string,
1238
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1239
+ error?: (error: ErrorEvent) => any
1240
+ }): Promise<AsyncResult<CommonRequestResult>>;
1241
+
1242
+ /**
1243
+ * Removes members from the allowlist in the chatroom. Only the chatroom owner or admin can call this method. The users who are removed will receive in onPresence callback type: 'rmUserFromChatRoomWhiteList'.
1244
+ *
1245
+ * ```typescript
1246
+ * connection.removeChatRoomWhitelistMember({chatRoomId: 'chatRoomId', userName: 'user1'})
1247
+ * `
1248
+ * @since v4.0.1
1249
+ */
1250
+ removeChatRoomWhitelistMember(this: Connection, params: {
1251
+ chatRoomId: string,
1252
+ userName: string,
1253
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1254
+ error?: (error: ErrorEvent) => any
1255
+ }): Promise<AsyncResult<CommonRequestResult>>;
1256
+
1257
+ /**
1258
+ * Gets the allowlist of the chat room. Only the chatroom owner or admin can call this method.
1259
+ *
1260
+ * ```typescript
1261
+ * connection.getChatRoomWhitelist({chatRoomId: 'chatRoomId'})
1262
+ * ```
1263
+ */
1264
+ getChatRoomWhitelist(this: Connection, params: {
1265
+ chatRoomId: string,
1266
+ success: (res: AsyncResult<UserId[]>) => any,
1267
+ error: (error: ErrorEvent) => any
1268
+ }): Promise<AsyncResult<UserId[]>>;
1269
+
1270
+ /**
1271
+ * Queries whether chat room members are in the allowlist. Only the chatroom owner or admin can call this method. The chatroom members can query themselves.
1272
+ *
1273
+ * ```typescript
1274
+ * connection.isChatRoomWhiteUser({chatRoomId: 'chatRoomId', userName: 'user1'})
1275
+ * `
1276
+ */
1277
+ isChatRoomWhiteUser(this: Connection, params: {
1278
+ chatRoomId: string,
1279
+ userName: string,
1280
+ success?: (res: AsyncResult<IsChatRoomWhiteUserResult>) => any,
1281
+ error?: (error: ErrorEvent) => any
1282
+ }): Promise<AsyncResult<IsChatRoomWhiteUserResult>>;
1283
+
1284
+ /**
1285
+ * Gets the announcement of the chat room.
1286
+ *
1287
+ * ```typescript
1288
+ * connection.fetchChatRoomAnnouncement({roomId: 'roomId'})
1289
+ * ```
1290
+ */
1291
+ fetchChatRoomAnnouncement(this: Connection, params: {
1292
+ roomId: string,
1293
+ success?: (res: AsyncResult<FetchChatRoomAnnouncementResult>) => any,
1294
+ error?: (error: ErrorEvent) => any
1295
+ }): Promise<AsyncResult<FetchChatRoomAnnouncementResult>>;
1296
+
1297
+ /**
1298
+ * Updates the announcement of the chat room.
1299
+ *
1300
+ * ```typescript
1301
+ * connection.updateChatRoomAnnouncement({roomId: 'roomId', announcement: 'hello'})
1302
+ * `
1303
+ */
1304
+ updateChatRoomAnnouncement(this: Connection, params: {
1305
+ roomId: string,
1306
+ announcement: string,
1307
+ success: (res: AsyncResult<UpdateChatRoomAnnouncementResult>) => any,
1308
+ error: (error: ErrorEvent) => any
1309
+ }): Promise<AsyncResult<UpdateChatRoomAnnouncementResult>>;
1310
+
1311
+ /**
1312
+ * Uploads shared files to the chat room.
1313
+ *
1314
+ * ```typescript
1315
+ * connection.uploadChatRoomSharedFile({roomId: 'roomId', file: 'file object', onFileUploadProgress: onFileUploadProgress, onFileUploadComplete: onFileUploadComplete,onFileUploadError:onFileUploadError,onFileUploadCanceled:onFileUploadCanceled})
1316
+ * ```
1317
+ * @return Void
1318
+ */
1319
+ uploadChatRoomSharedFile(this: Connection, params: {
1320
+ roomId: string,
1321
+ file: Object,
1322
+ onFileUploadProgress?: (data: any) => any,
1323
+ onFileUploadComplete?: (data: any) => any,
1324
+ onFileUploadError?: (data: any) => any,
1325
+ onFileUploadCanceled?: (data: any) => any,
1326
+ }): void;
1327
+
1328
+ /**
1329
+ * Deletes the chat room shared files.
1330
+ *
1331
+ * ```typescript
1332
+ * connection.deleteChatRoomSharedFile({roomId: 'roomId', fileId: 'fileId'})
1333
+ *
1334
+ */
1335
+ deleteChatRoomSharedFile(this: Connection, params: {
1336
+ roomId: string,
1337
+ fileId: string,
1338
+ success?: (res: AsyncResult<DeleteChatRoomSharedFileResult>) => any,
1339
+ error?: (error: ErrorEvent) => any
1340
+ }): Promise<AsyncResult<DeleteChatRoomSharedFileResult>>;
1341
+
1342
+ /**
1343
+ * Gets a list of shared files in the chat room.
1344
+ *
1345
+ * ```typescript
1346
+ * connection.fetchChatRoomSharedFileList({roomId: 'roomId'})
1347
+ * ```
1348
+ */
1349
+ fetchChatRoomSharedFileList(this: Connection, params: {
1350
+ roomId: string,
1351
+ success?: (res: AsyncResult<FetchChatRoomSharedFileListResult[]>) => any,
1352
+ error?: (error: ErrorEvent) => any
1353
+ }): Promise<AsyncResult<FetchChatRoomSharedFileListResult[]>>;
1354
+
1355
+
1356
+ // Group API
1357
+ /** @deprecated */
1358
+ createGroupNew(this: Connection, params: {
1359
+ data: {
1360
+ groupname: string,
1361
+ desc: string,
1362
+ members: UserId[],
1363
+ public: boolean,
1364
+ approval: boolean,
1365
+ allowinvites: boolean,
1366
+ inviteNeedConfirm: boolean
1367
+ },
1368
+ success?: (res: AsyncResult<CreateGroupResult>) => any,
1369
+ error?: (error: ErrorEvent) => any
1370
+ }): Promise<AsyncResult<CreateGroupResult>>;
1371
+
1372
+ /**
1373
+ * Creates group
1374
+ *
1375
+ * ```typescript
1376
+ * connection.createGroup({
1377
+ data: {
1378
+ groupname: 'groupname',
1379
+ desc: 'this is my group',
1380
+ members: ['user1', 'user2'],
1381
+ public: true,
1382
+ approval: false,
1383
+ allowinvites: true,
1384
+ inviteNeedConfirm: false
1385
+ }
1386
+ })
1387
+ * ```
1388
+ * @since v4.0.1
1389
+ */
1390
+ createGroup(this: Connection, params: {
1391
+ data: {
1392
+ groupname: string,
1393
+ desc: string,
1394
+ members: UserId[],
1395
+ public: boolean,
1396
+ approval: boolean,
1397
+ allowinvites: boolean,
1398
+ inviteNeedConfirm: boolean
1399
+ },
1400
+ success?: (res: AsyncResult<CreateGroupResult>) => any,
1401
+ error?: (error: ErrorEvent) => any
1402
+ }): Promise<AsyncResult<CreateGroupResult>>;
1403
+
1404
+ /** @deprecated */
1405
+ blockGroup(this: Connection, params: {
1406
+ groupId: string,
1407
+ success?: (res: AsyncResult<BlockGroupResult>) => any,
1408
+ error?: (error: ErrorEvent) => any
1409
+ }): Promise<AsyncResult<BlockGroupResult>>;
1410
+
1411
+ /**
1412
+ * Block group messages, Only valid for mobile terminal
1413
+ * ```typescript
1414
+ * connection.blockGroupMessages({groupId: 'groupId'})
1415
+ * ```
1416
+ * @since v4.0.1
1417
+ */
1418
+ blockGroupMessages(this: Connection, params: {
1419
+ groupId: string,
1420
+ success?: (res: AsyncResult<BlockGroupResult>) => any,
1421
+ error?: (error: ErrorEvent) => any
1422
+ }): Promise<AsyncResult<BlockGroupResult>>;
1423
+
1424
+ /**
1425
+ * Gets public groups (paginated).
1426
+ *
1427
+ * ```typescript
1428
+ * connection.listGroups({limit: 20, cursor: null})
1429
+ * ```
1430
+ * @since 1.4.11
1431
+ */
1432
+ listGroups(this: Connection, params: {
1433
+ limit: number,
1434
+ cursor?: string,
1435
+ success?: (res: AsyncResult<BaseGroupInfo[]>) => any,
1436
+ error?: (error: ErrorEvent) => any
1437
+ }): Promise<AsyncResult<BaseGroupInfo[]>>;
1438
+
1439
+ /**
1440
+ * Lists all the groups a user has joined.
1441
+ *
1442
+ * ```typescript
1443
+ * connection.getGroup()
1444
+ * ```
1445
+ * @since 1.4.11
1446
+ */
1447
+ getGroup(this: Connection, params?: {
1448
+ success?: (res: AsyncResult<BaseGroupInfo[]>) => any,
1449
+ error?: (error: ErrorEvent) => any
1450
+ }): Promise<AsyncResult<BaseGroupInfo[]>>;
1451
+
1452
+ /** @deprecated */
1453
+ changeOwner(this: Connection, params: {
1454
+ groupId: string,
1455
+ newOwner: UserId,
1456
+ success?: (res: AsyncResult<ChangeGroupOwnerResult>) => any,
1457
+ error?: (error: ErrorEvent) => any
1458
+ }): Promise<AsyncResult<ChangeGroupOwnerResult>>;
1459
+
1460
+ /**
1461
+ * Transfers group. Requires owner permission. Group members will receive type: 'changeowner' in the onpresence callback
1462
+ *
1463
+ * ```typescript
1464
+ * connection.changeGroupOwner({groupId: 'groupId', newOwner: 'user1'})
1465
+ * ```
1466
+ * @since v4.0.1
1467
+ */
1468
+ changeGroupOwner(this: Connection, params: {
1469
+ groupId: string,
1470
+ newOwner: UserId,
1471
+ success?: (res: AsyncResult<ChangeGroupOwnerResult>) => any,
1472
+ error?: (error: ErrorEvent) => any
1473
+ }): Promise<AsyncResult<ChangeGroupOwnerResult>>;
1474
+
1475
+ /**
1476
+ * Gets group details
1477
+ * ```typescript
1478
+ * connection.getGroupInfo({groupId: groupId})
1479
+ * ```
1480
+ * @since 1.4.11
1481
+ */
1482
+ getGroupInfo(this: Connection, params: {
1483
+ groupId: string,
1484
+ success?: (res: AsyncResult<GroupDetailInfo[]>) => any,
1485
+ error?: (error: ErrorEvent) => any
1486
+ }): Promise<AsyncResult<GroupDetailInfo[]>>;
1487
+
1488
+ /**
1489
+ * Modifys group information, Administrator right is required.
1490
+ *
1491
+ * ```typescript
1492
+ * connection.modifyGroup({groupId: 'groupId', groupName: 'groupName', description:'description'})
1493
+ * ```
1494
+ */
1495
+ modifyGroup(this: Connection, params: {
1496
+ groupId: string,
1497
+ groupName: string,
1498
+ description: string
1499
+ success?: (res: AsyncResult<ModifyGroupResult>) => any,
1500
+ error?: (error: ErrorEvent) => any
1501
+ }): Promise<AsyncResult<ModifyGroupResult>>;
1502
+
1503
+ /** @deprecated */
1504
+ listGroupMember(this: Connection, params: {
1505
+ groupId: string,
1506
+ pageNum: number,
1507
+ pageSize: number,
1508
+ success?: (res: AsyncResult<GroupMember[]>) => any,
1509
+ error?: (error: ErrorEvent) => any
1510
+ }): Promise<AsyncResult<GroupMember[]>>;
1511
+
1512
+ /**
1513
+ * Lists all members of the group (paginated).
1514
+ *
1515
+ * ```typescript
1516
+ * connection.listGroupMembers({pageNum: 1, pageSize: 20, groupId: 'groupId'})
1517
+ * ```
1518
+ * @since v4.0.1
1519
+ */
1520
+ listGroupMembers(this: Connection, params: {
1521
+ groupId: string,
1522
+ pageNum: number,
1523
+ pageSize: number,
1524
+ success?: (res: AsyncResult<GroupMember[]>) => any,
1525
+ error?: (error: ErrorEvent) => any
1526
+ }): Promise<AsyncResult<GroupMember[]>>;
1527
+
1528
+ /**
1529
+ * Gets all administrators in the group.
1530
+ * ```typescript
1531
+ * connection.getGroupAdmin({groupId: 'groupId'})
1532
+ * ```
1533
+ * @since 1.4.11
1534
+ */
1535
+ getGroupAdmin(this: Connection, params: {
1536
+ groupId: string,
1537
+ success?: (res: AsyncResult<UserId[]>) => any,
1538
+ error?: (error: ErrorEvent) => any
1539
+ }): Promise<AsyncResult<UserId[]>>;
1540
+
1541
+ /** @deprecated */
1542
+ setAdmin(this: Connection, params: {
1543
+ groupId: string,
1544
+ username: UserId,
1545
+ success?: (res: AsyncResult<SetGroupAdminResult>) => any,
1546
+ error?: (error: ErrorEvent) => any
1547
+ }): Promise<AsyncResult<SetGroupAdminResult>>;
1548
+
1549
+ /**
1550
+ * Sets up group administrator, need group owner authority. Users who are set as administrators will receive type: 'addadmin' in the onPresence callback.
1551
+ *
1552
+ * ```typescript
1553
+ * connection.setGroupAdmin({groupId: 'groupId', username: 'user1'})
1554
+ * ```
1555
+ * @since v4.0.1
1556
+ */
1557
+ setGroupAdmin(this: Connection, params: {
1558
+ groupId: string,
1559
+ username: UserId,
1560
+ success?: (res: AsyncResult<SetGroupAdminResult>) => any,
1561
+ error?: (error: ErrorEvent) => any
1562
+ }): Promise<AsyncResult<SetGroupAdminResult>>;
1563
+
1564
+ /**
1565
+ * Removes the group administrator, need the permission of the group master. The user whose administrator is canceled will receive type: 'removeadmin' in the callback of onPresence.
1566
+ *
1567
+ * ```typescript
1568
+ * connection.removeAdmin({gorupId: 'gorupId', username: 'user1'})
1569
+ * ```
1570
+ */
1571
+ removeAdmin(this: Connection, params: {
1572
+ groupId: string,
1573
+ username: string,
1574
+ success?: (res: AsyncResult<RemoveGroupAdminResult>) => any,
1575
+ error?: (error: ErrorEvent) => any
1576
+ }): Promise<AsyncResult<RemoveGroupAdminResult>>;
1577
+
1578
+ /** @deprecated */
1579
+ dissolveGroup(this: Connection, params: {
1580
+ groupId: string,
1581
+ success?: (res: AsyncResult<DestroyGroupResult>) => any,
1582
+ error?: (error: ErrorEvent) => any
1583
+ }): Promise<AsyncResult<DestroyGroupResult>>;
1584
+
1585
+ /**
1586
+ * Destroys a group, need the permission of the group owner. Group members will receive type: 'deletegroupchat' in the callback of onPrenscence.
1587
+ *
1588
+ * ```typescript
1589
+ * connection.destroyGroup({groupId: 'groupId'})
1590
+ * ```
1591
+ * @since v4.0.1
1592
+ */
1593
+ destroyGroup(this: Connection, params: {
1594
+ groupId: string,
1595
+ success?: (res: AsyncResult<DestroyGroupResult>) => any,
1596
+ error?: (error: ErrorEvent) => any
1597
+ }): Promise<AsyncResult<DestroyGroupResult>>;
1598
+
1599
+ /**
1600
+ * Leaves the group, group members will receive type: 'leavegroup' in the callback of onPresence.
1601
+ *
1602
+ * ```typescript
1603
+ * connection.quitGroup({groupId: 'groupId'})
1604
+ * ```
1605
+ */
1606
+ quitGroup(this: Connection, params: {
1607
+ groupId: string,
1608
+ success?: (res: AsyncResult<{ result: true }>) => any,
1609
+ error?: (error: ErrorEvent) => any
1610
+ }): Promise<AsyncResult<{ result: true }>>;
1611
+
1612
+ /** @deprecated */
1613
+ inviteToGroup(this: Connection, params: {
1614
+ groupId: string,
1615
+ users: UserId[],
1616
+ success?: (res: AsyncResult<InviteUsersToGroupResult[]>) => any,
1617
+ error?: (error: ErrorEvent) => any
1618
+ }): Promise<AsyncResult<InviteUsersToGroupResult[]>>;
1619
+
1620
+ /**
1621
+ * Invites users into group. The invited user will receive type: 'invite' in the callback of onPresence.
1622
+ *
1623
+ * ```typescript
1624
+ * connection.inviteUsersToGroup({groupId: 'groupId', users: ['user1', 'user2']})
1625
+ * ```
1626
+ * @since v4.0.1
1627
+ */
1628
+ inviteUsersToGroup(this: Connection, params: {
1629
+ groupId: string,
1630
+ users: UserId[],
1631
+ success?: (res: AsyncResult<InviteUsersToGroupResult[]>) => any,
1632
+ error?: (error: ErrorEvent) => any
1633
+ }): Promise<AsyncResult<InviteUsersToGroupResult[]>>;
1634
+
1635
+ /**
1636
+ * Applys to join the group. The group owner and administrator will receive type: 'joingroupnotifications' in the onPresence callback
1637
+ *
1638
+ * ```typescript
1639
+ * connection.joinGroup({groupId: 'groupId', message: 'I want to join the group'})
1640
+ * ```
1641
+ * @since 1.4.11
1642
+ */
1643
+ joinGroup(this: Connection, params: {
1644
+ groupId: string,
1645
+ message: string,
1646
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1647
+ error?: (error: ErrorEvent) => any
1648
+ }): Promise<AsyncResult<CommonRequestResult>>;
1649
+
1650
+ /** @deprecated */
1651
+ agreeJoinGroup(this: Connection, params: {
1652
+ applicant: UserId,
1653
+ groupId: string,
1654
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1655
+ error?: (error: ErrorEvent) => any
1656
+ }): Promise<AsyncResult<CommonRequestResult>>;
1657
+
1658
+ /**
1659
+ * Allows user to join the group. Group owner or administrator permissions are required. Users who join the group will receive type: 'joinpublicgroupsuccess' in the callback of onPresence.
1660
+ *
1661
+ * ```typescript
1662
+ * connection.acceptGroupJoinRequest({applicant: 'user1', groupId: 'groupId'})
1663
+ * ```
1664
+ * @since v4.0.1
1665
+ */
1666
+ acceptGroupJoinRequest(this: Connection, params: {
1667
+ applicant: UserId,
1668
+ groupId: string,
1669
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1670
+ error?: (error: ErrorEvent) => any
1671
+ }): Promise<AsyncResult<CommonRequestResult>>;
1672
+
1673
+ /** @deprecated */
1674
+ rejectJoinGroup(this: Connection, params: {
1675
+ applicant: UserId,
1676
+ groupId: string,
1677
+ reason: string,
1678
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1679
+ error?: (error: ErrorEvent) => any
1680
+ }): Promise<AsyncResult<CommonRequestResult>>;
1681
+
1682
+ /**
1683
+ * Refuses user to join the group. Group owner or administrator permissions are required.
1684
+ *
1685
+ * ```typescript
1686
+ * connection.rejectGroupJoinRequest({applicant: 'user1', groupId: 'groupId', reason: 'I do not like you'})
1687
+ * ```
1688
+ * @since v4.0.1
1689
+ */
1690
+ rejectGroupJoinRequest(this: Connection, params: {
1691
+ applicant: UserId,
1692
+ groupId: string,
1693
+ reason: string,
1694
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1695
+ error?: (error: ErrorEvent) => any
1696
+ }): Promise<AsyncResult<CommonRequestResult>>;
1697
+
1698
+ /** @deprecated */
1699
+ agreeInviteIntoGroup(this: Connection, params: {
1700
+ invitee: UserId,
1701
+ groupId: string,
1702
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1703
+ error?: (error: ErrorEvent) => any
1704
+ }): Promise<AsyncResult<CommonRequestResult>>;
1705
+
1706
+ /**
1707
+ * Accepts the group invitation. If others invite you to join the group, you can call this API and agree. The inviter will receive type: 'invite_accept' in the callback of onPresence, After joining successfully, group members will receive type: 'memberjoinpublicgroupsuccess' in the callback of onPresence.
1708
+ *
1709
+ * ```typescript
1710
+ * connection.acceptGroupInvite({invitee: 'myUserId', groupId: 'groupId'})
1711
+ * ```
1712
+ * @since v4.0.1
1713
+ */
1714
+ acceptGroupInvite(this: Connection, params: {
1715
+ invitee: UserId,
1716
+ groupId: string,
1717
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1718
+ error?: (error: ErrorEvent) => any
1719
+ }): Promise<AsyncResult<CommonRequestResult>>;
1720
+
1721
+ /** @deprecated */
1722
+ rejectInviteIntoGroup(this: Connection, params: {
1723
+ invitee: UserId,
1724
+ groupId: string,
1725
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1726
+ error?: (error: ErrorEvent) => any
1727
+ }): Promise<any>;
1728
+
1729
+ /**
1730
+ * Rejects group invitation. Other user invite you to join the group, you can call this API to refuse.
1731
+ *
1732
+ * ```typescript
1733
+ * connection.rejectGroupInvite({invitee: 'myUserId', groupId: 'groupId'})
1734
+ * ```
1735
+ * @since v4.0.1
1736
+ */
1737
+ rejectGroupInvite(this: Connection, params: {
1738
+ invitee: UserId,
1739
+ groupId: string,
1740
+ success?: (res: AsyncResult<CommonRequestResult>) => any,
1741
+ error?: (error: ErrorEvent) => any
1742
+ }): Promise<any>;
1743
+
1744
+ /** @deprecated */
1745
+ removeSingleGroupMember(this: Connection, params: {
1746
+ groupId: string,
1747
+ username: UserId,
1748
+ success?: (res: AsyncResult<RemoveGroupMemberResult>) => any,
1749
+ error?: (error: ErrorEvent) => any
1750
+ }): Promise<AsyncResult<RemoveGroupMemberResult>>;
1751
+
1752
+ /**
1753
+ * Removes a group member. Group owner or administrator permission is required. The removed user will receive type: 'removedfromgroup' in the callback of onPresence, and other group members will receive type: 'leavegroup' in the callback of onPresence.
1754
+ *
1755
+ * ```typescript
1756
+ * connection.removeGroupMember({groupId: 'groupId', username: 'user1'})
1757
+ * ```
1758
+ * @since v4.0.1
1759
+ */
1760
+ removeGroupMember(this: Connection, params: {
1761
+ groupId: string,
1762
+ username: UserId,
1763
+ success?: (res: AsyncResult<RemoveGroupMemberResult>) => any,
1764
+ error?: (error: ErrorEvent) => any
1765
+ }): Promise<AsyncResult<RemoveGroupMemberResult>>;
1766
+
1767
+ /** @deprecated */
1768
+ removeMultiGroupMember(this: Connection, params: {
1769
+ groupId: string,
1770
+ users: UserId[],
1771
+ success?: (res: AsyncResult<RemoveGroupMemberResult[]>) => any,
1772
+ error?: (error: ErrorEvent) => any
1773
+ }): Promise<AsyncResult<RemoveGroupMemberResult[]>>;
1774
+
1775
+ /**
1776
+ * Removes group members. Group owner or administrator permission is required. The removed users will receive type: 'removedfromgroup' in the callback of onPresence, and other group members will receive type: 'leavegroup' in the callback of onPresence.
1777
+ *
1778
+ * ```typescript
1779
+ * connection.removeGroupMembers({groupId: 'groupId', users: ['user1', 'user2']})
1780
+ * ```
1781
+ * @since v4.0.1
1782
+ */
1783
+ removeGroupMembers(this: Connection, params: {
1784
+ groupId: string,
1785
+ users: UserId[],
1786
+ success?: (res: AsyncResult<RemoveGroupMemberResult[]>) => any,
1787
+ error?: (error: ErrorEvent) => any
1788
+ }): Promise<AsyncResult<RemoveGroupMemberResult[]>>;
1789
+
1790
+ /** @deprecated */
1791
+ mute(this: Connection, params: {
1792
+ username: UserId,
1793
+ muteDuration: number,
1794
+ groupId: string,
1795
+ success?: (res: AsyncResult<MuteGroupMemberResult[]>) => any,
1796
+ error?: (error: ErrorEvent) => any
1797
+ }): Promise<AsyncResult<MuteGroupMemberResult[]>>;
1798
+
1799
+ /**
1800
+ * Mutes a group member. Group owner or administrator permission is required. Forbidden user and other users will receive type: 'addmute' in the onPresence callback.
1801
+ *
1802
+ * ```typescript
1803
+ * connection.muteGroupMember({username: 'user1', muteDuration: -1, groupId: 'groupId'})
1804
+ * ```
1805
+ * @since v4.0.1
1806
+ */
1807
+ muteGroupMember(this: Connection, params: {
1808
+ username: UserId,
1809
+ muteDuration: number,
1810
+ groupId: string,
1811
+ success?: (res: AsyncResult<MuteGroupMemberResult[]>) => any,
1812
+ error?: (error: ErrorEvent) => any
1813
+ }): Promise<AsyncResult<MuteGroupMemberResult[]>>;
1814
+
1815
+ /** @deprecated */
1816
+ removeMute(this: Connection, params: {
1817
+ groupId: string,
1818
+ username: UserId,
1819
+ success?: (res: AsyncResult<UnmuteGroupMemberResult[]>) => any,
1820
+ error?: (error: ErrorEvent) => any
1821
+ }): Promise<AsyncResult<UnmuteGroupMemberResult[]>>
1822
+
1823
+ /**
1824
+ * Unmutes group member. Group owner or administrator permissions are required. Users who have been released and other users will receive type: 'removemute' in the callback of onPresence.
1825
+ *
1826
+ * ```typescript
1827
+ * connection.unmuteGroupMember({groupId: 'groupId', username: 'user1'})
1828
+ * ```
1829
+ * @since v4.0.1
1830
+ */
1831
+ unmuteGroupMember(this: Connection, params: {
1832
+ groupId: string,
1833
+ username: UserId,
1834
+ success?: (res: AsyncResult<UnmuteGroupMemberResult[]>) => any,
1835
+ error?: (error: ErrorEvent) => any
1836
+ }): Promise<AsyncResult<UnmuteGroupMemberResult[]>>
1837
+
1838
+ /** @deprecated */
1839
+ getMuted(this: Connection, params: {
1840
+ groupId: string,
1841
+ success?: (res: AsyncResult<GetGroupMuteListResult[]>) => any,
1842
+ error?: (error: ErrorEvent) => any
1843
+ }): Promise<AsyncResult<GetGroupMuteListResult[]>>;
1844
+
1845
+ /**
1846
+ * Gets the group mute list.
1847
+ *
1848
+ * ```typescript
1849
+ * connection.getGroupMuteList({groupId: 'groupId'})
1850
+ * ```
1851
+ * @since v4.0.1
1852
+ */
1853
+ getGroupMuteList(this: Connection, params: {
1854
+ groupId: string,
1855
+ success?: (res: AsyncResult<GetGroupMuteListResult[]>) => any,
1856
+ error?: (error: ErrorEvent) => any
1857
+ }): Promise<AsyncResult<GetGroupMuteListResult[]>>;
1858
+
1859
+ /** @deprecated */
1860
+ groupBlockSingle(this: Connection, params: {
1861
+ groupId: string,
1862
+ username: UserId,
1863
+ success?: (res: AsyncResult<GroupRequestResult>) => any,
1864
+ error?: (error: ErrorEvent) => any
1865
+ }): Promise<AsyncResult<GroupRequestResult>>;
1866
+
1867
+ /**
1868
+ * Adds a member to the group blacklist. Group owner or administrator permission is required, The user added to the blacklist will receive type: 'removedFromGroup' in the onPresence callback.
1869
+ *
1870
+ * ```typescript
1871
+ * connection.blockGroupMember({groupId: 'groupId', username: 'user1'})
1872
+ * ```
1873
+ * @since v4.0.1
1874
+ */
1875
+ blockGroupMember(this: Connection, params: {
1876
+ groupId: string,
1877
+ username: UserId,
1878
+ success?: (res: AsyncResult<GroupRequestResult>) => any,
1879
+ error?: (error: ErrorEvent) => any
1880
+ }): Promise<AsyncResult<GroupRequestResult>>;
1881
+
1882
+ /** @deprecated */
1883
+ groupBlockMulti(this: Connection, params: {
1884
+ groupId: string,
1885
+ usernames: UserId[],
1886
+ success?: (res: AsyncResult<GroupRequestResult[]>) => any,
1887
+ error?: (error: ErrorEvent) => any
1888
+ }): Promise<AsyncResult<GroupRequestResult[]>>;
1889
+
1890
+ /**
1891
+ * Adds group members to the group blacklist. Administrator rights required,Users added to the blacklist will receive type: 'removedFromGroup' in the onPresence callback.
1892
+ *
1893
+ * ```typescript
1894
+ * connection.blockGroupMembers({usernames: ['user1', 'user2'], groupId: 'groupId'})
1895
+ * ```
1896
+ * @since v4.0.1
1897
+ */
1898
+ blockGroupMembers(this: Connection, params: {
1899
+ groupId: string,
1900
+ usernames: UserId[],
1901
+ success?: (res: AsyncResult<GroupRequestResult[]>) => any,
1902
+ error?: (error: ErrorEvent) => any
1903
+ }): Promise<AsyncResult<GroupRequestResult[]>>;
1904
+
1905
+ /** @deprecated */
1906
+ removeGroupBlockSingle(this: Connection, params: {
1907
+ groupId: string,
1908
+ username: string,
1909
+ success?: (res: AsyncResult<GroupRequestResult>) => any,
1910
+ error?: (error: ErrorEvent) => any
1911
+ }): Promise<AsyncResult<GroupRequestResult>>;
1912
+
1913
+ /**
1914
+ * Unblock a group member. Administrator rights required, Users who have been removed from the blacklist will receive type: 'allow' in the onPresence callback.
1915
+ *
1916
+ * ```typescript
1917
+ * connection.unblockGroupMember({groupId: 'groupId'})
1918
+ * ```
1919
+ * @since v4.0.1
1920
+ */
1921
+ unblockGroupMember(this: Connection, params: {
1922
+ groupId: string,
1923
+ username: string,
1924
+ success?: (res: AsyncResult<GroupRequestResult>) => any,
1925
+ error?: (error: ErrorEvent) => any
1926
+ }): Promise<AsyncResult<GroupRequestResult>>;
1927
+
1928
+ /** @deprecated */
1929
+ removeGroupBlockMulti(this: Connection, params: {
1930
+ groupId: string,
1931
+ usernames: UserId[],
1932
+ success?: (res: AsyncResult<GroupRequestResult[]>) => any,
1933
+ error?: (error: ErrorEvent) => any
1934
+ }): Promise<AsyncResult<GroupRequestResult[]>>;
1935
+
1936
+ /**
1937
+ * Unblock the group members. Group owner or administrator permissions are required, Users who have been removed from the blacklist will receive type: 'allow' in the onPresence callback.
1938
+ *
1939
+ * ```typescript
1940
+ * connection.unblockGroupMembers({groupId: 'groupId', usernames: ['user1', 'user2']})
1941
+ * ```
1942
+ * @since v4.0.1
1943
+ */
1944
+ unblockGroupMembers(this: Connection, params: {
1945
+ groupId: string,
1946
+ usernames: UserId[],
1947
+ success?: (res: AsyncResult<GroupRequestResult[]>) => any,
1948
+ error?: (error: ErrorEvent) => any
1949
+ }): Promise<AsyncResult<GroupRequestResult[]>>;
1950
+
1951
+ /** @deprecated */
1952
+ getGroupBlacklistNew(this: Connection, params: {
1953
+ groupId: string,
1954
+ success?: (res: AsyncResult<UserId[]>) => any,
1955
+ error?: (error: ErrorEvent) => any
1956
+ }): Promise<AsyncResult<UserId[]>>;
1957
+
1958
+ /**
1959
+ * Gets group blacklist.
1960
+ *
1961
+ * ```typescript
1962
+ * connection.getGroupBlacklist({groupId: 'groupId'})
1963
+ * ```
1964
+ * @since v4.0.1
1965
+ */
1966
+ getGroupBlacklist(this: Connection, params: {
1967
+ groupId: string,
1968
+ success?: (res: AsyncResult<UserId[]>) => any,
1969
+ error?: (error: ErrorEvent) => any
1970
+ }): Promise<AsyncResult<UserId[]>>;
1971
+
1972
+ /**
1973
+ * Mutes all members. All group members are prohibited from speaking. Operation permissions: group admin or above identity, Group members will receive type: 'muteGroup' in the onPresence callback.
1974
+ *
1975
+ * ```typescript
1976
+ * connection.disableSendGroupMsg({groupId: 'groupId'})
1977
+ * ```
1978
+ */
1979
+ disableSendGroupMsg(this: Connection, params: {
1980
+ groupId: string,
1981
+ success?: (res: AsyncResult<{ mute: true }>) => any,
1982
+ error?: (error: ErrorEvent) => any
1983
+ }): Promise<AsyncResult<{ mute: true }>>;
1984
+
1985
+ /**
1986
+ * Unmutes all members. Operation permissions: group admin or above identity, Group members will receive type: 'rmgroupmute' in the callback of onpresence.
1987
+ *
1988
+ * ```typescript
1989
+ * connection.enableSendGroupMsg({groupId: 'groupId'})
1990
+ * ```
1991
+ */
1992
+ enableSendGroupMsg(this: Connection, params: {
1993
+ groupId: string,
1994
+ success?: (res: AsyncResult<{ mute: false }>) => any,
1995
+ error?: (error: ErrorEvent) => any
1996
+ }): Promise<AsyncResult<{ mute: false }>>;
1997
+
1998
+ /**
1999
+ * Adds members to the group whitelist. Members of the white list can continue to speak after the group bans. Operation authority: Group admin or above, Users added to the whitelist will receive type: 'addusertogroupwhitelist' in the callback of onPresence.
2000
+ *
2001
+ * ```typescript
2002
+ * connection.addUsersToGroupWhitelist({groupId: 'groupId'})
2003
+ * ```
2004
+ */
2005
+ addUsersToGroupWhitelist(this: Connection, params: {
2006
+ groupId: string,
2007
+ users: UserId[],
2008
+ success?: (res: AsyncResult<GroupRequestResult[]>) => any,
2009
+ error?: (error: ErrorEvent) => any
2010
+ }): Promise<AsyncResult<GroupRequestResult[]>>;
2011
+
2012
+ /** @deprecated */
2013
+ rmUsersFromGroupWhitelist(this: Connection, params: {
2014
+ groupId: string,
2015
+ userName: UserId,
2016
+ success?: (res: AsyncResult<GroupRequestResult>) => any,
2017
+ error?: (error: ErrorEvent) => any
2018
+ }): Promise<AsyncResult<GroupRequestResult>>;
2019
+
2020
+ /**
2021
+ * Remove the group whitelist member. Operation permissions: group admin or above identity, The user whose whitelist is removed will receive type:'rmUserFromGroupWhiteList' in the onPresence callback.
2022
+ *
2023
+ * ```typescript
2024
+ * connection.removeGroupWhitelistMember({groupId: 'groupId', userName: 'user1'})
2025
+ * ```
2026
+ *
2027
+ * @since v4.0.1
2028
+ */
2029
+ removeGroupWhitelistMember(this: Connection, params: {
2030
+ groupId: string,
2031
+ userName: UserId,
2032
+ success?: (res: AsyncResult<GroupRequestResult>) => any,
2033
+ error?: (error: ErrorEvent) => any
2034
+ }): Promise<AsyncResult<GroupRequestResult>>;
2035
+
2036
+ /**
2037
+ * Gets group white list. Operation authority: admin or above.
2038
+ *
2039
+ * ```typescript
2040
+ * connection.getGroupWhitelist({groupId: 'groupId'})
2041
+ * ```
2042
+ */
2043
+ getGroupWhitelist(this: Connection, params: {
2044
+ groupId: string,
2045
+ success?: (res: AsyncResult<UserId[]>) => any,
2046
+ error?: (error: ErrorEvent) => any
2047
+ }): Promise<AsyncResult<UserId[]>>;
2048
+
2049
+ /** @deprecated */
2050
+ isGroupWhiteUser(this: Connection, params: {
2051
+ groupId: string,
2052
+ userName: UserId,
2053
+ success?: (res: AsyncResult<IsInGroupWhiteListResult>) => any,
2054
+ error?: (error: ErrorEvent) => any
2055
+ }): Promise<AsyncResult<IsInGroupWhiteListResult>>;
2056
+
2057
+ /**
2058
+ * Queries whether the group member is in white list. Operation permission: app admin can query all users; App users can query themselves.
2059
+ *
2060
+ * ```typescript
2061
+ * connection.isInGroupWhiteList({groupId: 'groupId', userName: 'user1'})
2062
+ * ```
2063
+ * @since v4.0.1
2064
+ */
2065
+ isInGroupWhiteList(this: Connection, params: {
2066
+ groupId: string,
2067
+ userName: UserId,
2068
+ success?: (res: AsyncResult<IsInGroupWhiteListResult>) => any,
2069
+ error?: (error: ErrorEvent) => any
2070
+ }): Promise<AsyncResult<IsInGroupWhiteListResult>>;
2071
+
2072
+ /**
2073
+ * Queries which users have read group message [Value-added function] needs to be opened separately.
2074
+ *
2075
+ * ```typescript
2076
+ * connection.getGroupMsgReadUser({groupId: 'groupId', msgId: 'msgId'})
2077
+ * ```
2078
+ */
2079
+ getGroupMsgReadUser(this: Connection, params: {
2080
+ groupId: string,
2081
+ msgId: string,
2082
+ success?: (res: AsyncResult<GetGroupMsgReadUserResult>) => any,
2083
+ error?: (error: ErrorEvent) => any
2084
+ }): Promise<AsyncResult<GetGroupMsgReadUserResult>>;
2085
+
2086
+ /**
2087
+ * Gets group announcement
2088
+ *
2089
+ * ```typescript
2090
+ * connection.fetchGroupAnnouncement({groupId: 'groupId'})
2091
+ * ```
2092
+ */
2093
+ fetchGroupAnnouncement(this: Connection, params: {
2094
+ groupId: string,
2095
+ success?: (res: AsyncResult<{ announcement: string }>) => any,
2096
+ error?: (error: ErrorEvent) => any
2097
+ }): Promise<AsyncResult<{ announcement: string }>>;
2098
+
2099
+ /**
2100
+ * Updates group announcement.
2101
+ *
2102
+ * ```typescript
2103
+ * connection.updateGroupAnnouncement({groupId: 'groupId', announcement: 'hello'})
2104
+ * ```
2105
+ */
2106
+ updateGroupAnnouncement(this: Connection, params: {
2107
+ groupId: string,
2108
+ announcement: string,
2109
+ success?: (res: AsyncResult<UpdateGroupAnnouncementResult>) => any,
2110
+ error?: (error: ErrorEvent) => any
2111
+ }): Promise<AsyncResult<UpdateGroupAnnouncementResult>>;
2112
+
2113
+ /**
2114
+ * Uploads group shared file.
2115
+ *
2116
+ * ```typescript
2117
+ * connection.uploadGroupSharedFile({groupId: 'groupId', file: 'file object', onFileUploadProgress: onFileUploadProgress, onFileUploadComplete: onFileUploadComplete,onFileUploadError:onFileUploadError,onFileUploadCanceled:onFileUploadCanceled})
2118
+ * ```
2119
+ */
2120
+ uploadGroupSharedFile(this: Connection, params: {
2121
+ groupId: string,
2122
+ file: Object,
2123
+ onFileUploadProgress?: (data: ProgressEvent) => any,
2124
+ onFileUploadComplete?: (data: any) => any,
2125
+ onFileUploadError?: (data: any) => any,
2126
+ onFileUploadCanceled?: (data: any) => any,
2127
+ }): void;
2128
+
2129
+ /**
2130
+ * Deletes group shared file
2131
+ *
2132
+ * ```typescript
2133
+ * connection.deleteGroupSharedFile({groupId: 'groupId', fileId: 'fileId'})
2134
+ * ```
2135
+ */
2136
+ deleteGroupSharedFile(this: Connection, params: {
2137
+ groupId: string,
2138
+ fileId: string,
2139
+ success?: (res: AsyncResult<DeleteGroupSharedFileResult>) => any,
2140
+ error?: (error: ErrorEvent) => any
2141
+ }): Promise<AsyncResult<DeleteGroupSharedFileResult>>;
2142
+
2143
+ /**
2144
+ * Gets a list of group shared files.
2145
+ *
2146
+ * ```typescript
2147
+ * connection.fetchGroupSharedFileList({groupId: 'groupId'})
2148
+ * ```
2149
+ */
2150
+ fetchGroupSharedFileList(this: Connection, params: {
2151
+ groupId: string,
2152
+ success?: (res: AsyncResult<FetchGroupSharedFileListResult>) => any,
2153
+ error?: (error: ErrorEvent) => any
2154
+ }): Promise<AsyncResult<FetchGroupSharedFileListResult>>;
2155
+
2156
+ // Contact API
2157
+ /**
2158
+ * Gets friends blacklist.
2159
+ *
2160
+ * ```typescript
2161
+ * connection.getBlacklist()
2162
+ * ```
2163
+ */
2164
+ getBlacklist(this: Connection, params?: {
2165
+ success?: (res: AsyncResult<UserId[]>) => any,
2166
+ error?: (error: ErrorEvent) => any
2167
+ }): Promise<AsyncResult<UserId[]>>;
2168
+
2169
+ /** @deprecated */
2170
+ getRoster(this: Connection, params?: {
2171
+ success?: (res: RosterData[]) => any,
2172
+ error?: (error: ErrorEvent) => any
2173
+ }): Promise<AsyncResult<UserId[]>>;
2174
+
2175
+ /**
2176
+ * Gets contacts.
2177
+ *
2178
+ * ```typescript
2179
+ * connection.getContacts()
2180
+ * ```
2181
+ * @since v4.0.1
2182
+ */
2183
+ getContacts(this: Connection, params?: {
2184
+ success?: (res: RosterData[]) => any,
2185
+ error?: (error: ErrorEvent) => any
2186
+ }): Promise<AsyncResult<UserId[]>>;
2187
+
2188
+ /** @deprecated */
2189
+ uploadToken(this: Connection, params: {
2190
+ deviceId: string,
2191
+ deviceToken: string,
2192
+ notifierName: string
2193
+ success?: (res: AsyncResult<UploadTokenResult>) => any,
2194
+ error?: (error: ErrorEvent) => any
2195
+ }): Promise<AsyncResult<UploadTokenResult>>;
2196
+
2197
+ /**
2198
+ * If you use the SDK on a native client and integrate third-party push functionality, you can call this method to upload the Token to the server.
2199
+ *
2200
+ * ```typescript
2201
+ * connection.uploadPushToken({deviceId: 'deviceId', deviceToken: 'deviceToken', notifierName: 'notifierName'})
2202
+ * ```
2203
+ * @since v4.0.1
2204
+ */
2205
+ uploadPushToken(this: Connection, params: {
2206
+ deviceId: string,
2207
+ deviceToken: string,
2208
+ notifierName: string
2209
+ success?: (res: AsyncResult<UploadTokenResult>) => any,
2210
+ error?: (error: ErrorEvent) => any
2211
+ }): Promise<AsyncResult<UploadTokenResult>>;
2212
+
2213
+ /**
2214
+ * Gets the session list.
2215
+ *
2216
+ * ```typescript
2217
+ * connection.getSessionList()
2218
+ * ```
2219
+ */
2220
+ getSessionList(this: Connection, params?: {
2221
+ success?: (res: AsyncResult<SessionInfo[]>) => any,
2222
+ error?: (error: ErrorEvent) => any
2223
+ }): Promise<AsyncResult<SessionInfo[]>>;
2224
+
2225
+ /**
2226
+ * Updates own information.
2227
+ *
2228
+ * ```typescript
2229
+ * connection.updateOwnUserInfo({nickname: 'Tom', avatarurl: 'avatarurl', mail: 'abc@gmail,com', ext: JSON.stringify({hobby: 'football'})})
2230
+ *
2231
+ * connection.updateOwnUserInfo('nickname', 'Tom')
2232
+ * ```
2233
+ */
2234
+ updateOwnUserInfo(this: Connection, params: UpdateOwnUserInfoParams | ConfigurableKey, value?: any): Promise<AsyncResult<UpdateOwnUserInfoParams>>;
2235
+
2236
+ /**
2237
+ * Queres user information.
2238
+ *
2239
+ * ```typescript
2240
+ * connection.fetchUserInfoById('user1') | fetchUserInfoById(['user1', 'user2'])
2241
+ * ```
2242
+ */
2243
+ fetchUserInfoById(this: Connection, userId: UserId | UserId[], properties: ConfigurableKey[] | ConfigurableKey): Promise<AsyncResult<UpdateOwnUserInfoParams>>;
2244
+
2245
+ /**
2246
+ * When registering, you can set a nickname, which is used to display when pushing messages. You can call the following API to modify the nickname.
2247
+ *
2248
+ * ```typescript
2249
+ * connection.updateCurrentUserNick('Tom')
2250
+ * ```
2251
+ */
2252
+ updateCurrentUserNick(this: Connection, nick: string): Promise<AsyncResult<BaseUserInfo[]>>;
2253
+
2254
+ getChatToken(this: Connection, agoraToken: string): Promise<any>;
2255
+
2256
+ /**
2257
+ * Gets historical messages.
2258
+ *
2259
+ * ```typescript
2260
+ * connection.fetchHistoryMessages({queue:'user1', count: 20})
2261
+ * ```
2262
+ */
2263
+ fetchHistoryMessages(this: Connection, options: {
2264
+ queue: string,
2265
+ start?: number | null,
2266
+ count?: number,
2267
+ isGroup?: boolean,
2268
+ success?: (res: MessageBody[]) => any,
2269
+ fail?: (error: ErrorEvent) => any
2270
+ }): Promise<MessageBody[]>;
2271
+
2272
+ /**
2273
+ * Adds Contact.
2274
+ *
2275
+ * ```typescript
2276
+ * connection.addContact('user1', 'I am Bob')
2277
+ * ```
2278
+ */
2279
+ addContact(this: Connection, to: string, message?: string): void;
2280
+
2281
+ /**
2282
+ * Deletes contact.
2283
+ *
2284
+ * ```typescript
2285
+ * connection.deleteContact('user1')
2286
+ * ```
2287
+ */
2288
+ deleteContact(this: Connection, to: string): void;
2289
+
2290
+ /** @deprecated */
2291
+ acceptInvitation(this: Connection, to: string): void;
2292
+
2293
+ /**
2294
+ * Accepting contact request
2295
+ *
2296
+ * ```typescript
2297
+ * connection.acceptContactInvite('user1')
2298
+ * ```
2299
+ * @since v4.0.1
2300
+ */
2301
+ acceptContactInvite(this: Connection, to: string): void;
2302
+
2303
+ /** @deprecated */
2304
+ declineInvitation(this: Connection, to: string): void;
2305
+
2306
+ /**
2307
+ * Declines contact invite.
2308
+ *
2309
+ * ```typescript
2310
+ * connection.declineContactInvite('user1')
2311
+ * ```
2312
+ * @since v4.0.1
2313
+ */
2314
+ declineContactInvite(this: Connection, to: string): void;
2315
+
2316
+ /** @deprecated */
2317
+ addToBlackList(this: Connection, options: {
2318
+ name: UserId | UserId[]
2319
+ }): void;
2320
+
2321
+ /**
2322
+ * Add contacts to your blacklist.
2323
+ *
2324
+ * ```typescript
2325
+ * connection.addUsersToBlacklist({name: 'user1'})
2326
+ * ```
2327
+ * @since v4.0.1
2328
+ */
2329
+ addUsersToBlacklist(this: Connection, options: {
2330
+ name: UserId | UserId[]
2331
+ }): void;
2332
+
2333
+ /** @deprecated */
2334
+ removeFromBlackList(this: Connection, options: {
2335
+ name: UserId | UserId[]
2336
+ }): void;
2337
+
2338
+ /**
2339
+ * Removes friends from your blacklist
2340
+ *
2341
+ * ```typescript
2342
+ * connection.removeUserFromBlackList({name: 'user1'})
2343
+ * ```
2344
+ * @since v4.0.1
2345
+ */
2346
+ removeUserFromBlackList(this: Connection, options: {
2347
+ name: UserId | UserId[]
2348
+ }): void;
2349
+
2350
+
2351
+ /** @deprecated*/
2352
+ subscribe(this: Connection, options: { to: UserId, message?: string }): void;
2353
+ /** @deprecated*/
2354
+ subscribed(this: Connection, options: { to: UserId }): void;
2355
+ /** @deprecated*/
2356
+ unsubscribed(this: Connection, options: { to: UserId }): void;
2357
+ /** @deprecated*/
2358
+ removeRoster(this: Connection, options: { to: UserId }): void;
2359
+
2360
+ /**
2361
+ * Recall a message
2362
+ *
2363
+ * ```typescript
2364
+ * connection.recallMessage({mid: 'messageId', to: 'user1', type: 'singleChat'})
2365
+ * ```
2366
+ */
2367
+ recallMessage(this: Connection, option: {
2368
+ mid: string,
2369
+ to: UserId,
2370
+ type?: 'chat' | 'groupchat' | 'chatroom' // v3.0
2371
+ chatType?: 'singleChat' | 'groupChat' | 'chatRoom', // v4.0
2372
+ success?: (res: number) => any,
2373
+ fail?: (error: ErrorEvent) => any,
2374
+ }): Promise<SendMsgResult>;
2375
+
2376
+ // listen @since 3.0
2377
+ listen(this: Connection, parameters: ListenParameters): void;
2378
+
2379
+ // eventHandler @since 4.0
2380
+ addEventHandler(id: string, handler: EventHandlerType): void;
2381
+ removeEventHandler(id: string): void;
2382
+ }
2383
+
891
2384
  /**
892
- * set log level, level: 0-5
2385
+ *
2386
+ * @module eventHandler
893
2387
  */
894
- setLevel(level: Level, persist: boolean, name: string): "No console available for logging" | undefined;
895
- setDefaultLevel(level: Level): void;
2388
+ type DispatchParameters = MessageBody | OnPresenceMsg | RosterData | ErrorEvent | MuteMsgBody | ReceivedMsgBody | RecallMsgBody | ChannelMsgBody;
2389
+
2390
+ type Event = 'onOpened' | 'onPresence' | 'onTextMessage' | 'onImageMessage' | 'onAudioMessage' | 'onVideoMessage' | 'onFileMessage' | 'onLocationMessage' | 'onCmdMessage' | 'onCustomMessage' | 'onReceivedMessage' | 'onDeliveredMessage' | 'onReadMessage' | 'onRecallMessage' | 'onMutedMessage' | 'onChannelMessage' | 'onError' | 'onOffline' | 'onOnline' | 'onRoster' | 'onStatisticMessage' | 'onContactAgreed' | 'onContactRefuse' | 'onContactDeleted' | 'onContactAdded' | 'onTokenWillExpire' | 'onTokenExpired' | 'onContactInvited' | 'onConnected' | 'onDisconnected' | 'onGroupChange' | 'onChatroomChange' | 'onContactChange';
2391
+
2392
+ interface EventHandlerType {
2393
+ 'onOpened'?: (msg: any) => void;
2394
+ 'onPresence'?: (msg: OnPresenceMsg) => void;
2395
+ 'onTextMessage'?: (msg: TextMsgBody) => void;
2396
+ 'onImageMessage'?: (msg: ImgMsgBody) => void;
2397
+ 'onAudioMessage'?: (msg: AudioMsgBody) => void;
2398
+ 'onVideoMessage'?: (msg: VideoMsgBody) => void;
2399
+ 'onFileMessage'?: (msg: FileMsgBody) => void;
2400
+ 'onLocationMessage'?: (msg: LocationMsgBody) => void;
2401
+ 'onCmdMessage'?: (msg: CmdMsgBody) => void;
2402
+ 'onCustomMessage'?: (msg: CustomMsgBody) => void;
2403
+ 'onReceivedMessage'?: (msg: ReceivedMsgBody) => void;
2404
+ 'onDeliveredMessage'?: (msg: DeliveryMsgBody) => void;
2405
+ 'onReadMessage'?: (msg: ReadMsgBody) => void;
2406
+ 'onRecallMessage'?: (msg: RecallMsgBody) => void;
2407
+ 'onMutedMessage'?: (msg: MuteMsgBody) => void;
2408
+ 'onChannelMessage'?: (msg: ChannelMsgBody) => void;
2409
+ 'onError'?: (error: ErrorEvent) => void;
2410
+ 'onOffline'?: (msg: any) => void;
2411
+ 'onOnline'?: (msg: any) => void;
2412
+ 'onRoster'?: (rosters: RosterData[]) => void;
2413
+ 'onStatisticMessage'?: (msg: any) => void;
2414
+ 'onContactAgreed'?: (msg: ContactMsgBody) => void;
2415
+ 'onContactRefuse'?: (msg: ContactMsgBody) => void;
2416
+ 'onContactDeleted'?: (msg: ContactMsgBody) => void;
2417
+ 'onContactAdded'?: (msg: ContactMsgBody) => void;
2418
+ 'onTokenWillExpire'?: (msg: any) => void;
2419
+ 'onTokenExpired'?: (msg: any) => void;
2420
+ 'onContactInvited'?: (msg: any) => void;
2421
+ 'onConnected'?: () => void;
2422
+ 'onDisconnected'?: () => void;
2423
+ 'onGroupChange'?: (msg: any) => void;
2424
+ 'onChatroomChange'?: (msg: any) => void;
2425
+ 'onContactChange'?: (msg: any) => void;
2426
+ }
2427
+
2428
+ interface HandlerData {
2429
+ [key: string]: EventHandlerType;
2430
+ }
2431
+
2432
+ class EventHandler {
2433
+ handlerData: HandlerData;
2434
+ constructor(Connection: any, eventHandlerId: string, eventHandler: EventHandlerType);
2435
+ addEventHandler(eventHandlerId: string, eventHandler: EventHandlerType): void;
2436
+ removeEventHandler(eventHandlerId: string): void;
2437
+ dispatch(this: EventHandler, event: Event, parameters?: DispatchParameters): void;
2438
+ }
2439
+
896
2440
  /**
897
- * Allows all levels of log output
2441
+ * @module listen
2442
+ * @deprecated v4.0.1
898
2443
  */
899
- enableAll(persist?: boolean): void;
2444
+ interface ListenParameters {
2445
+ onOpened?: () => any;
2446
+ onPresence?: (msg: PresenceMsg) => void;
2447
+ onTextMessage?: (msg: TextMsgBody) => void;
2448
+ onPictureMessage?: (msg: ImgMsgBody) => void;
2449
+ onAudioMessage?: (msg: AudioMsgBody) => void;
2450
+ onVideoMessage?: (msg: VideoMsgBody) => void;
2451
+ onFileMessage?: (msg: FileMsgBody) => void;
2452
+ onLocationMessage?: (msg: LocationMsgBody) => void;
2453
+ onCmdMessage?: (msg: CmdMsgBody) => void;
2454
+ onCustomMessage?: (msg: CustomMsgBody) => void;
2455
+ onReceivedMessage?: (msg: ReceivedMsgBody) => void;
2456
+ onDeliveredMessage?: (msg: DeliveryMsgBody) => void;
2457
+ onReadMessage?: (msg: ReadMsgBody) => void;
2458
+ onRecallMessage?: (msg: RecallMsgBody) => void;
2459
+ onMutedMessage?: (msg: MuteMsgBody) => void;
2460
+ onChannelMessage?: (msg: ChannelMsgBody) => void;
2461
+ onError?: (error: ErrorEvent) => void;
2462
+ onOffline?: () => void;
2463
+ onOnline?: () => void;
2464
+ onRoster?: (rosters: RosterData[]) => void;
2465
+ onStatisticMessage?: () => void;
2466
+ onCreateGroup?: () => void;
2467
+ onBlacklistUpdate?: () => void;
2468
+ onContactAgreed?: (msg: ContactMsgBody) => void;
2469
+ onContactRefuse?: (msg: ContactMsgBody) => void;
2470
+ onContactDeleted?: (msg: ContactMsgBody) => void;
2471
+ onContactAdded?: (msg: ContactMsgBody) => void;
2472
+ onTokenWillExpire?: () => void;
2473
+ onTokenExpired?: () => void;
2474
+ onClosed?: () => void;
2475
+ }
2476
+
900
2477
  /**
901
- * Disabling Log Output
2478
+ * @module Error
902
2479
  */
903
- disableAll(persist?: boolean): void;
2480
+ interface ErrorParameters {
2481
+ type: Code,
2482
+ message: string;
2483
+ data?: any
2484
+ }
2485
+ class ErrorEvent {
2486
+ type: Code;
2487
+ message: string;
2488
+ data?: any;
2489
+ constructor(parameters: ErrorParameters);
2490
+ static create(parameters: ErrorParameters): ErrorEvent;
2491
+ }
2492
+
904
2493
  /**
905
- * get logs object
2494
+ * @module Logger
906
2495
  */
907
- getLogs(): string[];
2496
+ type DefaultLevel = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'SILENT';
2497
+ type LevelNum = 0 | 1 | 2 | 3 | 4 | 5;
2498
+ type Level = DefaultLevel | LevelNum;
2499
+ enum Levels {
2500
+ "TRACE" = 0,
2501
+ "DEBUG" = 1,
2502
+ "INFO" = 2,
2503
+ "WARN" = 3,
2504
+ "ERROR" = 4,
2505
+ "SILENT" = 5
2506
+ }
2507
+ interface Config {
2508
+ useCache: boolean;
2509
+ maxCache: number;
2510
+ color: string;
2511
+ background: string;
2512
+ }
2513
+ class Logger {
2514
+ name: string;
2515
+ currentLevel: LevelNum;
2516
+ useCookiePersist: boolean;
2517
+ storageLogLevelKey: string;
2518
+ levels: typeof Levels;
2519
+ // logMethods: string[];
2520
+ // methodFactory: any;
2521
+ logs: string[];
2522
+ config: Config;
2523
+ logBytes: number;
2524
+ // [key: string]: any;
2525
+ constructor(name: string, defaultLevel: Level, factory?: any);
2526
+ setConfig(cofig: Config): void;
2527
+ /**
2528
+ * get current log level
2529
+ */
2530
+ getLevel(): LevelNum;
2531
+ /**
2532
+ * set log level, level: 0-5
2533
+ */
2534
+ setLevel(level: Level, persist: boolean, name: string): "No console available for logging" | undefined;
2535
+ setDefaultLevel(level: Level): void;
2536
+ /**
2537
+ * Allows all levels of log output
2538
+ */
2539
+ enableAll(persist?: boolean): void;
2540
+ /**
2541
+ * Disabling Log Output
2542
+ */
2543
+ disableAll(persist?: boolean): void;
2544
+ /**
2545
+ * get logs object
2546
+ */
2547
+ getLogs(): string[];
2548
+ /**
2549
+ * down load logs
2550
+ */
2551
+ download(): void;
2552
+ // _bindMethod(obj: any, methodName: string, useCache: boolean): any;
2553
+ // getTime(): string;
2554
+ // _cacheLog(...rest: any[]): void;
2555
+ // _cacheLogCall(log: any): void;
2556
+ // _getPersistedLevel(): any;
2557
+ // _persistLevel(levelNum: number): void;
2558
+ // replaceLoggingMethods(level: LevelNum, loggerName: string): void;
2559
+ // defaultMethodFactory(methodName: string, level: LevelNum, loggerName: string): any;
2560
+ // realMethod(methodName: string): any;
2561
+ // enableLoggingWhenConsoleArrives(methodName: string, level: LevelNum, loggerName: string): () => void;
2562
+ }
2563
+
2564
+
908
2565
  /**
909
- * down load logs
2566
+ * @moudle message
910
2567
  */
911
- download(): void;
912
- _bindMethod(obj: any, methodName: string, useCache: boolean): any;
913
- getTime(): string;
914
- _cacheLog(...rest: any[]): void;
915
- _cacheLogCall(log: any): void;
916
- _getPersistedLevel(): any;
917
- _persistLevel(levelNum: number): void;
918
- replaceLoggingMethods(level: LevelNum, loggerName: string): void;
919
- defaultMethodFactory(methodName: string, level: LevelNum, loggerName: string): any;
920
- realMethod(methodName: string): any;
921
- enableLoggingWhenConsoleArrives(methodName: string, level: LevelNum, loggerName: string): () => void;
922
- }
923
- declare const defaultLogger: Logger;
2568
+ type MessageType = 'read' | 'delivery' | 'channel' | 'txt' | 'cmd' | 'custom' | 'loc' | 'img' | 'audio' | 'file' | 'video';
924
2569
 
2570
+ type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
925
2571
 
2572
+ interface PresenceMsg {
2573
+ type: OnPresenceMsgType,
2574
+ to: string,
2575
+ from: string,
2576
+ status: string,
2577
+ chatroom?: boolean,
2578
+ toJid?: string,
2579
+ fromJid?: string,
2580
+ gid?: string,
2581
+ owner?: string,
2582
+ reason?: string,
2583
+ kicked?: string
2584
+ }
926
2585
 
927
- declare type MessageSetParameters = ReadMsgSetParameters | DeliveryMsgSetParameters | ChannelMsgSetParameters | TextMsgSetParameters | CmdMsgSetParameters | CustomMsgSetParameters | LocationMsgSetParameters | ImgMsgSetParameters | AudioMsgSetParameters | VideoMsgSetParameters | FileMsgSetParameters;
928
- interface CreateOldMsgOpt {
929
- type: MessageType;
930
- id: string;
931
- version: '3.0';
932
- }
933
- declare type CreateMsgType = TextMsgBody | CreateImgOps | CmdMsgBody | FileMsgBody | VideoMsgBody | CustomMsgBody | LocationMsgBody | ChannelMsgBody | DeliveryMsgBody | ReadMsgBody | AudioMsgBody
934
-
935
- export declare class Message {
936
- id: string;
937
- body: any;
938
- constructor(type: MessageType, id?: string);
939
- createOldMsg(options: any): any;
940
- static create(options: CreateMsgType): CreateMsgType;
941
- set(options: MessageSetParameters): void;
942
- }
2586
+ interface ReadMsgSetParameters {
2587
+ id: string,
2588
+ to: string,
2589
+ from?: string
2590
+ }
2591
+ interface ReadMsgBody extends ReadMsgSetParameters {
2592
+ type: 'read';
2593
+ ackId?: string;
2594
+ mid?: string,
2595
+ groupReadCount?: number;
2596
+ ackContent?: string;
2597
+ }
2598
+ interface ReadParameters {
2599
+ type: 'read',
2600
+ id: string,
2601
+ }
943
2602
 
2603
+ interface CreateReadMsgParameters {
2604
+ to: string,
2605
+ from?: string,
2606
+ type: 'read';
2607
+ id: string;
2608
+ }
944
2609
 
945
- declare interface KVString {
946
- [key: string]: string;
947
- }
948
- declare interface AjaxOptions {
949
- url: string;
950
- dataType?: string;
951
- type?: string;
952
- data?: any;
953
- headers?: KVString;
954
- responseType?: "arraybuffer" | "blob" | "document" | "json" | "text";
955
- mimeType?: string;
956
- success?: (res: any) => any;
957
- error?: (res: any) => any;
958
- }
959
- declare enum PLATFORM {
960
- WEB = "web",
961
- WX = "wx",
962
- ZFB = "zfb",
963
- TT = "tt",
964
- BAIDU = "baidu",
965
- QUICK_APP = "quick_app",
966
- UNI = "uni"
967
- }
968
- interface EnvInfo {
969
- platform: PLATFORM;
970
- global: any;
971
- }
972
- interface uri {
973
- url: string;
974
- filename: string;
975
- filetype: string;
976
- data: File | null;
977
- }
978
- declare interface UploadFile {
979
- onFileUploadProgress?: (msg: any) => any;
980
- onFileUploadComplete?: (msg: any) => any;
981
- onFileUploadError?: (msg: any) => any;
982
- onFileUploadCanceled?: (msg: any) => any;
983
- accessToken: string;
984
- appKey: string;
985
- apiUrl: string;
986
- uploadUrl?: string;
987
- file: any;
988
- }
989
- declare interface DownloadParams {
990
- onFileDownloadComplete: (data: any) => any;
991
- onFileDownloadError: (error: any) => any;
992
- id: string;
993
- secret: string;
994
- [key: string]: any;
995
- }
996
- declare type Fns = (...args: any) => any;
997
- interface Utils {
998
- autoIncrement: number;
999
- getUniqueId: () => string;
1000
- ajax: (options: AjaxOptions) => Promise<any>;
1001
- getFileUrl: (fileInputId: string | HTMLInputElement) => uri;
1002
- uploadFile: (options: UploadFile) => void;
1003
- flow: (fns: Fns[]) => any;
1004
- listenNetwork: (online: () => any, offline: () => any) => void;
1005
- getEnvInfo: () => EnvInfo;
1006
- wxRequest: (options: AjaxOptions) => Promise<any>;
1007
- parseDownloadResponse: (res: any) => string;
1008
- download: (params: DownloadParams) => any;
1009
- }
2610
+ interface DeliveryParameters {
2611
+ id: string,
2612
+ type: 'delivery'
2613
+ }
2614
+ interface DeliveryMsgSetParameters {
2615
+ ackId: string,
2616
+ to: string,
2617
+ from?: string
2618
+ }
2619
+ interface DeliveryMsgBody {
2620
+ id: string,
2621
+ mid?: string,
2622
+ ackId?: string,
2623
+ type: 'delivery',
2624
+ to: string,
2625
+ from?: string
2626
+ }
1010
2627
 
1011
- declare enum Code {
1012
- WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR = 0,
1013
- WEBIM_CONNCTION_OPEN_ERROR = 1,
1014
- WEBIM_CONNCTION_AUTH_ERROR = 2,
1015
- WEBIM_CONNCTION_OPEN_USERGRID_ERROR = 3,
1016
- WEBIM_CONNCTION_ATTACH_ERROR = 4,
1017
- WEBIM_CONNCTION_ATTACH_USERGRID_ERROR = 5,
1018
- WEBIM_CONNCTION_REOPEN_ERROR = 6,
1019
- WEBIM_CONNCTION_SERVER_CLOSE_ERROR = 7,
1020
- WEBIM_CONNCTION_SERVER_ERROR = 8,
1021
- WEBIM_CONNCTION_IQ_ERROR = 9,
1022
- WEBIM_CONNCTION_USER_REMOVED = 207,
1023
- WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE = 206,
1024
- WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD = 216,
1025
- WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE = 217,
1026
- WEBIM_CONNCTION_PING_ERROR = 10,
1027
- WEBIM_CONNCTION_NOTIFYVERSION_ERROR = 11,
1028
- WEBIM_CONNCTION_GETROSTER_ERROR = 12,
1029
- WEBIM_CONNCTION_CROSSDOMAIN_ERROR = 13,
1030
- WEBIM_CONNCTION_LISTENING_OUTOF_MAXRETRIES = 14,
1031
- WEBIM_CONNCTION_RECEIVEMSG_CONTENTERROR = 15,
1032
- WEBIM_CONNCTION_DISCONNECTED = 16,
1033
- WEBIM_CONNCTION_AJAX_ERROR = 17,
1034
- WEBIM_CONNCTION_JOINROOM_ERROR = 18,
1035
- WEBIM_CONNCTION_GETROOM_ERROR = 19,
1036
- WEBIM_CONNCTION_GETROOMINFO_ERROR = 20,
1037
- WEBIM_CONNCTION_GETROOMMEMBER_ERROR = 21,
1038
- WEBIM_CONNCTION_GETROOMOCCUPANTS_ERROR = 22,
1039
- WEBIM_CONNCTION_LOAD_CHATROOM_ERROR = 23,
1040
- WEBIM_CONNCTION_NOT_SUPPORT_CHATROOM_ERROR = 24,
1041
- WEBIM_CONNCTION_JOINCHATROOM_ERROR = 25,
1042
- WEBIM_CONNCTION_QUITCHATROOM_ERROR = 26,
1043
- WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR = 27,
1044
- WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR = 28,
1045
- WEBIM_CONNCTION_SESSIONID_NOT_ASSIGN_ERROR = 29,
1046
- WEBIM_CONNCTION_RID_NOT_ASSIGN_ERROR = 30,
1047
- WEBIM_CONNCTION_CALLBACK_INNER_ERROR = 31,
1048
- WEBIM_CONNCTION_CLIENT_OFFLINE = 32,
1049
- WEBIM_CONNCTION_CLIENT_LOGOUT = 33,
1050
- WEBIM_CONNCTION_CLIENT_TOO_MUCH_ERROR = 34,
1051
- WEBIM_CONNECTION_ACCEPT_INVITATION_FROM_GROUP = 35,
1052
- WEBIM_CONNECTION_DECLINE_INVITATION_FROM_GROUP = 36,
1053
- WEBIM_CONNECTION_ACCEPT_JOIN_GROUP = 37,
1054
- WEBIM_CONNECTION_DECLINE_JOIN_GROUP = 38,
1055
- WEBIM_CONNECTION_CLOSED = 39,
1056
- WEBIM_CONNECTION_ERROR = 40,
1057
- WEBIM_UPLOADFILE_BROWSER_ERROR = 100,
1058
- WEBIM_UPLOADFILE_ERROR = 101,
1059
- WEBIM_UPLOADFILE_NO_LOGIN = 102,
1060
- WEBIM_UPLOADFILE_NO_FILE = 103,
1061
- WEBIM_DOWNLOADFILE_ERROR = 200,
1062
- WEBIM_DOWNLOADFILE_NO_LOGIN = 201,
1063
- WEBIM_DOWNLOADFILE_BROWSER_ERROR = 202,
1064
- WEBIM_MESSAGE_REC_TEXT = 300,
1065
- WEBIM_MESSAGE_REC_TEXT_ERROR = 301,
1066
- WEBIM_MESSAGE_REC_EMOTION = 302,
1067
- WEBIM_MESSAGE_REC_PHOTO = 303,
1068
- WEBIM_MESSAGE_REC_AUDIO = 304,
1069
- WEBIM_MESSAGE_REC_AUDIO_FILE = 305,
1070
- WEBIM_MESSAGE_REC_VEDIO = 306,
1071
- WEBIM_MESSAGE_REC_VEDIO_FILE = 307,
1072
- WEBIM_MESSAGE_REC_FILE = 308,
1073
- WEBIM_MESSAGE_SED_TEXT = 309,
1074
- WEBIM_MESSAGE_SED_EMOTION = 310,
1075
- WEBIM_MESSAGE_SED_PHOTO = 311,
1076
- WEBIM_MESSAGE_SED_AUDIO = 312,
1077
- WEBIM_MESSAGE_SED_AUDIO_FILE = 313,
1078
- WEBIM_MESSAGE_SED_VEDIO = 314,
1079
- WEBIM_MESSAGE_SED_VEDIO_FILE = 315,
1080
- WEBIM_MESSAGE_SED_FILE = 316,
1081
- WEBIM_MESSAGE_SED_ERROR = 317,
1082
- STATUS_INIT = 400,
1083
- STATUS_DOLOGIN_USERGRID = 401,
1084
- STATUS_DOLOGIN_IM = 402,
1085
- STATUS_OPENED = 403,
1086
- STATUS_CLOSING = 404,
1087
- STATUS_CLOSED = 405,
1088
- STATUS_ERROR = 406,
1089
- GROUP_NOT_EXIST = 605,
1090
- GROUP_NOT_JOINED = 602,
1091
- MESSAGE_RECALL_TIME_LIMIT = 504,
1092
- SERVICE_NOT_ENABLED = 505,
1093
- SERVICE_NOT_ALLOW_MESSAGING = 506,
1094
- SERVICE_NOT_ALLOW_MESSAGING_MUTE = 507,
1095
- SERVER_UNKNOWN_ERROR = 503,
1096
- MESSAGE_INCLUDE_ILLEGAL_CONTENT = 501,
1097
- MESSAGE_EXTERNAL_LOGIC_BLOCKED = 502,
1098
- PERMISSION_DENIED = 603,
1099
- WEBIM_LOAD_MSG_ERROR = 604,
1100
- REST_PARAMS_STATUS = 700,
1101
- SDK_RUNTIME_ERROR = 999
1102
- }
2628
+ interface CreateDeliveryMsgParameters {
2629
+ ackId: string,
2630
+ type: 'delivery',
2631
+ to: string,
2632
+ from?: string
2633
+ }
1103
2634
 
1104
- export {
1105
- EasemobChat, Code, Utils, Connection, DispatchParameters, EventHandler, ErrorEvent, DefaultLevel,
1106
- LevelNum, Level, Levels, Config, Logger, MessageSetParameters, CreateMsgType,
1107
- PLATFORM, Fns, ConnectionParameters, RegisterUserParameters,
1108
- LoginParameters, Host, ListenParameters, CreateOldMsgOpt, KVString, AjaxOptions, uri, UploadFile, DownloadParams
1109
- }
1110
2635
 
2636
+ interface ChannelMsgSetParameters {
2637
+ chatType: ChatType,
2638
+ to: string,
2639
+ from?: string
2640
+ }
1111
2641
 
1112
- // types / message
2642
+ interface ChannelMsgBody extends ChannelMsgSetParameters {
2643
+ id: string,
2644
+ group?: string,
2645
+ type: 'channel',
2646
+ time: number
2647
+ }
2648
+ interface ChannelParameters {
2649
+ type: 'channel'
2650
+ id: string,
2651
+ }
1113
2652
 
1114
- declare type MessageType = 'read' | 'delivery' | 'channel' | 'txt' | 'cmd' | 'custom' | 'loc' | 'img' | 'audio' | 'file' | 'video';
2653
+ interface CreateChannelMsgParameters {
2654
+ type: 'channel',
2655
+ chatType: ChatType,
2656
+ to: string,
2657
+ from?: string
2658
+ }
1115
2659
 
1116
- declare type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
1117
2660
 
1118
- declare interface ReadMsgSetParameters {
1119
- ackId: string;
1120
- to: string;
1121
- from?: string;
1122
- }
1123
- declare interface ReadParameters {
1124
- type: 'read';
1125
- id?: string;
1126
- to: string;
1127
- from?: string;
1128
- body?: ReadMsgSetParameters | undefined;
1129
- }
1130
- declare interface DeliveryMsgSetParameters {
1131
- ackId?: string;
1132
- to: string;
1133
- from?: string;
1134
- }
1135
- declare interface DeliveryMsgBody extends DeliveryMsgSetParameters {
1136
- id?: string;
1137
- type: 'delivery';
1138
- mid: string;
1139
- }
1140
- declare interface ChannelMsgSetParameters {
1141
- chatType: ChatType;
1142
- to: string;
1143
- from?: string;
1144
- }
1145
- declare interface ChannelMsgBody extends ChannelMsgSetParameters {
1146
- id?: string;
1147
- type: 'channel';
1148
- }
1149
- declare interface TextMsgSetParameters {
1150
- chatType: ChatType;
1151
- to: string;
1152
- msg: string;
1153
- from?: string;
1154
- roomType?: boolean;
1155
- success?: () => any;
1156
- fail?: () => any;
1157
- ext?: {
1158
- [key: string]: any;
1159
- };
1160
- time?: number;
1161
- msgConfig?: {
1162
- [key: string]: any;
1163
- };
1164
- }
1165
- declare interface PresenceMsg {
1166
- type: OnPresenceMsgType,
1167
- to: string,
1168
- from: string,
1169
- status: string,
1170
- chatroom?: boolean,
1171
- toJid?: string,
1172
- fromJid?: string,
1173
- gid?: string,
1174
- owner?: string,
1175
- reason?: string,
1176
- kicked?: string
1177
- }
1178
- declare interface TextMsgBody extends TextMsgSetParameters {
1179
- id?: string;
1180
- type: 'txt';
1181
- }
1182
- declare interface CmdMsgSetParameters {
1183
- chatType: ChatType;
1184
- to: string;
1185
- action: string;
1186
- from?: string;
1187
- roomType?: boolean;
1188
- success?: () => any;
1189
- fail?: () => any;
1190
- ext?: {
1191
- [key: string]: any;
1192
- };
1193
- time?: number;
1194
- msgConfig?: {
1195
- [key: string]: any;
1196
- };
1197
- }
1198
- declare interface CmdMsgBody extends CmdMsgSetParameters {
1199
- id?: string;
1200
- type: 'cmd';
1201
- }
1202
- declare interface CustomMsgSetParameters {
1203
- chatType: ChatType;
1204
- to: string;
1205
- customEvent: string;
1206
- customExts: {
1207
- [key: string]: any;
1208
- };
1209
- from?: string;
1210
- roomType?: boolean;
1211
- success?: () => any;
1212
- fail?: () => any;
1213
- ext?: {
1214
- [key: string]: any;
1215
- };
1216
- time?: number;
1217
- msgConfig?: {
1218
- [key: string]: any;
1219
- };
1220
- }
1221
- declare interface CustomMsgBody extends CustomMsgSetParameters {
1222
- id?: string;
1223
- type: 'custom';
1224
- params: {
1225
- [key: string]: any;
1226
- };
1227
- }
1228
- declare interface LocationMsgSetParameters {
1229
- chatType: ChatType;
1230
- to: string;
1231
- addr: string;
1232
- lat: number;
1233
- lng: number;
1234
- from?: string;
1235
- roomType?: boolean;
1236
- success?: () => any;
1237
- fail?: () => any;
1238
- ext?: {
1239
- [key: string]: any;
1240
- };
1241
- time?: number;
1242
- msgConfig?: {
1243
- [key: string]: any;
1244
- };
1245
- }
1246
- declare interface LocationMsgBody extends LocationMsgSetParameters {
1247
- id?: string;
1248
- type: 'loc';
1249
- }
1250
- declare interface File {
1251
- url: string;
1252
- filetype: string;
1253
- filename: string;
1254
- data: any;
1255
- }
1256
- declare interface ImgMsgSetParameters {
1257
- chatType: ChatType;
1258
- to: string;
1259
- file: File;
1260
- width?: number;
1261
- height?: number;
1262
- fileInputId?: string;
1263
- from?: string;
1264
- roomType?: boolean;
1265
- group?: string;
1266
- success?: () => any;
1267
- fail?: () => any;
1268
- ext?: {
1269
- [key: string]: any;
1270
- };
1271
- url?: string;
1272
- onFileUploadError?: (error: any) => any;
1273
- onFileUploadComplete?: (data: any) => any;
1274
- onFileUploadProgress?: (data: any) => any;
1275
- uploadError?: () => any;
1276
- uploadComplete?: () => any;
1277
- msgConfig?: {
1278
- [key: string]: any;
1279
- };
1280
- body?: {
2661
+ interface TextParameters {
2662
+ type: 'txt'
2663
+ id: string,
2664
+ }
2665
+ interface TextMsgSetParameters {
2666
+ chatType: ChatType,
2667
+ to: string,
2668
+ msg: string,
2669
+ from?: string
2670
+ roomType?: boolean,
2671
+ success?: (data: SendMsgResult) => void,
2672
+ fail?: () => void,
2673
+ ext?: { [key: string]: any },
2674
+ }
2675
+
2676
+ interface TextMsgBody {
2677
+ id: string,
2678
+ chatType: ChatType,
2679
+ type: 'txt',
2680
+ to: string,
2681
+ msg: string,
2682
+ from?: string
2683
+ roomType?: boolean,
2684
+ group?: string,
2685
+ success?: (data: SendMsgResult) => void,
2686
+ fail?: () => void,
2687
+ ext?: { [key: string]: any },
2688
+ msgConfig?: { [key: string]: any }
2689
+ time: number
2690
+ }
2691
+
2692
+ interface CreateTextMsgParameters {
2693
+ chatType: ChatType,
2694
+ type: 'txt',
2695
+ to: string,
2696
+ msg: string,
2697
+ from?: string
2698
+ ext?: { [key: string]: any },
2699
+ }
2700
+
2701
+ interface CmdParameters {
2702
+ type: 'cmd'
2703
+ id: string,
2704
+ }
2705
+ interface CmdMsgSetParameters {
2706
+ chatType: ChatType,
2707
+ to: string,
2708
+ action: string,
2709
+ from?: string
2710
+ roomType?: boolean,
2711
+ success?: (data: SendMsgResult) => void,
2712
+ fail?: () => void,
2713
+ ext?: { [key: string]: any },
2714
+ }
2715
+
2716
+ interface CmdMsgBody {
2717
+ id: string,
2718
+ chatType: ChatType,
2719
+ type: 'cmd',
2720
+ to: string,
2721
+ action: string,
2722
+ from?: string
2723
+ roomType?: boolean,
2724
+ group?: string,
2725
+ success?: (data: SendMsgResult) => void,
2726
+ fail?: () => void,
2727
+ ext?: { [key: string]: any },
2728
+ msgConfig?: { [key: string]: any },
2729
+ time: number
2730
+ }
2731
+
2732
+ interface CreateCmdMsgParameters {
2733
+ type: 'cmd',
2734
+ chatType: ChatType,
2735
+ to: string,
2736
+ action: string,
2737
+ from?: string
2738
+ roomType?: boolean,
2739
+ ext?: { [key: string]: any },
2740
+ }
2741
+
2742
+
2743
+ interface CustomParameters {
2744
+ type: 'custom'
2745
+ id: string,
2746
+ }
2747
+ interface CustomMsgSetParameters {
2748
+ chatType: ChatType,
2749
+ to: string,
2750
+ customEvent: string,
2751
+ customExts: { [key: string]: any }
2752
+ from?: string
2753
+ roomType?: boolean,
2754
+ success?: (data: SendMsgResult) => void,
2755
+ fail?: () => void,
2756
+ ext?: { [key: string]: any },
2757
+ }
2758
+
2759
+ interface CustomMsgBody {
2760
+ id: string,
2761
+ chatType: ChatType,
2762
+ type: 'custom',
2763
+ to: string,
2764
+ customEvent: string,
2765
+ customExts: { [key: string]: any }
2766
+ from?: string
2767
+ roomType?: boolean,
2768
+ group?: string,
2769
+ params?: { [key: string]: any },
2770
+ success?: (data: SendMsgResult) => void,
2771
+ fail?: () => void,
2772
+ ext?: { [key: string]: any },
2773
+ msgConfig?: { [key: string]: any },
2774
+ time: number
2775
+ }
2776
+
2777
+ interface CreateCustomMsgParameters {
2778
+ type: 'custom',
2779
+ chatType: ChatType,
2780
+ to: string,
2781
+ customEvent: string,
2782
+ customExts: { [key: string]: any }
2783
+ from?: string
2784
+ ext?: { [key: string]: any },
2785
+ }
2786
+
2787
+ interface LocationParameters {
2788
+ type: 'loc'
2789
+ id: string,
2790
+ }
2791
+ interface LocationMsgSetParameters {
2792
+ chatType: ChatType,
2793
+ to: string,
2794
+ addr: string,
2795
+ lat: number,
2796
+ lng: number,
2797
+ from?: string
2798
+ roomType?: boolean,
2799
+ success?: (data: SendMsgResult) => void,
2800
+ fail?: () => void,
2801
+ ext?: { [key: string]: any }
2802
+ }
2803
+
2804
+ interface LocationMsgBody {
2805
+ id: string,
2806
+ chatType: ChatType,
2807
+ type: 'loc',
2808
+ to: string,
2809
+ addr: string,
2810
+ lat: number,
2811
+ lng: number,
2812
+ from?: string
2813
+ roomType?: boolean,
2814
+ group?: string,
2815
+ success?: (data: SendMsgResult) => void,
2816
+ fail?: () => void,
2817
+ ext?: { [key: string]: any },
2818
+ time: number
2819
+ }
2820
+
2821
+ interface CreateLocationMsgParameters {
2822
+ type: 'loc',
2823
+ chatType: ChatType,
2824
+ to: string,
2825
+ addr: string,
2826
+ lat: number,
2827
+ lng: number,
2828
+ from?: string
2829
+ ext?: { [key: string]: any },
2830
+ }
2831
+
2832
+ interface FileParameters {
2833
+ type: 'file'
2834
+ id: string,
2835
+ }
2836
+ interface FileMsgSetParameters {
2837
+ chatType: ChatType,
2838
+ file: any,
2839
+ filename: string,
2840
+ fileInputId?: string,
2841
+ to: string,
2842
+ from?: string
2843
+ roomType?: boolean,
2844
+ success?: (data: SendMsgResult) => void,
2845
+ fail?: () => void,
2846
+ ext?: { [key: string]: any },
2847
+ apiUrl?: string,
2848
+ onFileUploadError?: (err: any) => void,
2849
+ onFileUploadComplete?: (data: any) => void,
2850
+ onFileUploadProgress?: (data: ProgressEvent) => void,
2851
+ body?: {
2852
+ url: string,
2853
+ type: string,
2854
+ filename: string
2855
+ }
2856
+ }
2857
+
2858
+ interface FileMsgBody extends FileMsgSetParameters {
2859
+ id: string,
2860
+ type: 'file',
2861
+ group?: string,
2862
+ url?: string,
2863
+ secret?: string,
2864
+ length?: number,
2865
+ file_length?: number,
2866
+ filetype?: string,
2867
+ accessToken?: string,
2868
+ msgConfig?: { [key: string]: any },
2869
+ time: number,
2870
+ }
2871
+
2872
+ interface CreateFileMsgParameters {
2873
+ type: 'file',
2874
+ chatType: ChatType,
2875
+ file: any,
2876
+ filename: string,
2877
+ fileInputId?: string,
2878
+ to: string,
2879
+ from?: string
2880
+ ext?: { [key: string]: any },
2881
+ apiUrl?: string,
2882
+ onFileUploadError?: (err: any) => void,
2883
+ onFileUploadComplete?: (data: any) => void,
2884
+ onFileUploadProgress?: (data: ProgressEvent) => void,
2885
+ body?: {
2886
+ url: string,
2887
+ type: string,
2888
+ filename: string
2889
+ }
2890
+ }
2891
+
2892
+ interface ImgParameters {
2893
+ type: 'img'
2894
+ id: string,
2895
+ }
2896
+
2897
+ interface ImgMsgSetParameters {
2898
+ chatType: ChatType,
2899
+ to: string,
2900
+ file: File,
2901
+ width?: number,
2902
+ height?: number,
2903
+ fileInputId?: string,
2904
+ from?: string
2905
+ roomType?: boolean,
2906
+ group?: string,
2907
+ success?: (data: SendMsgResult) => void,
2908
+ fail?: () => void,
2909
+ ext?: { [key: string]: any },
2910
+ url?: string,
2911
+ onFileUploadError?: (error: any) => void,
2912
+ onFileUploadComplete?: (data: any) => void,
2913
+ onFileUploadProgress?: (data: ProgressEvent) => void,
2914
+ uploadError?: (error: any) => void,
2915
+ uploadComplete?: (data: any) => void,
2916
+ msgConfig?: { [key: string]: any }
2917
+ body?: {
2918
+ url: string,
2919
+ type: string,
2920
+ filename: string
2921
+ }
2922
+ }
2923
+
2924
+ interface ImgMsgBody extends ImgMsgSetParameters {
2925
+ id: string,
2926
+ type: 'img',
2927
+ time: number,
2928
+ secret?: string,
2929
+ thumb?: string,
2930
+ thumb_secret?: string,
2931
+ }
2932
+
2933
+ interface CreateImgMsgParameters {
2934
+ type: 'img',
2935
+ chatType: ChatType,
2936
+ file: File
2937
+ url?: string,
2938
+ width?: number,
2939
+ height?: number,
2940
+ to: string,
2941
+ from?: string,
2942
+ onFileUploadError?: (error: any) => void,
2943
+ onFileUploadComplete?: (data: any) => void,
2944
+ onFileUploadProgress?: (data: ProgressEvent) => void,
2945
+ uploadError?: (error: any) => void,
2946
+ uploadComplete?: (data: any) => void,
2947
+ ext?: { [key: string]: any },
2948
+ body?: {
2949
+ url: string,
2950
+ type: string,
2951
+ filename: string
2952
+ }
2953
+ }
2954
+
2955
+ interface AudioParameters {
2956
+ type: 'audio'
2957
+ id: string,
2958
+ }
2959
+ interface AudioMsgSetParameters {
2960
+ chatType: ChatType,
2961
+ file: object,
2962
+ filename: string,
2963
+ length: number,
2964
+ file_length: number,
2965
+ fileInputId?: string,
2966
+ to: string,
2967
+ from?: string
2968
+ roomType?: boolean,
2969
+ success?: (data: SendMsgResult) => void,
2970
+ fail?: () => void,
2971
+ ext?: { [key: string]: any },
2972
+ apiUrl?: string,
2973
+ onFileUploadError?: (err: any) => void,
2974
+ onFileUploadComplete?: (data: any) => void,
2975
+ onFileUploadProgress?: (data: ProgressEvent) => void,
2976
+ body?: {
2977
+ url: string,
2978
+ type: string,
2979
+ filename: string
2980
+ }
2981
+ }
2982
+
2983
+ interface AudioMsgBody extends AudioMsgSetParameters {
2984
+ id: string,
2985
+ type: 'audio',
2986
+ url?: string,
2987
+ secret?: string,
2988
+ filetype?: string,
2989
+ accessToken?: string
2990
+ group?: string,
2991
+ msgConfig?: { [key: string]: any },
2992
+ time: number,
2993
+ }
2994
+
2995
+
2996
+ interface CreateAudioMsgParameters {
2997
+ type: 'audio',
2998
+ chatType: ChatType,
2999
+ file: object,
3000
+ filename: string,
3001
+ length: number,
3002
+ file_length: number,
3003
+ fileInputId?: string,
3004
+ to: string,
3005
+ from?: string
3006
+ roomType?: boolean,
3007
+ success?: (data: SendMsgResult) => void,
3008
+ fail?: () => void,
3009
+ ext?: { [key: string]: any },
3010
+ apiUrl?: string,
3011
+ onFileUploadError?: (err: any) => void,
3012
+ onFileUploadComplete?: (data: any) => void,
3013
+ onFileUploadProgress?: (data: ProgressEvent) => void,
3014
+ body?: {
3015
+ url: string,
3016
+ type: string,
3017
+ filename: string
3018
+ }
3019
+ }
3020
+
3021
+ interface VideoParameters {
3022
+ type: 'video'
3023
+ id: string,
3024
+ }
3025
+ interface VideoMsgSetParameters {
3026
+ chatType: ChatType,
3027
+ file: object,
3028
+ filename: string,
3029
+ length: number,
3030
+ file_length: number,
3031
+ fileInputId?: string,
3032
+ to: string,
3033
+ from?: string
3034
+ roomType?: boolean,
3035
+ success?: (data: SendMsgResult) => any,
3036
+ fail?: () => any,
3037
+ ext?: { [key: string]: any },
3038
+ apiUrl?: string,
3039
+ onFileUploadError?: (err: any) => any,
3040
+ onFileUploadComplete?: (data: any) => any,
3041
+ onFileUploadProgress?: (data: ProgressEvent) => any,
3042
+ body?: {
3043
+ url: string,
3044
+ type: string,
3045
+ filename: string
3046
+ }
3047
+ }
3048
+
3049
+ interface VideoMsgBody extends VideoMsgSetParameters {
3050
+ id: string,
3051
+ type: 'video',
3052
+ url?: string,
3053
+ secret?: string,
3054
+ filetype?: string,
3055
+ accessToken?: string,
3056
+ msgConfig?: { [key: string]: any },
3057
+ group?: string,
3058
+ time: number,
3059
+ }
3060
+
3061
+ interface CreateVideoMsgParameters {
3062
+ type: 'video'
3063
+ chatType: ChatType,
3064
+ file: object,
3065
+ filename: string,
3066
+ length: number,
3067
+ file_length: number,
3068
+ fileInputId?: string,
3069
+ to: string,
3070
+ from?: string
3071
+ ext?: { [key: string]: any },
3072
+ apiUrl?: string,
3073
+ onFileUploadError?: (err: any) => any,
3074
+ onFileUploadComplete?: (data: any) => any,
3075
+ onFileUploadProgress?: (data: ProgressEvent) => any,
3076
+ body?: {
3077
+ url: string,
3078
+ type: string,
3079
+ filename: string
3080
+ }
3081
+ }
3082
+
3083
+ interface ReceivedMsgBody {
3084
+ id: string;
3085
+ mid: string;
3086
+ to: string;
3087
+ time: number;
3088
+ }
3089
+
3090
+ interface RecallMsgBody {
3091
+ id?: string;
3092
+ from: string;
3093
+ to: string;
3094
+ mid: string;
3095
+ }
3096
+ interface MuteMsgBody {
3097
+ mid: string;
3098
+ }
3099
+ interface ContactMsgBody {
3100
+ to: string;
3101
+ from: string;
3102
+ status: string;
3103
+ type: 'subscribed' | 'unsubscribed' | 'subscribe';
3104
+ }
3105
+
3106
+
3107
+ type NewMessageParamters = ReadParameters | DeliveryParameters | ChannelParameters | TextParameters | CmdParameters | CustomParameters | LocationParameters | ImgParameters | AudioParameters | VideoParameters | FileParameters
3108
+
3109
+
3110
+ type MessageSetParameters = ReadMsgSetParameters | DeliveryMsgSetParameters | ChannelMsgSetParameters | TextMsgSetParameters | CmdMsgSetParameters | CustomMsgSetParameters | LocationMsgSetParameters | ImgMsgSetParameters | AudioMsgSetParameters | VideoMsgSetParameters | FileMsgSetParameters
3111
+
3112
+
3113
+ type CreateMsgType = CreateTextMsgParameters | CreateImgMsgParameters | CreateCmdMsgParameters | CreateFileMsgParameters | CreateVideoMsgParameters | CreateCustomMsgParameters | CreateLocationMsgParameters | CreateChannelMsgParameters | CreateDeliveryMsgParameters | CreateReadMsgParameters | CreateAudioMsgParameters
3114
+
3115
+ type MessageBody = ReadMsgBody | DeliveryMsgBody | ChannelMsgBody | TextMsgBody | CmdMsgBody | CustomMsgBody | LocationMsgBody | ImgMsgBody | AudioMsgBody | VideoMsgBody | FileMsgBody;
3116
+
3117
+ class Message {
3118
+ id: string;
3119
+ type: MessageType;
3120
+ body?: MessageBody;
3121
+ constructor(type: MessageType, id?: string);
3122
+ static createOldMsg(options: NewMessageParamters): MessageBody;
3123
+ static create(options: CreateMsgType): MessageBody;
3124
+ set(options: MessageSetParameters): void;
3125
+ }
3126
+
3127
+ /**
3128
+ * @moudle utils
3129
+ */
3130
+
3131
+ interface AjaxOptions {
3132
+ url: string;
3133
+ dataType?: string;
3134
+ type?: string;
3135
+ data?: any;
3136
+ headers?: KVString;
3137
+ responseType?: "arraybuffer" | "blob" | "document" | "json" | "text";
3138
+ mimeType?: string;
3139
+ success?: (res: any) => any;
3140
+ error?: (res: any) => any;
3141
+ }
3142
+
3143
+ enum PLATFORM {
3144
+ WEB = "web",
3145
+ WX = "wx",
3146
+ ZFB = "zfb",
3147
+ TT = "tt",
3148
+ BAIDU = "baidu",
3149
+ QUICK_APP = "quick_app",
3150
+ UNI = "uni"
3151
+ }
3152
+ interface EnvInfo {
3153
+ platform: PLATFORM;
3154
+ global: any;
3155
+ }
3156
+ interface Uri {
1281
3157
  url: string;
1282
- type: string;
1283
3158
  filename: string;
1284
- };
1285
- }
1286
- declare interface ImgMsgBody extends ImgMsgSetParameters {
1287
- id?: string;
1288
- type: 'img';
1289
- time: number;
1290
- secret?: string;
1291
- thumb?: string;
1292
- thumb_secret?: string;
1293
- }
1294
- declare interface CreateImgOps {
1295
- type: 'img';
1296
- chatType: ChatType;
1297
- file: File;
1298
- url?: string;
1299
- width?: number;
1300
- height?: number;
1301
- to: string;
1302
- onFileUploadError?: (error: any) => any;
1303
- onFileUploadComplete?: (data: any) => any;
1304
- onFileUploadProgress?: (data: any) => any;
1305
- uploadError?: () => any;
1306
- uploadComplete?: () => any;
1307
- time?: number;
1308
- ext?: {
1309
- [key: string]: any;
1310
- };
1311
- msgConfig?: {
1312
- [key: string]: any;
1313
- };
1314
- }
1315
- declare interface AudioMsgSetParameters {
1316
- chatType: ChatType;
1317
- file: File;
1318
- filename: string;
1319
- length: number;
1320
- file_length: number;
1321
- fileInputId?: string;
1322
- to: string;
1323
- from?: string;
1324
- roomType?: boolean;
1325
- success?: () => any;
1326
- fail?: () => any;
1327
- ext?: {
1328
- [key: string]: any;
1329
- };
1330
- time?: number;
1331
- apiUrl: string;
1332
- onFileUploadError?: () => any;
1333
- onFileUploadComplete: () => any;
1334
- onFileUploadProgress?: () => any;
1335
- msgConfig?: {
1336
- [key: string]: any;
1337
- };
1338
- }
1339
- declare interface AudioMsgBody {
1340
- id?: string;
1341
- type: 'audio';
1342
- chatType: ChatType;
1343
- url: string;
1344
- length: number;
1345
- to: string;
1346
- from: string;
1347
- secret: string;
1348
- file: any;
1349
- filename: string;
1350
- file_length: number;
1351
- filetype: string;
1352
- accessToken: string;
1353
- time?: number;
1354
- ext?: {
1355
- [key: string]: any;
1356
- };
1357
- msgConfig?: {
1358
- [key: string]: any;
1359
- };
1360
- }
1361
- declare interface VideoMsgSetParameters {
1362
- chatType: ChatType;
1363
- file: File;
1364
- filename: string;
1365
- length: number;
1366
- file_length: number;
1367
- fileInputId?: string;
1368
- to: string;
1369
- from?: string;
1370
- roomType?: boolean;
1371
- success?: () => any;
1372
- fail?: () => any;
1373
- ext?: {
1374
- [key: string]: any;
1375
- };
1376
- time?: number;
1377
- apiUrl: string;
1378
- onFileUploadError?: () => any;
1379
- onFileUploadComplete: () => any;
1380
- onFileUploadProgress?: () => any;
1381
- msgConfig?: {
1382
- [key: string]: any;
1383
- };
1384
- }
1385
- declare interface VideoMsgBody {
1386
- id?: string;
1387
- type: 'video';
1388
- chatType: ChatType;
1389
- url: string;
1390
- length: number;
1391
- to: string;
1392
- from: string;
1393
- secret: string;
1394
- filename: string;
1395
- file: any;
1396
- file_length: number;
1397
- filetype: string;
1398
- accessToken: string;
1399
- time?: number;
1400
- ext?: {
1401
- [key: string]: any;
1402
- };
1403
- msgConfig?: {
1404
- [key: string]: any;
1405
- };
1406
- onFileUploadCompletets?: (data: any) => any;
1407
- }
1408
- declare interface FileMsgSetParameters {
1409
- chatType: ChatType;
1410
- file: File;
1411
- filename: string;
1412
- fileInputId?: string;
1413
- to: string;
1414
- from?: string;
1415
- roomType?: boolean;
1416
- success?: () => any;
1417
- fail?: () => any;
1418
- ext?: {
1419
- [key: string]: any;
1420
- };
1421
- time?: number;
1422
- apiUrl: string;
1423
- onFileUploadError?: () => any;
1424
- onFileUploadComplete: () => any;
1425
- onFileUploadProgress?: () => any;
1426
- msgConfig?: {
1427
- [key: string]: any;
1428
- };
1429
- }
1430
- declare interface FileMsgBody {
1431
- id?: string;
1432
- type: 'file';
1433
- chatType: ChatType;
1434
- from: string;
1435
- to: string;
1436
- url: string;
1437
- secret: string;
1438
- filename: string;
1439
- length: number;
1440
- file: any;
1441
- file_length: number;
1442
- filetype: string;
1443
- accessToken: string;
1444
- ext?: {
1445
- [key: string]: any;
1446
- };
1447
- time: number;
1448
- msgConfig?: {
3159
+ filetype: string;
3160
+ data: File | null;
3161
+ }
3162
+ interface UploadFile {
3163
+ onFileUploadProgress?: (msg: any) => any;
3164
+ onFileUploadComplete?: (msg: any) => any;
3165
+ onFileUploadError?: (msg: any) => any;
3166
+ onFileUploadCanceled?: (msg: any) => any;
3167
+ accessToken: string;
3168
+ appKey: string;
3169
+ apiUrl?: string;
3170
+ uploadUrl?: string;
3171
+ file: object;
3172
+ }
3173
+ interface DownloadParams {
3174
+ onFileDownloadComplete: (data: any) => any;
3175
+ onFileDownloadError: (error: any) => any;
3176
+ id: string;
3177
+ secret: string;
1449
3178
  [key: string]: any;
1450
- };
1451
- }
1452
- declare interface ReceivedMsgBody {
1453
- id: string;
1454
- mid: string;
1455
- to: string;
1456
- time: number;
1457
- }
1458
- declare interface ReadMsgBody {
1459
- id?: string;
1460
- ackId?: string;
1461
- type: 'read';
1462
- to: string;
1463
- from?: string;
1464
- mid?: string;
1465
- groupReadCount?: number;
1466
- ackContent?: string;
1467
- }
1468
- declare interface RecallMsgBody {
1469
- id?: string;
1470
- from: string;
1471
- to: string;
1472
- mid: string;
1473
- }
1474
- declare interface MuteMsgBody {
1475
- mid: string;
1476
- }
1477
- declare interface ContactMsgBody {
1478
- to: string;
1479
- from: string;
1480
- status: string;
1481
- type: 'subscribed' | 'unsubscribed' | 'subscribe';
3179
+ }
3180
+ interface Utils {
3181
+ getUniqueId: () => string;
3182
+ ajax: (options: AjaxOptions) => Promise<any>;
3183
+ getFileUrl: (fileInputId: string | HTMLInputElement) => Uri;
3184
+ uploadFile: (options: UploadFile) => void;
3185
+ listenNetwork: (online: () => any, offline: () => any) => void;
3186
+ getEnvInfo: () => EnvInfo;
3187
+ wxRequest: (options: AjaxOptions) => Promise<any>;
3188
+ parseDownloadResponse: (res: any) => string;
3189
+ download: (params: DownloadParams) => any;
3190
+ }
1482
3191
  }
1483
- declare type MessagesType = TextMsgBody | DeliveryMsgBody | ChannelMsgBody | CmdMsgBody | CustomMsgBody | ImgMsgBody | LocationMsgBody | AudioMsgBody | VideoMsgBody | FileMsgBody | ReadMsgBody;
1484
- export { MessageType, ReadMsgSetParameters, ReadParameters, DeliveryMsgSetParameters, ChannelMsgSetParameters, TextMsgSetParameters, CmdMsgSetParameters, CustomMsgSetParameters, LocationMsgSetParameters, ImgMsgSetParameters, AudioMsgSetParameters, VideoMsgSetParameters, FileMsgSetParameters, ChatType, TextMsgBody, DeliveryMsgBody, ChannelMsgBody, CmdMsgBody, CustomMsgBody, ImgMsgBody, CreateImgOps, LocationMsgBody, AudioMsgBody, VideoMsgBody, FileMsgBody, ReceivedMsgBody, ReadMsgBody, RecallMsgBody, MuteMsgBody, ContactMsgBody, MessagesType };
1485
-
1486
- declare let EasemobChat: {
1487
- connection: typeof Connection;
1488
- message: typeof Message;
1489
- utils: Utils;
1490
- logger: Logger;
1491
- statusCode: typeof Code;
1492
- };