juggleim-rnsdk 0.1.6 → 0.1.8

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 (146) hide show
  1. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  2. package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
  3. package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
  4. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/8.9/executionHistory/executionHistory.lock +0 -0
  6. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  7. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/8.9/gc.properties +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  11. package/android/.gradle/vcs-1/gc.properties +0 -0
  12. package/android/.settings/org.eclipse.buildship.core.prefs +12 -1
  13. package/android/build/.transforms/42b8ab7e96b9440b0e91d2ecba5f579c/transformed/classes/classes_dex/classes.dex +0 -0
  14. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$10.dex +0 -0
  15. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$11.dex +0 -0
  16. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$12.dex +0 -0
  17. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$13.dex +0 -0
  18. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$14.dex +0 -0
  19. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$15.dex +0 -0
  20. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$16.dex +0 -0
  21. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$17.dex +0 -0
  22. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$18.dex +0 -0
  23. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$19.dex +0 -0
  24. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$20.dex +0 -0
  25. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$21.dex +0 -0
  26. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$22.dex +0 -0
  27. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$6.dex +0 -0
  28. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$7.dex +0 -0
  29. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$8.dex +0 -0
  30. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager$9.dex +0 -0
  31. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMManager.dex +0 -0
  32. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/JuggleIMPackage.dex +0 -0
  33. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/call/JuggleIMCallModule$1.dex +0 -0
  34. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/call/JuggleIMCallModule$2.dex +0 -0
  35. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/call/JuggleIMCallModule$3.dex +0 -0
  36. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/call/JuggleIMCallModule.dex +0 -0
  37. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/call/view/RCTZegoSurfaceViewManager.dex +0 -0
  38. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/juggleim/call/view/ZegoSurfaceView.dex +0 -0
  39. package/android/build/.transforms/a3b636e0768beb7635f48b7f77613c33/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  40. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  41. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  42. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$10.class +0 -0
  43. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$11.class +0 -0
  44. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$12.class +0 -0
  45. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$13.class +0 -0
  46. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$14.class +0 -0
  47. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$15.class +0 -0
  48. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$16.class +0 -0
  49. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$17.class +0 -0
  50. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$18.class +0 -0
  51. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$19.class +0 -0
  52. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$20.class +0 -0
  53. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$21.class +0 -0
  54. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$22.class +0 -0
  55. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$6.class +0 -0
  56. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$7.class +0 -0
  57. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$8.class +0 -0
  58. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager$9.class +0 -0
  59. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMManager.class +0 -0
  60. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/JuggleIMPackage.class +0 -0
  61. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/call/JuggleIMCallModule$1.class +0 -0
  62. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/call/JuggleIMCallModule$2.class +0 -0
  63. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/call/JuggleIMCallModule$3.class +0 -0
  64. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/call/JuggleIMCallModule.class +0 -0
  65. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/call/view/RCTZegoSurfaceViewManager.class +0 -0
  66. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/juggleim/call/view/ZegoSurfaceView.class +0 -0
  67. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$10.class +0 -0
  68. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$11.class +0 -0
  69. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$12.class +0 -0
  70. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$13.class +0 -0
  71. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$14.class +0 -0
  72. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$15.class +0 -0
  73. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$16.class +0 -0
  74. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$17.class +0 -0
  75. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$18.class +0 -0
  76. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$19.class +0 -0
  77. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$20.class +0 -0
  78. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$21.class +0 -0
  79. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$22.class +0 -0
  80. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$6.class +0 -0
  81. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$7.class +0 -0
  82. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$8.class +0 -0
  83. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager$9.class +0 -0
  84. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMManager.class +0 -0
  85. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/JuggleIMPackage.class +0 -0
  86. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/call/JuggleIMCallModule$1.class +0 -0
  87. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/call/JuggleIMCallModule$2.class +0 -0
  88. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/call/JuggleIMCallModule$3.class +0 -0
  89. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/call/JuggleIMCallModule.class +0 -0
  90. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/call/view/RCTZegoSurfaceViewManager.class +0 -0
  91. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/juggleim/call/view/ZegoSurfaceView.class +0 -0
  92. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  93. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$1.class.uniqueId24 +0 -0
  94. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$10.class.uniqueId0 +0 -0
  95. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$11.class.uniqueId14 +0 -0
  96. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$12.class.uniqueId22 +0 -0
  97. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$13.class.uniqueId7 +0 -0
  98. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$14.class.uniqueId15 +0 -0
  99. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$15.class.uniqueId6 +0 -0
  100. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$16.class.uniqueId11 +0 -0
  101. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$17.class.uniqueId23 +0 -0
  102. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$18.class.uniqueId8 +0 -0
  103. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$19.class.uniqueId20 +0 -0
  104. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$2.class.uniqueId3 +0 -0
  105. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$20.class.uniqueId5 +0 -0
  106. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$21.class.uniqueId13 +0 -0
  107. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$22.class.uniqueId18 +0 -0
  108. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$23.class.uniqueId10 +0 -0
  109. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$3.class.uniqueId17 +0 -0
  110. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$4.class.uniqueId21 +0 -0
  111. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$5.class.uniqueId9 +0 -0
  112. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$6.class.uniqueId12 +0 -0
  113. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$7.class.uniqueId4 +0 -0
  114. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$8.class.uniqueId16 +0 -0
  115. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager$9.class.uniqueId19 +0 -0
  116. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMManager.class.uniqueId1 +0 -0
  117. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/JuggleIMPackage.class.uniqueId2 +0 -0
  118. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  119. package/android/build.gradle +2 -0
  120. package/android/src/main/java/com/juggleim/JuggleIMManager.java +24 -3
  121. package/android/src/main/java/com/juggleim/JuggleIMPackage.java +4 -1
  122. package/android/src/main/java/com/juggleim/call/JuggleIMCallModule.java +507 -0
  123. package/android/src/main/java/com/juggleim/call/view/RCTZegoSurfaceViewManager.java +32 -0
  124. package/android/src/main/java/com/juggleim/call/view/ZegoSurfaceView.java +43 -0
  125. package/ios/JModelFactory.m +12 -3
  126. package/ios/JuggleIMManager.m +6 -7
  127. package/ios/call/JuggleIMCallModule.h +10 -0
  128. package/ios/call/JuggleIMCallModule.m +520 -0
  129. package/ios/call/README.md +51 -0
  130. package/ios/call/view/ZegoSurfaceView.h +7 -0
  131. package/ios/call/view/ZegoSurfaceView.m +45 -0
  132. package/ios/call/view/ZegoSurfaceViewManager.h +5 -0
  133. package/ios/call/view/ZegoSurfaceViewManager.m +12 -0
  134. package/juggleim-rnsdk.podspec +2 -0
  135. package/package.json +1 -1
  136. package/src/call/CallConst.ts +43 -0
  137. package/src/call/CallInfo.ts +13 -0
  138. package/src/call/CallMember.ts +12 -0
  139. package/src/call/CallSession.ts +186 -0
  140. package/src/call/JuggleIMCall.ts +79 -0
  141. package/src/call/ZegoSurfaceView.tsx +24 -0
  142. package/src/call/index.ts +8 -0
  143. package/src/index.d.ts +422 -864
  144. package/src/index.js +1 -0
  145. package/src/types.d.ts +453 -0
  146. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GenericCustomMessage.class.uniqueId0 +0 -0
