easemob-websdk 4.24.1 → 5.0.0

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 (324) hide show
  1. package/README.md +95 -39
  2. package/bundle/im-sdk-web.iife.js +1 -0
  3. package/cache/cache-crypto.d.ts +26 -0
  4. package/cache/cache-eviction.d.ts +16 -0
  5. package/cache/cache-keys.d.ts +23 -0
  6. package/cache/cache-manager.d.ts +254 -0
  7. package/cache/cache-metadata.d.ts +14 -0
  8. package/cache/cache-store.d.ts +19 -0
  9. package/cache/cache-types.d.ts +225 -0
  10. package/cache/cache-utils.d.ts +7 -0
  11. package/cache/contact-cache.d.ts +35 -0
  12. package/cache/conversation-cache.d.ts +21 -0
  13. package/cache/group-namecard-cache.d.ts +20 -0
  14. package/cache/index.d.ts +24 -0
  15. package/cache/joined-group-preview-cache.d.ts +12 -0
  16. package/cache/session-list-cache.d.ts +10 -0
  17. package/cache/user-info-cache.d.ts +16 -0
  18. package/chat-client.d.ts +558 -0
  19. package/chunks/cache-utils-BwRPIZ7n.js +1 -0
  20. package/chunks/cache-utils-CKbcYPlM.cjs +1 -0
  21. package/chunks/chat-manager-ChdK26ck.cjs +1 -0
  22. package/chunks/chat-manager-DH8a6Qj9.js +2 -0
  23. package/chunks/common-CfAlncj9.cjs +1 -0
  24. package/chunks/common-DN_g4O3n.js +1 -0
  25. package/chunks/event-system-COBJFEIq.cjs +1 -0
  26. package/chunks/event-system-D6IJA0C4.js +1 -0
  27. package/chunks/group-user-info-resolver-C5pdiqox.cjs +1 -0
  28. package/chunks/group-user-info-resolver-FNRqDg18.js +1 -0
  29. package/chunks/index-BKg4EGcI.cjs +1 -0
  30. package/chunks/index-CK3GHdGU.cjs +1 -0
  31. package/chunks/index-CjofwvEQ.js +1 -0
  32. package/chunks/index-uKWbjx-u.js +1 -0
  33. package/chunks/profile-version-DLMz8lqW.js +1 -0
  34. package/chunks/profile-version-njNs7R5-.cjs +1 -0
  35. package/chunks/reflection-proto-codec-64ocOTHU.js +1 -0
  36. package/chunks/reflection-proto-codec-BnQFQdZC.cjs +1 -0
  37. package/chunks/session-list-query-B6dh-b4Y.cjs +1 -0
  38. package/chunks/session-list-query-Dnp2HbpW.js +1 -0
  39. package/chunks/user-info-BfRwS4ZA.js +1 -0
  40. package/chunks/user-info-icpL0Eaw.cjs +1 -0
  41. package/config/cache.d.ts +12 -0
  42. package/config/timeouts.d.ts +34 -0
  43. package/core/connection/connection-manager.d.ts +228 -0
  44. package/core/connection/connection-retry.d.ts +47 -0
  45. package/core/connection/heartbeat.d.ts +68 -0
  46. package/core/contact-sync/contact-roster-event-sidecar.d.ts +3 -0
  47. package/core/contact-sync/roster-sync-client.d.ts +21 -0
  48. package/core/contact-sync/roster-sync-controller.d.ts +20 -0
  49. package/core/contact-sync/roster-sync-session.d.ts +28 -0
  50. package/core/contact-sync/roster-sync-types.d.ts +74 -0
  51. package/core/events/event-hub.d.ts +13 -0
  52. package/core/group-sync/group-sync-client.d.ts +19 -0
  53. package/core/group-sync/group-sync-controller.d.ts +11 -0
  54. package/core/group-sync/group-sync-merge.d.ts +3 -0
  55. package/core/group-sync/group-sync-normalizer.d.ts +4 -0
  56. package/core/group-sync/group-sync-session.d.ts +17 -0
  57. package/core/group-sync/group-sync-types.d.ts +24 -0
  58. package/core/group-sync/index.d.ts +4 -0
  59. package/core/index.d.ts +95 -0
  60. package/core/message/attachment-downloader.d.ts +7 -0
  61. package/core/message/chatroom-operation-types.d.ts +6 -0
  62. package/core/message/combine-message-downloader.d.ts +7 -0
  63. package/core/message/message-action-types.d.ts +22 -0
  64. package/core/message/message-deduplicator.d.ts +11 -0
  65. package/core/message/message-receiver.d.ts +65 -0
  66. package/core/message/message-retry.d.ts +33 -0
  67. package/core/message/message-sender.d.ts +63 -0
  68. package/core/message/profile-sync/group-namecard-hydration-queue.d.ts +33 -0
  69. package/core/message/profile-sync/group-namecard-hydrator.d.ts +8 -0
  70. package/core/message/profile-sync/latest-message-version-projector.d.ts +3 -0
  71. package/core/message/profile-sync/profile-version-sidecar.d.ts +9 -0
  72. package/core/message/profile-sync/profile-version.d.ts +3 -0
  73. package/core/message/profile-sync/user-info-hydration-queue.d.ts +29 -0
  74. package/core/message/profile-sync/user-info-hydrator.d.ts +8 -0
  75. package/core/message/stream-message-cache.d.ts +38 -0
  76. package/core/message/stream-message-handler.d.ts +22 -0
  77. package/core/session-list-sync/session-list-query.d.ts +26 -0
  78. package/core/session-list-sync/session-list-sync-controller.d.ts +17 -0
  79. package/core/session-list-sync/session-list-sync-merge.d.ts +17 -0
  80. package/core/session-list-sync/session-list-sync-normalizer.d.ts +6 -0
  81. package/core/session-list-sync/session-list-sync-runner.d.ts +13 -0
  82. package/core/session-list-sync/session-list-sync-session.d.ts +26 -0
  83. package/core/session-list-sync/session-list-sync-types.d.ts +24 -0
  84. package/core/sync/shared-sync-websocket-session.d.ts +61 -0
  85. package/core/user-info/group-user-info-resolver.d.ts +40 -0
  86. package/data-report/bridge.d.ts +11 -0
  87. package/data-report/constants.d.ts +25 -0
  88. package/data-report/data-reporter.d.ts +21 -0
  89. package/data-report/event-queue.d.ts +38 -0
  90. package/data-report/index.d.ts +3 -0
  91. package/data-report/network-type.d.ts +1 -0
  92. package/data-report/operation-map.d.ts +8 -0
  93. package/data-report/transport.d.ts +17 -0
  94. package/data-report/types.d.ts +61 -0
  95. package/index.cjs +1 -0
  96. package/index.d.ts +134 -0
  97. package/index.js +3 -0
  98. package/managers/chat/index.cjs +1 -0
  99. package/managers/chat/index.d.ts +1 -0
  100. package/managers/chat/index.js +1 -0
  101. package/managers/chat-manager.d.ts +880 -0
  102. package/managers/chat-thread/chat-thread.d.ts +126 -0
  103. package/managers/chat-thread/index.cjs +1 -0
  104. package/managers/chat-thread/index.d.ts +2 -0
  105. package/managers/chat-thread/index.js +1 -0
  106. package/managers/chat-thread-manager.d.ts +257 -0
  107. package/managers/chatroom/chatroom-event-mapper.d.ts +17 -0
  108. package/managers/chatroom/chatroom-event-user-info-resolver.d.ts +15 -0
  109. package/managers/chatroom/chatroom-normalizers.d.ts +23 -0
  110. package/managers/chatroom/chatroom.d.ts +403 -0
  111. package/managers/chatroom/index.cjs +1 -0
  112. package/managers/chatroom/index.d.ts +2 -0
  113. package/managers/chatroom/index.js +1 -0
  114. package/managers/chatroom-manager.d.ts +604 -0
  115. package/managers/contact/contact-user-info-resolver.d.ts +15 -0
  116. package/managers/contact/index.cjs +1 -0
  117. package/managers/contact/index.d.ts +1 -0
  118. package/managers/contact/index.js +1 -0
  119. package/managers/contact-manager.d.ts +215 -0
  120. package/managers/group/group-event-mapper.d.ts +18 -0
  121. package/managers/group/group-event-user-info-resolver.d.ts +15 -0
  122. package/managers/group/group-normalizers.d.ts +15 -0
  123. package/managers/group/group.d.ts +504 -0
  124. package/managers/group/index.cjs +1 -0
  125. package/managers/group/index.d.ts +2 -0
  126. package/managers/group/index.js +1 -0
  127. package/managers/group/internal/group-event-sync.d.ts +13 -0
  128. package/managers/group/internal/group-repository.d.ts +31 -0
  129. package/managers/group/internal/group-snapshot-mapper.d.ts +6 -0
  130. package/managers/group/internal/internal-group.d.ts +24 -0
  131. package/managers/group-manager.d.ts +371 -0
  132. package/managers/presence/index.cjs +1 -0
  133. package/managers/presence/index.d.ts +1 -0
  134. package/managers/presence/index.js +1 -0
  135. package/managers/presence-manager.d.ts +201 -0
  136. package/managers/push/index.cjs +1 -0
  137. package/managers/push/index.d.ts +1 -0
  138. package/managers/push/index.js +1 -0
  139. package/managers/push-manager.d.ts +205 -0
  140. package/managers/user-info/index.cjs +1 -0
  141. package/managers/user-info/index.d.ts +4 -0
  142. package/managers/user-info/index.js +1 -0
  143. package/managers/user-info/user-info-notify-normalizer.d.ts +2 -0
  144. package/managers/user-info/user-info-runtime-store.d.ts +28 -0
  145. package/managers/user-info-manager.d.ts +196 -0
  146. package/message/combine-compatible-text-sidecar.d.ts +4 -0
  147. package/message/combine-message-constraints.d.ts +7 -0
  148. package/message/combine-payload-codec.d.ts +17 -0
  149. package/message/create-message.d.ts +64 -0
  150. package/package.json +64 -16
  151. package/platform/capability-validator.d.ts +7 -0
  152. package/platform/env.d.ts +68 -0
  153. package/platform/factory.d.ts +7 -0
  154. package/platform/image/miniapp-image-processor.d.ts +45 -0
  155. package/platform/image/web-image-processor.d.ts +2 -0
  156. package/platform/index.d.ts +17 -0
  157. package/platform/miniapp/miniapp-adapter.d.ts +3 -0
  158. package/platform/proto/proto-adapter.d.ts +17 -0
  159. package/platform/proto/reflection-proto-codec.d.ts +8 -0
  160. package/platform/proto/static-proto-adapter.d.ts +8 -0
  161. package/platform/request/web-request-adapter.d.ts +9 -0
  162. package/platform/runtime/connection-event-normalizer.d.ts +14 -0
  163. package/platform/runtime/runtime-event-bridge.d.ts +23 -0
  164. package/platform/runtime/web-runtime-adapter.d.ts +26 -0
  165. package/platform/socket/web-socket-adapter.d.ts +8 -0
  166. package/platform/types.d.ts +472 -0
  167. package/platform/upload/react-native-upload-adapter.d.ts +14 -0
  168. package/platform/upload/upload-error-mapper.d.ts +7 -0
  169. package/platform/upload/upload-source.d.ts +20 -0
  170. package/platform/upload/web-upload-adapter.d.ts +10 -0
  171. package/protocol/joined-groups/codec.d.ts +11 -0
  172. package/protocol/joined-groups/gateway.d.ts +2 -0
  173. package/protocol/joined-groups/index.d.ts +2 -0
  174. package/protocol/joined-groups/proto.d.ts +174 -0
  175. package/protocol/joined-groups/types.d.ts +65 -0
  176. package/protocol/msync/codec.d.ts +191 -0
  177. package/protocol/msync/context.d.ts +40 -0
  178. package/protocol/msync/lz4-compressor/index.d.ts +40 -0
  179. package/protocol/msync/lz4-compressor/utils.d.ts +27 -0
  180. package/protocol/msync/multi-device-normalizer.d.ts +75 -0
  181. package/protocol/msync/proto.d.ts +1306 -0
  182. package/protocol/msync/root.d.ts +5 -0
  183. package/protocol/msync/types.d.ts +96 -0
  184. package/protocol/msync/utils.d.ts +26 -0
  185. package/protocol/protobuf/decoder.d.ts +44 -0
  186. package/protocol/protobuf/encoder.d.ts +23 -0
  187. package/protocol/protobuf/types.d.ts +53 -0
  188. package/protocol/roster/codec.d.ts +9 -0
  189. package/protocol/roster/proto.d.ts +205 -0
  190. package/protocol/roster/root.d.ts +5 -0
  191. package/protocol/roster/types.d.ts +83 -0
  192. package/protocol/session-list/codec.d.ts +11 -0
  193. package/protocol/session-list/gateway.d.ts +19 -0
  194. package/protocol/session-list/payload-decoder.d.ts +1 -0
  195. package/protocol/session-list/proto.d.ts +207 -0
  196. package/protocol/session-list/types.d.ts +83 -0
  197. package/rest/chat-management.d.ts +26 -0
  198. package/rest/chat-thread-management.d.ts +14 -0
  199. package/rest/chatroom-management.d.ts +40 -0
  200. package/rest/client.d.ts +86 -0
  201. package/rest/contact-management.d.ts +27 -0
  202. package/rest/contact-metadata.d.ts +11 -0
  203. package/rest/conversation-management.d.ts +11 -0
  204. package/rest/dns-config.d.ts +20 -0
  205. package/rest/error-map-types.d.ts +32 -0
  206. package/rest/error-maps/chat.d.ts +888 -0
  207. package/rest/error-maps/chatroom.d.ts +592 -0
  208. package/rest/error-maps/common.d.ts +208 -0
  209. package/rest/error-maps/contact.d.ts +185 -0
  210. package/rest/error-maps/core.d.ts +21 -0
  211. package/rest/error-maps/group.d.ts +500 -0
  212. package/rest/error-maps/index.d.ts +9 -0
  213. package/rest/error-maps/presence.d.ts +62 -0
  214. package/rest/error-maps/push.d.ts +158 -0
  215. package/rest/error-maps/thread.d.ts +538 -0
  216. package/rest/error-maps/user-info.d.ts +289 -0
  217. package/rest/errors.d.ts +23 -0
  218. package/rest/group-management.d.ts +55 -0
  219. package/rest/rtc-token.d.ts +14 -0
  220. package/rest/speech-helpers.d.ts +24 -0
  221. package/rest/user-info-subscription.d.ts +10 -0
  222. package/rest/user-info.d.ts +34 -0
  223. package/types/chat-client.d.ts +226 -0
  224. package/types/chat-manager.d.ts +641 -0
  225. package/types/chat-thread.d.ts +311 -0
  226. package/types/chatroom.d.ts +1258 -0
  227. package/types/connection.d.ts +111 -0
  228. package/types/contact.d.ts +149 -0
  229. package/types/conversation.d.ts +270 -0
  230. package/types/event-system.d.ts +721 -0
  231. package/types/group.d.ts +980 -0
  232. package/types/index.d.ts +577 -44
  233. package/types/manager.d.ts +99 -0
  234. package/types/message-conversation.d.ts +22 -0
  235. package/types/message-create.d.ts +173 -0
  236. package/types/multi-device.d.ts +275 -0
  237. package/types/presence.d.ts +101 -0
  238. package/types/push.d.ts +296 -0
  239. package/types/sender.d.ts +12 -0
  240. package/types/sync-data.d.ts +54 -0
  241. package/types/user-info.d.ts +178 -0
  242. package/upload/attachment-file-store.d.ts +11 -0
  243. package/upload/attachment-uploader.d.ts +36 -0
  244. package/upload/constants.d.ts +8 -0
  245. package/upload/index.d.ts +2 -0
  246. package/upload/multipart-upload.d.ts +14 -0
  247. package/upload/simple-upload.d.ts +3 -0
  248. package/upload/types.d.ts +79 -0
  249. package/upload/utils.d.ts +71 -0
  250. package/utils/env.d.ts +4 -0
  251. package/utils/error-codes.d.ts +2 -0
  252. package/utils/error-codes.generated.d.ts +145 -0
  253. package/utils/error-sanitizer.d.ts +8 -0
  254. package/utils/errors.d.ts +139 -0
  255. package/utils/log-reporter.d.ts +61 -0
  256. package/utils/log-sanitizer.d.ts +6 -0
  257. package/utils/logger.d.ts +48 -0
  258. package/utils/md5.d.ts +1 -0
  259. package/utils/message-id.d.ts +12 -0
  260. package/utils/provision-error-mapping.d.ts +21 -0
  261. package/utils/retry.d.ts +26 -0
  262. package/utils/runtime-global.d.ts +4 -0
  263. package/utils/trace-id.d.ts +5 -0
  264. package/utils/utf8.d.ts +2 -0
  265. package/validators/chat-client.d.ts +787 -0
  266. package/validators/message-create.d.ts +419 -0
  267. package/validators/search-messages.d.ts +127 -0
  268. package/validators/validator.d.ts +49 -0
  269. package/version.d.ts +2 -0
  270. package/Easemob-chat.d.ts +0 -8457
  271. package/Easemob-chat.js +0 -2
  272. package/chatroom/chatroom.d.ts +0 -649
  273. package/chatroom/chatroom.js +0 -1
  274. package/contact/contact.d.ts +0 -726
  275. package/contact/contact.js +0 -1
  276. package/group/group.d.ts +0 -848
  277. package/group/group.js +0 -1
  278. package/localCache/localCache.d.ts +0 -59
  279. package/localCache/localCache.js +0 -1
  280. package/message/audio.d.ts +0 -183
  281. package/message/channel.d.ts +0 -82
  282. package/message/cmd.d.ts +0 -146
  283. package/message/combine.d.ts +0 -132
  284. package/message/custom.d.ts +0 -135
  285. package/message/delivery.d.ts +0 -77
  286. package/message/file.d.ts +0 -173
  287. package/message/img.d.ts +0 -200
  288. package/message/index.d.ts +0 -211
  289. package/message/location.d.ts +0 -134
  290. package/message/read.d.ts +0 -85
  291. package/message/text.d.ts +0 -149
  292. package/message/video.d.ts +0 -180
  293. package/miniCore/miniCore.d.ts +0 -217
  294. package/miniCore/miniCore.js +0 -2
  295. package/miniProgram/Easemob-chat.js +0 -2
  296. package/miniProgram/miniProgram.zip +0 -0
  297. package/presence/presence.d.ts +0 -69
  298. package/presence/presence.js +0 -1
  299. package/silent/silent.d.ts +0 -128
  300. package/silent/silent.js +0 -1
  301. package/status.d.ts +0 -184
  302. package/thread/thread.d.ts +0 -159
  303. package/thread/thread.js +0 -1
  304. package/translation/translation.d.ts +0 -30
  305. package/translation/translation.js +0 -1
  306. package/types/chatRoomApi.d.ts +0 -226
  307. package/types/common.d.ts +0 -89
  308. package/types/engineCore.d.ts +0 -194
  309. package/types/error.d.ts +0 -13
  310. package/types/eventHandler.d.ts +0 -437
  311. package/types/groupApi.d.ts +0 -306
  312. package/types/indexApi.d.ts +0 -366
  313. package/types/localCache.d.ts +0 -53
  314. package/types/message.d.ts +0 -959
  315. package/types/presenceApi.d.ts +0 -61
  316. package/types/reactionApi.d.ts +0 -74
  317. package/types/restApis.d.ts +0 -6
  318. package/types/silentModeApi.d.ts +0 -109
  319. package/types/threadApi.d.ts +0 -175
  320. package/types/translation.d.ts +0 -25
  321. package/types/utils.d.ts +0 -90
  322. package/uniApp/Easemob-chat.js +0 -2
  323. package/uniApp/uniApp.zip +0 -0
  324. package/websdk.zip +0 -0
