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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/Easemob-chat.d.ts +1338 -267
  3. package/Easemob-chat.js +1 -3
  4. package/chatroom/chatroom.d.ts +590 -0
  5. package/chatroom/chatroom.js +1 -0
  6. package/contact/contact.d.ts +322 -0
  7. package/contact/contact.js +1 -0
  8. package/group/group.d.ts +645 -0
  9. package/group/group.js +1 -0
  10. package/message/audio.d.ts +140 -0
  11. package/message/channel.d.ts +58 -0
  12. package/message/cmd.d.ts +102 -0
  13. package/message/custom.d.ts +94 -0
  14. package/message/delivery.d.ts +53 -0
  15. package/message/file.d.ts +134 -0
  16. package/message/img.d.ts +150 -0
  17. package/message/index.d.ts +147 -0
  18. package/message/location.d.ts +98 -0
  19. package/message/read.d.ts +61 -0
  20. package/message/text.d.ts +107 -0
  21. package/message/video.d.ts +140 -0
  22. package/miniCore/miniCore.d.ts +148 -0
  23. package/miniCore/miniCore.js +1 -0
  24. package/package.json +1 -1
  25. package/presence/presence.d.ts +67 -0
  26. package/presence/presence.js +1 -0
  27. package/readme.md +15 -11
  28. package/silent/silent.d.ts +110 -0
  29. package/silent/silent.js +1 -0
  30. package/thread/thread.d.ts +157 -0
  31. package/thread/thread.js +1 -0
  32. package/translation/translation.d.ts +28 -0
  33. package/translation/translation.js +1 -0
  34. package/types/chatRoomApi.d.ts +198 -0
  35. package/types/common.d.ts +56 -0
  36. package/types/engineCore.d.ts +83 -0
  37. package/types/error.d.ts +12 -0
  38. package/types/eventHandler.d.ts +201 -0
  39. package/types/groupApi.d.ts +235 -0
  40. package/types/indexApi.d.ts +134 -0
  41. package/types/presenceApi.d.ts +66 -0
  42. package/types/reactionApi.d.ts +74 -0
  43. package/types/restApis.d.ts +6 -0
  44. package/types/silentModeApi.d.ts +90 -0
  45. package/types/threadApi.d.ts +169 -0
  46. package/types/translation.d.ts +25 -0