package/src/index.d.ts CHANGED
@@ -1,895 +1,453 @@
1
- declare module "juggleim-rnsdk" {
1
+
2
+ export * from './types';
3
+ export * from './call';
4
+
5
+ import {
6
+ ConnectionStatusListener,
7
+ MessageListener,
8
+ MessageReadReceiptListener,
9
+ MessageDestroyListener,
10
+ ConversationListener,
11
+ GetConversationOptions,
12
+ ConversationInfo,
13
+ Conversation,
14
+ SimpleCallback,
15
+ ConversationTagOptions,
16
+ SendMessageObject,
17
+ SendMessageCallback,
18
+ Message,
19
+ MessageContent,
20
+ MergeMessageContent,
21
+ SendMediaMessageCallback,
22
+ VoiceMessageContent,
23
+ CustomMessageConstructor,
24
+ UpdateMessageCallback,
25
+ GetMessageOptions,
26
+ MessageResponse
27
+ } from './types';
28
+
29
+ /**
30
+ * Juggle IM React Native SDK
31
+ */
32
+ export default class JuggleIM {
2
33
  /**
3
- * 连接状态类型
34
+ * 设置服务器地址列表
35
+ * @param urls 服务器地址列表
4
36
  */
5
- export type ConnectionStatus =
6
- | "connected"
7
- | "connecting"
8
- | "disconnected"
9
- | "failure"
10
- | "dbOpen"
11
- | "dbClose";
37
+ static setServerUrls(urls: string[]): void;
12
38
 
13
39
  /**
14
- * 会话类型
40
+ * 初始化SDK
41
+ * @param appKey 应用唯一标识
15
42
  */
16
- export enum ConversationType {
17
- PRIVATE = 1,
18
- GROUP = 2,
19
- CHATROOM = 3,
20
- SYSTEM = 4,
21
- }
43
+ static init(appKey: string): void;
22
44
 
23
45
  /**
24
- * 会话对象
25
- * @property {number} conversationType - 会话类型 @ConversationType
26
- * @property {string} conversationId - 会话ID
46
+ * 注册自定义消息类型
47
+ * @param contentType 消息类型标识符(不能以 "jg:" 开头)
48
+ * @param messageClass 自定义消息类的构造函数
49
+ * @example
50
+ * ```typescript
51
+ * class CustomMessage implements CustomMessageContent {
52
+ * contentType = 'my:custom';
53
+ * value: string = '';
54
+ * }
55
+ *
56
+ * JuggleIM.registerCustomMessageType('my:custom', CustomMessage);
57
+ * ```
27
58
  */
28
- export interface Conversation {
29
- conversationType: number;
30
- conversationId: string;
31
- }
59
+ static registerCustomMessageType(
60
+ contentType: string,
61
+ messageClass: CustomMessageConstructor
62
+ ): void;
32
63
 
33
64
  /**
34
- * 消息内容基类
35
- * @property {string} contentType - 消息内容类型
36
- * 枚举:jg:text, jg:img, jg:file, jg:voice
65
+ * 连接到服务器
66
+ * @param token 用户token
37
67
  */
38
- export abstract class MessageContent {
39
- contentType: string;
40
- }
68
+ static connect(token: string): void;
41
69
 
42
70
  /**
43
- * 自定义消息内容
44
- * 实现示例:
45
- * ```
46
- * export class TextCardMessage extends CustomMessageContent {
47
- * title: string = '';
48
- * description: string = '';
49
- * url: string = '';
50
- * constructor(title?: string, description?: string, url?: string) {
51
- * super('demo:textcard');
52
- * this.title = title || '';
53
- * this.description = description || '';
54
- * this.url = url || '';
55
- * }
56
- * ```
57
- *
58
- * 自定义消息注册
59
- * ```
60
- * JuggleIM.registerCustomMessageType('demo:textcard', TextCardMessage);
61
- * ```
71
+ * 断开连接
72
+ * @param pushable 是否继续接收推送
73
+ */
74
+ static disconnect(pushable: boolean): void;
75
+
76
+ /**
77
+ * 添加连接状态监听器
78
+ * @param key 监听器标识
79
+ * @param listener 监听器回调函数
80
+ * @returns 返回取消监听的函数
81
+ */
82
+ static addConnectionStatusListener(
83
+ key: string,
84
+ listener: ConnectionStatusListener
85
+ ): () => void;
86
+
87
+ /**
88
+ * 添加消息监听器
89
+ * @param key 监听器标识
90
+ * @param listener 监听器回调函数
91
+ * @returns 返回取消监听的函数
92
+ */
93
+ static addMessageListener(
94
+ key: string,
95
+ listener: MessageListener
96
+ ): () => void;
97
+
98
+ /**
99
+ * 添加消息阅读状态监听器
100
+ * @param key 监听器标识
101
+ * @param listener 监听器回调函数
102
+ * @returns 返回取消监听的函数
103
+ */
104
+ static addMessageReadReceiptListener(
105
+ key: string,
106
+ listener: MessageReadReceiptListener
107
+ ): () => void;
108
+
109
+ /**
110
+ * 添加消息销毁监听器
111
+ * @param key 监听器标识
112
+ * @param listener 监听器回调函数
113
+ * @returns 返回取消监听的函数
114
+ */
115
+ static addMessageDestroyListener(
116
+ key: string,
117
+ listener: MessageDestroyListener
118
+ ): () => void;
119
+
120
+ /**
121
+ * 添加会话监听器
122
+ * @param key 监听器标识
123
+ * @param listener 监听器回调函数
124
+ * @returns 返回取消监听的函数
125
+ */
126
+ static addConversationListener(
127
+ key: string,
128
+ listener: ConversationListener
129
+ ): () => void;
130
+
131
+ /**
132
+ * 获取会话信息列表
133
+ * @param options 获取选项
134
+ * @returns {Promise<ConversationInfo[]>} 会话信息列表
135
+ */
136
+ static getConversationInfoList(
137
+ options: GetConversationOptions
138
+ ): Promise<ConversationInfo[]>;
139
+
140
+ /**
141
+ * 获取单个会话信息
142
+ * @param {Conversation} conversation 会话对象
143
+ * @returns {Promise<ConversationInfo | null>} 会话信息对象
144
+ */
145
+ static getConversationInfo(
146
+ conversation: Conversation
147
+ ): Promise<ConversationInfo | null>;
148
+
149
+ /**
150
+ * 创建会话信息
151
+ * @param conversation 会话对象
152
+ * @param callback 回调函数
153
+ */
154
+ static createConversationInfo(
155
+ conversation: Conversation
156
+ ): Promise<ConversationInfo>;
157
+
158
+ /**
159
+ * 删除会话信息
160
+ * @param conversation 会话对象
161
+ * @param callback 回调函数
162
+ */
163
+ static deleteConversationInfo(
164
+ conversation: Conversation,
165
+ callback: SimpleCallback
166
+ ): Promise<Boolean>;
167
+
168
+ /**
169
+ * 设置会话免打扰状态
170
+ * @param conversation 会话对象
171
+ * @param isMute 是否免打扰
172
+ * @param callback 回调函数
173
+ */
174
+ static setMute(
175
+ conversation: Conversation,
176
+ isMute: boolean
177
+ ): Promise<Boolean>;
178
+
179
+ /**
180
+ * 设置会话置顶状态
181
+ * @param conversation 会话对象
182
+ * @param isTop 是否置顶
183
+ * @param callback 回调函数
184
+ */
185
+ static setTop(conversation: Conversation, isTop: boolean): Promise<Boolean>;
186
+
187
+ /**
188
+ * 清除会话未读数
189
+ * @param conversation 会话对象
190
+ * @param callback 回调函数
191
+ */
192
+ static clearUnreadCount(conversation: Conversation): Promise<Boolean>;
193
+
194
+ /**
195
+ * 清除总未读数
196
+ * @param callback 回调函数
62
197
  */
63
- export class CustomMessageContent extends MessageContent {
64
- constructor(contentType: string);
65
- }
198
+ static clearTotalUnreadCount(): Promise<Boolean>;
66
199
 
67
200
  /**
68
- * 自定义消息类构造函数类型
201
+ * 获取总未读数
202
+ * @param callback 回调函数
69
203
  */
70
- export type CustomMessageConstructor = new () => MessageContent;
204
+ static getTotalUnreadCount(): Promise<number>;
71
205
 
72
206
  /**
73
- * 文本消息内容
207
+ * 设置会话草稿
208
+ * @param conversation 会话对象
209
+ * @param draft 草稿内容
210
+ * @param callback 回调函数
74
211
  */
75
- export class TextMessageContent extends MessageContent {
76
- contentType: string;
77
- content: string;
78
- constructor(content: string);
79
- }
212
+ static setDraft(
213
+ conversation: Conversation,
214
+ draft: string
215
+ ): Promise<Boolean>;
80
216
 
81
217
  /**
82
- * 撤回消息内容: 'jg:recallinfo';
218
+ * 清除会话草稿
219
+ * @param conversation 会话对象
220
+ * @param callback 回调函数
83
221
  */
84
- export class RecallInfoMessageContent extends MessageContent {
85
- contentType: string;
86
- }
222
+ static clearDraft(conversation: Conversation): Promise<Boolean>;
87
223
 
88
224
  /**
89
- * 合并消息内容
225
+ * 设置会话未读状态
226
+ * @param conversation 会话对象
227
+ * @param isUnread 是否未读
228
+ * @param callback 回调函数
90
229
  */
91
- export class MergeMessageContent extends MessageContent {
92
- contentType: string;
230
+ static setUnread(
231
+ conversation: Conversation,
232
+ isUnread: boolean
233
+ ): Promise<Boolean>;
93
234
 
94
- constructor(
95
- title?: string,
96
- conversation?: Conversation,
97
- messageIdList?: string[],
98
- previewList?: MergeMessagePreviewUnit[]
99
- );
235
+ /**
236
+ * 获取置顶会话信息列表
237
+ * @param count 获取数量
238
+ * @param timestamp 上一页最后一条数据的时间戳
239
+ * @param direction 拉取方向: 0-更新的消息, 1-更早的消息
240
+ * @returns {Promise<ConversationInfo[]>} 会话信息列表
241
+ */
242
+ static getTopConversationInfoList(
243
+ count: number,
244
+ timestamp: number,
245
+ direction: number
246
+ ): Promise<ConversationInfo[]>;
100
247
 
101
- title?: string;
102
- containerMsgId?: string;
103
- conversation?: Conversation;
104
- messageIdList?: string[];
105
- previewList?: MergeMessagePreviewUnit[];
106
- extra?: string;
107
-
108
- conversationDigest?(): string;
109
- getTitle?(): string | undefined;
110
- getContainerMsgId?(): string | undefined;
111
- setContainerMsgId?(containerMsgId: string): void;
112
- getConversation?(): Conversation | undefined;
113
- setConversation?(conversation: Conversation): void;
114
- getMessageIdList?(): string[] | undefined;
115
- getPreviewList?(): MergeMessagePreviewUnit[] | undefined;
116
- getExtra?(): string | undefined;
117
- setExtra?(extra: string): void;
118
- }
119
-
120
- /**
121
- * 合并消息预览单元
122
- */
123
- export class MergeMessagePreviewUnit {
124
- constructor(previewContent?: string, sender?: UserInfo);
125
-
126
- previewContent?: string;
127
- sender?: UserInfo;
128
-
129
- getPreviewContent?(): string | undefined;
130
- setPreviewContent?(previewContent: string): void;
131
- getSender?(): UserInfo | undefined;
132
- setSender?(sender: UserInfo): void;
133
- }
134
-
135
-
136
- /**
137
- * 图片消息内容
138
- * @property {string} localPath - 图片本地路径:支持 /
139
- * @property {string} [thumbnailLocalPath] - 缩略图本地路径:支持 /
140
- * @property {string} [url] - 图片远程URL
141
- * @property {string} [thumbnailUrl] - 缩略图远程URL
142
- * @property {number} width - 图片宽度
143
- * @property {number} height - 图片高度
144
- */
145
- export class ImageMessageContent extends MessageContent {
146
- localPath: string;
147
- thumbnailLocalPath?: string;
148
- url?: string;
149
- thumbnailUrl?: string;
150
- width: number;
151
- height: number;
152
-
153
- contentType: string;
154
- }
248
+ /**
249
+ * 获取指定类型的未读数
250
+ * @param conversationTypes 会话类型数组
251
+ * @returns {Promise<number>} 未读数
252
+ */
253
+ static getUnreadCountWithTypes(
254
+ conversationTypes: number[]
255
+ ): Promise<number>;
256
+
257
+ /**
258
+ * 将会话添加到标签
259
+ * @param options 标签选项
260
+ */
261
+ static addConversationsToTag(
262
+ options: ConversationTagOptions
263
+ ): Promise<Boolean>;
264
+
265
+ /**
266
+ * 从标签中移除会话
267
+ * @param options 标签选项
268
+ */
269
+ static removeConversationsFromTag(
270
+ options: ConversationTagOptions
271
+ ): Promise<Boolean>;
272
+
273
+ /**
274
+ * 发送消息
275
+ * @param {SendMessageObject} message 发送消息对象
276
+ * @param {SendMessageCallback} [callback] 发送消息回调函数
277
+ * @returns {Promise<Message>} 发送的消息对象
278
+ */
279
+ static sendMessage(
280
+ message: SendMessageObject,
281
+ callback?: SendMessageCallback
282
+ ): Promise<Message>;
283
+
284
+
285
+ /**
286
+ * 发送合并消息
287
+ * @param {string} title 合并消息的标题
288
+ * @param {string[]} messageIds 要合并的消息ID列表
289
+ * @param {Conversation} conversation 目标会话对象
290
+ * @param {SendMessageCallback} [callback] 发送消息回调函数
291
+ * @returns {Promise<Message>} 发送的消息对象
292
+ */
293
+ static sendMergeMessage(
294
+ message: MergeMessageContent,
295
+ conversation: Conversation,
296
+ callback?: SendMessageCallback
297
+ ): Promise<Message>;
298
+
299
+ /**
300
+ * 发送图片消息
301
+ * 示例
302
+ * ```javascript
303
+ * const imageContent = {
304
+ * contentType: 'image',
305
+ * localPath: '/path/to/image',
306
+ * width: 800,
307
+ * height: 600,
308
+ * };
309
+ * @param {SendMessageObject} message
310
+ * @param {SendMediaMessageCallback} [callback] 发送消息回调函数
311
+ * @returns {Promise<Message>} 发送的消息对象
312
+ */
313
+ static sendImageMessage(
314
+ message: SendMessageObject,
315
+ callback?: SendMediaMessageCallback
316
+ ): Promise<Message>;
317
+ /**
318
+ * 发送文件消息
319
+ * 示例:
320
+ * ```javascript
321
+ * const fileContent = {
322
+ * contentType: 'file',
323
+ * localPath: '/path/to/file',
324
+ * name: 'filename.ext',
325
+ * size: 123456,
326
+ * };
327
+ * @param {SendMessageObject} message
328
+ * @param {SendMediaMessageCallback} [callback] 发送消息回调函数
329
+ * @returns {Promise<Message>} 发送的消息对象
330
+ */
331
+ static sendFileMessage(
332
+ message: SendMessageObject,
333
+ callback?: SendMediaMessageCallback
334
+ ): Promise<Message>;
335
+
336
+ /**
337
+ * 发送语音消息
338
+ * 示例
339
+ * ```javascript
340
+ * const voiceContent = {
341
+ * contentType: 'voice',
342
+ * localPath: '/path/to/voice',
343
+ * duration: 10, // 语音时长,单位秒
344
+ * };
345
+ * @param {number} conversationType 会话类型
346
+ * @param {string} conversationId 会话ID
347
+ * @param {VoiceMessageContent} content 语音消息内容
348
+ * @param {SendMediaMessageCallback} [callback] 发送消息回调函数
349
+ * @returns {Promise<Message>} 发送的消息对象
350
+ */
351
+ static sendVoiceMessage(
352
+ conversationType: number,
353
+ conversationId: string,
354
+ content: VoiceMessageContent,
355
+ callback?: SendMediaMessageCallback
356
+ ): Promise<Message>;
155
357
 
156
358
  /**
157
- * 文件消息内容
158
- * @property {string} localPath - 文件本地路径:支持 /
159
- * @property {string} [url] - 文件远程URL
160
- * @property {string} name - 文件名称
161
- * @property {number} size - 文件大小,单位字节
162
- * @property {string} [type] - 文件类型(MIME类型)
163
- */
164
- export class FileMessageContent extends MessageContent {
165
- localPath: string;
166
- url?: string;
167
- name: string;
168
- size: number;
169
- type?: string;
170
-
171
- contentType: string;
172
- }
173
-
174
- /**
175
- * 语音消息内容
176
- * @property {string} localPath - 语音本地路径:支持 /
177
- * @property {string} [url] - 语音远程URL
178
- * @property {number} duration - 语音时长,单位秒
179
- */
180
- export class VoiceMessageContent extends MessageContent {
181
- localPath: string;
182
- url?: string;
183
- duration: number;
184
-
185
- contentType: string;
186
- }
187
-
188
-
189
- /**
190
- * 消息对象
191
- * @interface Message
192
- * @property {number} clientMsgNo - 客户端消息序号
193
- * @property {string} localAttribute - 本地属性
194
- * @property {number} messageState - 消息状态 : 0未知, 1-发送中, 2-已发送, 3-发送失败, 4-上传中
195
- * @property {boolean} isEdited - 是否已编辑
196
- * @property {number} direction - 消息方向: 1-发送, 2-接收
197
- * @property {boolean} isDelete - 是否已删除
198
- * @property {string} senderUserId - 发送者用户ID
199
- * @property {string} messageId - 消息ID
200
- * @property {boolean} hasRead - 是否已读
201
- * @property {number} timestamp - 消息时间戳
202
- * @property {Conversation} conversation - 会话对象
203
- * @property {MessageContent} content - 消息内容
204
- * @property {GroupMessageReadInfo} [groupMessageReadInfo] - 群消息阅读信息(可选)
205
- * @property {MessageMentionInfo} mentionInfo - 消息提及信息
206
- * @property {Message} [referredMessage] - 引用的消息
207
- */
208
- export interface Message {
209
- clientMsgNo: number;
210
- localAttribute: string;
211
- messageState: number;
212
- isEdit: boolean;
213
- direction: number;
214
- isDelete: boolean;
215
- senderUserId: string;
216
- messageId: string;
217
- hasRead: boolean;
218
- timestamp: number;
219
- conversation: Conversation;
220
- content: MessageContent;
221
- groupMessageReadInfo?: GroupMessageReadInfo;
222
- mentionInfo: MessageMentionInfo;
223
- referredMessage?: Message;
224
- }
225
-
226
- /**
227
- * 消息响应对象
228
- * @interface MessageResponse
229
- * @property {Message[]} messages - 消息列表
230
- * @property {number} timestamp - 时间戳
231
- * @property {boolean} hasMore - 是否有更多消息
232
- */
233
- export interface MessageResponse {
234
- messages: Message[];
235
- timestamp: number;
236
- hasMore: boolean;
237
- code: number;
238
- }
239
-
240
- /**
241
- * 用户信息
242
- */
243
- export interface UserInfo {
244
- userId: string;
245
- nickname: string;
246
- avatar: string;
247
- }
248
-
249
- export interface MessageReactionItem {
250
- reactionId: string;
251
- userInfoList: UserInfo[];
252
- }
253
-
254
- /**
255
- * 消息回应
256
- */
257
- export interface MessageReaction {
258
- messageId: string;
259
- reactionType: string;
260
- userId: string;
261
- timestamp: number;
262
- }
263
-
264
- /**
265
- * 群消息阅读信息
266
- */
267
- export interface GroupMessageReadInfo {
268
- readCount: number;
269
- memberCount: number;
270
- }
271
-
272
- /**
273
- * 会话信息
274
- */
275
- export interface ConversationMentionInfo {
276
- mentionMsgList: MentionMsg[];
277
- }
278
-
279
- export interface MessageMentionInfo {
280
- /**
281
- * DEFAULT(0),
282
- * ALL(1),
283
- * SOMEONE(2),
284
- * ALL_AND_SOMEONE(3);
285
- */
286
- type: number;
287
- targetUsers: UserInfo[];
288
- }
289
-
290
- /**
291
- * 推送数据
292
- */
293
- export interface PushData {
294
- content: string;
295
- extra: string;
296
- }
297
-
298
- export interface MentionMsg {
299
- senderId: string;
300
- msgId: string;
301
- msgTime: number;
302
- /**
303
- * DEFAULT(0),
304
- * ALL(1),
305
- * SOMEONE(2),
306
- * ALL_AND_SOMEONE(3);
307
- */
308
- type: number;
309
- }
310
-
311
- export interface ConversationInfo {
312
- conversation: Conversation;
313
- unreadCount: number;
314
- isTop: boolean;
315
- isMute: boolean;
316
- lastMessage?: Message;
317
- topTime: number;
318
- sortTime: number;
319
- hasUnread: boolean;
320
- draft: string;
321
- mentionInfo?: ConversationMentionInfo;
322
- }
323
-
324
- /**
325
- * 分页获取会话选项
326
- * @property {number} count - 获取数量
327
- * @property {number} timestamp - 上一页最后一条数据的时间戳
328
- * @property {number} direction - 拉取方向: 0-更新的消息, 1-更早的消息
329
- */
330
- export interface GetConversationOptions {
331
- count: number;
332
- timestamp: number;
333
- direction: number; //0-new, 1-old
334
- }
335
-
336
- /**
337
- * 简单回调接口
338
- */
339
- export interface SimpleCallback {
340
- onSuccess: () => void;
341
- onError: (errorCode: number) => void;
342
- }
343
-
344
- /**
345
- * 创建会话回调接口
346
- */
347
- export interface CreateConversationCallback {
348
- onSuccess: (conversationInfo: ConversationInfo) => void;
349
- onError: (errorCode: number) => void;
350
- }
351
-
352
- /**
353
- * 会话标签选项
354
- */
355
- export interface ConversationTagOptions {
356
- tagId: string;
357
- conversations: Conversation[];
358
- }
359
-
360
- export interface SendMessageResult {
361
- messageId: string;
362
- sentTime: number;
363
- }
364
-
365
- export interface SendMessageCallback {
366
- onSuccess?: (message: Message) => void;
367
- onError?: (message: Message, errorCode: number) => void;
368
- }
369
-
370
- export interface UpdateMessageCallback {
371
- onSuccess?: (message: Message) => void;
372
- onError?: (errorCode: number) => void;
373
- }
374
-
375
- // 获取消息相关接口
376
- export interface GetMessageOptions {
377
- count?: number;
378
- startTime?: number;
379
- }
380
-
381
- // 发送消息实体对象
382
- export interface SendMessageObject {
383
- conversationType: number;
384
- conversationId: string;
385
- content: MessageContent;
386
- mentionInfo?: MessageMentionInfo;
387
- pushData?: PushData;
388
- // 引用消息ID
389
- referredMessageId?: string;
390
- }
391
- /**
392
- * 连接状态监听器回调函数
393
- */
394
- export type ConnectionStatusListener = (
395
- status: ConnectionStatus,
396
- code: number,
397
- extra: string
398
- ) => void;
399
-
400
- /**
401
- * 消息监听器回调函数
402
- */
403
- export interface MessageListener {
404
- onMessageReceive?: (message: Message) => void;
405
- onMessageRecall?: (message: Message) => void;
406
- onMessageUpdate?: (message: Message) => void;
407
- onMessageDelete?: (
408
- conversation: Conversation,
409
- clientMsgNos: number[]
410
- ) => void;
411
- onMessageClear?: (
412
- conversation: Conversation,
413
- timestamp: number,
414
- senderId: string
415
- ) => void;
416
- onMessageReactionAdd?: (
417
- conversation: Conversation,
418
- reaction: MessageReaction
419
- ) => void;
420
- onMessageReactionRemove?: (
421
- conversation: Conversation,
422
- reaction: MessageReaction
423
- ) => void;
424
- onMessageSetTop?: (
425
- message: Message,
426
- operator: UserInfo,
427
- isTop: boolean
428
- ) => void;
429
- }
430
-
431
- /**
432
- * 消息阅读状态监听器回调函数
433
- */
434
- export interface MessageReadReceiptListener {
435
- onMessagesRead?: (conversation: Conversation, messageIds: string[]) => void;
436
- onGroupMessagesRead?: (
437
- conversation: Conversation,
438
- messages: { [messageId: string]: GroupMessageReadInfo }
439
- ) => void;
440
- }
441
-
442
- /**
443
- * 消息销毁监听器回调函数
444
- */
445
- export interface MessageDestroyListener {
446
- onMessageDestroyTimeUpdate?: (
447
- messageId: string,
448
- conversation: Conversation,
449
- destroyTime: number
450
- ) => void;
451
- }
452
-
453
- /**
454
- * 会话监听器回调函数
455
- */
456
- export interface ConversationListener {
457
- onConversationInfoAdd?: (conversations: ConversationInfo[]) => void;
458
- onConversationInfoUpdate?: (conversations: ConversationInfo[]) => void;
459
- onConversationInfoDelete?: (conversations: ConversationInfo[]) => void;
460
- onTotalUnreadMessageCountUpdate?: (count: number) => void;
461
- }
462
-
463
- /**
464
- * 发送媒体消息回调接口
465
- */
466
- export interface SendMediaMessageCallback {
467
- onProgress?: (progress: number, message: Message) => void;
468
- onSuccess?: (message: Message) => void;
469
- onError?: (message: Message, errorCode: number) => void;
470
- onCancel?: (message: Message) => void;
471
- }
472
-
473
- /**
474
- * Juggle IM React Native SDK
475
- */
476
- export default class JuggleIM {
477
- /**
478
- * 设置服务器地址列表
479
- * @param urls 服务器地址列表
480
- */
481
- static setServerUrls(urls: string[]): void;
482
-
483
- /**
484
- * 初始化SDK
485
- * @param appKey 应用唯一标识
486
- */
487
- static init(appKey: string): void;
488
-
489
- /**
490
- * 注册自定义消息类型
491
- * @param contentType 消息类型标识符(不能以 "jg:" 开头)
492
- * @param messageClass 自定义消息类的构造函数
493
- * @example
494
- * ```typescript
495
- * class CustomMessage implements CustomMessageContent {
496
- * contentType = 'my:custom';
497
- * value: string = '';
498
- * }
499
- *
500
- * JuggleIM.registerCustomMessageType('my:custom', CustomMessage);
501
- * ```
502
- */
503
- static registerCustomMessageType(
504
- contentType: string,
505
- messageClass: CustomMessageConstructor
506
- ): void;
507
-
508
- /**
509
- * 连接到服务器
510
- * @param token 用户token
511
- */
512
- static connect(token: string): void;
513
-
514
- /**
515
- * 断开连接
516
- * @param pushable 是否继续接收推送
517
- */
518
- static disconnect(pushable: boolean): void;
519
-
520
- /**
521
- * 添加连接状态监听器
522
- * @param key 监听器标识
523
- * @param listener 监听器回调函数
524
- * @returns 返回取消监听的函数
525
- */
526
- static addConnectionStatusListener(
527
- key: string,
528
- listener: ConnectionStatusListener
529
- ): () => void;
530
-
531
- /**
532
- * 添加消息监听器
533
- * @param key 监听器标识
534
- * @param listener 监听器回调函数
535
- * @returns 返回取消监听的函数
536
- */
537
- static addMessageListener(
538
- key: string,
539
- listener: MessageListener
540
- ): () => void;
541
-
542
- /**
543
- * 添加消息阅读状态监听器
544
- * @param key 监听器标识
545
- * @param listener 监听器回调函数
546
- * @returns 返回取消监听的函数
547
- */
548
- static addMessageReadReceiptListener(
549
- key: string,
550
- listener: MessageReadReceiptListener
551
- ): () => void;
552
-
553
- /**
554
- * 添加消息销毁监听器
555
- * @param key 监听器标识
556
- * @param listener 监听器回调函数
557
- * @returns 返回取消监听的函数
558
- */
559
- static addMessageDestroyListener(
560
- key: string,
561
- listener: MessageDestroyListener
562
- ): () => void;
563
-
564
- /**
565
- * 添加会话监听器
566
- * @param key 监听器标识
567
- * @param listener 监听器回调函数
568
- * @returns 返回取消监听的函数
569
- */
570
- static addConversationListener(
571
- key: string,
572
- listener: ConversationListener
573
- ): () => void;
574
-
575
- /**
576
- * 获取会话信息列表
577
- * @param options 获取选项
578
- * @returns {Promise<ConversationInfo[]>} 会话信息列表
579
- */
580
- static getConversationInfoList(
581
- options: GetConversationOptions
582
- ): Promise<ConversationInfo[]>;
583
-
584
- /**
585
- * 获取单个会话信息
586
- * @param {Conversation} conversation 会话对象
587
- * @returns {Promise<ConversationInfo | null>} 会话信息对象
588
- */
589
- static getConversationInfo(
590
- conversation: Conversation
591
- ): Promise<ConversationInfo | null>;
592
-
593
- /**
594
- * 创建会话信息
595
- * @param conversation 会话对象
596
- * @param callback 回调函数
597
- */
598
- static createConversationInfo(
599
- conversation: Conversation
600
- ): Promise<ConversationInfo>;
601
-
602
- /**
603
- * 删除会话信息
604
- * @param conversation 会话对象
605
- * @param callback 回调函数
606
- */
607
- static deleteConversationInfo(
608
- conversation: Conversation,
609
- callback: SimpleCallback
610
- ): Promise<Boolean>;
611
-
612
- /**
613
- * 设置会话免打扰状态
614
- * @param conversation 会话对象
615
- * @param isMute 是否免打扰
616
- * @param callback 回调函数
617
- */
618
- static setMute(
619
- conversation: Conversation,
620
- isMute: boolean
621
- ): Promise<Boolean>;
622
-
623
- /**
624
- * 设置会话置顶状态
625
- * @param conversation 会话对象
626
- * @param isTop 是否置顶
627
- * @param callback 回调函数
628
- */
629
- static setTop(conversation: Conversation, isTop: boolean): Promise<Boolean>;
630
-
631
- /**
632
- * 清除会话未读数
633
- * @param conversation 会话对象
634
- * @param callback 回调函数
635
- */
636
- static clearUnreadCount(conversation: Conversation): Promise<Boolean>;
637
-
638
- /**
639
- * 清除总未读数
640
- * @param callback 回调函数
641
- */
642
- static clearTotalUnreadCount(): Promise<Boolean>;
643
-
644
- /**
645
- * 获取总未读数
646
- * @param callback 回调函数
647
- */
648
- static getTotalUnreadCount(): Promise<number>;
649
-
650
- /**
651
- * 设置会话草稿
652
- * @param conversation 会话对象
653
- * @param draft 草稿内容
654
- * @param callback 回调函数
655
- */
656
- static setDraft(
657
- conversation: Conversation,
658
- draft: string
659
- ): Promise<Boolean>;
660
-
661
- /**
662
- * 清除会话草稿
663
- * @param conversation 会话对象
664
- * @param callback 回调函数
665
- */
666
- static clearDraft(conversation: Conversation): Promise<Boolean>;
667
-
668
- /**
669
- * 设置会话未读状态
670
- * @param conversation 会话对象
671
- * @param isUnread 是否未读
672
- * @param callback 回调函数
673
- */
674
- static setUnread(
675
- conversation: Conversation,
676
- isUnread: boolean
677
- ): Promise<Boolean>;
678
-
679
- /**
680
- * 获取置顶会话信息列表
681
- * @param count 获取数量
682
- * @param timestamp 上一页最后一条数据的时间戳
683
- * @param direction 拉取方向: 0-更新的消息, 1-更早的消息
684
- * @returns {Promise<ConversationInfo[]>} 会话信息列表
685
- */
686
- static getTopConversationInfoList(
687
- count: number,
688
- timestamp: number,
689
- direction: number
690
- ): Promise<ConversationInfo[]>;
691
-
692
- /**
693
- * 获取指定类型的未读数
694
- * @param conversationTypes 会话类型数组
695
- * @returns {Promise<number>} 未读数
696
- */
697
- static getUnreadCountWithTypes(
698
- conversationTypes: number[]
699
- ): Promise<number>;
700
-
701
- /**
702
- * 将会话添加到标签
703
- * @param options 标签选项
704
- */
705
- static addConversationsToTag(
706
- options: ConversationTagOptions
707
- ): Promise<Boolean>;
708
-
709
- /**
710
- * 从标签中移除会话
711
- * @param options 标签选项
712
- */
713
- static removeConversationsFromTag(
714
- options: ConversationTagOptions
715
- ): Promise<Boolean>;
716
-
717
- /**
718
- * 发送消息
719
- * @param {SendMessageObject} message 发送消息对象
720
- * @param {SendMessageCallback} [callback] 发送消息回调函数
721
- * @returns {Promise<Message>} 发送的消息对象
722
- */
723
- static sendMessage(
724
- message: SendMessageObject,
725
- callback?: SendMessageCallback
726
- ): Promise<Message>;
727
-
728
-
729
- /**
730
- * 发送合并消息
731
- * @param {string} title 合并消息的标题
732
- * @param {string[]} messageIds 要合并的消息ID列表
733
- * @param {Conversation} conversation 目标会话对象
734
- * @param {SendMessageCallback} [callback] 发送消息回调函数
735
- * @returns {Promise<Message>} 发送的消息对象
736
- */
737
- static sendMergeMessage(
738
- message: MergeMessageContent,
739
- conversation: Conversation,
740
- callback?: SendMessageCallback
741
- ): Promise<Message>;
742
-
743
- /**
744
- * 发送图片消息
745
- * 示例
746
- * ```javascript
747
- * const imageContent = {
748
- * contentType: 'image',
749
- * localPath: '/path/to/image',
750
- * width: 800,
751
- * height: 600,
752
- * };
753
- * @param {SendMessageObject} message
754
- * @param {SendMediaMessageCallback} [callback] 发送消息回调函数
755
- * @returns {Promise<Message>} 发送的消息对象
756
- */
757
- static sendImageMessage(
758
- message: SendMessageObject,
759
- callback?: SendMediaMessageCallback
760
- ): Promise<Message>;
761
- /**
762
- * 发送文件消息
763
- * 示例:
764
- * ```javascript
765
- * const fileContent = {
766
- * contentType: 'file',
767
- * localPath: '/path/to/file',
768
- * name: 'filename.ext',
769
- * size: 123456,
770
- * };
771
- * @param {SendMessageObject} message
772
- * @param {SendMediaMessageCallback} [callback] 发送消息回调函数
773
- * @returns {Promise<Message>} 发送的消息对象
774
- */
775
- static sendFileMessage(
776
- message: SendMessageObject,
777
- callback?: SendMediaMessageCallback
778
- ): Promise<Message>;
779
-
780
- /**
781
- * 发送语音消息
782
- * 示例
783
- * ```javascript
784
- * const voiceContent = {
785
- * contentType: 'voice',
786
- * localPath: '/path/to/voice',
787
- * duration: 10, // 语音时长,单位秒
788
- * };
789
- * @param {number} conversationType 会话类型
790
- * @param {string} conversationId 会话ID
791
- * @param {VoiceMessageContent} content 语音消息内容
792
- * @param {SendMediaMessageCallback} [callback] 发送消息回调函数
793
- * @returns {Promise<Message>} 发送的消息对象
794
- */
795
- static sendVoiceMessage(
796
- conversationType: number,
797
- conversationId: string,
798
- content: VoiceMessageContent,
799
- callback?: SendMediaMessageCallback
800
- ): Promise<Message>;
801
-
802
- /**
803
- * 获取历史消息
804
- * @param {Conversation} conversation 会话
805
- * @param {number} direction 拉取方向,0表示从startTime往后的消息,1表示从startTime往前的消息
806
- * @param {GetMessageOptions} options 获取消息选项
807
- * @returns {Promise<MessageResponse>} 消息响应对象,包含消息列表、时间戳和是否有更多消息
808
- */
809
- static getMessageList(
810
- conversation: Conversation,
811
- direction: number,
812
- options: GetMessageOptions
813
- ): Promise<MessageResponse>;
814
-
815
- /**
816
- * 撤回消息
817
- * @param messageId 消息ID列表
818
- * @param extras 扩展字段
819
- * @returns {Promise<Boolean>} 是否撤回成功
820
- */
821
- static recallMessage(
822
- messageId: string,
823
- extras?: { [key: string]: any }
824
- ): Promise<Boolean>;
825
-
826
- /**
827
- * 根据clientMsgNo列表删除消息
828
- * @param conversation 会话
829
- * @param clientMsgNos clientMsgNo列表
830
- */
831
- static deleteMessagesByClientMsgNoList(conversation: Conversation, clientMsgNos: number[]): Promise<boolean>;
832
-
833
- /**
834
- * 添加消息反应
835
- * @param messageId 消息ID
836
- * @param reactionId 反应ID
837
- * @returns {Promise<Boolean>} 是否添加成功
838
- */
839
- static addMessageReaction(
840
- messageId: string,
841
- reactionId: string
842
- ): Promise<Boolean>;
843
-
844
- /**
845
- * 移除消息反应
846
- * @param messageId 消息ID
847
- * @param reactionId 反应ID
848
- * @returns {Promise<Boolean>} 是否移除成功
849
- */
850
- static removeMessageReaction(
851
- messageId: string,
852
- reactionId: string
853
- ): Promise<Boolean>;
854
-
855
- /**
856
- * 发送消息已读回执
857
- * @param conversation 会话对象
858
- * @param messageIds 消息ID列表
859
- * @returns {Promise<Boolean>} 是否发送成功
860
- */
861
- static sendReadReceipt(
862
- conversation: Conversation,
863
- messageIds: string[],
864
- ): Promise<Boolean>;
865
-
866
- /**
867
- * 更新消息
868
- * @param messageId 消息ID
869
- * @param content 新的消息内容
870
- * @param conversation 会话对象
871
- * @param callback 回调函数
872
- * @returns {Promise<Message>} 更新后的消息对象
873
- */
874
- static updateMessage(
875
- messageId: string,
876
- content: MessageContent,
877
- conversation: Conversation,
878
- callback?: UpdateMessageCallback
879
- ): Promise<Message>;
880
-
881
- /**
882
- * 设置消息置顶
883
- * @param messageId 消息ID
884
- * @param conversation 会话对象
885
- * @param isTop 是否置顶
886
- * @param callback 回调函数
887
- * @returns {Promise<Boolean>} 是否设置成功
888
- */
889
- static setMessageTop(
890
- messageId: string,
891
- conversation: Conversation,
892
- isTop: boolean,
893
- ): Promise<Boolean>;
894
- }
359
+ * 获取历史消息
360
+ * @param {Conversation} conversation 会话
361
+ * @param {number} direction 拉取方向,0 比startTime更新的消息,1 比startTime更旧的消息
362
+ * @param {GetMessageOptions} options 获取消息选项
363
+ * @returns {Promise<MessageResponse>} 消息响应对象,包含消息列表、时间戳和是否有更多消息
364
+ */
365
+ static getMessageList(
366
+ conversation: Conversation,
367
+ direction: number,
368
+ options: GetMessageOptions
369
+ ): Promise<MessageResponse>;
370
+
371
+ /**
372
+ * 撤回消息
373
+ * @param messageId 消息ID列表
374
+ * @param extras 扩展字段
375
+ * @returns {Promise<Boolean>} 是否撤回成功
376
+ */
377
+ static recallMessage(
378
+ messageId: string,
379
+ extras?: { [key: string]: any }
380
+ ): Promise<Boolean>;
381
+
382
+ /**
383
+ * 根据clientMsgNo列表删除消息
384
+ * @param conversation 会话
385
+ * @param clientMsgNos clientMsgNo列表
386
+ */
387
+ static deleteMessagesByClientMsgNoList(conversation: Conversation, clientMsgNos: number[]): Promise<boolean>;
388
+
389
+ /**
390
+ * 添加消息反应
391
+ * @param messageId 消息ID
392
+ * @param reactionId 反应ID
393
+ * @returns {Promise<Boolean>} 是否添加成功
394
+ */
395
+ static addMessageReaction(
396
+ messageId: string,
397
+ reactionId: string
398
+ ): Promise<Boolean>;
399
+
400
+ /**
401
+ * 移除消息反应
402
+ * @param messageId 消息ID
403
+ * @param reactionId 反应ID
404
+ * @returns {Promise<Boolean>} 是否移除成功
405
+ */
406
+ static removeMessageReaction(
407
+ messageId: string,
408
+ reactionId: string
409
+ ): Promise<Boolean>;
410
+
411
+ /**
412
+ * 发送消息已读回执
413
+ * @param conversation 会话对象
414
+ * @param messageIds 消息ID列表
415
+ * @returns {Promise<Boolean>} 是否发送成功
416
+ */
417
+ static sendReadReceipt(
418
+ conversation: Conversation,
419
+ messageIds: string[],
420
+ ): Promise<Boolean>;
421
+
422
+ /**
423
+ * 更新消息
424
+ * @param messageId 消息ID
425
+ * @param content 新的消息内容
426
+ * @param conversation 会话对象
427
+ * @param callback 回调函数
428
+ * @returns {Promise<Message>} 更新后的消息对象
429
+ */
430
+ static updateMessage(
431
+ messageId: string,
432
+ content: MessageContent,
433
+ conversation: Conversation,
434
+ callback?: UpdateMessageCallback
435
+ ): Promise<Message>;
436
+
437
+ /**
438
+ * 设置消息置顶
439
+ * @param messageId 消息ID
440
+ * @param conversation 会话对象
441
+ * @param isTop 是否置顶
442
+ * @param callback 回调函数
443
+ * @returns {Promise<Boolean>} 是否设置成功
444
+ */
445
+ static setMessageTop(
446
+ messageId: string,
447
+ conversation: Conversation,
448
+ isTop: boolean,
449
+ ): Promise<Boolean>;
895
450
  }
451
+
452
+
453
+ export * from './call';