@@ -1,726 +0,0 @@
1
- import * as IndexTypes from '../types/indexApi';
2
- import * as ReactionTypes from '../types/reactionApi';
3
- import { AsyncResult, UserId } from '../types/common';
4
- import { MessageType, ModifiedMsg, ChatType, AudioMsgBody } from '../types/message';
5
- export interface Contact {
6
- /**
7
- * Gets the blocklist.
8
- *
9
- * ```typescript
10
- * connection.getBlocklist()
11
- * ```
12
- */
13
- getBlocklist(): Promise<AsyncResult<UserId[]>>;
14
-
15
- /**
16
- * Gets the contact list.
17
- *
18
- * ```typescript
19
- * connection.getContacts()
20
- * ```
21
- */
22
- getContacts(): Promise<AsyncResult<UserId[]>>;
23
-
24
- /**
25
- * 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.
26
- *
27
- * ```typescript
28
- * connection.uploadPushToken({deviceId: 'deviceId', deviceToken: 'deviceToken', notifierName: 'notifierName'})
29
- * ```
30
- */
31
- uploadPushToken(params: {
32
- /** The device ID that identifies the device. Custom device IDs are allowed. */
33
- deviceId: string;
34
- /** The push token, which identifies a device during message push. Custom push tokens are allowed.*/
35
- deviceToken: string;
36
- /** The app ID for the push service, which is the senderID for Firebase Cloud Messaging (FCM) and "appId+#+AppKey" for the vivo push service. */
37
- notifierName: string;
38
- }): Promise<AsyncResult<IndexTypes.UploadTokenResult>>;
39
-
40
- /**
41
- *
42
- * Unbind push device token.
43
- *
44
- * ```typescript
45
- * connection.unbindPushToken()
46
- * ```
47
- */
48
- unbindPushToken(): Promise<AsyncResult<IndexTypes.UploadTokenResult>>;
49
-
50
- /**
51
- * Gets the conversation list and the latest message in the conversation.
52
- *
53
- * ```typescript
54
- * connection.getConversationlist()
55
- * ```
56
- */
57
- getConversationlist(params?: {
58
- /** The current page number, starting from 1. */
59
- pageNum?: number;
60
- /** The number of conversations that you expect to get on each page. The value cannot exceed 20. */
61
- pageSize?: number;
62
- success?: (res: AsyncResult<IndexTypes.ConversationInfo>) => void;
63
- error?: (error: ErrorEvent) => void;
64
- }): Promise<AsyncResult<IndexTypes.ConversationInfo>>;
65
-
66
- /**
67
- * Deletes the conversation.
68
- *
69
- * ```typescript
70
- * connection.deleteConversation()
71
- * ```
72
- */
73
- deleteConversation(params: {
74
- /** The conversation ID: the peer's user ID or group ID. */
75
- channel: string;
76
- /** The conversation type.
77
- * - `singleChat`: one-to-one chat;
78
- * - `groupChat`: group chat.
79
- */
80
- chatType: 'singleChat' | 'groupChat';
81
- /** Whether to delete server roaming messages during conversation deletion.
82
- * - `true`: Yes;
83
- * - `false`: No.
84
- */
85
- deleteRoam: boolean;
86
- }): Promise<AsyncResult<IndexTypes.DeleteSessionResult>>;
87
-
88
- /**
89
- * Modifies the user's attributes.
90
- *
91
- * ```typescript
92
- * connection.updateUserInfo({nickname: 'Tom', avatarurl: 'avatarurl', mail: 'abc@gmail,com', ext: JSON.stringify({hobby: 'football'})})
93
- *
94
- * connection.updateUserInfo('nickname', 'Tom')
95
- * ```
96
- */
97
- updateUserInfo(
98
- params: IndexTypes.UpdateOwnUserInfoParams | IndexTypes.ConfigurableKey,
99
- value?: string
100
- ): Promise<AsyncResult<IndexTypes.UpdateOwnUserInfoParams>>;
101
-
102
- /**
103
- * Queries the user attributes.
104
- *
105
- * ```typescript
106
- * connection.fetchUserInfoById('user1') | fetchUserInfoById(['user1', 'user2'])
107
- * ```
108
- */
109
- fetchUserInfoById(
110
- /** The array of IDs of users or user ID to query. */
111
- userId: UserId | UserId[],
112
- /** User properties to query. If the parameter is blank, query all. */
113
- properties?: IndexTypes.ConfigurableKey[] | IndexTypes.ConfigurableKey
114
- ): Promise<
115
- AsyncResult<{
116
- [key: string]: IndexTypes.UpdateOwnUserInfoParams;
117
- }>
118
- >;
119
-
120
- /**
121
- * 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.
122
- *
123
- * ```typescript
124
- * connection.updateCurrentUserNick('Tom')
125
- * ```
126
- */
127
- updateCurrentUserNick(
128
- /** The nickname shown when a message push notification is received. */
129
- nick: string
130
- ): Promise<AsyncResult<IndexTypes.BaseUserInfo[]>>;
131
-
132
- /**
133
- * Gets the message history.
134
- *
135
- * ```typescript
136
- * connection.getHistoryMessages({targetId:'targetId',chatType:'groupChat', pageSize: 20})
137
- * ```
138
- */
139
- getHistoryMessages(options: {
140
- /** The user ID of the other party or the group ID or chat room ID. */
141
- targetId: string;
142
- /** The starting message ID for this query. The default value is -1, which means to start retrieving from the latest message. */
143
- cursor?: number | string | null;
144
- /** The number of messages to retrieve each time. The default value is 20,The maximum value is 50. */
145
- pageSize?: number;
146
- /**
147
- * The chat type for SDK:
148
- * - `singleChat`: one-to-one chat;
149
- * - `groupChat`: group chat;
150
- * - `chatRoom`: chat room chat.
151
- */
152
- chatType: 'singleChat' | 'groupChat' | 'chatRoom';
153
- /** Whether to select pull history messages in positive order(Pull message from the oldest to the latest).
154
- * - `up`: means searching from the newer messages to the older messages.
155
- * - `down`: means searching from the older messages to the newer messages.
156
- * - (Default)`up`.
157
- */
158
- searchDirection?: 'down' | 'up';
159
- /** Query conditions. */
160
- searchOptions?: {
161
- /** The user ID of the message sender. This parameter is used only for group chat. */
162
- from?: UserId;
163
- /** An array of message types for query. If no value is passed in, all message types will be queried. */
164
- msgTypes?: Array<
165
- Exclude<MessageType, 'read' | 'delivery' | 'channel'>
166
- >;
167
- /** The start timestamp for query. The unit is millisecond. */
168
- startTime?: number;
169
- /** The end timestamp for query. The unit is millisecond. */
170
- endTime?: number;
171
- };
172
- }): Promise<IndexTypes.HistoryMessages>;
173
-
174
- /**
175
- * ~chinese
176
- * 从服务端搜索消息。
177
- * 该功能需要在 Console 开通「消息搜索」增值服务。
178
- *
179
- * @param option 搜索参数配置,详见 {@link MessageSearchOption}。
180
- * @param pageNum 分页页码,从 1 开始。
181
- * @param pageSize 每页返回条数(1-100,默认 20)。
182
- * ~english
183
- * Searches messages from the server.
184
- * This feature requires the "Message Search" service to be enabled in the Console.
185
- *
186
- * @param option The search option. See {@link MessageSearchOption}.
187
- * @param pageNum The page number for pagination, starting from 1.
188
- * @param pageSize The number of results per page (1-100, default 20).
189
- */
190
- searchMessages(params: {
191
- /** The search option. */
192
- option: IndexTypes.MessageSearchOption;
193
- /** The page number for pagination, starting from 1. */
194
- pageNum?: number;
195
- /** The number of results per page. The range is 1 to 100. */
196
- pageSize?: number;
197
- }): Promise<IndexTypes.ServerSearchMessagesResult>;
198
-
199
- /**
200
- * Adds a friend.
201
- *
202
- * ```typescript
203
- * connection.addContact('user1', 'I am Bob')
204
- * ```
205
- */
206
- addContact(
207
- /** The user ID of the other party. */
208
- to: string,
209
- /** The validation message. */
210
- message?: string
211
- ): Promise<void>;
212
-
213
- /**
214
- * Deletes the contact.
215
- *
216
- * ```typescript
217
- * connection.deleteContact('user1')
218
- * ```
219
- */
220
- deleteContact(
221
- /** The user ID of the other party. */
222
- to: string
223
- ): Promise<void>;
224
-
225
- /**
226
- * Accepts a friend request.
227
- *
228
- * ```typescript
229
- * connection.acceptContactInvite('user1')
230
- * ```
231
- */
232
- acceptContactInvite(
233
- /** The user ID of the other party. */
234
- to: string
235
- ): Promise<void>;
236
-
237
- /**
238
- * Declines a friend request.
239
- *
240
- * ```typescript
241
- * connection.declineContactInvite('user1')
242
- * ```
243
- */
244
- declineContactInvite(
245
- /** The user ID of the other party. */
246
- to: string
247
- ): Promise<void>;
248
-
249
- /**
250
- * Adds a contact to the blocklist.
251
- *
252
- * ```typescript
253
- * connection.addUsersToBlocklist({name: 'user1'})
254
- * ```
255
- */
256
- addUsersToBlocklist(options: {
257
- /** 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. */
258
- name: UserId | UserId[];
259
- }): Promise<AsyncResult<IndexTypes.OperateResult>>;
260
-
261
- /**
262
- *
263
- * Removes contacts from the blocklist.
264
- *
265
- * ```typescript
266
- * connection.removeUserFromBlocklist({name: 'user1'})
267
- * ```
268
- */
269
- removeUserFromBlocklist(options: {
270
- /** 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. */
271
- name: UserId | UserId[];
272
- }): Promise<void>;
273
-
274
- /**
275
- * Recalls a message.
276
- *
277
- * ```typescript
278
- * connection.recallMessage({mid: 'messageId', to: 'user1', type: 'singleChat'})
279
- * ```
280
- */
281
- recallMessage(option: {
282
- /** The ID of the message to be recalled. */
283
- mid: string;
284
- /** The recipient of the message. */
285
- to: UserId;
286
- /** The chat type for SDK:
287
- * - `singleChat`: one-to-one chat;
288
- * - `groupChat`: group chat;
289
- * - `chatroom`: chat room.
290
- */
291
- chatType?: 'singleChat' | 'groupChat' | 'chatRoom';
292
- /** Whether the message is in the thread. */
293
- isChatThread?: boolean;
294
- /** Custom extension fields. */
295
- ext?: string;
296
- }): Promise<IndexTypes.SendMsgResult>;
297
-
298
- /**
299
- * Modifies a message in the server.
300
- *
301
- * - Text message: Both the message body `msg` and extension information `ext` can be modified.
302
- * - Custom message: The custom extension property field `customExts`, custom event type field `customEvent` , and message extension field `ext` can be modified.
303
- * - Image/video/voice/file/location/combined message: Only the message extension field `ext` can be modified.
304
- * - Command message: This type of message cannot be modified.
305
- *
306
- * The message recipient can listen for message changes via `onModifiedMessage`. Also, this callback applies in multi-device scenarios.
307
- *
308
- *
309
- * ```typescript
310
- *
311
- * const textMessage = WebIM.message.create({
312
- * type: "txt",
313
- * msg: "message content",
314
- * to: "username",
315
- * chatType: "singleChat",
316
- * });
317
- *
318
- * connection.modifyMessage({ messageId: 'messageId', message: textMessage })
319
- * ```
320
- */
321
- modifyMessage(option: {
322
- /** The ID of the message to modify.*/
323
- messageId: string;
324
- /** The modified message.*/
325
- modifiedMessage: ModifiedMsg;
326
- }): Promise<IndexTypes.ModifyMsgResult>;
327
-
328
- /**
329
- * Adds a reaction to the message.
330
- *
331
- * ```typescript
332
- * connection.addReaction({messageId: 'messageId', action: 'action'})
333
- * ```
334
- */
335
- addReaction(params: {
336
- /** The message ID. */
337
- messageId: string;
338
- /** The reaction to be added to the message. The length is limited to 128 characters. */
339
- reaction: string;
340
- }): Promise<void>;
341
-
342
- /**
343
- * Removes a reaction from a message.
344
- *
345
- * ```typescript
346
- * connection.deleteReaction({reactionId: 'reactionId'})
347
- * ```
348
- */
349
- deleteReaction(params: {
350
- /** The message reaction to delete. */
351
- reaction: string;
352
- /** The message ID. */
353
- messageId: string;
354
- }): Promise<void>;
355
-
356
- /**
357
- * Gets the reaction list for the message.
358
- *
359
- * ```typescript
360
- * connection.getReactionlist({chatType: 'chatType', messageId: 'messageId'})
361
- * ```
362
- */
363
- getReactionList(params: {
364
- /** The conversation type:
365
- * - singleChat;
366
- * - groupChat;
367
- */
368
- chatType: 'singleChat' | 'groupChat';
369
- /** The message ID. */
370
- messageId: string | Array<string>;
371
- /** The group ID. */
372
- groupId?: string;
373
- }): Promise<AsyncResult<ReactionTypes.GetReactionListResult[]>>;
374
-
375
- /**
376
- * Gets the details of a reaction.
377
- *
378
- * ```typescript
379
- * getReactionDetail({messageId: 'messageId', reaction: 'reaction', cursor: '', pageSize: 20})
380
- * ```
381
- */
382
- getReactionDetail(params: {
383
- /** The message ID. */
384
- messageId: string;
385
- /** The reactions to retrieve. */
386
- reaction: string;
387
- /** 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.*/
388
- cursor?: string;
389
- /** The number of reactions per page. The default value is 20, and the maximum value is 100. */
390
- pageSize?: number;
391
- }): Promise<AsyncResult<ReactionTypes.GetReactionDetailResult>>;
392
-
393
- /**
394
- * Reports an inappropriate message.
395
- *
396
- * ```typescript
397
- * reportMessage()
398
- * ```
399
- */
400
- reportMessage(params: {
401
- /** The type of reporting. */
402
- reportType: string;
403
- /** The reason for reporting. You need to type a specific reason. */
404
- reportReason: string;
405
- /** The ID of the message to report. */
406
- messageId: string;
407
- }): Promise<void>;
408
-
409
- /**
410
- * Unidirectionally deletes historical messages from the server.
411
- *
412
- * ```typescript
413
- * connection.removeHistoryMessages({targetId: 'userId', chatType: 'singleChat', beforeTimeStamp: Date.now()})
414
- *
415
- * connection.removeHistoryMessages({targetId: 'userId', chatType: 'singleChat', messageIds: ['messageId']})
416
- * ```
417
- */
418
- removeHistoryMessages(options: {
419
- /** The ID of the peer user , group ID or chatRoom ID. */
420
- targetId: string;
421
- /**
422
- * The conversation type:
423
- * - `singleChat`: one-to-one chat;
424
- * - `groupChat`: group chat.
425
- * - `chatRoom`: chat room.
426
- */
427
- chatType: ChatType;
428
- /** The ID list of messages to be deleted. A maximum of 20 message IDs can be passed in. */
429
- messageIds?: Array<string>;
430
- /** The starting timestamp for message deletion. Messages with the timestamp before the specified one will be deleted. */
431
- beforeTimeStamp?: number;
432
- }): Promise<void>;
433
-
434
- /**
435
- * Gets the list of conversations from the server with pagination.
436
- *
437
- * The SDK returns the list of conversations in the reverse chronological order of their active time (the timestamp of the last message).
438
- *
439
- * If there is no message in the conversation, the SDK retrieves the list of conversations in the reverse chronological order of their creation time.
440
- *
441
- * ```typescript
442
- * connection.getServerConversations({pageSize:50, cursor: ''})
443
- * ```
444
- */
445
- getServerConversations(params: {
446
- /** The number of conversations that you expect to get on each page. The value range is [1,50] and the default value is `20`. */
447
- pageSize?: number;
448
- /** The position from which to start getting data. If you set `cursor` to an empty string (''), the SDK retrieves conversations from the latest active one.*/
449
- cursor?: string;
450
- /**
451
- * Whether to include empty conversations, default is false.
452
- * - `true`: Yes;
453
- * - `false`: No.
454
- */
455
- includeEmptyConversations?: boolean;
456
- }): Promise<AsyncResult<IndexTypes.ServerConversations>>;
457
-
458
- /**
459
- * Get the list of pinned conversations from the server with pagination.
460
- *
461
- * The SDK returns the pinned conversations in the reverse chronological order of their pinning.
462
- *
463
- * ```typescript
464
- * connection.getServerPinnedConversations({pageSize:50, cursor: ''})
465
- * ```
466
- */
467
- getServerPinnedConversations(params: {
468
- /** The number of conversations that you expect to get on each page. The value range is [1,50] and the default value is `20`. */
469
- pageSize?: number;
470
- /** The position from which to start getting data. If you pass in an empty string (''), the SDK retrieves conversations from the latest pinned one.*/
471
- cursor?: string;
472
- /**
473
- * Whether to include empty conversations, default is false.
474
- * - `true`: Yes;
475
- * - `false`: No.
476
- */
477
- includeEmptyConversations?: boolean;
478
- }): Promise<AsyncResult<IndexTypes.ServerConversations>>;
479
-
480
- /**
481
- * Sets whether to pin a conversation.
482
- *
483
- * ```typescript
484
- * connection.pinConversation({conversationId:'conversationId',conversationType: 'singleChat', isPinned: boolean})
485
- * ```
486
- */
487
- pinConversation(params: {
488
- /** The conversation ID. */
489
- conversationId: string;
490
- /** The conversation type. */
491
- conversationType: 'singleChat' | 'groupChat';
492
- /** Whether to pin the conversation:
493
- * - `true`: Yes.
494
- * - `false`: No. The conversation is unpinned.
495
- */
496
- isPinned: boolean;
497
- }): Promise<AsyncResult<IndexTypes.PinConversation>>;
498
-
499
- /**
500
- * Set contact remark.
501
- *
502
- * ```typescript
503
- * setContactRemark({userId: 'userId', remark: 'remark'})
504
- * ```
505
- */
506
- setContactRemark(params: {
507
- /**
508
- * The ID of the contact to set the remark for.
509
- */
510
- userId: UserId;
511
- /**
512
- * The remark to set.
513
- */
514
- remark: string;
515
- }): Promise<void>;
516
-
517
- /**
518
- * Gets the all contacts.
519
- *
520
- * ```typescript
521
- * connection.getAllContacts()
522
- * ```
523
- */
524
- getAllContacts(): Promise<AsyncResult<IndexTypes.ContactItem[]>>;
525
-
526
- /**
527
- * Gets the list of contacts with pagination.
528
- *
529
- * ```typescript
530
- * connection.getContactsWithCursor({pageSize:50, cursor: ''})
531
- * ```
532
- */
533
- getContactsWithCursor(params: {
534
- /** The number of contacts that you expect to get on each page. The value range is [1,50] and the default value is `20`. */
535
- pageSize?: number;
536
- /** The position from which to start getting data. */
537
- cursor?: string;
538
- }): Promise<AsyncResult<IndexTypes.CursorContactsResult>>;
539
-
540
- /**
541
- * Marks conversations.
542
- *
543
- * ```typescript
544
- * connection.addConversationMark({
545
- * conversations: [{conversationId: 'conversationId', conversationType: 'singleChat'}],
546
- * mark: 0,
547
- * })
548
- * ```
549
- */
550
- addConversationMark(params: {
551
- /** The list of conversations. */
552
- conversations: Array<
553
- Pick<
554
- IndexTypes.ConversationItem,
555
- 'conversationId' | 'conversationType'
556
- >
557
- >;
558
- /** The mark to add for the conversations. */
559
- mark: IndexTypes.MarkType;
560
- }): Promise<void>;
561
-
562
- /**
563
- * Unmarks conversations.
564
- *
565
- * ```typescript
566
- * connection.removeConversationMark({
567
- * conversations: [{conversationId: 'conversationId', conversationType: 'singleChat'}],
568
- * mark: 0,
569
- * })
570
- * ```
571
- */
572
- removeConversationMark(params: {
573
- /** The list of conversations. */
574
- conversations: Array<
575
- Pick<
576
- IndexTypes.ConversationItem,
577
- 'conversationId' | 'conversationType'
578
- >
579
- >;
580
- /** The conversation mark to remove. */
581
- mark: IndexTypes.MarkType;
582
- }): Promise<void>;
583
-
584
- /**
585
- * Gets the conversations from the server with pagination according to the conversation filter.
586
- *
587
- * ```typescript
588
- * connection.getServerConversationsByFilter({pageSize:10, cursor: '',filter: {mark: 0})
589
- * ```
590
- */
591
- getServerConversationsByFilter(params: {
592
- /** The number of conversations to retrieve on each page. The value range is [1,10] and the default value is `10`. */
593
- pageSize?: number;
594
- /** The position from which to start getting data. */
595
- cursor?: string;
596
- /** The conversation filter options. */
597
- filter: {
598
- /** The conversation mark for query. */
599
- mark: IndexTypes.MarkType;
600
- };
601
- }): Promise<AsyncResult<IndexTypes.ServerConversations>>;
602
- /**
603
- * Get the unique IDs of current user on the other devices. The ID is user ID + "/" + resource.
604
- *
605
- * ```typescript
606
- * connection.getSelfIdsOnOtherPlatform()
607
- * ```
608
- */
609
- getSelfIdsOnOtherPlatform(): Promise<AsyncResult<string[]>>;
610
- /**
611
- * Deletes all conversations and all messages in them.
612
- *
613
- * ```typescript
614
- * connection.deleteAllMessagesAndConversations()
615
- * ```
616
- */
617
- deleteAllMessagesAndConversations(): Promise<void>;
618
- /**
619
- * Pins a message.
620
- *
621
- * connection.pinMessage({
622
- * conversationId: 'conversationId',
623
- * conversationType: 'groupChat',
624
- * messageId: 'messageId'
625
- * })
626
- */
627
- pinMessage(params: {
628
- /** The conversation ID. */
629
- conversationId: string;
630
- /** The conversation type. */
631
- conversationType: ChatType;
632
- /** The ID of the message to be pinned. */
633
- messageId: string;
634
- }): Promise<void>;
635
-
636
- /**
637
- * Unpins a message.
638
- *
639
- * connection.unpinMessage({
640
- * conversationId: 'conversationId',
641
- * conversationType: 'groupChat',
642
- * messageId: 'messageId'
643
- * })
644
- */
645
- unpinMessage(params: {
646
- /** The conversation ID. */
647
- conversationId: string;
648
- /** The conversation type. */
649
- conversationType: ChatType;
650
- /** The ID of the message to be unpinned. */
651
- messageId: string;
652
- }): Promise<void>;
653
-
654
- /**
655
- * Gets the pinned messages in a conversation with pagination.
656
- *
657
- * connection.getServerPinnedMessages({
658
- * conversationId: 'conversationId',
659
- * conversationType: 'groupChat',
660
- * pageSize: 20,
661
- * cursor: ''
662
- * })
663
- */
664
- getServerPinnedMessages(params: {
665
- /** The conversation ID. */
666
- conversationId: string;
667
- /** The conversation type. */
668
- conversationType: ChatType;
669
- /** The number of pinned messages to retrieve on each page. The value range is [1,50] and the default value is `10`. */
670
- pageSize?: number;
671
- /** The position from which to start getting data. For the first call of the method, an empty string ('') is passed in and the SDK returns the list of pinned messages in the descending order of when they are pinned. */
672
- cursor?: string;
673
- }): Promise<AsyncResult<IndexTypes.CursorPinnedMessagesResult>>;
674
-
675
- /**
676
- * Converts a voice message to text.
677
- *
678
- * ```typescript
679
- * connection.voiceMessageToText(messageBody, audioParams)
680
- * ```
681
- */
682
- voiceMessageToText(
683
- /** The voice message body. */
684
- messageBody: AudioMsgBody,
685
- /** Optional audio parameters used to help speech recognition. */
686
- audioParams?: IndexTypes.AudioParams
687
- ): Promise<
688
- AsyncResult<{
689
- text: string;
690
- }>
691
- >;
692
-
693
- /**
694
- * Converts a voice file to text.
695
- *
696
- * ```typescript
697
- * connection.voiceFileToText(file, audioParams)
698
- * ```
699
- */
700
- voiceFileToText(
701
- /** The voice file object or mini program local file path object. */
702
- file: IndexTypes.VoiceSourceFile,
703
- /** Optional audio parameters used to help speech recognition. */
704
- audioParams?: IndexTypes.AudioParams
705
- ): Promise<
706
- AsyncResult<{
707
- text: string;
708
- }>
709
- >;
710
-
711
- getUserIdByRTCUIds(
712
- RTCUIds: number[]
713
- ): Promise<AsyncResult<Record<number, string>>>;
714
-
715
- getRTCToken(channelName: string): Promise<
716
- AsyncResult<{
717
- appId: string;
718
- RTCToken: string;
719
- channelName: string;
720
- RTCUId: number;
721
- expire: number;
722
- }>
723
- >;
724
- }
725
-
726
- export { IndexTypes, ReactionTypes, AsyncResult, UserId, MessageType };