easemob-websdk 4.0.9 → 4.1.0-beta2
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 +12 -0
- package/Easemob-chat.d.ts +1338 -267
- package/Easemob-chat.js +1 -3
- package/chatroom/chatroom.d.ts +590 -0
- package/chatroom/chatroom.js +1 -0
- package/contact/contact.d.ts +322 -0
- package/contact/contact.js +1 -0
- package/group/group.d.ts +645 -0
- package/group/group.js +1 -0
- package/message/audio.d.ts +140 -0
- package/message/channel.d.ts +58 -0
- package/message/cmd.d.ts +102 -0
- package/message/custom.d.ts +94 -0
- package/message/delivery.d.ts +53 -0
- package/message/file.d.ts +134 -0
- package/message/img.d.ts +150 -0
- package/message/index.d.ts +147 -0
- package/message/location.d.ts +98 -0
- package/message/read.d.ts +61 -0
- package/message/text.d.ts +107 -0
- package/message/video.d.ts +140 -0
- package/miniCore/miniCore.d.ts +148 -0
- package/miniCore/miniCore.js +1 -0
- package/package.json +1 -1
- package/presence/presence.d.ts +67 -0
- package/presence/presence.js +1 -0
- package/readme.md +15 -11
- package/silent/silent.d.ts +110 -0
- package/silent/silent.js +1 -0
- package/thread/thread.d.ts +157 -0
- package/thread/thread.js +1 -0
- package/translation/translation.d.ts +28 -0
- package/translation/translation.js +1 -0
- package/types/chatRoomApi.d.ts +198 -0
- package/types/common.d.ts +56 -0
- package/types/engineCore.d.ts +83 -0
- package/types/error.d.ts +12 -0
- package/types/eventHandler.d.ts +201 -0
- package/types/groupApi.d.ts +235 -0
- package/types/indexApi.d.ts +134 -0
- package/types/presenceApi.d.ts +66 -0
- package/types/reactionApi.d.ts +74 -0
- package/types/restApis.d.ts +6 -0
- package/types/silentModeApi.d.ts +90 -0
- package/types/threadApi.d.ts +169 -0
- package/types/translation.d.ts +25 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare type OnPresenceMsgType =
|
|
2
|
+
| 'rmChatRoomMute'
|
|
3
|
+
| 'rmGroupMute'
|
|
4
|
+
| 'muteChatRoom'
|
|
5
|
+
| 'muteGroup'
|
|
6
|
+
| 'rmUserFromChatRoomWhiteList'
|
|
7
|
+
| 'rmUserFromGroupWhiteList'
|
|
8
|
+
| 'addUserToChatRoomWhiteList'
|
|
9
|
+
| 'addUserToGroupWhiteList'
|
|
10
|
+
| 'deleteFile'
|
|
11
|
+
| 'uploadFile'
|
|
12
|
+
| 'deleteAnnouncement'
|
|
13
|
+
| 'updateAnnouncement'
|
|
14
|
+
| 'removeMute'
|
|
15
|
+
| 'addMute'
|
|
16
|
+
| 'removeAdmin'
|
|
17
|
+
| 'addAdmin'
|
|
18
|
+
| 'changeOwner'
|
|
19
|
+
| 'direct_joined'
|
|
20
|
+
| 'leaveChatRoom'
|
|
21
|
+
| 'leaveGroup'
|
|
22
|
+
| 'memberJoinChatRoomSuccess'
|
|
23
|
+
| 'memberJoinPublicGroupSuccess'
|
|
24
|
+
| 'unblock'
|
|
25
|
+
| 'block'
|
|
26
|
+
| 'update'
|
|
27
|
+
| 'allow'
|
|
28
|
+
| 'ban'
|
|
29
|
+
| 'getBlackList'
|
|
30
|
+
| 'removedFromGroup'
|
|
31
|
+
| 'invite_decline'
|
|
32
|
+
| 'invite_accept'
|
|
33
|
+
| 'invite'
|
|
34
|
+
| 'joinPublicGroupDeclined'
|
|
35
|
+
| 'joinPublicGroupSuccess'
|
|
36
|
+
| 'joinGroupNotifications'
|
|
37
|
+
| 'leave'
|
|
38
|
+
| 'join'
|
|
39
|
+
| 'deleteGroupChat'
|
|
40
|
+
| 'subscribe'
|
|
41
|
+
| 'unsubscribed'
|
|
42
|
+
| 'subscribed'
|
|
43
|
+
| 'disableGroup'
|
|
44
|
+
| 'ableGroup';
|
|
45
|
+
interface PresenceMsg {
|
|
46
|
+
type: OnPresenceMsgType;
|
|
47
|
+
to: string;
|
|
48
|
+
from: string;
|
|
49
|
+
status: string;
|
|
50
|
+
chatroom?: boolean;
|
|
51
|
+
toJid?: string;
|
|
52
|
+
fromJid?: string;
|
|
53
|
+
gid?: string;
|
|
54
|
+
owner?: string;
|
|
55
|
+
reason?: string;
|
|
56
|
+
kicked?: string;
|
|
57
|
+
groupName?: string;
|
|
58
|
+
}
|
|
59
|
+
interface SendMsgResult {
|
|
60
|
+
/** The local ID of the message. */
|
|
61
|
+
localMsgId: string;
|
|
62
|
+
/** The ID of the message stored on the server. */
|
|
63
|
+
serverMsgId: string;
|
|
64
|
+
}
|
|
65
|
+
declare type multiDeviceEventType =
|
|
66
|
+
| 'chatThreadCreate'
|
|
67
|
+
| 'chatThreadDestroy'
|
|
68
|
+
| 'chatThreadJoin'
|
|
69
|
+
| 'chatThreadLeave'
|
|
70
|
+
| 'chatThreadNameUpdate';
|
|
71
|
+
interface ThreadMultiDeviceInfo {
|
|
72
|
+
operation: multiDeviceEventType;
|
|
73
|
+
chatThreadId?: string;
|
|
74
|
+
chatThreadName?: string;
|
|
75
|
+
parentId?: string;
|
|
76
|
+
}
|
|
77
|
+
export type {
|
|
78
|
+
OnPresenceMsgType,
|
|
79
|
+
PresenceMsg,
|
|
80
|
+
SendMsgResult,
|
|
81
|
+
ThreadMultiDeviceInfo,
|
|
82
|
+
multiDeviceEventType,
|
|
83
|
+
};
|
package/types/error.d.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TextMsgBody,
|
|
3
|
+
DeliveryMsgBody,
|
|
4
|
+
ChannelMsgBody,
|
|
5
|
+
CmdMsgBody,
|
|
6
|
+
CustomMsgBody,
|
|
7
|
+
ImgMsgBody,
|
|
8
|
+
LocationMsgBody,
|
|
9
|
+
AudioMsgBody,
|
|
10
|
+
VideoMsgBody,
|
|
11
|
+
FileMsgBody,
|
|
12
|
+
ReceivedMsgBody,
|
|
13
|
+
ReadMsgBody,
|
|
14
|
+
RecallMsgBody,
|
|
15
|
+
ContactMsgBody,
|
|
16
|
+
} from '../types/message';
|
|
17
|
+
import { PresenceMsg, ThreadMultiDeviceInfo } from './engineCore';
|
|
18
|
+
import { ErrorEvent } from './error';
|
|
19
|
+
import { PresenceType } from './presenceApi';
|
|
20
|
+
import { ReactionMessage } from './reactionApi';
|
|
21
|
+
import { ThreadChangeInfo } from './threadApi';
|
|
22
|
+
import { EventData } from './common';
|
|
23
|
+
export declare type OnPresenceMsgType =
|
|
24
|
+
| 'rmChatRoomMute'
|
|
25
|
+
| 'rmGroupMute'
|
|
26
|
+
| 'muteChatRoom'
|
|
27
|
+
| 'muteGroup'
|
|
28
|
+
| 'rmUserFromChatRoomWhiteList'
|
|
29
|
+
| 'rmUserFromGroupWhiteList'
|
|
30
|
+
| 'addUserToChatRoomWhiteList'
|
|
31
|
+
| 'addUserToGroupWhiteList'
|
|
32
|
+
| 'deleteFile'
|
|
33
|
+
| 'uploadFile'
|
|
34
|
+
| 'deleteAnnouncement'
|
|
35
|
+
| 'updateAnnouncement'
|
|
36
|
+
| 'removeMute'
|
|
37
|
+
| 'addMute'
|
|
38
|
+
| 'removeAdmin'
|
|
39
|
+
| 'addAdmin'
|
|
40
|
+
| 'changeOwner'
|
|
41
|
+
| 'direct_joined'
|
|
42
|
+
| 'leaveChatRoom'
|
|
43
|
+
| 'leaveGroup'
|
|
44
|
+
| 'memberJoinChatRoomSuccess'
|
|
45
|
+
| 'memberJoinPublicGroupSuccess'
|
|
46
|
+
| 'unblock'
|
|
47
|
+
| 'block'
|
|
48
|
+
| 'update'
|
|
49
|
+
| 'allow'
|
|
50
|
+
| 'ban'
|
|
51
|
+
| 'getBlackList'
|
|
52
|
+
| 'removedFromGroup'
|
|
53
|
+
| 'invite_decline'
|
|
54
|
+
| 'invite_accept'
|
|
55
|
+
| 'invite'
|
|
56
|
+
| 'joinPublicGroupDeclined'
|
|
57
|
+
| 'joinPublicGroupSuccess'
|
|
58
|
+
| 'joinGroupNotifications'
|
|
59
|
+
| 'leave'
|
|
60
|
+
| 'join'
|
|
61
|
+
| 'deleteGroupChat'
|
|
62
|
+
| 'subscribe'
|
|
63
|
+
| 'unsubscribed'
|
|
64
|
+
| 'subscribed'
|
|
65
|
+
| 'disableGroup'
|
|
66
|
+
| 'ableGroup';
|
|
67
|
+
interface OnPresenceMsg {
|
|
68
|
+
type: OnPresenceMsgType;
|
|
69
|
+
to: string;
|
|
70
|
+
from: string;
|
|
71
|
+
status: string;
|
|
72
|
+
chatroom?: boolean;
|
|
73
|
+
toJid?: string;
|
|
74
|
+
fromJid?: string;
|
|
75
|
+
gid?: string;
|
|
76
|
+
owner?: string;
|
|
77
|
+
}
|
|
78
|
+
declare type Event =
|
|
79
|
+
| 'onOpened'
|
|
80
|
+
| 'onPresence'
|
|
81
|
+
| 'onTextMessage'
|
|
82
|
+
| 'onImageMessage'
|
|
83
|
+
| 'onAudioMessage'
|
|
84
|
+
| 'onVideoMessage'
|
|
85
|
+
| 'onFileMessage'
|
|
86
|
+
| 'onLocationMessage'
|
|
87
|
+
| 'onCmdMessage'
|
|
88
|
+
| 'onCustomMessage'
|
|
89
|
+
| 'onReceivedMessage'
|
|
90
|
+
| 'onDeliveredMessage'
|
|
91
|
+
| 'onReadMessage'
|
|
92
|
+
| 'onRecallMessage'
|
|
93
|
+
| 'onChannelMessage'
|
|
94
|
+
| 'onError'
|
|
95
|
+
| 'onOffline'
|
|
96
|
+
| 'onOnline'
|
|
97
|
+
| 'onStatisticMessage'
|
|
98
|
+
| 'onContactAgreed'
|
|
99
|
+
| 'onContactRefuse'
|
|
100
|
+
| 'onContactDeleted'
|
|
101
|
+
| 'onContactAdded'
|
|
102
|
+
| 'onTokenWillExpire'
|
|
103
|
+
| 'onTokenExpired'
|
|
104
|
+
| 'onContactInvited'
|
|
105
|
+
| 'onConnected'
|
|
106
|
+
| 'onDisconnected'
|
|
107
|
+
| 'onGroupChange'
|
|
108
|
+
| 'onChatroomChange'
|
|
109
|
+
| 'onContactChange'
|
|
110
|
+
| 'onPresenceStatusChange'
|
|
111
|
+
| 'onReactionChange'
|
|
112
|
+
| 'onChatThreadChange'
|
|
113
|
+
| 'onMultiDeviceEvent'
|
|
114
|
+
| 'onGroupEvent'
|
|
115
|
+
| 'onChatroomEvent';
|
|
116
|
+
interface EventHandlerType {
|
|
117
|
+
/** The callback to receive a text message. */
|
|
118
|
+
onTextMessage?: (msg: TextMsgBody) => void;
|
|
119
|
+
/** The callback to receive a image message. */
|
|
120
|
+
onImageMessage?: (msg: ImgMsgBody) => void;
|
|
121
|
+
/** The callback to receive a audio message. */
|
|
122
|
+
onAudioMessage?: (msg: AudioMsgBody) => void;
|
|
123
|
+
/** The callback to receive a video message. */
|
|
124
|
+
onVideoMessage?: (msg: VideoMsgBody) => void;
|
|
125
|
+
/** The callback to receive a file message. */
|
|
126
|
+
onFileMessage?: (msg: FileMsgBody) => void;
|
|
127
|
+
/** The callback to receive a location message. */
|
|
128
|
+
onLocationMessage?: (msg: LocationMsgBody) => void;
|
|
129
|
+
/** The callback to receive a command message. */
|
|
130
|
+
onCmdMessage?: (msg: CmdMsgBody) => void;
|
|
131
|
+
/** The callback to receive a custom message. */
|
|
132
|
+
onCustomMessage?: (msg: CustomMsgBody) => void;
|
|
133
|
+
/** The callback to receive a received ack. */
|
|
134
|
+
onReceivedMessage?: (msg: ReceivedMsgBody) => void;
|
|
135
|
+
/** The callback to receive a delivery ack. */
|
|
136
|
+
onDeliveredMessage?: (msg: DeliveryMsgBody) => void;
|
|
137
|
+
/** The callback to receive a read ack. */
|
|
138
|
+
onReadMessage?: (msg: ReadMsgBody) => void;
|
|
139
|
+
/** The callback to receive a recall message. */
|
|
140
|
+
onRecallMessage?: (msg: RecallMsgBody) => void;
|
|
141
|
+
/** The callback to receive a session read ack. */
|
|
142
|
+
onChannelMessage?: (msg: ChannelMsgBody) => void;
|
|
143
|
+
/** The callback to receive error. */
|
|
144
|
+
onError?: (error: ErrorEvent) => void;
|
|
145
|
+
/** The callback for network disconnection. */
|
|
146
|
+
onOffline?: () => void;
|
|
147
|
+
/** The callback for network connection. */
|
|
148
|
+
onOnline?: () => void;
|
|
149
|
+
/** The callback to receive a statistic message. */
|
|
150
|
+
onStatisticMessage?: (msg: any) => void;
|
|
151
|
+
/** The callback to accept contact request. */
|
|
152
|
+
onContactAgreed?: (msg: ContactMsgBody) => void;
|
|
153
|
+
/** The callback to refuse contact request. */
|
|
154
|
+
onContactRefuse?: (msg: ContactMsgBody) => void;
|
|
155
|
+
/** The callback to deleted a contact. */
|
|
156
|
+
onContactDeleted?: (msg: ContactMsgBody) => void;
|
|
157
|
+
/** The callback to added a contact. */
|
|
158
|
+
onContactAdded?: (msg: ContactMsgBody) => void;
|
|
159
|
+
/** The callback whose token is about to expire. */
|
|
160
|
+
onTokenWillExpire?: () => void;
|
|
161
|
+
/** The callback whose token has expired. */
|
|
162
|
+
onTokenExpired?: () => void;
|
|
163
|
+
/** The callback to contact request was received. */
|
|
164
|
+
onContactInvited?: (msg: ContactMsgBody) => void;
|
|
165
|
+
/** The callback for successful connection. */
|
|
166
|
+
onConnected?: () => void;
|
|
167
|
+
/** The callback for disconnected. */
|
|
168
|
+
onDisconnected?: () => void;
|
|
169
|
+
/** Occurs when the presence state of a subscribed user changes. */
|
|
170
|
+
onPresenceStatusChange?: (msg: PresenceType[]) => void;
|
|
171
|
+
/** The callback to receive a thread event. */
|
|
172
|
+
onChatThreadChange?: (msg: ThreadChangeInfo) => void;
|
|
173
|
+
/** The callback to receive a reaction message. */
|
|
174
|
+
onReactionChange?: (msg: ReactionMessage) => void;
|
|
175
|
+
/** The callback to receive a multi device event. */
|
|
176
|
+
onMultiDeviceEvent?: (msg: ThreadMultiDeviceInfo) => void;
|
|
177
|
+
/** The callback to receive a group event. */
|
|
178
|
+
onGroupEvent?: (eventData: EventData) => void;
|
|
179
|
+
/** The callback to receive a chatroom event. */
|
|
180
|
+
onChatroomEvent?: (eventData: EventData) => void;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface HandlerData {
|
|
184
|
+
[key: string]: EventHandlerType;
|
|
185
|
+
}
|
|
186
|
+
declare class EventHandler {
|
|
187
|
+
handlerData: HandlerData;
|
|
188
|
+
addEventHandler: (
|
|
189
|
+
eventHandlerId: string,
|
|
190
|
+
eventHandler: EventHandlerType
|
|
191
|
+
) => void;
|
|
192
|
+
removeEventHandler: (eventHandlerId: string) => void;
|
|
193
|
+
protected dispatch: (event: Event, ...args: any[]) => void;
|
|
194
|
+
}
|
|
195
|
+
export type {
|
|
196
|
+
Event,
|
|
197
|
+
EventHandlerType,
|
|
198
|
+
HandlerData,
|
|
199
|
+
EventHandler,
|
|
200
|
+
OnPresenceMsg,
|
|
201
|
+
};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* group types
|
|
3
|
+
* @module TYPES
|
|
4
|
+
*/
|
|
5
|
+
import { UserId } from './common';
|
|
6
|
+
interface BaseGroupInfo {
|
|
7
|
+
/** The group ID. */
|
|
8
|
+
groupid: string;
|
|
9
|
+
/** The group name. */
|
|
10
|
+
groupname: string;
|
|
11
|
+
}
|
|
12
|
+
export declare type GroupAffiliation =
|
|
13
|
+
| {
|
|
14
|
+
/** The group owner. */
|
|
15
|
+
owner: UserId;
|
|
16
|
+
/** The Unix timestamp when the owner joined the group. */
|
|
17
|
+
joined_time: number;
|
|
18
|
+
}
|
|
19
|
+
| {
|
|
20
|
+
/** The group member. */
|
|
21
|
+
member: UserId;
|
|
22
|
+
/** The Unix timestamp when the user joins the group. */
|
|
23
|
+
joined_time: number;
|
|
24
|
+
};
|
|
25
|
+
interface CreateGroupResult {
|
|
26
|
+
/** The group ID. */
|
|
27
|
+
groupid: string;
|
|
28
|
+
}
|
|
29
|
+
interface BlockGroupResult {
|
|
30
|
+
/** Whether the current user is enabled. */
|
|
31
|
+
activated: boolean;
|
|
32
|
+
/** The Unix timestamp when the user is created. */
|
|
33
|
+
created: number;
|
|
34
|
+
/** The Unix timestamp when the user information was last edited. */
|
|
35
|
+
modified: number;
|
|
36
|
+
/** User nickname for push. */
|
|
37
|
+
nickname: string;
|
|
38
|
+
/** The user type. */
|
|
39
|
+
type: string;
|
|
40
|
+
/** The user ID. */
|
|
41
|
+
username: string;
|
|
42
|
+
/** The user uuid. */
|
|
43
|
+
uuid: string;
|
|
44
|
+
}
|
|
45
|
+
interface ChangeGroupOwnerResult {
|
|
46
|
+
/** The group owner change result. */
|
|
47
|
+
newowner: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface GroupDetailInfo {
|
|
50
|
+
/** The list of existing members. */
|
|
51
|
+
affiliations: GroupAffiliation[];
|
|
52
|
+
/** The number of existing members. */
|
|
53
|
+
affiliations_count: number;
|
|
54
|
+
/** Whether to allow group members to invite others to join the group. */
|
|
55
|
+
allowinvites: boolean;
|
|
56
|
+
/** The Unix timestamp when the group is created. */
|
|
57
|
+
created: number;
|
|
58
|
+
custom: string;
|
|
59
|
+
/** The group description. */
|
|
60
|
+
description: string;
|
|
61
|
+
/** The group ID. */
|
|
62
|
+
id: string;
|
|
63
|
+
/** The maximum number of group members */
|
|
64
|
+
maxusers: number;
|
|
65
|
+
/** Whether a user requires the approval from the group owner or admin to join the group. -`true`: Yes; -`false`: No. */
|
|
66
|
+
membersonly: boolean;
|
|
67
|
+
/** Whether to mute all members. -`true`: Yes; -`false`: No.*/
|
|
68
|
+
mute: boolean;
|
|
69
|
+
/** The group name. */
|
|
70
|
+
name: string;
|
|
71
|
+
/** The group owner. */
|
|
72
|
+
owner: UserId;
|
|
73
|
+
/** Whether it is a public group. */
|
|
74
|
+
public: boolean;
|
|
75
|
+
/** Whether the member is on the blocklist. -`true`: Yes; -`false`: No. */
|
|
76
|
+
shieldgroup: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface ModifyGroupResult {
|
|
79
|
+
/** Whether the group description is modified successfully. -`true`: Yes; -`false`: No. */
|
|
80
|
+
description?: boolean;
|
|
81
|
+
/** Whether the maximum number of group members is changed successfully. -`true`: Yes; -`false`: No.*/
|
|
82
|
+
maxusers?: boolean;
|
|
83
|
+
/** Whether the group name is changed successfully. -`true`: Yes; -`false`: No.*/
|
|
84
|
+
groupname?: boolean;
|
|
85
|
+
/** Whether requiring approval is changed successfully. -`true`: Yes; -`false`: No. */
|
|
86
|
+
membersonly?: boolean;
|
|
87
|
+
/** Whether allowing a group member to invite others is modified successfully. -`true`: Yes; -`false`: No.*/
|
|
88
|
+
allowinvites?: boolean;
|
|
89
|
+
}
|
|
90
|
+
declare type GroupMember =
|
|
91
|
+
| {
|
|
92
|
+
owner: UserId;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
member: UserId;
|
|
96
|
+
};
|
|
97
|
+
interface SetGroupAdminResult {
|
|
98
|
+
/** The user ID of the new admin. */
|
|
99
|
+
newadmin: UserId;
|
|
100
|
+
/** The setting result. */
|
|
101
|
+
result: 'success';
|
|
102
|
+
}
|
|
103
|
+
interface RemoveGroupAdminResult {
|
|
104
|
+
/** The user ID of a removed admin. */
|
|
105
|
+
oldadmin: UserId;
|
|
106
|
+
/** The setting result. */
|
|
107
|
+
result: 'success';
|
|
108
|
+
}
|
|
109
|
+
interface DestroyGroupResult {
|
|
110
|
+
/** The group ID. */
|
|
111
|
+
id: string;
|
|
112
|
+
/** The operation result. */
|
|
113
|
+
success: boolean;
|
|
114
|
+
}
|
|
115
|
+
interface InviteUsersToGroupResult {
|
|
116
|
+
/** The action. */
|
|
117
|
+
action: 'invite';
|
|
118
|
+
/** The group ID. */
|
|
119
|
+
id: string;
|
|
120
|
+
/** The reason for failure. */
|
|
121
|
+
reason?: string;
|
|
122
|
+
/** The invitation result. - `true`: The invitation is delivered successfully; - `false`: The invitation fails to be delivered. */
|
|
123
|
+
result: boolean;
|
|
124
|
+
/** The invitee ID. */
|
|
125
|
+
user: UserId;
|
|
126
|
+
}
|
|
127
|
+
interface RemoveGroupMemberResult {
|
|
128
|
+
/** The action. */
|
|
129
|
+
action: 'remove_member';
|
|
130
|
+
/** The group ID. */
|
|
131
|
+
groupid: string;
|
|
132
|
+
/** The invitation result. - `true`: Success; - `false`: Failure.*/
|
|
133
|
+
result: boolean;
|
|
134
|
+
/** The user ID. */
|
|
135
|
+
user: UserId;
|
|
136
|
+
}
|
|
137
|
+
interface MuteGroupMemberResult {
|
|
138
|
+
/** The mute duration in milliseconds. */
|
|
139
|
+
expire: number;
|
|
140
|
+
/** The operation result. - `true`: Succeed; - `false`: Failed.*/
|
|
141
|
+
result: boolean;
|
|
142
|
+
/** The ID of the muted member. */
|
|
143
|
+
user: UserId;
|
|
144
|
+
}
|
|
145
|
+
interface UnmuteGroupMemberResult {
|
|
146
|
+
/** The operation result. - `true`: Succeed; - `false`: Failed.*/
|
|
147
|
+
result: boolean;
|
|
148
|
+
/** The ID of the unmuted member. */
|
|
149
|
+
user: UserId;
|
|
150
|
+
}
|
|
151
|
+
interface GetGroupMuteListResult {
|
|
152
|
+
/** The mute duration in milliseconds. */
|
|
153
|
+
expire: number;
|
|
154
|
+
/** The ID of the muted user. */
|
|
155
|
+
user: UserId;
|
|
156
|
+
}
|
|
157
|
+
interface GroupRequestResult {
|
|
158
|
+
/** The action. */
|
|
159
|
+
action: string;
|
|
160
|
+
/** The group ID. */
|
|
161
|
+
groupid: string;
|
|
162
|
+
/** The invitation result. - `true`: Succeed; - `false`: Failed. */
|
|
163
|
+
result: boolean;
|
|
164
|
+
/** The user ID. */
|
|
165
|
+
user: UserId;
|
|
166
|
+
}
|
|
167
|
+
interface IsInGroupWhiteListResult {
|
|
168
|
+
/** The user ID to query. */
|
|
169
|
+
member: UserId;
|
|
170
|
+
/** Whether the user is on the allowlist. -`true`: Yes; -`false`: No.*/
|
|
171
|
+
white: boolean;
|
|
172
|
+
}
|
|
173
|
+
interface GetGroupMsgReadUserResult {
|
|
174
|
+
/** The message ID to query. */
|
|
175
|
+
ackmid: string;
|
|
176
|
+
/** Whether the message is the last one. -`true`: Yes; -`false`: No.*/
|
|
177
|
+
is_last: boolean;
|
|
178
|
+
/** The cursor for next pagination query. It specifies where to start to get the next page of data.*/
|
|
179
|
+
next_key: string;
|
|
180
|
+
/** The Unix timestamp of the current query. */
|
|
181
|
+
timestamp: number;
|
|
182
|
+
/** The number of members that have read the message. */
|
|
183
|
+
total: number;
|
|
184
|
+
/** The list of members that have read this message. */
|
|
185
|
+
userlist: UserId[];
|
|
186
|
+
}
|
|
187
|
+
interface UpdateGroupAnnouncementResult {
|
|
188
|
+
/** The group ID. */
|
|
189
|
+
id: string;
|
|
190
|
+
/** The operation result. - `true`: Success; - `false`: Failure.*/
|
|
191
|
+
result: boolean;
|
|
192
|
+
}
|
|
193
|
+
interface DeleteGroupSharedFileResult {
|
|
194
|
+
/** The group ID. */
|
|
195
|
+
group_id: string;
|
|
196
|
+
/** The file ID. */
|
|
197
|
+
file_id: string;
|
|
198
|
+
/** The operation result. - `true`: Success; - `false`: Failure.*/
|
|
199
|
+
result: boolean;
|
|
200
|
+
}
|
|
201
|
+
interface FetchGroupSharedFileListResult {
|
|
202
|
+
/** The file ID. */
|
|
203
|
+
file_id: string;
|
|
204
|
+
/** The file name. */
|
|
205
|
+
file_name: string;
|
|
206
|
+
/** The file owner. */
|
|
207
|
+
file_owner: string;
|
|
208
|
+
/** The file size. */
|
|
209
|
+
file_size: number;
|
|
210
|
+
/** The Unix timestamp when the file is uploaded.*/
|
|
211
|
+
created: number;
|
|
212
|
+
}
|
|
213
|
+
export type {
|
|
214
|
+
GroupRequestResult,
|
|
215
|
+
BaseGroupInfo,
|
|
216
|
+
CreateGroupResult,
|
|
217
|
+
BlockGroupResult,
|
|
218
|
+
ChangeGroupOwnerResult,
|
|
219
|
+
GroupDetailInfo,
|
|
220
|
+
ModifyGroupResult,
|
|
221
|
+
GroupMember,
|
|
222
|
+
SetGroupAdminResult,
|
|
223
|
+
RemoveGroupAdminResult,
|
|
224
|
+
DestroyGroupResult,
|
|
225
|
+
InviteUsersToGroupResult,
|
|
226
|
+
RemoveGroupMemberResult,
|
|
227
|
+
MuteGroupMemberResult,
|
|
228
|
+
UnmuteGroupMemberResult,
|
|
229
|
+
GetGroupMuteListResult,
|
|
230
|
+
IsInGroupWhiteListResult,
|
|
231
|
+
GetGroupMsgReadUserResult,
|
|
232
|
+
UpdateGroupAnnouncementResult,
|
|
233
|
+
DeleteGroupSharedFileResult,
|
|
234
|
+
FetchGroupSharedFileListResult,
|
|
235
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Jid } from './common';
|
|
2
|
+
import { MessagesType } from './message';
|
|
3
|
+
import { LastMessage } from '../types/threadApi';
|
|
4
|
+
interface UpdateOwnUserInfoParams {
|
|
5
|
+
/** The nickname. */
|
|
6
|
+
nickname?: string;
|
|
7
|
+
/** The avatar url. */
|
|
8
|
+
avatarurl?: string;
|
|
9
|
+
/** The email. */
|
|
10
|
+
mail?: string;
|
|
11
|
+
/** The phone number. */
|
|
12
|
+
phone?: string;
|
|
13
|
+
/** Gender. You can define it with the following type: string, number, boolean. */
|
|
14
|
+
gender?: string | number | boolean;
|
|
15
|
+
/** Signature. */
|
|
16
|
+
sign?: string;
|
|
17
|
+
/** Birthday. */
|
|
18
|
+
birth?: string;
|
|
19
|
+
/** Extension. You can define it with the following type: string, number, boolean. */
|
|
20
|
+
ext?: {
|
|
21
|
+
[key: string]: string | number | boolean;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Configurable fields. */
|
|
25
|
+
declare type ConfigurableKey =
|
|
26
|
+
| 'nickname'
|
|
27
|
+
| 'avatarurl'
|
|
28
|
+
| 'mail'
|
|
29
|
+
| 'phone'
|
|
30
|
+
| 'gender'
|
|
31
|
+
| 'sign'
|
|
32
|
+
| 'birth'
|
|
33
|
+
| 'ext';
|
|
34
|
+
interface RosterData {
|
|
35
|
+
name: string;
|
|
36
|
+
subscription: 'both';
|
|
37
|
+
jid: Jid;
|
|
38
|
+
}
|
|
39
|
+
interface BaseUserInfo {
|
|
40
|
+
/** Whether the current user is enabled. - `true`: Yes; - `false`: No.*/
|
|
41
|
+
activated: boolean;
|
|
42
|
+
/** The timestamp when the current user is created. */
|
|
43
|
+
created: number;
|
|
44
|
+
/** The time when the user information is last edited. */
|
|
45
|
+
modified: number;
|
|
46
|
+
/** The display name in the message push notification. */
|
|
47
|
+
nickname: string;
|
|
48
|
+
/** The user type. */
|
|
49
|
+
type: string;
|
|
50
|
+
/** The user ID. */
|
|
51
|
+
username: string;
|
|
52
|
+
/** The user uuid on the chat server. */
|
|
53
|
+
uuid: string;
|
|
54
|
+
}
|
|
55
|
+
export interface PushInfo {
|
|
56
|
+
/** The device ID, used to identify a device, which can be customized.*/
|
|
57
|
+
device_id: string;
|
|
58
|
+
/** The push token, which can be defined by yourself, is generally used to identify the same device. */
|
|
59
|
+
device_token: string;
|
|
60
|
+
/** The Push service appId, senderID for FCM, "appId+#+AppKey" for Vivo */
|
|
61
|
+
notifier_name: string;
|
|
62
|
+
}
|
|
63
|
+
interface UploadTokenResult extends BaseUserInfo {
|
|
64
|
+
/** The push info. */
|
|
65
|
+
pushInfo: PushInfo[];
|
|
66
|
+
}
|
|
67
|
+
interface SessionInfo {
|
|
68
|
+
/** The conversation ID. */
|
|
69
|
+
channel_id: string;
|
|
70
|
+
/** The content of the last message.*/
|
|
71
|
+
meta: {
|
|
72
|
+
/** The message sender. */
|
|
73
|
+
from: string;
|
|
74
|
+
/** The message ID. */
|
|
75
|
+
id: string;
|
|
76
|
+
/** The message content. */
|
|
77
|
+
payload: string;
|
|
78
|
+
/** The time when the message is received. */
|
|
79
|
+
timestamp: number;
|
|
80
|
+
/** The message recipient. */
|
|
81
|
+
to: string;
|
|
82
|
+
};
|
|
83
|
+
/** The number of unread messages. */
|
|
84
|
+
unread_num: number;
|
|
85
|
+
}
|
|
86
|
+
interface conversationList {
|
|
87
|
+
/** The conversation ID. */
|
|
88
|
+
channel_id: string;
|
|
89
|
+
/** Overview of the latest news. */
|
|
90
|
+
lastMessage: LastMessage;
|
|
91
|
+
/** The number of unread messages. */
|
|
92
|
+
unread_num: number;
|
|
93
|
+
}
|
|
94
|
+
interface DeleteSessionResult {
|
|
95
|
+
/** The result of request. */
|
|
96
|
+
result: 'ok';
|
|
97
|
+
}
|
|
98
|
+
interface SendMsgResult {
|
|
99
|
+
/** The message local ID. */
|
|
100
|
+
localMsgId: string;
|
|
101
|
+
/** The ID of the message on the server. */
|
|
102
|
+
serverMsgId: string;
|
|
103
|
+
}
|
|
104
|
+
interface HistoryMessages {
|
|
105
|
+
/** 游标。如果数据还有下一页,该方法的返回值会包含此字段,传递此字段可获取下一页的数据,为 '' 时获取第一页数据 */
|
|
106
|
+
cursor?: string;
|
|
107
|
+
/** The Historical messages. */
|
|
108
|
+
messages: MessagesType[];
|
|
109
|
+
}
|
|
110
|
+
interface ContactRelationshipMsg {
|
|
111
|
+
/** The message type, subscribe: request a contact, unsubscribed: cancel or refuse to add contact, subscribed: added contact successfully. */
|
|
112
|
+
type: 'subscribe' | 'unsubscribed' | 'subscribed';
|
|
113
|
+
/** The message receiver. */
|
|
114
|
+
to: string;
|
|
115
|
+
/** The message sender. */
|
|
116
|
+
from: string;
|
|
117
|
+
/** Reason. */
|
|
118
|
+
status?: string;
|
|
119
|
+
}
|
|
120
|
+
export type {
|
|
121
|
+
UploadTokenResult,
|
|
122
|
+
SessionInfo,
|
|
123
|
+
conversationList,
|
|
124
|
+
BaseUserInfo,
|
|
125
|
+
DeleteSessionResult,
|
|
126
|
+
SendMsgResult,
|
|
127
|
+
ContactRelationshipMsg,
|
|
128
|
+
};
|
|
129
|
+
export type {
|
|
130
|
+
RosterData,
|
|
131
|
+
UpdateOwnUserInfoParams,
|
|
132
|
+
ConfigurableKey,
|
|
133
|
+
HistoryMessages,
|
|
134
|
+
};
|