easemob-websdk 4.2.0-beta → 4.2.1-beta
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 +9 -0
- package/Easemob-chat.d.ts +15 -3
- package/Easemob-chat.js +1 -1
- package/chatroom/chatroom.d.ts +2 -0
- package/contact/contact.d.ts +7 -1
- package/contact/contact.js +1 -1
- package/group/group.d.ts +2 -0
- package/group/group.js +1 -1
- package/localCache/localCache.d.ts +59 -0
- package/localCache/localCache.js +1 -0
- package/miniCore/miniCore.d.ts +20 -1
- package/miniCore/miniCore.js +1 -1
- package/miniProgram/Easemob-chat.js +1 -1
- package/package.json +1 -1
- package/presence/presence.d.ts +2 -0
- package/silent/silent.d.ts +2 -0
- package/status.d.ts +160 -0
- package/thread/thread.d.ts +2 -0
- package/translation/translation.d.ts +2 -0
- package/types/common.d.ts +24 -1
- package/types/engineCore.d.ts +5 -2
- package/types/error.d.ts +2 -1
- package/types/eventHandler.d.ts +16 -0
- package/types/groupApi.d.ts +8 -7
- package/types/index.d.ts +32 -0
- package/types/indexApi.d.ts +2 -2
- package/types/localCache.d.ts +53 -0
- package/types/message.d.ts +0 -1
- package/types/presenceApi.d.ts +0 -5
- package/types/threadApi.d.ts +7 -1
- package/types/utils.d.ts +90 -0
- package/uniApp/Easemob-chat.js +1 -1
- package/types/status.d.ts +0 -337
package/package.json
CHANGED
package/presence/presence.d.ts
CHANGED
package/silent/silent.d.ts
CHANGED
package/status.d.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error codes in the SDK.
|
|
3
|
+
* Defines error codes commonly used in the SDK.
|
|
4
|
+
* @module StatusCode
|
|
5
|
+
*/
|
|
6
|
+
declare enum Code {
|
|
7
|
+
/** No error. */
|
|
8
|
+
REQUEST_SUCCESS = 0,
|
|
9
|
+
/** The server response times out. */
|
|
10
|
+
REQUEST_TIMEOUT = -1,
|
|
11
|
+
/** A general error. */
|
|
12
|
+
REQUEST_UNKNOWN = -2,
|
|
13
|
+
/** The parameter is invalid. */
|
|
14
|
+
REQUEST_PARAMETER_ERROR = -3,
|
|
15
|
+
/** The request is canceled. */
|
|
16
|
+
REQUEST_ABORT = -4,
|
|
17
|
+
/** @hidden */
|
|
18
|
+
WEBIM_CONNCTION_USER_NOT_ASSIGN_ERROR = 0,
|
|
19
|
+
/** Login failed. */
|
|
20
|
+
WEBIM_CONNCTION_OPEN_ERROR = 1,
|
|
21
|
+
/** The user authentication fails. The reasons are as follows. The SDK is not initiated. The user is not login. */
|
|
22
|
+
WEBIM_CONNCTION_AUTH_ERROR = 2,
|
|
23
|
+
/** Fails to get the token. */
|
|
24
|
+
WEBIM_CONNCTION_GETROSTER_ERROR = 12,
|
|
25
|
+
/** Websocket is disconnected */
|
|
26
|
+
WEBIM_CONNCTION_DISCONNECTED = 16,
|
|
27
|
+
/** A general error. */
|
|
28
|
+
WEBIM_CONNCTION_AJAX_ERROR = 17,
|
|
29
|
+
/** The App Key is invalid. */
|
|
30
|
+
WEBIM_CONNCTION_APPKEY_NOT_ASSIGN_ERROR = 27,
|
|
31
|
+
/** The token is invalid. */
|
|
32
|
+
WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR = 28,
|
|
33
|
+
/** The callback inner error code while the message is successfully sent. */
|
|
34
|
+
WEBIM_CONNCTION_CALLBACK_INNER_ERROR = 31,
|
|
35
|
+
/** The current user is offline. */
|
|
36
|
+
WEBIM_CONNCTION_CLIENT_OFFLINE = 32,
|
|
37
|
+
/** The user is not logged in.*/
|
|
38
|
+
WEBIM_CONNECTION_CLOSED = 39,
|
|
39
|
+
/** The user authentication fails. */
|
|
40
|
+
WEBIM_CONNECTION_ERROR = 40,
|
|
41
|
+
/** The upper limit is reached. */
|
|
42
|
+
MAX_LIMIT = 50,
|
|
43
|
+
/** The message is not found. */
|
|
44
|
+
MESSAGE_NOT_FOUND = 51,
|
|
45
|
+
/** Unauthorized operation. */
|
|
46
|
+
NO_PERMISSION = 52,
|
|
47
|
+
/** Unsupported Operation. */
|
|
48
|
+
OPERATION_UNSUPPORTED = 53,
|
|
49
|
+
/** An operation that is not allowed. */
|
|
50
|
+
OPERATION_NOT_ALLOWED = 54,
|
|
51
|
+
/** A local database operation failed. */
|
|
52
|
+
LOCAL_DB_OPERATION_FAILED = 55,
|
|
53
|
+
/** The uploading of the file failed. */
|
|
54
|
+
WEBIM_UPLOADFILE_ERROR = 101,
|
|
55
|
+
/** The current user is not logged in when uploading the file. */
|
|
56
|
+
WEBIM_UPLOADFILE_NO_LOGIN = 102,
|
|
57
|
+
/** File-downloading failed. */
|
|
58
|
+
WEBIM_DOWNLOADFILE_ERROR = 200,
|
|
59
|
+
/** Parse file failed. */
|
|
60
|
+
PARSE_FILE_ERROR = 203,
|
|
61
|
+
/** User does not found. */
|
|
62
|
+
USER_NOT_FOUND = 204,
|
|
63
|
+
/** The message parameter is invalid. */
|
|
64
|
+
MESSAGE_PARAMETER_ERROR = 205,
|
|
65
|
+
/** The user is logged in on another device. */
|
|
66
|
+
WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE = 206,
|
|
67
|
+
/** The user was removed. */
|
|
68
|
+
WEBIM_CONNCTION_USER_REMOVED = 207,
|
|
69
|
+
/** The password is renewed. */
|
|
70
|
+
WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD = 216,
|
|
71
|
+
/** The user was kicked off from another device. */
|
|
72
|
+
WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE = 217,
|
|
73
|
+
/** Global muted. */
|
|
74
|
+
USER_MUTED_BY_ADMIN = 219,
|
|
75
|
+
/**
|
|
76
|
+
* The user is not on your contact list, and you cannot send messages to him or her.
|
|
77
|
+
* Note: You can send messages to strangers by default. This error occurs only when you enable the function of allowing to send messages only to your contacts.
|
|
78
|
+
*/
|
|
79
|
+
USER_NOT_FRIEND = 221,
|
|
80
|
+
/** The server is busy. */
|
|
81
|
+
SERVER_BUSY = 500,
|
|
82
|
+
/** The message content contains illegal or sensitive words. */
|
|
83
|
+
MESSAGE_INCLUDE_ILLEGAL_CONTENT = 501,
|
|
84
|
+
/** The message was blocked. */
|
|
85
|
+
MESSAGE_EXTERNAL_LOGIC_BLOCKED = 502,
|
|
86
|
+
/** Unknown error. */
|
|
87
|
+
SERVER_UNKNOWN_ERROR = 503,
|
|
88
|
+
/** The message recall has exceeded the time limit.*/
|
|
89
|
+
MESSAGE_RECALL_TIME_LIMIT = 504,
|
|
90
|
+
/** The service is not enabled. */
|
|
91
|
+
SERVICE_NOT_ENABLED = 505,
|
|
92
|
+
/** The message fails to be delivered because the user is not on the allow list.*/
|
|
93
|
+
SERVICE_NOT_ALLOW_MESSAGING = 506,
|
|
94
|
+
/** The current user is muted. */
|
|
95
|
+
SERVICE_NOT_ALLOW_MESSAGING_MUTE = 507,
|
|
96
|
+
/** The message is blocked by the Moderation service. */
|
|
97
|
+
MESSAGE_MODERATION_BLOCKED = 508,
|
|
98
|
+
/** Group chat ID current limiting. */
|
|
99
|
+
MESSAGE_CURRENT_LIMITING = 509,
|
|
100
|
+
/** The network is disconnected, causing message sending failure. */
|
|
101
|
+
MESSAGE_WEBSOCKET_DISCONNECTED = 510,
|
|
102
|
+
/** You have exceeded the maximum allowed size of a message body.*/
|
|
103
|
+
MESSAGE_SIZE_LIMIT = 511,
|
|
104
|
+
/** The group is not found. */
|
|
105
|
+
GROUP_NOT_EXIST = 605,
|
|
106
|
+
/** The user being operated is not in the group. */
|
|
107
|
+
GROUP_NOT_JOINED = 602,
|
|
108
|
+
/** The number of members in the group reaches the limit. */
|
|
109
|
+
GROUP_MEMBERS_FULL = 606,
|
|
110
|
+
/** Permission denied. */
|
|
111
|
+
PERMISSION_DENIED = 603,
|
|
112
|
+
/** Internal error. */
|
|
113
|
+
WEBIM_LOAD_MSG_ERROR = 604,
|
|
114
|
+
/** The current user is already in the group. */
|
|
115
|
+
GROUP_ALREADY_JOINED = 601,
|
|
116
|
+
/** The maximum number of group members exceeds the limit during group creation. */
|
|
117
|
+
GROUP_MEMBERS_LIMIT = 607,
|
|
118
|
+
/** Group disabled */
|
|
119
|
+
/** @hidden */
|
|
120
|
+
GROUP_IS_DISABLED = 608,
|
|
121
|
+
/** Failed to set the custom attributes of a group member. */
|
|
122
|
+
GROUP_MEMBER_ATTRIBUTES_SET_FAILED = 609,
|
|
123
|
+
/** Invalid token or App Key. */
|
|
124
|
+
REST_PARAMS_STATUS = 700,
|
|
125
|
+
/** The user being operated is not in the chatroom. */
|
|
126
|
+
CHATROOM_NOT_JOINED = 702,
|
|
127
|
+
/** The number of chatroom members reaches the limit.*/
|
|
128
|
+
CHATROOM_MEMBERS_FULL = 704,
|
|
129
|
+
/** The chatroom is not found. */
|
|
130
|
+
CHATROOM_NOT_EXIST = 705,
|
|
131
|
+
/** Websocket error. */
|
|
132
|
+
SDK_RUNTIME_ERROR = 999,
|
|
133
|
+
/** The parameter length exceeds the limit when posting custom presence status. */
|
|
134
|
+
PRESENCE_PARAM_EXCEED = 1100,
|
|
135
|
+
/** The Reaction already exists. */
|
|
136
|
+
REACTION_ALREADY_ADDED = 1101,
|
|
137
|
+
/** A Reaction is being created by multiple users at the same time. */
|
|
138
|
+
REACTION_CREATING = 1102,
|
|
139
|
+
/** The user does not have the permission for the Reaction operation. For example, the user who does not add the reaction attempts to delete it, or the user that is neither the sender nor recipient of the one-to-one message attempts to add the Reaction. */
|
|
140
|
+
REACTION_OPERATION_IS_ILLEGAL = 1103,
|
|
141
|
+
/** Invalid language code. */
|
|
142
|
+
TRANSLATION_NOT_VALID = 1200,
|
|
143
|
+
/** The translated text is too long. */
|
|
144
|
+
TRANSLATION_TEXT_TOO_LONG = 1201,
|
|
145
|
+
/** Failed to obtain the translation service. */
|
|
146
|
+
TRANSLATION_FAILED = 1204,
|
|
147
|
+
/** The chatThread is not found. */
|
|
148
|
+
THREAD_NOT_EXIST = 1300,
|
|
149
|
+
/** Chat thread already exists. */
|
|
150
|
+
THREAD_ALREADY_EXIST = 1301,
|
|
151
|
+
/** The message to modify does not exist. */
|
|
152
|
+
MODIFY_MESSAGE_NOT_EXIST = 1302,
|
|
153
|
+
/** The format of the modified messaged is incorrect. */
|
|
154
|
+
MODIFY_MESSAGE_FORMAT_ERROR = 1303,
|
|
155
|
+
/** The message modification failed. */
|
|
156
|
+
MODIFY_MESSAGE_FAILED = 1304,
|
|
157
|
+
/** The current conversation not exist . */
|
|
158
|
+
CONVERSATION_NOT_EXIST = 1400,
|
|
159
|
+
}
|
|
160
|
+
export { Code };
|
package/thread/thread.d.ts
CHANGED
package/types/common.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Code } from '
|
|
1
|
+
import { Code } from '../status';
|
|
2
2
|
import ErrorEvent from './error';
|
|
3
|
+
import { GroupModifyInfo } from './groupApi';
|
|
3
4
|
interface AsyncResult<T = any> {
|
|
4
5
|
/** Status of the request. */
|
|
5
6
|
type: Code;
|
|
@@ -38,13 +39,34 @@ interface EventData {
|
|
|
38
39
|
id: string;
|
|
39
40
|
/** Message sender. */
|
|
40
41
|
from: string;
|
|
42
|
+
/** The modified group info. */
|
|
43
|
+
detail?: GroupModifyInfo;
|
|
41
44
|
/** The name of a group or chatroom. */
|
|
42
45
|
name?: string;
|
|
46
|
+
/** The userId of a group event. */
|
|
47
|
+
userId?: string;
|
|
43
48
|
/** ChatRoom Attributes. */
|
|
44
49
|
attributes?: {
|
|
45
50
|
[key: string]: string;
|
|
46
51
|
};
|
|
47
52
|
}
|
|
53
|
+
|
|
54
|
+
interface AttributeRespData {
|
|
55
|
+
is_forced: boolean;
|
|
56
|
+
operator: string;
|
|
57
|
+
properties: {
|
|
58
|
+
[key: string]: string;
|
|
59
|
+
};
|
|
60
|
+
result: {
|
|
61
|
+
errorKeys: {
|
|
62
|
+
[key: string]: string;
|
|
63
|
+
};
|
|
64
|
+
successKeys: Array<string>;
|
|
65
|
+
};
|
|
66
|
+
keys?: Array<string>;
|
|
67
|
+
auto_delete?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
48
70
|
export type {
|
|
49
71
|
AsyncResult,
|
|
50
72
|
UserId,
|
|
@@ -53,4 +75,5 @@ export type {
|
|
|
53
75
|
ErrorEvent,
|
|
54
76
|
Jid,
|
|
55
77
|
EventData,
|
|
78
|
+
AttributeRespData,
|
|
56
79
|
};
|
package/types/engineCore.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GroupId, UserId } from './common';
|
|
2
|
-
import { MemberAttributes } from './groupApi';
|
|
2
|
+
import { GroupModifyInfo, MemberAttributes } from './groupApi';
|
|
3
3
|
|
|
4
4
|
declare type OnPresenceMsgType =
|
|
5
5
|
| 'rmChatRoomMute'
|
|
@@ -58,6 +58,7 @@ interface PresenceMsg {
|
|
|
58
58
|
reason?: string;
|
|
59
59
|
kicked?: string;
|
|
60
60
|
groupName?: string;
|
|
61
|
+
detail?: GroupModifyInfo;
|
|
61
62
|
}
|
|
62
63
|
interface SendMsgResult {
|
|
63
64
|
/** The local ID of the message. */
|
|
@@ -121,7 +122,7 @@ interface ConversationChangedInfo {
|
|
|
121
122
|
timestamp: number;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
type MultiDeviceEvent =
|
|
125
|
+
declare type MultiDeviceEvent =
|
|
125
126
|
| ThreadMultiDeviceInfo
|
|
126
127
|
| ConversationChangedInfo
|
|
127
128
|
| RoamingDeleteMultiDeviceInfo
|
|
@@ -135,4 +136,6 @@ export type {
|
|
|
135
136
|
multiDeviceEventType,
|
|
136
137
|
MultiDeviceEvent,
|
|
137
138
|
ConversationChangedInfo,
|
|
139
|
+
RoamingDeleteMultiDeviceInfo,
|
|
140
|
+
GroupMemberAttributesUpdateMultiDeviceInfo,
|
|
138
141
|
};
|
package/types/error.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Code } from '
|
|
1
|
+
import { Code } from '../status';
|
|
2
2
|
interface ErrorParameters {
|
|
3
3
|
type: Code;
|
|
4
4
|
message: string;
|
|
@@ -9,4 +9,5 @@ declare class ErrorEvent {
|
|
|
9
9
|
message: string;
|
|
10
10
|
data?: any;
|
|
11
11
|
}
|
|
12
|
+
|
|
12
13
|
export type { ErrorParameters, ErrorEvent };
|
package/types/eventHandler.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TextMsgBody,
|
|
3
|
+
CombineMsgBody,
|
|
3
4
|
DeliveryMsgBody,
|
|
4
5
|
ChannelMsgBody,
|
|
5
6
|
CmdMsgBody,
|
|
@@ -81,6 +82,7 @@ declare type Event =
|
|
|
81
82
|
| 'onOpened'
|
|
82
83
|
| 'onPresence'
|
|
83
84
|
| 'onTextMessage'
|
|
85
|
+
| 'onCombineMessage'
|
|
84
86
|
| 'onImageMessage'
|
|
85
87
|
| 'onAudioMessage'
|
|
86
88
|
| 'onVideoMessage'
|
|
@@ -245,8 +247,16 @@ export interface GroupEvent {
|
|
|
245
247
|
detail?: GroupModifyInfo;
|
|
246
248
|
}
|
|
247
249
|
interface EventHandlerType {
|
|
250
|
+
/** @hidden */
|
|
251
|
+
onOpened?: (msg: any) => void;
|
|
252
|
+
/** @hidden */
|
|
253
|
+
onClosed?: (msg: any) => void;
|
|
254
|
+
/** @hidden */
|
|
255
|
+
onPresence?: (msg: OnPresenceMsg) => void;
|
|
248
256
|
/** The callback to receive a text message. */
|
|
249
257
|
onTextMessage?: (msg: TextMsgBody) => void;
|
|
258
|
+
/** The callback to receive a combine message. */
|
|
259
|
+
onCombineMessage?: (msg: CombineMsgBody) => void;
|
|
250
260
|
/** The callback to receive a image message. */
|
|
251
261
|
onImageMessage?: (msg: ImgMsgBody) => void;
|
|
252
262
|
/** The callback to receive a audio message. */
|
|
@@ -301,6 +311,12 @@ interface EventHandlerType {
|
|
|
301
311
|
onReconnecting?: () => void;
|
|
302
312
|
/** The callback for disconnected. */
|
|
303
313
|
onDisconnected?: () => void;
|
|
314
|
+
/** @hidden The callback to receive a group event. */
|
|
315
|
+
onGroupChange?: (msg: any) => void;
|
|
316
|
+
/** @hidden The callback to receive a chatroom event. */
|
|
317
|
+
onChatroomChange?: (msg: any) => void;
|
|
318
|
+
/** @hidden The callback to receive a contact event. */
|
|
319
|
+
onContactChange?: (msg: any) => void;
|
|
304
320
|
/** Occurs when the presence state of a subscribed user changes. */
|
|
305
321
|
onPresenceStatusChange?: (msg: PresenceType[]) => void;
|
|
306
322
|
/** The callback to receive a thread event. */
|
package/types/groupApi.d.ts
CHANGED
|
@@ -55,12 +55,13 @@ interface GroupDetailInfo {
|
|
|
55
55
|
allowinvites: boolean;
|
|
56
56
|
/** The Unix timestamp when the group is created. */
|
|
57
57
|
created: number;
|
|
58
|
+
/** The custom information. */
|
|
58
59
|
custom: string;
|
|
59
60
|
/** The group description. */
|
|
60
61
|
description: string;
|
|
61
62
|
/** The group ID. */
|
|
62
63
|
id: string;
|
|
63
|
-
/** The maximum number of group members */
|
|
64
|
+
/** The maximum number of group members. */
|
|
64
65
|
maxusers: number;
|
|
65
66
|
/** Whether a user requires the approval from the group owner or admin to join the group. -`true`: Yes; -`false`: No. */
|
|
66
67
|
membersonly: boolean;
|
|
@@ -247,10 +248,10 @@ interface GroupModifyInfo {
|
|
|
247
248
|
allowInvites?: boolean;
|
|
248
249
|
/** The maximum number of group members */
|
|
249
250
|
maxUsers?: number;
|
|
250
|
-
/** Whether the invitee needs to accept the invitation before joining the group.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
/** Whether the invitee needs to accept the invitation before joining the group.
|
|
252
|
+
- `true`: The invitee's consent is required. The default value is `true`.
|
|
253
|
+
- `false`: The invitee will be directly added to the group without confirmation.
|
|
254
|
+
*/
|
|
254
255
|
inviteNeedConfirm?: boolean;
|
|
255
256
|
/** Group detail extensions. */
|
|
256
257
|
ext?: string;
|
|
@@ -258,9 +259,9 @@ interface GroupModifyInfo {
|
|
|
258
259
|
lastModified?: number;
|
|
259
260
|
}
|
|
260
261
|
|
|
261
|
-
type MemberAttributes = Record<string, string>;
|
|
262
|
+
declare type MemberAttributes = Record<string, string>;
|
|
262
263
|
|
|
263
|
-
type GetGroupMembersAttributesResult = Record<UserId, MemberAttributes>;
|
|
264
|
+
declare type GetGroupMembersAttributesResult = Record<UserId, MemberAttributes>;
|
|
264
265
|
|
|
265
266
|
export type {
|
|
266
267
|
GroupRequestResult,
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type definition of the return value
|
|
3
|
+
* @module Types
|
|
4
|
+
*/
|
|
5
|
+
import * as GroupType from './groupApi';
|
|
6
|
+
import * as ChatRoomType from './chatRoomApi';
|
|
7
|
+
import * as Connection from './engineCore';
|
|
8
|
+
import * as Error from './error';
|
|
9
|
+
import * as EventHandlerType from './eventHandler';
|
|
10
|
+
import * as ContactType from './indexApi';
|
|
11
|
+
import * as Message from './message';
|
|
12
|
+
import * as Common from './common';
|
|
13
|
+
import * as PresenceType from './presenceApi';
|
|
14
|
+
import * as ReactionType from './reactionApi';
|
|
15
|
+
import * as ThreadType from './threadApi';
|
|
16
|
+
import * as TranslationType from './translation';
|
|
17
|
+
import * as SilentModeType from './silentModeApi';
|
|
18
|
+
export type {
|
|
19
|
+
ContactType,
|
|
20
|
+
GroupType,
|
|
21
|
+
ChatRoomType,
|
|
22
|
+
Connection,
|
|
23
|
+
EventHandlerType,
|
|
24
|
+
PresenceType,
|
|
25
|
+
ReactionType,
|
|
26
|
+
TranslationType,
|
|
27
|
+
ThreadType,
|
|
28
|
+
SilentModeType,
|
|
29
|
+
Message,
|
|
30
|
+
Error,
|
|
31
|
+
Common,
|
|
32
|
+
};
|
package/types/indexApi.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ interface ModifyMsgResult extends SendMsgResult {
|
|
|
108
108
|
message: ModifiedMsg;
|
|
109
109
|
}
|
|
110
110
|
interface HistoryMessages {
|
|
111
|
-
/** The
|
|
111
|
+
/** The starting message ID for the next query. If the number of messages returned by the SDK is smaller than the requested number, the cursor will be `undefined`. */
|
|
112
112
|
cursor?: string;
|
|
113
113
|
/** The historical messages. */
|
|
114
114
|
messages: MessagesType[];
|
|
@@ -132,7 +132,7 @@ interface ConversationItem {
|
|
|
132
132
|
conversationId: string;
|
|
133
133
|
/** The conversation type. */
|
|
134
134
|
conversationType: 'singleChat' | 'groupChat';
|
|
135
|
-
/** Whether the conversation is pinned. `true`:
|
|
135
|
+
/** Whether the conversation is pinned. `true`:pinned; `false`: unpinned. */
|
|
136
136
|
isPinned: boolean;
|
|
137
137
|
/** The UNIX timestamp when the conversation is pinned. The unit is millisecond. This value is `0` when conversation is not pinned. */
|
|
138
138
|
pinnedTime: number;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* localCache types
|
|
3
|
+
* @module TYPES
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
MessageBody,
|
|
8
|
+
DeliveryMsgBody,
|
|
9
|
+
ChannelMsgBody,
|
|
10
|
+
ReadMsgBody,
|
|
11
|
+
ChatType,
|
|
12
|
+
CmdMsgBody,
|
|
13
|
+
} from '../types/message';
|
|
14
|
+
declare type LocalMessageBody = Exclude<
|
|
15
|
+
MessageBody,
|
|
16
|
+
DeliveryMsgBody | ReadMsgBody | ChannelMsgBody | CmdMsgBody
|
|
17
|
+
>;
|
|
18
|
+
declare type ConversationType = Exclude<ChatType, 'chatRoom'>;
|
|
19
|
+
interface ConversationItem {
|
|
20
|
+
/** The conversation ID. */
|
|
21
|
+
conversationId: string;
|
|
22
|
+
/** The conversation type. */
|
|
23
|
+
conversationType: ConversationType;
|
|
24
|
+
/** The number of unread messages in the conversation. */
|
|
25
|
+
unReadCount?: number;
|
|
26
|
+
/** The last message in the conversation. */
|
|
27
|
+
lastMessage?: LocalMessageBody;
|
|
28
|
+
/** The conversation custom field. */
|
|
29
|
+
customField?: Record<string, any>;
|
|
30
|
+
}
|
|
31
|
+
declare type SessionParams = Pick<
|
|
32
|
+
ConversationItem,
|
|
33
|
+
'conversationId' | 'conversationType'
|
|
34
|
+
>;
|
|
35
|
+
declare type RemoveLocalConversationParams = SessionParams &
|
|
36
|
+
isRemoveLocalMessage;
|
|
37
|
+
declare type isRemoveLocalMessage = {
|
|
38
|
+
/** Whether to delete the historical messages with the conversation. (Default) `true`: Yes; `false`: No. Historical messages of the conversation remain in the local database even if the conversation is deleted. */
|
|
39
|
+
isRemoveLocalMessage?: boolean;
|
|
40
|
+
};
|
|
41
|
+
declare type UpdateConversationParams = Pick<
|
|
42
|
+
ConversationItem,
|
|
43
|
+
'conversationId' | 'conversationType' | 'customField'
|
|
44
|
+
>;
|
|
45
|
+
export type {
|
|
46
|
+
ConversationItem,
|
|
47
|
+
SessionParams,
|
|
48
|
+
RemoveLocalConversationParams,
|
|
49
|
+
UpdateConversationParams,
|
|
50
|
+
isRemoveLocalMessage,
|
|
51
|
+
LocalMessageBody,
|
|
52
|
+
ConversationType,
|
|
53
|
+
};
|
package/types/message.d.ts
CHANGED
|
@@ -818,7 +818,6 @@ declare type MessageBody =
|
|
|
818
818
|
* The priority of chat room messages.
|
|
819
819
|
*
|
|
820
820
|
* Currently, this attribute is available only to chat room messages. If this attribute is not set, messages are assigned a medium priority. */
|
|
821
|
-
|
|
822
821
|
declare type MessagePriority =
|
|
823
822
|
/** High. */
|
|
824
823
|
| 'high'
|
package/types/presenceApi.d.ts
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
* presence types
|
|
3
3
|
* @module TYPES
|
|
4
4
|
*/
|
|
5
|
-
interface PublishPresenceResult {
|
|
6
|
-
/** The result of publish. */
|
|
7
|
-
result: 'ok';
|
|
8
|
-
}
|
|
9
5
|
interface SubscribePresence {
|
|
10
6
|
/** The expiration time of the presence subscription. */
|
|
11
7
|
expiry: number;
|
|
@@ -55,7 +51,6 @@ interface PresenceType {
|
|
|
55
51
|
expire: number;
|
|
56
52
|
}
|
|
57
53
|
export type {
|
|
58
|
-
PublishPresenceResult,
|
|
59
54
|
SubscribePresence,
|
|
60
55
|
SubscribePresenceResult,
|
|
61
56
|
SubscribeUserListType,
|
package/types/threadApi.d.ts
CHANGED
|
@@ -121,7 +121,13 @@ interface ChatThreadLastMessage {
|
|
|
121
121
|
/** The last threaded reply. */
|
|
122
122
|
lastMessage: MessageBody;
|
|
123
123
|
}
|
|
124
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* The definition of the message thread event types: <br/>
|
|
126
|
+
* create: Occurs when creating a chat thread.<br/>
|
|
127
|
+
* update: Occurs when there is a new message in the chat thread.<br/>
|
|
128
|
+
* destroy: Occurs when a chat thread is deleted.<br/>
|
|
129
|
+
* userRemove: Occurs when you were kicked out of chat thread.<br/>
|
|
130
|
+
*/
|
|
125
131
|
declare type onChatThreadChangeType =
|
|
126
132
|
| 'create'
|
|
127
133
|
| 'update'
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Code } from '../status';
|
|
2
|
+
interface AsyncResult<T = any> {
|
|
3
|
+
/** Status of the request. */
|
|
4
|
+
type: Code;
|
|
5
|
+
/** Data returned by successful request. */
|
|
6
|
+
data?: T;
|
|
7
|
+
/** message. */
|
|
8
|
+
message?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
interface uri {
|
|
12
|
+
url: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
filetype: string;
|
|
15
|
+
data: File | null;
|
|
16
|
+
}
|
|
17
|
+
interface KVString {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
}
|
|
20
|
+
interface AjaxOptions {
|
|
21
|
+
url: string;
|
|
22
|
+
dataType?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
data?: any;
|
|
25
|
+
headers?: KVString;
|
|
26
|
+
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
|
|
27
|
+
mimeType?: string;
|
|
28
|
+
success?: (res: any) => void;
|
|
29
|
+
error?: (res: any) => void;
|
|
30
|
+
}
|
|
31
|
+
interface UploadFileOptions {
|
|
32
|
+
onFileUploadProgress?: (msg: any) => void;
|
|
33
|
+
onFileUploadComplete?: (msg: any) => void;
|
|
34
|
+
onFileUploadError?: (msg: any) => void;
|
|
35
|
+
onFileUploadCanceled?: (msg: any) => void;
|
|
36
|
+
accessToken: string;
|
|
37
|
+
appKey: string;
|
|
38
|
+
apiUrl: string;
|
|
39
|
+
uploadUrl?: string;
|
|
40
|
+
file: any;
|
|
41
|
+
}
|
|
42
|
+
declare type Fns = (...args: any) => any;
|
|
43
|
+
declare enum PLATFORM {
|
|
44
|
+
WEB = 'web',
|
|
45
|
+
WX = 'wx',
|
|
46
|
+
ZFB = 'zfb',
|
|
47
|
+
DD = 'dd',
|
|
48
|
+
TT = 'tt',
|
|
49
|
+
BAIDU = 'baidu',
|
|
50
|
+
QUICK_APP = 'quick_app',
|
|
51
|
+
UNI = 'uni',
|
|
52
|
+
NODE = 'node',
|
|
53
|
+
}
|
|
54
|
+
interface EnvInfo {
|
|
55
|
+
platform: PLATFORM;
|
|
56
|
+
global: any;
|
|
57
|
+
}
|
|
58
|
+
interface DownloadParams {
|
|
59
|
+
onFileDownloadComplete: (data: any) => void;
|
|
60
|
+
onFileDownloadError: (error: any) => void;
|
|
61
|
+
id: string;
|
|
62
|
+
secret: string;
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
}
|
|
65
|
+
interface Utils {
|
|
66
|
+
/** @hidden */
|
|
67
|
+
autoIncrement: number;
|
|
68
|
+
getUniqueId: () => string;
|
|
69
|
+
/** @hidden */
|
|
70
|
+
ajax: (options: AjaxOptions) => Promise<AsyncResult<any>>;
|
|
71
|
+
getFileUrl: (fileInputId: string | HTMLInputElement) => uri;
|
|
72
|
+
uploadFile: (options: UploadFileOptions) => void;
|
|
73
|
+
/** @hidden */
|
|
74
|
+
flow: (fns: Fns[]) => any;
|
|
75
|
+
listenNetwork: (online: () => void, offline: () => void) => void;
|
|
76
|
+
getEnvInfo: () => EnvInfo;
|
|
77
|
+
/** @hidden */
|
|
78
|
+
wxRequest: (options: AjaxOptions) => Promise<AsyncResult<any>>;
|
|
79
|
+
/** @hidden */
|
|
80
|
+
parseDownloadResponse: (res: any) => string;
|
|
81
|
+
download: (params: DownloadParams) => void;
|
|
82
|
+
}
|
|
83
|
+
export type {
|
|
84
|
+
Utils,
|
|
85
|
+
DownloadParams,
|
|
86
|
+
EnvInfo,
|
|
87
|
+
PLATFORM,
|
|
88
|
+
UploadFileOptions,
|
|
89
|
+
uri,
|
|
90
|
+
};
|