easemob-websdk 4.0.1-beta5 → 4.0.2

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