@@ -0,0 +1,322 @@
1
+ import * as IndexTypes from '../types/indexApi';
2
+ import * as ReactonTypes from '../types/reactionApi';
3
+ import { AsyncResult, UserId } from '../types/common';
4
+ export interface Contact {
5
+ /**
6
+ * Gets the blocklist.
7
+ *
8
+ * ```typescript
9
+ * connection.getBlocklist()
10
+ * ```
11
+ */
12
+ getBlocklist(): Promise<AsyncResult<UserId[]>>;
13
+
14
+ /**
15
+ * Gets the contact list.
16
+ *
17
+ * ```typescript
18
+ * connection.getContacts()
19
+ * ```
20
+ */
21
+ getContacts(): Promise<AsyncResult<UserId[]>>;
22
+
23
+ /**
24
+ * Uploads the token to the server. This method is used when the SDK is used on a native client on which a third-party push service is to be integrated.
25
+ *
26
+ * ```typescript
27
+ * connection.uploadPushToken({deviceId: 'deviceId', deviceToken: 'deviceToken', notifierName: 'notifierName'})
28
+ * ```
29
+ */
30
+ uploadPushToken(params: {
31
+ /** The device ID that identifies the device. Custom device IDs are allowed. */
32
+ deviceId: string;
33
+ /** The push token, which identifies a device during message push. Custom push tokens are allowed.*/
34
+ deviceToken: string;
35
+ /** The app ID for the push service, which is the senderID for Firebase Cloud Messaging (FCM) and "appId+#+AppKey" for the vivo push service. */
36
+ notifierName: string;
37
+ }): Promise<AsyncResult<IndexTypes.UploadTokenResult>>;
38
+
39
+ /**
40
+ * Gets the conversation list.
41
+ *
42
+ * ```typescript
43
+ * connection.getConversationlist()
44
+ * ```
45
+ */
46
+ getConversationlist(): Promise<AsyncResult<IndexTypes.SessionInfo[]>>;
47
+
48
+ /**
49
+ * Deletes the conversation.
50
+ *
51
+ * ```typescript
52
+ * connection.deleteConversation()
53
+ * ```
54
+ */
55
+ deleteConversation(params: {
56
+ /** The conversation ID: the peer's user ID or group ID. */
57
+ channel: string;
58
+ /** The conversation type.
59
+ * - `singleChat`: one-to-one chat;
60
+ * - `groupChat`: group chat.
61
+ */
62
+ chatType: 'singleChat' | 'groupChat';
63
+ /** Whether to delete server roaming messages during conversation deletion.
64
+ * - `true`: Yes;
65
+ * - `false`: No.
66
+ */
67
+ deleteRoam: boolean;
68
+ }): Promise<AsyncResult<IndexTypes.DeleteSessionResult>>;
69
+
70
+ /**
71
+ * Modifies the user's attributes.
72
+ *
73
+ * ```typescript
74
+ * connection.updateUserInfo({nickname: 'Tom', avatarurl: 'avatarurl', mail: 'abc@gmail,com', ext: JSON.stringify({hobby: 'football'})})
75
+ *
76
+ * connection.updateUserInfo('nickname', 'Tom')
77
+ * ```
78
+ */
79
+ updateOwnUserInfo(
80
+ params: IndexTypes.UpdateOwnUserInfoParams | IndexTypes.ConfigurableKey,
81
+ value?: any
82
+ ): Promise<AsyncResult<IndexTypes.UpdateOwnUserInfoParams>>;
83
+
84
+ /**
85
+ * Queries the user attributes.
86
+ *
87
+ * ```typescript
88
+ * connection.fetchUserInfoById('user1') | fetchUserInfoById(['user1', 'user2'])
89
+ * ```
90
+ */
91
+ fetchUserInfoById(
92
+ /** The array of IDs of users or user ID to query. */
93
+ userId: UserId | UserId[],
94
+ /** User properties to query. If the parameter is blank, query all. */
95
+ properties?: IndexTypes.ConfigurableKey[] | IndexTypes.ConfigurableKey
96
+ ): Promise<AsyncResult<IndexTypes.UpdateOwnUserInfoParams>>;
97
+
98
+ /**
99
+ * Changes the nickname shown when the message push notification is received. This nickname is specified during user registration and it's not the same as the nickname attribute of the user.
100
+ *
101
+ * ```typescript
102
+ * connection.updateCurrentUserNick('Tom')
103
+ * ```
104
+ */
105
+ updateCurrentUserNick(
106
+ /** The nickname shown when a message push notification is received. */
107
+ nick: string
108
+ ): Promise<AsyncResult<IndexTypes.BaseUserInfo[]>>;
109
+
110
+ /**
111
+ * Gets the message history.
112
+ *
113
+ * ```typescript
114
+ * connection.getHistoryMessages({targetId:'user1',chatType:'groupChat', pageSize: 20})
115
+ * ```
116
+ */
117
+ getHistoryMessages(options: {
118
+ /** The user ID of the other party or the group ID. */
119
+ targetId: string;
120
+ /** The starting message ID for this query. The default value is -1, which means to start retrieving from the latest message. */
121
+ cursor?: number | string | null;
122
+ /** The number of messages to retrieve each time. The default value is 20,The maximum value is 50. */
123
+ pageSize?: number;
124
+ /** The chat type:
125
+ * - `singleChat`: one-to-one chat;
126
+ * - `groupChat`: group chat;
127
+ * - `chatRoom`: chat room.
128
+ * - (Default)`singleChat`: No.
129
+ */
130
+ chatType?: 'singleChat' | 'groupChat' | 'chatRoom';
131
+ /** Whether to select pull history messages in positive order(Pull message from the oldest to the latest).
132
+ * - `up`: means searching from the newer messages to the older messages.
133
+ * - `down`: means searching from the older messages to the newer messages.
134
+ * - (Default)`up`.
135
+ */
136
+ searchDirection?: string;
137
+ }): Promise<IndexTypes.HistoryMessages>;
138
+
139
+ /**
140
+ * Adds a friend.
141
+ *
142
+ * ```typescript
143
+ * connection.addContact('user1', 'I am Bob')
144
+ * ```
145
+ */
146
+ addContact(
147
+ /** The user ID of the other party. */
148
+ to: string,
149
+ /** The validation message. */
150
+ message?: string
151
+ ): void;
152
+
153
+ /**
154
+ * Deletes the contact.
155
+ *
156
+ * ```typescript
157
+ * connection.deleteContact('user1')
158
+ * ```
159
+ */
160
+ deleteContact(
161
+ /** The user ID of the other party. */
162
+ to: string
163
+ ): void;
164
+
165
+ /**
166
+ * Accepts a friend request.
167
+ *
168
+ * ```typescript
169
+ * connection.acceptContactInvite('user1')
170
+ * ```
171
+ */
172
+ acceptContactInvite(
173
+ /** The user ID of the other party. */
174
+ to: string
175
+ ): void;
176
+
177
+ /**
178
+ * Declines a friend request.
179
+ *
180
+ * ```typescript
181
+ * connection.declineContactInvite('user1')
182
+ * ```
183
+ */
184
+ declineContactInvite(
185
+ /** The user ID of the other party. */
186
+ to: string
187
+ ): void;
188
+
189
+ /**
190
+ * Adds a contact to the blocklist.
191
+ *
192
+ * ```typescript
193
+ * connection.addUsersToBlocklist({name: 'user1'})
194
+ * ```
195
+ */
196
+ addUsersToBlocklist(options: {
197
+ /** The user ID. You can type a specific user ID to add a single user to the blocklist or type an array of user IDs, like ["user1","user2"], to add multiple users. */
198
+ name: UserId | UserId[];
199
+ }): void;
200
+
201
+ /**
202
+ *
203
+ * Removes contacts from the blocklist.
204
+ *
205
+ * ```typescript
206
+ * connection.removeUserFromBlocklist({name: 'user1'})
207
+ * ```
208
+ */
209
+ removeUserFromBlocklist(options: {
210
+ /** The user ID. You can type a specific user ID to remove a single user from the blocklist or type an array of user IDs, like ["user1","user2"], to remove multiple users. */
211
+ name: UserId | UserId[];
212
+ }): void;
213
+
214
+ /**
215
+ * Recalls a message.
216
+ *
217
+ * ```typescript
218
+ * connection.recallMessage({mid: 'messageId', to: 'user1', type: 'singleChat'})
219
+ * ```
220
+ */
221
+ recallMessage(option: {
222
+ /** The ID of the message to be recalled. */
223
+ mid: string;
224
+ /** The recipient of the message. */
225
+ to: UserId;
226
+ /** The chat type:
227
+ * - `singleChat`: one-to-one chat;
228
+ * - `groupchat`: group chat;
229
+ * - `chatroom`: chat room.
230
+ */
231
+ chatType?: 'singleChat' | 'groupChat' | 'chatRoom';
232
+ /** Is it a message in the thread. */
233
+ isChatThread?: boolean;
234
+ }): Promise<IndexTypes.SendMsgResult>;
235
+
236
+ /**
237
+ * Adds a reaction to the message.
238
+ *
239
+ * ```typescript
240
+ * connection.addReaction({messageId: 'messageId', action: 'action'})
241
+ * ```
242
+ */
243
+ addReaction(params: {
244
+ /** The message ID. */
245
+ messageId: string;
246
+ /** The reaction to be added to the message. The length is limited to 128 characters. */
247
+ reaction: string;
248
+ }): Promise<void>;
249
+
250
+ /**
251
+ * Removes a reaction from a message.
252
+ *
253
+ * ```typescript
254
+ * connection.deleteReaction({reactionId: 'reactionId'})
255
+ * ```
256
+ */
257
+ deleteReaction(params: {
258
+ /** The message reaction to delete. */
259
+ reaction: string;
260
+ /** The message ID. */
261
+ messageId: string;
262
+ }): Promise<void>;
263
+
264
+ /**
265
+ * Gets the reaction list for the message.
266
+ *
267
+ * ```typescript
268
+ * connection.getReactionlist({chatType: 'chatType', messageId: 'messageId'})
269
+ * ```
270
+ */
271
+ getReactionList(params: {
272
+ /** The conversation type:
273
+ * - singleChat;
274
+ * - groupChat;
275
+ */
276
+ chatType: 'singleChat' | 'groupChat';
277
+ /** The message ID. */
278
+ messageId: string | Array<string>;
279
+ /** The group ID. */
280
+ groupId?: string;
281
+ }): Promise<AsyncResult<ReactonTypes.GetReactionListResult[]>>;
282
+
283
+ /**
284
+ * Gets the details of a reaction.
285
+ *
286
+ * ```typescript
287
+ * getReactionDetail({messageId: 'messageId', reaction: 'reaction', cursor: '', pageSize: 20})
288
+ * ```
289
+ */
290
+ getReactionDetail(
291
+ this: Connection,
292
+ params: {
293
+ /** The message ID. */
294
+ messageId: string;
295
+ /** The reactions to retrieve. */
296
+ reaction: string;
297
+ /** The cursor that specifies where to start to get data. If there will be data on the next page, this method will return the value of this field to indicate the position to start to get data of the next page. If it is null, the data of the first page will be retrieved.*/
298
+ cursor?: string;
299
+ /** The number of reactions per page. The default value is 20, and the maximum value is 100. */
300
+ pageSize?: number;
301
+ }
302
+ ): Promise<AsyncResult<ReactonTypes.GetReactionDetailResult>>;
303
+
304
+ /**
305
+ * Reports a message.
306
+ *
307
+ * ```typescript
308
+ * reportMessage()
309
+ * ```
310
+ */
311
+ reportMessage(
312
+ this: Connection,
313
+ params: {
314
+ /** The type of report. */
315
+ reportType: string;
316
+ /** The reason for reporting. */
317
+ reportReason: string;
318
+ /** ID of the message to be reported. */
319
+ messageId: string;
320
+ }
321
+ ): Promise<void>;
322
+ }