easemob-websdk 4.1.0 → 4.1.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/CHANGELOG.md +16 -1
- package/Easemob-chat.d.ts +347 -54
- package/Easemob-chat.js +1 -1
- package/contact/contact.d.ts +42 -24
- package/contact/contact.js +1 -1
- package/group/group.d.ts +4 -0
- package/group/group.js +1 -1
- package/message/audio.d.ts +15 -0
- package/message/cmd.d.ts +15 -0
- package/message/custom.d.ts +14 -0
- package/message/file.d.ts +14 -0
- package/message/img.d.ts +13 -0
- package/message/location.d.ts +13 -0
- package/message/text.d.ts +13 -0
- package/message/video.d.ts +13 -0
- package/miniProgram/Easemob-chat.js +1 -0
- package/package.json +1 -1
- package/types/eventHandler.d.ts +1 -1
- package/types/message.ts +931 -0
- package/uniApp/Easemob-chat.js +1 -0
package/types/message.ts
ADDED
|
@@ -0,0 +1,931 @@
|
|
|
1
|
+
import { Reaction } from './reactionApi';
|
|
2
|
+
import { TranslationResult } from './translation';
|
|
3
|
+
import { ChatThread, ChatThreadOverview } from './threadApi';
|
|
4
|
+
type MessageType =
|
|
5
|
+
| 'read'
|
|
6
|
+
| 'delivery'
|
|
7
|
+
| 'channel'
|
|
8
|
+
| 'txt'
|
|
9
|
+
| 'cmd'
|
|
10
|
+
| 'custom'
|
|
11
|
+
| 'loc'
|
|
12
|
+
| 'img'
|
|
13
|
+
| 'audio'
|
|
14
|
+
| 'file'
|
|
15
|
+
| 'video';
|
|
16
|
+
|
|
17
|
+
type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
|
|
18
|
+
|
|
19
|
+
/** Message online state type. */
|
|
20
|
+
/** 消息在线状态类型。 */
|
|
21
|
+
export enum ONLINESTATETYPE {
|
|
22
|
+
/** Offline message. */
|
|
23
|
+
/** 离线消息。 */
|
|
24
|
+
OFFLINE = 0,
|
|
25
|
+
/** Online message. */
|
|
26
|
+
/** 在线消息。 */
|
|
27
|
+
ONLINE = 1,
|
|
28
|
+
/** Unknown state. */
|
|
29
|
+
/** 未知状态。 */
|
|
30
|
+
UNKNOWN = 2,
|
|
31
|
+
/** Message online status is not enabled. */
|
|
32
|
+
/** 未启用消息在线状态。 */
|
|
33
|
+
NONE = 3,
|
|
34
|
+
}
|
|
35
|
+
interface ReadMsgSetParameters {
|
|
36
|
+
id: string;
|
|
37
|
+
to: string;
|
|
38
|
+
from?: string;
|
|
39
|
+
}
|
|
40
|
+
interface ReadMsgBody extends ReadMsgSetParameters {
|
|
41
|
+
type: 'read';
|
|
42
|
+
ackId?: string;
|
|
43
|
+
mid?: string;
|
|
44
|
+
groupReadCount?: number;
|
|
45
|
+
ackContent?: string;
|
|
46
|
+
onlineState?: ONLINESTATETYPE;
|
|
47
|
+
}
|
|
48
|
+
interface ReadParameters {
|
|
49
|
+
type: 'read';
|
|
50
|
+
id: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface CreateReadMsgParameters {
|
|
54
|
+
/** The receiver. */
|
|
55
|
+
/** 消息接收方。 */
|
|
56
|
+
to: string;
|
|
57
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
58
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
59
|
+
from?: string;
|
|
60
|
+
/** The message type. */
|
|
61
|
+
/** 消息类型。 */
|
|
62
|
+
type: 'read';
|
|
63
|
+
/** The ID of the read message */
|
|
64
|
+
/** 已读消息的 ID。 */
|
|
65
|
+
id: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface DeliveryParameters {
|
|
69
|
+
id: string;
|
|
70
|
+
type: 'delivery';
|
|
71
|
+
}
|
|
72
|
+
interface DeliveryMsgSetParameters {
|
|
73
|
+
ackId: string;
|
|
74
|
+
to: string;
|
|
75
|
+
from?: string;
|
|
76
|
+
}
|
|
77
|
+
interface DeliveryMsgBody {
|
|
78
|
+
id: string;
|
|
79
|
+
mid?: string;
|
|
80
|
+
ackId?: string;
|
|
81
|
+
type: 'delivery';
|
|
82
|
+
to: string;
|
|
83
|
+
from?: string;
|
|
84
|
+
onlineState?: ONLINESTATETYPE;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface CreateDeliveryMsgParameters {
|
|
88
|
+
/** The delivered message ID. */
|
|
89
|
+
/** 送达消息 ID。 */
|
|
90
|
+
ackId: string;
|
|
91
|
+
/** The message type. */
|
|
92
|
+
/** 消息类型。 */
|
|
93
|
+
type: 'delivery';
|
|
94
|
+
/** The receiver. */
|
|
95
|
+
/** 消息接收方。 */
|
|
96
|
+
to: string;
|
|
97
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
98
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
99
|
+
from?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface TextParameters {
|
|
103
|
+
type: 'txt';
|
|
104
|
+
id: string;
|
|
105
|
+
}
|
|
106
|
+
interface TextMsgSetParameters {
|
|
107
|
+
chatType: ChatType;
|
|
108
|
+
to: string;
|
|
109
|
+
msg: string;
|
|
110
|
+
from?: string;
|
|
111
|
+
roomType?: boolean;
|
|
112
|
+
success?: () => void;
|
|
113
|
+
fail?: () => void;
|
|
114
|
+
ext?: { [key: string]: any };
|
|
115
|
+
}
|
|
116
|
+
interface TextMsgBody {
|
|
117
|
+
id: string;
|
|
118
|
+
chatType: ChatType;
|
|
119
|
+
type: 'txt';
|
|
120
|
+
to: string;
|
|
121
|
+
msg: string;
|
|
122
|
+
from?: string;
|
|
123
|
+
roomType?: boolean;
|
|
124
|
+
group?: string;
|
|
125
|
+
success?: () => void;
|
|
126
|
+
fail?: () => void;
|
|
127
|
+
ext?: { [key: string]: any };
|
|
128
|
+
msgConfig?: { [key: string]: any };
|
|
129
|
+
time: number;
|
|
130
|
+
reactions?: Reaction;
|
|
131
|
+
translations?: TranslationResult;
|
|
132
|
+
chatThread?: ChatThread;
|
|
133
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
134
|
+
onlineState?: ONLINESTATETYPE;
|
|
135
|
+
priority?: MessagePriority;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
interface CreateTextMsgParameters {
|
|
139
|
+
/** Session type. */
|
|
140
|
+
/** 会话类型。 */
|
|
141
|
+
chatType: ChatType;
|
|
142
|
+
/** Message type. */
|
|
143
|
+
/** 消息类型。 */
|
|
144
|
+
type: 'txt';
|
|
145
|
+
/** The receiver. */
|
|
146
|
+
/** 消息接收方。 */
|
|
147
|
+
to: string;
|
|
148
|
+
/** The message content. */
|
|
149
|
+
/** 消息内容。 */
|
|
150
|
+
msg: string;
|
|
151
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
152
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
153
|
+
from?: string;
|
|
154
|
+
/** Message extension. */
|
|
155
|
+
/** 消息扩展。 */
|
|
156
|
+
ext?: { [key: string]: any };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface CmdParameters {
|
|
160
|
+
type: 'cmd';
|
|
161
|
+
id: string;
|
|
162
|
+
}
|
|
163
|
+
interface CmdMsgSetParameters {
|
|
164
|
+
chatType: ChatType;
|
|
165
|
+
to: string;
|
|
166
|
+
action: string;
|
|
167
|
+
from?: string;
|
|
168
|
+
roomType?: boolean;
|
|
169
|
+
success?: () => void;
|
|
170
|
+
fail?: () => void;
|
|
171
|
+
ext?: { [key: string]: any };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
interface CmdMsgBody {
|
|
175
|
+
id: string;
|
|
176
|
+
chatType: ChatType;
|
|
177
|
+
type: 'cmd';
|
|
178
|
+
to: string;
|
|
179
|
+
action: string;
|
|
180
|
+
from?: string;
|
|
181
|
+
roomType?: boolean;
|
|
182
|
+
group?: string;
|
|
183
|
+
success?: () => void;
|
|
184
|
+
fail?: () => void;
|
|
185
|
+
ext?: { [key: string]: any };
|
|
186
|
+
msgConfig?: { [key: string]: any };
|
|
187
|
+
time: number;
|
|
188
|
+
reactions?: Reaction;
|
|
189
|
+
chatThread?: ChatThread;
|
|
190
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
191
|
+
onlineState?: ONLINESTATETYPE;
|
|
192
|
+
priority?: MessagePriority;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface CreateCmdMsgParameters {
|
|
196
|
+
/** The message type. */
|
|
197
|
+
/** 消息类型。 */
|
|
198
|
+
type: 'cmd';
|
|
199
|
+
/** The session type. */
|
|
200
|
+
/** 会话类型。 */
|
|
201
|
+
chatType: ChatType;
|
|
202
|
+
/** The receiver. */
|
|
203
|
+
/** 消息接收方。 */
|
|
204
|
+
to: string;
|
|
205
|
+
/** The command. */
|
|
206
|
+
/** 指令。 */
|
|
207
|
+
action: string;
|
|
208
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
209
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
210
|
+
from?: string;
|
|
211
|
+
// roomType?: boolean,
|
|
212
|
+
/** The message extension. */
|
|
213
|
+
/** 消息扩展。 */
|
|
214
|
+
ext?: { [key: string]: any };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface CustomParameters {
|
|
218
|
+
type: 'custom';
|
|
219
|
+
id: string;
|
|
220
|
+
}
|
|
221
|
+
interface CustomMsgSetParameters {
|
|
222
|
+
chatType: ChatType;
|
|
223
|
+
to: string;
|
|
224
|
+
customEvent: string;
|
|
225
|
+
customExts: { [key: string]: any };
|
|
226
|
+
from?: string;
|
|
227
|
+
roomType?: boolean;
|
|
228
|
+
success?: () => void;
|
|
229
|
+
fail?: () => void;
|
|
230
|
+
ext?: { [key: string]: any };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface CustomMsgBody {
|
|
234
|
+
id: string;
|
|
235
|
+
chatType: ChatType;
|
|
236
|
+
type: 'custom';
|
|
237
|
+
to: string;
|
|
238
|
+
customEvent: string;
|
|
239
|
+
customExts: { [key: string]: any };
|
|
240
|
+
from?: string;
|
|
241
|
+
roomType?: boolean;
|
|
242
|
+
group?: string;
|
|
243
|
+
params?: { [key: string]: any };
|
|
244
|
+
success?: () => void;
|
|
245
|
+
fail?: () => void;
|
|
246
|
+
ext?: { [key: string]: any };
|
|
247
|
+
msgConfig?: { [key: string]: any };
|
|
248
|
+
time: number;
|
|
249
|
+
reactions?: Reaction;
|
|
250
|
+
chatThread?: ChatThread;
|
|
251
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
252
|
+
onlineState?: ONLINESTATETYPE;
|
|
253
|
+
priority?: MessagePriority;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
interface CreateCustomMsgParameters {
|
|
257
|
+
/** The message type. */
|
|
258
|
+
/** 消息类型。 */
|
|
259
|
+
type: 'custom';
|
|
260
|
+
/** The session type. */
|
|
261
|
+
/** 会话类型。 */
|
|
262
|
+
chatType: ChatType;
|
|
263
|
+
/** The receiver. */
|
|
264
|
+
/** 消息接收方。 */
|
|
265
|
+
to: string;
|
|
266
|
+
/** The custom event. */
|
|
267
|
+
/** 自定义事件。 */
|
|
268
|
+
customEvent: string;
|
|
269
|
+
/** The custom event extension. */
|
|
270
|
+
/** 自定事件扩展。 */
|
|
271
|
+
customExts: { [key: string]: any };
|
|
272
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
273
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
274
|
+
from?: string;
|
|
275
|
+
/** Message extension. */
|
|
276
|
+
/** 消息扩展。 */
|
|
277
|
+
ext?: { [key: string]: any };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
interface LocationParameters {
|
|
281
|
+
type: 'loc';
|
|
282
|
+
id: string;
|
|
283
|
+
}
|
|
284
|
+
interface LocationMsgSetParameters {
|
|
285
|
+
chatType: ChatType;
|
|
286
|
+
to: string;
|
|
287
|
+
addr: string;
|
|
288
|
+
buildingName: string;
|
|
289
|
+
lat: number;
|
|
290
|
+
lng: number;
|
|
291
|
+
from?: string;
|
|
292
|
+
roomType?: boolean;
|
|
293
|
+
success?: () => void;
|
|
294
|
+
fail?: () => void;
|
|
295
|
+
ext?: { [key: string]: any };
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
interface LocationMsgBody {
|
|
299
|
+
id: string;
|
|
300
|
+
chatType: ChatType;
|
|
301
|
+
type: 'loc';
|
|
302
|
+
to: string;
|
|
303
|
+
addr: string;
|
|
304
|
+
buildingName: string;
|
|
305
|
+
lat: number;
|
|
306
|
+
lng: number;
|
|
307
|
+
from?: string;
|
|
308
|
+
roomType?: boolean;
|
|
309
|
+
group?: string;
|
|
310
|
+
success?: () => void;
|
|
311
|
+
fail?: () => void;
|
|
312
|
+
ext?: { [key: string]: any };
|
|
313
|
+
msgConfig?: { [key: string]: any };
|
|
314
|
+
time: number;
|
|
315
|
+
reactions?: Reaction;
|
|
316
|
+
chatThread?: ChatThread;
|
|
317
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
318
|
+
onlineState?: ONLINESTATETYPE;
|
|
319
|
+
priority?: MessagePriority;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
interface CreateLocationMsgParameters {
|
|
323
|
+
/** The message type. */
|
|
324
|
+
/** 消息类型。 */
|
|
325
|
+
type: 'loc';
|
|
326
|
+
/** The session type. */
|
|
327
|
+
/** 会话类型。 */
|
|
328
|
+
chatType: ChatType;
|
|
329
|
+
/** The receiver. */
|
|
330
|
+
/** 消息接收方。 */
|
|
331
|
+
to: string;
|
|
332
|
+
/** The building name. */
|
|
333
|
+
/** 建筑物名称。 */
|
|
334
|
+
buildingName: string;
|
|
335
|
+
/** Address. */
|
|
336
|
+
/** 地址。 */
|
|
337
|
+
addr: string;
|
|
338
|
+
/** The latitude. */
|
|
339
|
+
/** 纬度。 */
|
|
340
|
+
lat: number;
|
|
341
|
+
/** The longitude. */
|
|
342
|
+
/** 精度。 */
|
|
343
|
+
lng: number;
|
|
344
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
345
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
346
|
+
from?: string;
|
|
347
|
+
/** Message extension. */
|
|
348
|
+
/** 消息扩展。 */
|
|
349
|
+
ext?: { [key: string]: any };
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface ImgParameters {
|
|
353
|
+
type: 'img';
|
|
354
|
+
id: string;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
interface ImgMsgSetParameters {
|
|
358
|
+
chatType: ChatType;
|
|
359
|
+
to: string;
|
|
360
|
+
file: object;
|
|
361
|
+
width?: number;
|
|
362
|
+
height?: number;
|
|
363
|
+
fileInputId?: string;
|
|
364
|
+
from?: string;
|
|
365
|
+
roomType?: boolean;
|
|
366
|
+
group?: string;
|
|
367
|
+
success?: () => void;
|
|
368
|
+
fail?: () => void;
|
|
369
|
+
ext?: { [key: string]: any };
|
|
370
|
+
url?: string;
|
|
371
|
+
onFileUploadError?: (error: any) => void;
|
|
372
|
+
onFileUploadComplete?: (data: any) => void;
|
|
373
|
+
onFileUploadProgress?: (data: any) => void;
|
|
374
|
+
uploadError?: () => void;
|
|
375
|
+
uploadComplete?: () => void;
|
|
376
|
+
msgConfig?: { [key: string]: any };
|
|
377
|
+
body?: {
|
|
378
|
+
url: string;
|
|
379
|
+
type: string;
|
|
380
|
+
filename: string;
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
interface ImgMsgBody extends ImgMsgSetParameters {
|
|
385
|
+
id: string;
|
|
386
|
+
type: 'img';
|
|
387
|
+
time: number;
|
|
388
|
+
secret?: string;
|
|
389
|
+
thumb?: string;
|
|
390
|
+
thumb_secret?: string;
|
|
391
|
+
reactions?: Reaction;
|
|
392
|
+
chatThread?: ChatThread;
|
|
393
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
394
|
+
onlineState?: ONLINESTATETYPE;
|
|
395
|
+
priority?: MessagePriority;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
interface CreateImgMsgParameters {
|
|
399
|
+
/** Message type. */
|
|
400
|
+
/** 消息类型。 */
|
|
401
|
+
type: 'img';
|
|
402
|
+
/** Session type. */
|
|
403
|
+
/** 会话类型。 */
|
|
404
|
+
chatType: ChatType;
|
|
405
|
+
/** The file object. */
|
|
406
|
+
/** 文件对象。 */
|
|
407
|
+
file: File;
|
|
408
|
+
/** The file URL. If the file has been uploaded, you can directly use the URL. */
|
|
409
|
+
/** 文件 url,如果文件已经上传可以直接使用 url。 */
|
|
410
|
+
url?: string;
|
|
411
|
+
/** The image width. */
|
|
412
|
+
/** 图片宽度。 */
|
|
413
|
+
width?: number;
|
|
414
|
+
/** The image height. */
|
|
415
|
+
/** 图片高度。 */
|
|
416
|
+
height?: number;
|
|
417
|
+
/** The receiver. */
|
|
418
|
+
/** 消息接收方。 */
|
|
419
|
+
to: string;
|
|
420
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
421
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
422
|
+
from?: string;
|
|
423
|
+
/** The callback of file upload error. */
|
|
424
|
+
/** 文件上传错误的回调。 */
|
|
425
|
+
onFileUploadError?: (error: any) => void;
|
|
426
|
+
/** The callback of file upload complete. */
|
|
427
|
+
/** 文件上传完成的回调。 */
|
|
428
|
+
onFileUploadComplete?: (data: any) => void;
|
|
429
|
+
/** The callback of file upload progress. */
|
|
430
|
+
/** 文件上传进度的回调。 */
|
|
431
|
+
onFileUploadProgress?: (data: any) => void;
|
|
432
|
+
/** Message extension. */
|
|
433
|
+
/** 消息扩展。 */
|
|
434
|
+
ext?: { [key: string]: any };
|
|
435
|
+
/** The message body. */
|
|
436
|
+
/** 消息体。 */
|
|
437
|
+
body?: {
|
|
438
|
+
/** The file URL. */
|
|
439
|
+
/** 文件 url。 */
|
|
440
|
+
url: string;
|
|
441
|
+
/** The file type. */
|
|
442
|
+
/** 文件类型。 */
|
|
443
|
+
type: string;
|
|
444
|
+
/** The file type. */
|
|
445
|
+
/** 文件名。 */
|
|
446
|
+
filename: string;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface AudioParameters {
|
|
451
|
+
type: 'audio';
|
|
452
|
+
id: string;
|
|
453
|
+
}
|
|
454
|
+
interface AudioMsgSetParameters {
|
|
455
|
+
chatType: ChatType;
|
|
456
|
+
file: object;
|
|
457
|
+
filename: string;
|
|
458
|
+
length: number;
|
|
459
|
+
file_length: number;
|
|
460
|
+
fileInputId?: string;
|
|
461
|
+
to: string;
|
|
462
|
+
from?: string;
|
|
463
|
+
roomType?: boolean;
|
|
464
|
+
success?: () => void;
|
|
465
|
+
fail?: () => void;
|
|
466
|
+
ext?: { [key: string]: any };
|
|
467
|
+
apiUrl?: string;
|
|
468
|
+
onFileUploadError?: (err: any) => void;
|
|
469
|
+
onFileUploadComplete?: (data: any) => void;
|
|
470
|
+
onFileUploadProgress?: (data: ProgressEvent) => void;
|
|
471
|
+
body?: {
|
|
472
|
+
url: string;
|
|
473
|
+
type: string;
|
|
474
|
+
filename: string;
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
interface AudioMsgBody extends AudioMsgSetParameters {
|
|
479
|
+
id: string;
|
|
480
|
+
type: 'audio';
|
|
481
|
+
url?: string;
|
|
482
|
+
secret?: string;
|
|
483
|
+
filetype?: string;
|
|
484
|
+
accessToken?: string;
|
|
485
|
+
group?: string;
|
|
486
|
+
msgConfig?: { [key: string]: any };
|
|
487
|
+
time: number;
|
|
488
|
+
reactions?: Reaction;
|
|
489
|
+
chatThread?: ChatThread;
|
|
490
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
491
|
+
onlineState?: ONLINESTATETYPE;
|
|
492
|
+
priority?: MessagePriority;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
interface CreateAudioMsgParameters {
|
|
496
|
+
/** The message type. */
|
|
497
|
+
/** 消息类型。 */
|
|
498
|
+
type: 'video';
|
|
499
|
+
/** The session type. */
|
|
500
|
+
/** 会话类型。 */
|
|
501
|
+
chatType: ChatType;
|
|
502
|
+
/** The file object. */
|
|
503
|
+
/** 文件对象。 */
|
|
504
|
+
file: object;
|
|
505
|
+
/** The file name. */
|
|
506
|
+
/** 文件名。 */
|
|
507
|
+
filename: string;
|
|
508
|
+
/** The video duration. */
|
|
509
|
+
/** 视频时长。 */
|
|
510
|
+
length: number;
|
|
511
|
+
/** The video file length. */
|
|
512
|
+
/** 视频文件大小。 */
|
|
513
|
+
file_length: number;
|
|
514
|
+
/** The input ID of the uploaded file. */
|
|
515
|
+
/** 上传文件的input ID。 */
|
|
516
|
+
fileInputId?: string;
|
|
517
|
+
/** The receiver. */
|
|
518
|
+
/** 消息的接收方。 */
|
|
519
|
+
to: string;
|
|
520
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
521
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
522
|
+
from?: string;
|
|
523
|
+
/** Message extension. */
|
|
524
|
+
/** 消息扩展。 */
|
|
525
|
+
ext?: { [key: string]: any };
|
|
526
|
+
// apiUrl?: string,
|
|
527
|
+
/** The callback of file upload error. */
|
|
528
|
+
/** 文件上传错误的回调。 */
|
|
529
|
+
onFileUploadError?: (error: any) => void;
|
|
530
|
+
/** The callback of file upload complete. */
|
|
531
|
+
/** 文件上传完成的回调。 */
|
|
532
|
+
onFileUploadComplete?: (data: any) => void;
|
|
533
|
+
/** The callback of file upload progress. */
|
|
534
|
+
/** 文件上传进度的回调。 */
|
|
535
|
+
onFileUploadProgress?: (data: any) => void;
|
|
536
|
+
/** The message body. */
|
|
537
|
+
/** 消息体。 */
|
|
538
|
+
body?: {
|
|
539
|
+
/** The file URL. */
|
|
540
|
+
/** 文件 url。 */
|
|
541
|
+
url: string;
|
|
542
|
+
/** The file type. */
|
|
543
|
+
/** 文件类型。 */
|
|
544
|
+
type: string;
|
|
545
|
+
/** The file type. */
|
|
546
|
+
/** 文件名。 */
|
|
547
|
+
filename: string;
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
interface VideoParameters {
|
|
552
|
+
type: 'video';
|
|
553
|
+
id: string;
|
|
554
|
+
}
|
|
555
|
+
interface VideoMsgSetParameters {
|
|
556
|
+
chatType: ChatType;
|
|
557
|
+
file: object;
|
|
558
|
+
filename: string;
|
|
559
|
+
length: number;
|
|
560
|
+
file_length: number;
|
|
561
|
+
fileInputId?: string;
|
|
562
|
+
to: string;
|
|
563
|
+
from?: string;
|
|
564
|
+
roomType?: boolean;
|
|
565
|
+
success?: () => void;
|
|
566
|
+
fail?: () => void;
|
|
567
|
+
ext?: { [key: string]: any };
|
|
568
|
+
apiUrl?: string;
|
|
569
|
+
onFileUploadError?: (err: any) => void;
|
|
570
|
+
onFileUploadComplete?: (data: any) => void;
|
|
571
|
+
onFileUploadProgress?: (data: ProgressEvent) => void;
|
|
572
|
+
body?: {
|
|
573
|
+
url: string;
|
|
574
|
+
type: string;
|
|
575
|
+
filename: string;
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
interface VideoMsgBody extends VideoMsgSetParameters {
|
|
580
|
+
id: string;
|
|
581
|
+
type: 'video';
|
|
582
|
+
url?: string;
|
|
583
|
+
secret?: string;
|
|
584
|
+
filetype?: string;
|
|
585
|
+
accessToken?: string;
|
|
586
|
+
msgConfig?: { [key: string]: any };
|
|
587
|
+
group?: string;
|
|
588
|
+
time: number;
|
|
589
|
+
reactions?: Reaction;
|
|
590
|
+
chatThread?: ChatThread;
|
|
591
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
592
|
+
onlineState?: ONLINESTATETYPE;
|
|
593
|
+
priority?: MessagePriority;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
interface CreateVideoMsgParameters {
|
|
597
|
+
/** The message type. */
|
|
598
|
+
/** 消息类型。 */
|
|
599
|
+
type: 'video';
|
|
600
|
+
/** The session type. */
|
|
601
|
+
/** 会话类型。 */
|
|
602
|
+
chatType: ChatType;
|
|
603
|
+
/** The file object. */
|
|
604
|
+
/** 文件对象。 */
|
|
605
|
+
file: object;
|
|
606
|
+
/** The file name. */
|
|
607
|
+
/** 文件名。 */
|
|
608
|
+
filename: string;
|
|
609
|
+
/** The video duration. */
|
|
610
|
+
/** 视频时长。 */
|
|
611
|
+
length: number;
|
|
612
|
+
/** The video file length. */
|
|
613
|
+
/** 视频文件大小。 */
|
|
614
|
+
file_length: number;
|
|
615
|
+
/** The input ID of the uploaded file. */
|
|
616
|
+
/** 上传文件的input ID。 */
|
|
617
|
+
fileInputId?: string;
|
|
618
|
+
/** The receiver. */
|
|
619
|
+
/** 消息的接收方。 */
|
|
620
|
+
to: string;
|
|
621
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
622
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
623
|
+
from?: string;
|
|
624
|
+
/** Message extension. */
|
|
625
|
+
/** 消息扩展。 */
|
|
626
|
+
ext?: { [key: string]: any };
|
|
627
|
+
// apiUrl?: string,
|
|
628
|
+
/** The callback of file upload error. */
|
|
629
|
+
/** 文件上传错误的回调。 */
|
|
630
|
+
onFileUploadError?: (error: any) => void;
|
|
631
|
+
/** The callback of file upload complete. */
|
|
632
|
+
/** 文件上传完成的回调。 */
|
|
633
|
+
onFileUploadComplete?: (data: any) => void;
|
|
634
|
+
/** The callback of file upload progress. */
|
|
635
|
+
/** 文件上传进度的回调。 */
|
|
636
|
+
onFileUploadProgress?: (data: any) => void;
|
|
637
|
+
/** The message body. */
|
|
638
|
+
/** 消息体。 */
|
|
639
|
+
body?: {
|
|
640
|
+
/** The file URL. */
|
|
641
|
+
/** 文件 url。 */
|
|
642
|
+
url: string;
|
|
643
|
+
/** The file type. */
|
|
644
|
+
/** 文件类型。 */
|
|
645
|
+
type: string;
|
|
646
|
+
/** The file type. */
|
|
647
|
+
/** 文件名。 */
|
|
648
|
+
filename: string;
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
interface FileParameters {
|
|
653
|
+
type: 'file';
|
|
654
|
+
id: string;
|
|
655
|
+
}
|
|
656
|
+
interface FileMsgSetParameters {
|
|
657
|
+
chatType: ChatType;
|
|
658
|
+
file: any;
|
|
659
|
+
filename: string;
|
|
660
|
+
fileInputId?: string;
|
|
661
|
+
to: string;
|
|
662
|
+
from?: string;
|
|
663
|
+
roomType?: boolean;
|
|
664
|
+
success?: () => void;
|
|
665
|
+
fail?: () => void;
|
|
666
|
+
ext?: { [key: string]: any };
|
|
667
|
+
apiUrl?: string;
|
|
668
|
+
onFileUploadError?: () => void;
|
|
669
|
+
onFileUploadComplete?: () => void;
|
|
670
|
+
onFileUploadProgress?: () => void;
|
|
671
|
+
body?: {
|
|
672
|
+
url: string;
|
|
673
|
+
type: string;
|
|
674
|
+
filename: string;
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
interface FileMsgBody extends FileMsgSetParameters {
|
|
679
|
+
id: string;
|
|
680
|
+
type: 'file';
|
|
681
|
+
group?: string;
|
|
682
|
+
url?: string;
|
|
683
|
+
secret?: string;
|
|
684
|
+
length?: number;
|
|
685
|
+
file_length?: number;
|
|
686
|
+
filetype?: string;
|
|
687
|
+
accessToken?: string;
|
|
688
|
+
msgConfig?: { [key: string]: any };
|
|
689
|
+
time: number;
|
|
690
|
+
reactions?: Reaction;
|
|
691
|
+
chatThread?: ChatThread;
|
|
692
|
+
chatThreadOverview?: ChatThreadOverview;
|
|
693
|
+
onlineState?: ONLINESTATETYPE;
|
|
694
|
+
priority?: MessagePriority;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
interface CreateFileMsgParameters {
|
|
698
|
+
/** The message type. */
|
|
699
|
+
/** 消息类型。 */
|
|
700
|
+
type: 'file';
|
|
701
|
+
/** The session type. */
|
|
702
|
+
/** 会话类型。 */
|
|
703
|
+
chatType: ChatType;
|
|
704
|
+
/** The file object. */
|
|
705
|
+
/** 文件对象。 */
|
|
706
|
+
file: any;
|
|
707
|
+
/** The file name. */
|
|
708
|
+
/** 文件名。 */
|
|
709
|
+
filename: string;
|
|
710
|
+
/** The input ID of the uploaded file. */
|
|
711
|
+
/** 上传文件的input ID。 */
|
|
712
|
+
fileInputId?: string;
|
|
713
|
+
/** The receiver. */
|
|
714
|
+
/** 消息的接收方。 */
|
|
715
|
+
to: string;
|
|
716
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
717
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
718
|
+
from?: string;
|
|
719
|
+
/** Message extension. */
|
|
720
|
+
/** 消息扩展。 */
|
|
721
|
+
ext?: { [key: string]: any };
|
|
722
|
+
// apiUrl?: string,
|
|
723
|
+
/** The callback of file upload error. */
|
|
724
|
+
/** 文件上传错误的回调。 */
|
|
725
|
+
onFileUploadError?: (error: any) => void;
|
|
726
|
+
/** The callback of file upload complete. */
|
|
727
|
+
/** 文件上传完成的回调。 */
|
|
728
|
+
onFileUploadComplete?: (data: any) => void;
|
|
729
|
+
/** The callback of file upload progress. */
|
|
730
|
+
/** 文件上传进度的回调。 */
|
|
731
|
+
onFileUploadProgress?: (data: any) => void;
|
|
732
|
+
/** The message body. */
|
|
733
|
+
/** 消息体。 */
|
|
734
|
+
body?: {
|
|
735
|
+
/** The file URL. */
|
|
736
|
+
/** 文件 url。 */
|
|
737
|
+
url: string;
|
|
738
|
+
/** The file type. */
|
|
739
|
+
/** 文件类型。 */
|
|
740
|
+
type: string;
|
|
741
|
+
/** The file type. */
|
|
742
|
+
/** 文件名。 */
|
|
743
|
+
filename: string;
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
interface ReceivedMsgBody {
|
|
748
|
+
id: string;
|
|
749
|
+
mid: string;
|
|
750
|
+
to: string;
|
|
751
|
+
time: number;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
interface RecallMsgBody {
|
|
755
|
+
id: string;
|
|
756
|
+
from: string;
|
|
757
|
+
to: string;
|
|
758
|
+
mid: string;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
interface MuteMsgBody {
|
|
762
|
+
mid: string;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
interface ContactMsgBody {
|
|
766
|
+
/** The message type, subscribe: request a contact, unsubscribed: cancel or refuse to add contact, subscribed: added contact successfully. */
|
|
767
|
+
/** 消息类型 subscribe: 请求加好友,unsubscribed: 取消或决绝加好友,subscribed: 加好友成功。 */
|
|
768
|
+
type: 'subscribe' | 'unsubscribed' | 'subscribed';
|
|
769
|
+
/** The message receiver. */
|
|
770
|
+
/** 消息接收者。 */
|
|
771
|
+
to: string;
|
|
772
|
+
/** The message sender. */
|
|
773
|
+
/** 消息发送者。 */
|
|
774
|
+
from: string;
|
|
775
|
+
/** Reason. */
|
|
776
|
+
/** 原因。 */
|
|
777
|
+
status?: string;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
interface ChannelMsgSetParameters {
|
|
781
|
+
chatType: ChatType;
|
|
782
|
+
to: string;
|
|
783
|
+
from?: string;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
interface ChannelMsgBody extends ChannelMsgSetParameters {
|
|
787
|
+
id: string;
|
|
788
|
+
group?: string;
|
|
789
|
+
type: 'channel';
|
|
790
|
+
time: number;
|
|
791
|
+
onlineState?: ONLINESTATETYPE;
|
|
792
|
+
}
|
|
793
|
+
interface ChannelParameters {
|
|
794
|
+
type: 'channel';
|
|
795
|
+
id: string;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
interface CreateChannelMsgParameters {
|
|
799
|
+
/** The message type. */
|
|
800
|
+
/** 消息类型。 */
|
|
801
|
+
type: 'channel';
|
|
802
|
+
/** The session type. */
|
|
803
|
+
/** 会话类型。 */
|
|
804
|
+
chatType: ChatType;
|
|
805
|
+
/** The receiver. */
|
|
806
|
+
/** 消息接收方。 */
|
|
807
|
+
to: string;
|
|
808
|
+
/** The sender, only can be yourself and can not de changed. */
|
|
809
|
+
/** 消息发送方,只能是自己,不可改变。*/
|
|
810
|
+
from?: string;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
type MessagesType =
|
|
814
|
+
| TextMsgBody
|
|
815
|
+
| DeliveryMsgBody
|
|
816
|
+
| ChannelMsgBody
|
|
817
|
+
| CmdMsgBody
|
|
818
|
+
| CustomMsgBody
|
|
819
|
+
| ImgMsgBody
|
|
820
|
+
| LocationMsgBody
|
|
821
|
+
| AudioMsgBody
|
|
822
|
+
| VideoMsgBody
|
|
823
|
+
| FileMsgBody
|
|
824
|
+
| ReadMsgBody;
|
|
825
|
+
|
|
826
|
+
type MessageSetParameters =
|
|
827
|
+
| ReadMsgSetParameters
|
|
828
|
+
| DeliveryMsgSetParameters
|
|
829
|
+
| ChannelMsgSetParameters
|
|
830
|
+
| TextMsgSetParameters
|
|
831
|
+
| CmdMsgSetParameters
|
|
832
|
+
| CustomMsgSetParameters
|
|
833
|
+
| LocationMsgSetParameters
|
|
834
|
+
| ImgMsgSetParameters
|
|
835
|
+
| AudioMsgSetParameters
|
|
836
|
+
| VideoMsgSetParameters
|
|
837
|
+
| FileMsgSetParameters;
|
|
838
|
+
|
|
839
|
+
type CreateMsgType =
|
|
840
|
+
| CreateTextMsgParameters
|
|
841
|
+
| CreateImgMsgParameters
|
|
842
|
+
| CreateCmdMsgParameters
|
|
843
|
+
| CreateFileMsgParameters
|
|
844
|
+
| CreateVideoMsgParameters
|
|
845
|
+
| CreateCustomMsgParameters
|
|
846
|
+
| CreateLocationMsgParameters
|
|
847
|
+
| CreateChannelMsgParameters
|
|
848
|
+
| CreateDeliveryMsgParameters
|
|
849
|
+
| CreateReadMsgParameters
|
|
850
|
+
| CreateAudioMsgParameters;
|
|
851
|
+
|
|
852
|
+
type MessageBody =
|
|
853
|
+
| ReadMsgBody
|
|
854
|
+
| DeliveryMsgBody
|
|
855
|
+
| ChannelMsgBody
|
|
856
|
+
| TextMsgBody
|
|
857
|
+
| CmdMsgBody
|
|
858
|
+
| CustomMsgBody
|
|
859
|
+
| LocationMsgBody
|
|
860
|
+
| ImgMsgBody
|
|
861
|
+
| AudioMsgBody
|
|
862
|
+
| VideoMsgBody
|
|
863
|
+
| FileMsgBody;
|
|
864
|
+
|
|
865
|
+
/** The delivery priority of chat room messages.
|
|
866
|
+
* Currently, this attribute is available only to chat room messages. If this attribute is not set, messages are assigned a medium priority. */
|
|
867
|
+
/**
|
|
868
|
+
* 聊天室消息的到达优先级。
|
|
869
|
+
* 目前,仅聊天室消息支持该属性,不传默认为中优先级。*/
|
|
870
|
+
type MessagePriority =
|
|
871
|
+
/** High. */
|
|
872
|
+
/** 高。*/
|
|
873
|
+
| 'high'
|
|
874
|
+
/** Medium. */
|
|
875
|
+
/** 中。*/
|
|
876
|
+
| 'normal'
|
|
877
|
+
/** Low. */
|
|
878
|
+
/** 低。*/
|
|
879
|
+
| 'low';
|
|
880
|
+
|
|
881
|
+
interface PriorityExt {
|
|
882
|
+
chatroom_msg_tag: number;
|
|
883
|
+
}
|
|
884
|
+
export type {
|
|
885
|
+
MessageType,
|
|
886
|
+
ReadMsgSetParameters,
|
|
887
|
+
ReadParameters,
|
|
888
|
+
DeliveryMsgSetParameters,
|
|
889
|
+
ChannelMsgSetParameters,
|
|
890
|
+
TextMsgSetParameters,
|
|
891
|
+
CmdMsgSetParameters,
|
|
892
|
+
CustomMsgSetParameters,
|
|
893
|
+
LocationMsgSetParameters,
|
|
894
|
+
ImgMsgSetParameters,
|
|
895
|
+
AudioMsgSetParameters,
|
|
896
|
+
VideoMsgSetParameters,
|
|
897
|
+
FileMsgSetParameters,
|
|
898
|
+
ChatType,
|
|
899
|
+
TextMsgBody,
|
|
900
|
+
DeliveryMsgBody,
|
|
901
|
+
ChannelMsgBody,
|
|
902
|
+
CmdMsgBody,
|
|
903
|
+
CustomMsgBody,
|
|
904
|
+
ImgMsgBody,
|
|
905
|
+
CreateImgMsgParameters,
|
|
906
|
+
LocationMsgBody,
|
|
907
|
+
AudioMsgBody,
|
|
908
|
+
VideoMsgBody,
|
|
909
|
+
FileMsgBody,
|
|
910
|
+
ReceivedMsgBody,
|
|
911
|
+
ReadMsgBody,
|
|
912
|
+
RecallMsgBody,
|
|
913
|
+
MuteMsgBody,
|
|
914
|
+
ContactMsgBody,
|
|
915
|
+
MessagesType,
|
|
916
|
+
MessageSetParameters,
|
|
917
|
+
CreateMsgType,
|
|
918
|
+
MessageBody,
|
|
919
|
+
CreateTextMsgParameters,
|
|
920
|
+
CreateCmdMsgParameters,
|
|
921
|
+
CreateFileMsgParameters,
|
|
922
|
+
CreateVideoMsgParameters,
|
|
923
|
+
CreateCustomMsgParameters,
|
|
924
|
+
CreateLocationMsgParameters,
|
|
925
|
+
CreateChannelMsgParameters,
|
|
926
|
+
CreateDeliveryMsgParameters,
|
|
927
|
+
CreateReadMsgParameters,
|
|
928
|
+
CreateAudioMsgParameters,
|
|
929
|
+
MessagePriority,
|
|
930
|
+
PriorityExt,
|
|
931
|
+
};
|