index.d.ts 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719
  1. /*
  2. * RCIMLibUni - v5.1.3-release.4
  3. * CommitId - 683537a92582a32f4686f41774947782dc7ff16e
  4. * Wed Jan 19 2022 15:01:35 GMT+0800 (中国标准时间)
  5. * ©2020 RongCloud, Inc. All rights reserved.
  6. */
  7. /**
  8. * 消息方向
  9. */
  10. declare enum MessageDirection {
  11. SEND = 1,
  12. RECEIVE = 2
  13. }
  14. /**
  15. * 会话类型
  16. */
  17. declare enum ConversationType {
  18. PRIVATE = 1,
  19. DISCUSSION = 2,
  20. GROUP = 3,
  21. CHATROOM = 4,
  22. CUSTOMER_SERVICE = 5,
  23. SYSTEM = 6,
  24. APP_SERVICE = 7,
  25. PUBLIC_SERVICE = 8,
  26. PUSH_SERVICE = 9
  27. }
  28. /**
  29. * 发送状态
  30. */
  31. declare enum SentStatus {
  32. SENDING = 10,
  33. FAILED = 20,
  34. SENT = 30,
  35. RECEIVED = 40,
  36. READ = 50,
  37. DESTROYED = 60,
  38. CANCELED = 70
  39. }
  40. /**
  41. * 用户信息
  42. */
  43. interface UserInfo {
  44. userId: string;
  45. name: string;
  46. portraitUrl: string;
  47. }
  48. /**
  49. * 消息提醒类型
  50. */
  51. declare enum MentionedType {
  52. /**
  53. * 提醒所有
  54. */
  55. ALL = 1,
  56. /**
  57. * 部分提醒
  58. */
  59. PART = 2
  60. }
  61. /**
  62. * 提醒信息
  63. */
  64. interface MentionedInfo {
  65. type: MentionedType;
  66. userIdList: string[];
  67. mentionedContent: string;
  68. }
  69. /**
  70. * 消息对象名称
  71. */
  72. declare enum ObjectName {
  73. /**
  74. * 文本消息
  75. */
  76. Text = "RC:TxtMsg",
  77. /**
  78. * 文件消息
  79. */
  80. File = "RC:FileMsg",
  81. /**
  82. * 图片消息
  83. */
  84. Image = "RC:ImgMsg",
  85. /**
  86. * GIF 图片消息
  87. */
  88. GIF = "RC:GIFMsg",
  89. /**
  90. * 位置信息
  91. */
  92. Location = "RC:LBSMsg",
  93. /**
  94. * 语音消息
  95. */
  96. Voice = "RC:VcMsg",
  97. /**
  98. * 高质量语音消息
  99. */
  100. HQVoice = "RC:HQVCMsg",
  101. /**
  102. * 小视频消息
  103. */
  104. Sight = "RC:SightMsg",
  105. /**
  106. * 命令消息
  107. */
  108. Command = "RC:CmdMsg",
  109. /**
  110. * 公众服务单图文消息
  111. */
  112. PublicServiceRich = "RC:PSImgTxtMsg",
  113. /**
  114. * 公众服务多图文消息
  115. */
  116. PublicServiceMultiRich = "RC:PSMultiImgTxtMsg",
  117. /**
  118. * 好友通知消息
  119. */
  120. ContactNotification = "RC:ContactNtf",
  121. /**
  122. * 资料通知消息
  123. */
  124. ProfileNotification = "RC:ProfileNtf",
  125. /**
  126. * 通用命令通知消息
  127. */
  128. CommandNotification = "RC:CmdNtf",
  129. /**
  130. * 提示条通知消息
  131. */
  132. InformationNotification = "RC:InfoNtf",
  133. /**
  134. * 群组通知消息
  135. */
  136. GroupNotification = "RC:GrpNtf",
  137. /**
  138. * 已读通知消息
  139. */
  140. ReadReceipt = "RC:ReadNtf",
  141. /**
  142. * 公众服务命令消息
  143. */
  144. PublicServiceCommand = "RC:PSCmd",
  145. /**
  146. * 对方正在输入状态消息
  147. */
  148. TypingStatus = "RC:TypSts",
  149. /**
  150. * 群消息已读状态回执
  151. */
  152. ReadReceiptResponse = "RC:RRRspMsg"
  153. }
  154. /**
  155. * 消息内容
  156. */
  157. interface MessageContent {
  158. /**
  159. * 消息对象名称
  160. */
  161. objectName?: ObjectName;
  162. /**
  163. * 用户信息
  164. */
  165. userInfo?: UserInfo;
  166. /**
  167. * 提醒信息
  168. */
  169. mentionedInfo?: MentionedInfo;
  170. }
  171. interface RCAndroidPushConfig {
  172. miAppId?: string;
  173. miAppKey?: string;
  174. meizuAppId?: string;
  175. meizuAppKey?: string;
  176. oppoAppKey?: string;
  177. oppoAppSecret?: string;
  178. }
  179. interface RCIMEngineSetup {
  180. naviServer?: string;
  181. fileServer?: string;
  182. statisticServer?: string;
  183. appVersion?: string;
  184. androidPushConfig?: RCAndroidPushConfig;
  185. }
  186. /**
  187. * 自定义消息类型
  188. */
  189. declare enum CustomMessageType {
  190. /**
  191. * 命令消息,不存储、不计入未读计数
  192. */
  193. COMMAND = 0,
  194. /**
  195. * 存储消息,存储、不计入未读计数
  196. */
  197. STORAGE = 1,
  198. /**
  199. * 普通消息,存储、计入未读计数
  200. */
  201. NORMAL = 2,
  202. /**
  203. * 状态消息,不存储不计数
  204. */
  205. STATUS = 3
  206. }
  207. /**
  208. * 自定义消息,不支持自定义媒体类型消息.
  209. * 使用自定义消息,必须设置 type 指明自定义消息类型,另外还必须设置 objectName ,指明消息对象名称
  210. */
  211. interface CustomMessage extends MessageContent {
  212. /**
  213. * 发送自定义消息,需要设置类型
  214. */
  215. customType: CustomMessageType;
  216. /**
  217. * 自定义消息数据集合
  218. */
  219. customFields: {
  220. [key: string]: string;
  221. };
  222. }
  223. /**
  224. * 消息对象名称枚举
  225. */
  226. declare enum MessageObjectNames {
  227. text = "RC:TxtMsg",
  228. image = "RC:ImgMsg",
  229. file = "RC:FileMsg",
  230. location = "RC:LocMsg",
  231. voice = "RC:VcMsg"
  232. }
  233. /**
  234. * 文本消息
  235. */
  236. interface TextMessage extends MessageContent {
  237. objectName: ObjectName.Text;
  238. content: string;
  239. extra?: string;
  240. }
  241. /**
  242. * 图片消息
  243. */
  244. interface ImageMessage extends MessageContent {
  245. objectName: ObjectName.Image;
  246. local: string;
  247. remote?: string;
  248. thumbnail?: string;
  249. isFull?: string;
  250. extra?: string;
  251. }
  252. /**
  253. * GIF 图片消息
  254. */
  255. interface GIFMessage extends MessageContent {
  256. objectName: ObjectName.GIF;
  257. local: string;
  258. remote?: string;
  259. width: number;
  260. height: number;
  261. gifDataSize: number;
  262. extra?: string;
  263. }
  264. /**
  265. * 文件消息
  266. */
  267. interface FileMessage extends MessageContent {
  268. objectName: ObjectName.File;
  269. local: string;
  270. remote?: string;
  271. name?: string;
  272. size?: number;
  273. fileType?: string;
  274. extra?: string;
  275. }
  276. /**
  277. * 位置消息
  278. */
  279. interface LocationMessage extends MessageContent {
  280. objectName: ObjectName.Location;
  281. name: string;
  282. latitude: number;
  283. longitude: number;
  284. thumbnail?: string;
  285. extra?: string;
  286. }
  287. /**
  288. * 语音消息
  289. */
  290. interface VoiceMessage extends MessageContent {
  291. objectName: ObjectName.Voice;
  292. local: string;
  293. duration: number;
  294. }
  295. /**
  296. * 高质量语音消息
  297. */
  298. interface HQVoiceMessage extends MessageContent {
  299. objectName: ObjectName.HQVoice;
  300. local: string;
  301. remote?: string;
  302. duration: number;
  303. }
  304. /**
  305. * 命令消息
  306. */
  307. interface CommandMessage extends MessageContent {
  308. objectName: ObjectName.Command;
  309. name: string;
  310. data: string;
  311. }
  312. /**
  313. * 命令通知消息
  314. */
  315. interface CommandNotificationMessage extends MessageContent {
  316. objectName: ObjectName.CommandNotification;
  317. name: string;
  318. data: string;
  319. }
  320. /**
  321. * 好友通知消息
  322. */
  323. interface ContactNotificationMessage extends MessageContent {
  324. objectName: ObjectName.ContactNotification;
  325. sourceUserId: string;
  326. targetUserId: string;
  327. message: string;
  328. operation: string;
  329. extra: string;
  330. }
  331. /**
  332. * 资料通知消息
  333. */
  334. interface ProfileNotificationMessage extends MessageContent {
  335. objectName: ObjectName.ProfileNotification;
  336. data: string;
  337. operation: string;
  338. extra: string;
  339. }
  340. /**
  341. * 提示条通知消息
  342. */
  343. interface InfomationNotificationMessage extends MessageContent {
  344. objectName: ObjectName.InformationNotification;
  345. message: string;
  346. extra: string;
  347. }
  348. /**
  349. * 群组通知消息
  350. */
  351. interface GroupNotificationMessage extends MessageContent {
  352. objectName: ObjectName.GroupNotification;
  353. /**
  354. * 群组通知的操作名称
  355. */
  356. operation: string;
  357. /**
  358. * 操作者 ID
  359. */
  360. operatorUserId: string;
  361. /**
  362. * 操作数据
  363. */
  364. data: string;
  365. /**
  366. * 消息内容
  367. */
  368. message: string;
  369. /**
  370. * 额外数据
  371. */
  372. extra: string;
  373. }
  374. /**
  375. * 已读通知消息
  376. */
  377. interface ReadReceiptMessage extends MessageContent {
  378. objectName: ObjectName.ReadReceipt;
  379. type: number;
  380. messageUId: string;
  381. lastMessageSendTime: number;
  382. }
  383. /**
  384. * 已读通知消息
  385. */
  386. interface PublicServiceCommandMessage extends MessageContent {
  387. objectName: ObjectName.PublicServiceCommand;
  388. extra: string;
  389. }
  390. /**
  391. * 撤回通知消息
  392. */
  393. interface RecallNotificationMessage extends MessageContent {
  394. /**
  395. * 撤回消息的用户 ID
  396. */
  397. operatorId: string;
  398. /**
  399. * 撤回时间
  400. */
  401. recallTime: number;
  402. /**
  403. * 原消息对象名称
  404. */
  405. originalObjectName: string;
  406. /**
  407. * 是否管理员操作
  408. */
  409. isAdmin: string;
  410. }
  411. /**
  412. * 输入状态消息
  413. */
  414. interface TypingStatusMessage extends MessageContent {
  415. objectName: ObjectName.TypingStatus;
  416. data: string;
  417. typingContentType: string;
  418. }
  419. /**
  420. * 消息
  421. */
  422. interface Message {
  423. /**
  424. * 会话类型
  425. */
  426. conversationType: ConversationType;
  427. /**
  428. * 消息对象名称
  429. */
  430. objectName: string;
  431. /**
  432. * 消息 ID
  433. */
  434. messageId: number;
  435. /**
  436. * 消息 UID
  437. */
  438. messageUId: string;
  439. /**
  440. * 消息方向
  441. */
  442. messageDirection: MessageDirection;
  443. /**
  444. * 发送者 ID
  445. */
  446. senderUserId: string;
  447. /**
  448. * 发送时间
  449. */
  450. sentTime: number;
  451. /**
  452. * 目标 ID
  453. */
  454. targetId: string;
  455. /**
  456. * 消息接收时间
  457. */
  458. receivedTime: number;
  459. /**
  460. * 消息内容
  461. */
  462. content: MessageContent;
  463. /**
  464. * 附加信息
  465. */
  466. extra?: string;
  467. }
  468. /**
  469. * 收到的消息
  470. */
  471. interface ReceiveMessage {
  472. /**
  473. * 消息数据
  474. */
  475. message: Message;
  476. /**
  477. * 剩余未接收的消息数量
  478. */
  479. left: number;
  480. }
  481. /**
  482. * 连接错误代码
  483. */
  484. declare enum ConnectErrorCode {
  485. RC_SUCCESS = 0,
  486. RC_NET_CHANNEL_INVALID = 30001,
  487. RC_NET_UNAVAILABLE = 30002,
  488. RC_NAVI_REQUEST_FAIL = 30004,
  489. RC_NAVI_RESPONSE_ERROR = 30007,
  490. RC_NODE_NOT_FOUND = 30008,
  491. RC_SOCKET_NOT_CONNECTED = 30010,
  492. RC_SOCKET_DISCONNECTED = 30011,
  493. RC_PING_SEND_FAIL = 30012,
  494. RC_PONG_RECV_FAIL = 30013,
  495. RC_MSG_SEND_FAIL = 30014,
  496. RC_CONN_OVERFREQUENCY = 30015,
  497. RC_CONN_ACK_TIMEOUT = 31000,
  498. RC_CONN_PROTO_VERSION_ERROR = 31001,
  499. RC_CONN_ID_REJECT = 31002,
  500. RC_CONN_SERVER_UNAVAILABLE = 31003,
  501. RC_CONN_TOKEN_INCORRECT = 31004,
  502. RC_CONN_NOT_AUTHRORIZED = 31005,
  503. RC_CONN_REDIRECTED = 31006,
  504. RC_CONN_PACKAGE_NAME_INVALID = 31007,
  505. RC_CONN_APP_BLOCKED_OR_DELETED = 31008,
  506. RC_CONN_USER_BLOCKED = 31009,
  507. RC_DISCONN_KICK = 31010,
  508. RC_CONN_OTHER_DEVICE_LOGIN = 31023,
  509. RC_CONN_REFUSED = 32061,
  510. RC_CLIENT_NOT_INIT = 33001,
  511. RC_INVALID_PARAMETER = 33003,
  512. RC_CONNECTION_EXIST = 34001,
  513. RC_BACKGROUND_CONNECT = 34002,
  514. RC_INVALID_ARGUMENT = -1000
  515. }
  516. /**
  517. * 错误代码
  518. */
  519. declare enum ErrorCode {
  520. PARAMETER_ERROR = -3,
  521. ERRORCODE_UNKNOWN = -1,
  522. REJECTED_BY_BLACKLIST = 405,
  523. ERRORCODE_TIMEOUT = 5004,
  524. SEND_MSG_FREQUENCY_OVERRUN = 20604,
  525. NOT_IN_DISCUSSION = 21406,
  526. NOT_IN_GROUP = 22406,
  527. FORBIDDEN_IN_GROUP = 22408,
  528. NOT_IN_CHATROOM = 23406,
  529. FORBIDDEN_IN_CHATROOM = 23408,
  530. KICKED_FROM_CHATROOM = 23409,
  531. CHATROOM_NOT_EXIST = 23410,
  532. CHATROOM_IS_FULL = 23411,
  533. PARAMETER_INVALID_CHATROOM = 23412,
  534. ROAMING_SERVICE_UNAVAILABLE_CHATROOM = 23414,
  535. CHANNEL_INVALID = 30001,
  536. NETWORK_UNAVAILABLE = 30002,
  537. MSG_RESPONSE_TIMEOUT = 30003,
  538. CLIENT_NOT_INIT = 33001,
  539. DATABASE_ERROR = 33002,
  540. INVALID_PARAMETER = 33003,
  541. MSG_ROAMING_SERVICE_UNAVAILABLE = 33007,
  542. INVALID_PUBLIC_NUMBER = 29201,
  543. MSG_SIZE_OUT_OF_LIMIT = 30016,
  544. RECALLMESSAGE_PARAMETER_INVALID = 25101,
  545. PUSHSETTING_PARAMETER_INVALID = 26001,
  546. OPERATION_BLOCKED = 20605,
  547. OPERATION_NOT_SUPPORT = 20606,
  548. MSG_BLOCKED_SENSITIVE_WORD = 21501,
  549. MSG_REPLACED_SENSITIVE_WORD = 21502,
  550. SIGHT_MSG_DURATION_LIMIT_EXCEED = 34002
  551. }
  552. /**
  553. * iOS 连接状态
  554. */
  555. declare enum ConnectionStatusIOS {
  556. UNKNOWN = -1,
  557. Connected = 0,
  558. NETWORK_UNAVAILABLE = 1,
  559. AIRPLANE_MODE = 2,
  560. Cellular_2G = 3,
  561. Cellular_3G_4G = 4,
  562. WIFI = 5,
  563. KICKED_OFFLINE_BY_OTHER_CLIENT = 6,
  564. LOGIN_ON_WEB = 7,
  565. SERVER_INVALID = 8,
  566. VALIDATE_INVALID = 9,
  567. Connecting = 10,
  568. Unconnected = 11,
  569. SignUp = 12,
  570. TOKEN_INCORRECT = 31004,
  571. DISCONN_EXCEPTION = 31011
  572. }
  573. /**
  574. * Android 连接状态
  575. */
  576. declare enum ConnectionStatusAndroid {
  577. NETWORK_UNAVAILABLE = -1,
  578. CONNECTED = 0,
  579. CONNECTING = 1,
  580. DISCONNECTED = 2,
  581. KICKED_OFFLINE_BY_OTHER_CLIENT = 3,
  582. TOKEN_INCORRECT = 4,
  583. SERVER_INVALID = 5
  584. }
  585. /**
  586. * 连接状态
  587. */
  588. declare type ConnectionStatus = ConnectionStatusIOS | ConnectionStatusAndroid;
  589. interface ConnectionListenerResult {
  590. status: ConnectionStatus;
  591. }
  592. declare enum ResponseType {
  593. SUCCESS = "success",
  594. ERROR = "error",
  595. CANCEL = "cancel",
  596. PROGRESS = "progress"
  597. }
  598. /**
  599. * 连接回调
  600. */
  601. interface ConnectResult {
  602. code: ConnectErrorCode;
  603. userId?: number;
  604. }
  605. /**
  606. * 监听日志回调参数
  607. */
  608. interface LogInfoResult {
  609. logInfo: string;
  610. }
  611. /**
  612. * 监听撤回消息回调参数
  613. */
  614. interface RecallMessageResult {
  615. messageId: number;
  616. }
  617. /**
  618. * uni监听
  619. */
  620. interface UniListenerResult<T> {
  621. type: string;
  622. module: string;
  623. data: T;
  624. }
  625. /**
  626. * 要发送的消息
  627. */
  628. interface SentMessage {
  629. /**
  630. * 会话类型
  631. */
  632. conversationType: ConversationType;
  633. /**
  634. * 目标 ID
  635. */
  636. targetId: string;
  637. /**
  638. * 消息内容
  639. */
  640. content: MessageContent;
  641. /**
  642. * 推送内容,用于显示
  643. */
  644. pushContent: string;
  645. /**
  646. * 推送数据,不显示
  647. */
  648. pushData: string;
  649. }
  650. interface SendMessageResult extends BaseResult {
  651. messageId?: number;
  652. }
  653. interface SendRecallMessageResult extends BaseResult {
  654. message?: RecallNotificationMessage;
  655. }
  656. interface BaseResult {
  657. code: number;
  658. }
  659. interface MessageListResult extends BaseResult {
  660. messages?: Message[];
  661. }
  662. interface MessageResult extends BaseResult {
  663. message?: Message;
  664. }
  665. interface ConversationResult extends BaseResult {
  666. conversation?: Conversation;
  667. }
  668. interface ConversationListResult extends BaseResult {
  669. conversations?: Conversation[];
  670. }
  671. interface statusResult extends BaseResult {
  672. status?: number;
  673. }
  674. interface DraftResult extends BaseResult {
  675. draft?: string;
  676. }
  677. interface CountResult extends BaseResult {
  678. count?: number;
  679. }
  680. interface ChatRoomInfoResult extends BaseResult {
  681. chatRoomInfo?: ChatRoomInfo;
  682. }
  683. /**
  684. * 搜索会话结果
  685. */
  686. interface SearchConversationResult extends BaseResult {
  687. result?: {
  688. conversation: Conversation;
  689. matchCount: number;
  690. };
  691. }
  692. /**
  693. * 会话信息
  694. */
  695. interface Conversation {
  696. conversationType: ConversationType;
  697. conversationTitle: string;
  698. isTop: boolean;
  699. unreadMessageCount: number;
  700. draft: string;
  701. targetId: string;
  702. objectName: string;
  703. latestMessageId: number;
  704. latestMessage: MessageContent;
  705. receivedStatus: number;
  706. receivedTime: number;
  707. sentStatus: SentStatus;
  708. senderUserId: string;
  709. hasUnreadMentioned: boolean;
  710. mentionedCount: number;
  711. }
  712. /**
  713. * 搜索类型
  714. */
  715. declare enum SearchType {
  716. /**
  717. * 精准
  718. */
  719. EXACT = 0,
  720. /**
  721. * 模糊
  722. */
  723. FUZZY = 1
  724. }
  725. /**
  726. * 公共服务类型
  727. */
  728. declare enum PublicServiceType {
  729. /**
  730. * 应用公众服务
  731. */
  732. APP_PUBLIC_SERVICE = 7,
  733. /**
  734. * 公共服务号
  735. */
  736. PUBLIC_SERVICE = 8
  737. }
  738. /**
  739. * 公众服务菜单类型
  740. */
  741. declare enum PublicServiceMenuItemType {
  742. /**
  743. * 作为分组包含子菜单的菜单
  744. */
  745. GROUP = 0,
  746. /**
  747. * 查看事件菜单
  748. */
  749. VIEW = 1,
  750. /**
  751. * 点击事件菜单
  752. */
  753. CLICK = 2
  754. }
  755. /**
  756. * 公众服务菜单项
  757. */
  758. interface PublicServiceMenuItem {
  759. /**
  760. * 菜单项 ID
  761. */
  762. id: string;
  763. /**
  764. * 菜单项名称
  765. */
  766. name: string;
  767. /**
  768. * 菜单项 URL
  769. */
  770. url: string;
  771. /**
  772. * 菜单项类型
  773. */
  774. type: PublicServiceMenuItemType;
  775. }
  776. /**
  777. * 公众服务描述
  778. */
  779. interface PublicServiceProfile {
  780. id: string;
  781. /**
  782. * 服务名称
  783. */
  784. name: string;
  785. /**
  786. * 服务描述
  787. */
  788. introduction: string;
  789. /**
  790. * 头像连接
  791. */
  792. portraitUrl: string;
  793. /**
  794. * 是否设置为所有用户均关注
  795. */
  796. isGlobal: boolean;
  797. /**
  798. * 用户是否已关注
  799. */
  800. followed: boolean;
  801. /**
  802. * 类型
  803. */
  804. type: PublicServiceType | ConversationType;
  805. /**
  806. * 菜单
  807. */
  808. menu: PublicServiceMenuItem[];
  809. }
  810. /**
  811. * 输入状态
  812. */
  813. interface TypingStatus {
  814. conversationType: ConversationType;
  815. targetId: string;
  816. userId: string;
  817. typingContentType: string;
  818. }
  819. /**
  820. * 消息已读回执
  821. */
  822. interface ReadReceipt {
  823. conversationType: ConversationType;
  824. targetId: string;
  825. messageTime: number;
  826. }
  827. /**
  828. * 消息回执请求信息
  829. */
  830. interface ReceiptRequest {
  831. conversationType: ConversationType;
  832. targetId: string;
  833. messageUId: string;
  834. }
  835. /**
  836. * 消息回执响应信息
  837. */
  838. interface ReceiptResponse {
  839. conversationType: ConversationType;
  840. targetId: string;
  841. messageUId: string;
  842. users: {
  843. [key: string]: number;
  844. };
  845. }
  846. /**
  847. * 时间戳排序方式
  848. */
  849. declare enum TimestampOrder {
  850. /**
  851. * 按时间戳倒序排序
  852. */
  853. DESC = 0,
  854. /**
  855. * 按时间戳顺序排序
  856. */
  857. ASC = 1
  858. }
  859. /**
  860. * 聊天室成员排序,按加入时间
  861. */
  862. declare enum ChatRoomMemberOrder {
  863. /**
  864. * 生序
  865. */
  866. ASC = 1,
  867. /**
  868. * 降序
  869. */
  870. DESC = 2
  871. }
  872. /**
  873. * 聊天室成员信息
  874. */
  875. interface MemberInfo {
  876. userId: string;
  877. joinTime: number;
  878. }
  879. /**
  880. * 聊天室信息
  881. */
  882. interface ChatRoomInfo {
  883. targetId: string;
  884. memberOrder: ChatRoomMemberOrder;
  885. totalMemberCount: number;
  886. members: MemberInfo[];
  887. }
  888. /**
  889. * 讨论组
  890. */
  891. interface Discussion {
  892. id: string;
  893. name: string;
  894. creatorId: string;
  895. memberIdList: string[];
  896. isOpen: boolean;
  897. }
  898. /**
  899. * 实时位置共享状态
  900. */
  901. declare enum RealTimeLocationStatus {
  902. /**
  903. * 初始状态
  904. */
  905. IDLE = 0,
  906. /**
  907. * 接收状态
  908. */
  909. INCOMING = 1,
  910. /**
  911. * 发起状态
  912. */
  913. OUTGOING = 2,
  914. /**
  915. * 已连接,正在共享的状态
  916. */
  917. CONNECTED = 3
  918. }
  919. /**
  920. * 推送语言
  921. */
  922. declare enum PushLanguage {
  923. EN_US = "en_US",
  924. ZH_CN = "zh_CN",
  925. AR_SA = "ar_SA"
  926. }
  927. /**
  928. * 推送提醒消息
  929. */
  930. interface PushNotificationMessage {
  931. pushType: string;
  932. pushId: string;
  933. pushTitle: string;
  934. pushFlag: string;
  935. pushContent: string;
  936. pushData: string;
  937. objectName: string;
  938. senderId: string;
  939. senderName: string;
  940. senderPortraitUrl: string;
  941. targetId: string;
  942. targetUserName: string;
  943. conversationType: ConversationType;
  944. extra: string;
  945. }
  946. /**
  947. * 推送配置
  948. */
  949. interface PushConfig {
  950. FCM: boolean;
  951. HW: boolean;
  952. VIVO: boolean;
  953. MI: {
  954. MI_PUSH_APPID: string;
  955. MI_PUSH_APPKEY: string;
  956. };
  957. MEIZU: {
  958. MEIZU_PUSH_APPID: string;
  959. MEIZU_PUSH_APPKEY: string;
  960. };
  961. OPPO: {
  962. OPPO_PUSH_APPID: string;
  963. OPPO_PUSH_APPKEY: string;
  964. };
  965. }
  966. /**
  967. * 发送进度消息回调
  968. */
  969. interface SentProgressMessageCallback {
  970. success?: (messageId: number) => void;
  971. progress?: (progress: number, messageId: number) => void;
  972. cancel?: (messageId: number) => void;
  973. error?: (errorCode: ErrorCode, messageId: number) => void;
  974. }
  975. /**
  976. * 发送进度消息回调参数
  977. */
  978. interface ProgressMessageResult {
  979. type: ResponseType;
  980. eventId: string;
  981. messageId: number;
  982. progress: number;
  983. errorCode: number;
  984. }
  985. /**
  986. * 初始化 SDK,只需要调用一次
  987. *
  988. * @param appKey 从融云开发者平台创建应用后获取到的 App Key
  989. */
  990. declare function init(appKey: string): void;
  991. /**
  992. * 初始化 SDK,只需要调用一次
  993. * @param appKey 从融云开发者平台创建应用后获取到的 App Key
  994. * @param engineSetup 引擎初始化配置参数
  995. */
  996. declare function initWithSetup(appKey: string, engineSetup: RCIMEngineSetup): void;
  997. /**
  998. * 连接融云服务器,只需要调用一次
  999. *
  1000. * 在 App 整个生命周期,您只需要调用一次此方法与融云服务器建立连接。
  1001. * 之后无论是网络出现异常或者App有前后台的切换等,SDK都会负责自动重连。
  1002. * 除非您已经手动将连接断开,否则您不需要自己再手动重连。
  1003. *
  1004. * @param token 从服务端获取的用户身份令牌(Token)
  1005. * @param callback 回调函数
  1006. */
  1007. declare function connect(token: string, callback: (result: ConnectResult) => void): void;
  1008. /**
  1009. * 断开与融云服务器的连接
  1010. *
  1011. * @param isReceivePush 是否还接收推送
  1012. */
  1013. declare function disconnect(isReceivePush?: boolean): void;
  1014. /**
  1015. * 添加连接状态监听函数
  1016. *
  1017. * @param listener 回调函数
  1018. */
  1019. declare function addConnectionStatusListener(listener: (result: UniListenerResult<ConnectionListenerResult>) => void): void;
  1020. /**
  1021. * 清除连接状态监听函数
  1022. *
  1023. */
  1024. declare function clearConnectionStatusListener(): void;
  1025. /**
  1026. * 添加日志信息监听函数
  1027. *
  1028. * @param listener
  1029. */
  1030. declare function addLogInfoListener(listener: (result: UniListenerResult<LogInfoResult>) => void): void;
  1031. /**
  1032. * 清除日志信息监听函数
  1033. *
  1034. */
  1035. declare function clearLogInfoListener(): void;
  1036. /**
  1037. * 添加消息撤回监听函数
  1038. *
  1039. * @param listener
  1040. */
  1041. declare function addRecallMessageListener(listener: (result: UniListenerResult<RecallMessageResult>) => void): void;
  1042. /**
  1043. * 添加消息撤回监听函数
  1044. *
  1045. */
  1046. declare function clearRecallMessageListener(): void;
  1047. /**
  1048. * 添加消息监听函数
  1049. *
  1050. * @param listener
  1051. */
  1052. declare function addReceiveMessageListener(listener: (result: UniListenerResult<ReceiveMessage>) => void): void;
  1053. /**
  1054. * 清除消息监听函数
  1055. *
  1056. */
  1057. declare function clearReceiveMessageListener(): void;
  1058. /**
  1059. * 添加输入状态监听函数
  1060. *
  1061. * @param listener
  1062. */
  1063. declare function addTypingStatusListener(listener: (result: UniListenerResult<TypingStatus>) => void): void;
  1064. /**
  1065. * 清除输入状态监听函数
  1066. *
  1067. */
  1068. declare function clearTypingStatusListener(): void;
  1069. /**
  1070. * 添加推送消息到达监听函数
  1071. *
  1072. * @param listener
  1073. */
  1074. /**
  1075. * 同步会话阅读状态
  1076. *
  1077. * @param conversationType 会话类型
  1078. * @param targetId 目标 ID
  1079. * @param timestamp 该会话中已读的最后一条消息的发送时间戳,必须是有效的时间戳
  1080. * @param callback 回调函数
  1081. */
  1082. declare function syncConversationReadStatus(conversationType: ConversationType, targetId: string, timestamp: number, callback: (result: BaseResult) => void): void;
  1083. /**
  1084. * 设置 deviceToken,用于远程推送
  1085. *
  1086. * @param deviceToken 从系统获取到的设备号 deviceToken(需要去掉空格和尖括号)
  1087. *
  1088. * deviceToken是系统提供的,从苹果服务器获取的,用于APNs远程推送必须使用的设备唯一值。
  1089. * 您需要将 `-application:didRegisterForRemoteNotificationsWithDeviceToken:`
  1090. * 获取到的deviceToken,转为NSString类型,并去掉其中的空格和尖括号,作为参数传入此方法。
  1091. */
  1092. /**
  1093. * 设置导航服务器和上传文件服务器信息,要在 [[init]] 前使用
  1094. *
  1095. * @param naviServer 导航服务器地址
  1096. * @param fileServer 文件服务器地址
  1097. */
  1098. declare function setServerInfo(naviServer: string, fileServer: string): void;
  1099. /**
  1100. * 设置统计服务地址
  1101. *
  1102. * 配置数据上传地址 (非必须) 通过配置该地址,SDK
  1103. * 会在初始化时把设备相关信息上传到私有云节点。
  1104. * 影响到的功能是开发者后台的广播推送功能,如果私有云客户没有配置该地址,那从后台发推送时,客户端是收不到的。
  1105. * 普通的 IM 推送不受影响。设置数据上传服务器地址。
  1106. * 可以支持设置 http://cn.xxx.com 或者 https://cn.xxx.com 或者 cn.xxx.com
  1107. * 如果设置成 cn.xxx.com,sdk 会组装成并仅支持 http:// 协议格式。
  1108. *
  1109. * @param server 服务地址
  1110. */
  1111. declare function setStatisticServer(server: string): void;
  1112. /**
  1113. * 获取当前连接状态
  1114. *
  1115. * @param callback 回调函数
  1116. */
  1117. declare function getConnectionStatus(callback: (result: {
  1118. status: ConnectionStatus;
  1119. }) => {}): void;
  1120. /**
  1121. * 发送消息
  1122. *
  1123. * @param message 消息
  1124. * @param callback 回调函数
  1125. */
  1126. declare function sendMessage(message: SentMessage, callback: (result: SendMessageResult) => {}): void;
  1127. /**
  1128. * 发送媒体消息
  1129. *
  1130. * @param message 消息
  1131. * @param callback 回调函数
  1132. */
  1133. declare function sendMediaMessage(message: SentMessage, callback?: SentProgressMessageCallback): void;
  1134. /**
  1135. * 发送定向消息
  1136. *
  1137. * @param message 消息
  1138. * @param userIdList 用户 ID 列表
  1139. * @param callback 回调函数
  1140. */
  1141. declare function sendDirectionalMessage(message: SentMessage, userIdList: string[], callback: (result: SendMessageResult) => {}): void;
  1142. /**
  1143. * 消息撤回
  1144. *
  1145. * @param messageId 消息 ID
  1146. * @param pushContent 推送内容
  1147. * @param callback 回调函数
  1148. */
  1149. declare function recallMessage(messageId: number, pushContent: string | undefined, callback: (message: SendRecallMessageResult) => void): void;
  1150. /**
  1151. * 发送输入状态
  1152. *
  1153. * @param conversationType 会话类型
  1154. * @param targetId 目标 ID
  1155. * @param typingContentType 输入内容类型
  1156. */
  1157. declare function sendTypingStatus(conversationType: ConversationType, targetId: string, typingContentType: ObjectName): void;
  1158. /**
  1159. * 设置消息发送状态
  1160. *
  1161. * @param messageId 消息 ID
  1162. * @param status 状态
  1163. * @param callback 回调函数
  1164. */
  1165. declare function setMessageSentStatus(messageId: number, status: SentStatus, callback: (result: {
  1166. code: number;
  1167. }) => {}): any;
  1168. /**
  1169. * 设置消息接收状态
  1170. *
  1171. * @param messageId 消息 ID
  1172. * @param status 状态
  1173. * @param callback 回调函数
  1174. */
  1175. declare function setMessageReceivedStatus(messageId: number, status: number, callback: (result: {
  1176. code: number;
  1177. }) => {}): any;
  1178. /**
  1179. * 获取屏蔽消息提醒的会话列表
  1180. *
  1181. * @param conversationTypeList 消息类型列表会话类型
  1182. * @param callback 回调函数
  1183. */
  1184. declare function getBlockedConversationList(conversationTypeList: ConversationType[], callback: (result: ConversationListResult) => void): void;
  1185. /**
  1186. * 发送阅读回执
  1187. *
  1188. * @param conversationType 会话类型
  1189. * @param targetId 目标 ID
  1190. * @param timestamp 该会话中已阅读点最后一条消息的发送时间戳
  1191. */
  1192. declare function sendReadReceiptMessage(conversationType: ConversationType, targetId: string, timestamp: number): void;
  1193. /**
  1194. * 发起群组消息回执请求
  1195. *
  1196. * @param messageId 消息 ID
  1197. * @param callback 回调函数
  1198. */
  1199. declare function sendReadReceiptRequest(messageId: number, callback: (result: BaseResult) => void): void;
  1200. /**
  1201. * 发起群组消息回执响应
  1202. *
  1203. * @param conversationType 会话类型
  1204. * @param targetId 会话 ID
  1205. * @param messages 回执的消息列表
  1206. * @param callback 回调函数
  1207. */
  1208. declare function sendReadReceiptResponse(conversationType: ConversationType, targetId: string, messages: Message[], callback: (result: BaseResult) => void): void;
  1209. /**
  1210. * 添加私聊阅读回执监听函数
  1211. */
  1212. declare function addReadReceiptReceivedListener(listener: (message: UniListenerResult<ReadReceipt>) => void): void;
  1213. /**
  1214. * 清除私聊阅读回执监听函数
  1215. */
  1216. declare function clearReadReceiptReceivedListener(): void;
  1217. /**
  1218. * 添加收到消息已读回执请求监听函数
  1219. *
  1220. * 收到此请求后,如果用户阅读了对应的消息,需要调用
  1221. * sendMessageReadReceiptResponse 接口发送已读响应
  1222. */
  1223. declare function addReceiptRequestListener(listener: (data: UniListenerResult<ReceiptRequest>) => void): void;
  1224. /**
  1225. * 清除收到消息已读回执请求监听函数
  1226. *
  1227. */
  1228. declare function clearReceiptRequestListener(): void;
  1229. /**
  1230. * 添加消息回执响应监听函数
  1231. *
  1232. * @param listener
  1233. */
  1234. declare function addReceiptResponseListener(listener: (data: UniListenerResult<ReceiptResponse>) => void): void;
  1235. /**
  1236. * 添加消息回执响应监听函数
  1237. *
  1238. */
  1239. declare function clearReceiptResponseListener(): void;
  1240. /**
  1241. * 取消发送中的媒体消息
  1242. *
  1243. * @param messageId 消息 ID
  1244. * @param callback 回调函数
  1245. */
  1246. declare function cancelSendMediaMessage(messageId: number, callback: (result: BaseResult) => void): void;
  1247. /**
  1248. * 取消下载中的媒体消息
  1249. *
  1250. * @param messageId 消息 ID
  1251. * @param callback 回调函数
  1252. */
  1253. declare function cancelDownloadMediaMessage(messageId: number, callback: (result: BaseResult) => void): void;
  1254. interface MediaMessageCallback {
  1255. progress?: (progress: number) => void;
  1256. success?: (path: string) => void;
  1257. error?: (errorCode: number) => void;
  1258. cancel?: () => void;
  1259. }
  1260. /**
  1261. * 下载媒体消息
  1262. *
  1263. * @param messageId 消息 ID
  1264. * @param callback 回调
  1265. */
  1266. declare function downloadMediaMessage(messageId: number, callback?: MediaMessageCallback): void;
  1267. /**
  1268. * 设置断线重连时是否踢出重连设备
  1269. *
  1270. * 用户没有开通多设备登录功能的前提下,同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
  1271. * 由于 SDK 有断线重连功能,存在下面情况。 用户在 A 设备登录,A
  1272. * 设备网络不稳定,没有连接成功,SDK 启动重连机制。 用户此时又在 B 设备登录,B
  1273. * 设备连接成功。 A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
  1274. * 这个接口就是为这种情况加的。 设置 enable 为 true 时,SDK
  1275. * 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
  1276. *
  1277. * @param enabled 是否踢出重连设备
  1278. */
  1279. declare function setReconnectKickEnable(enabled: boolean): void;
  1280. /**
  1281. * 获取历史消息
  1282. *
  1283. * 此方法会获取该会话中,baseMessageId 之前或之后的、指定数量、消息类型和查询方向的最新消息实体,返回的消息实体按照时间从新到旧排列。
  1284. * 返回的消息中不包含 baseMessageId 对应的那条消息,如果会话中的消息数量小于参数 count 的值,会将该会话中的所有消息返回。
  1285. *
  1286. * @param conversationType 会话类型
  1287. * @param targetId 目标 ID
  1288. * @param objectName 消息对象名称,可以用 MessageObjectNames 获取消息类型对应的对象名称, 传空字符串获取所有类型
  1289. * @param baseMessageId 最近一条消息的 ID
  1290. * @param count 数量
  1291. * @param isForward 是否向前获取
  1292. * @param callback 回调函数
  1293. */
  1294. declare function getHistoryMessages(conversationType: ConversationType, targetId: string, objectName: string | undefined, baseMessageId: number | undefined, count: number | undefined, isForward: boolean | undefined, callback: (result: MessageListResult) => void): void;
  1295. /**
  1296. * 通过时间戳获取历史消息
  1297. *
  1298. * @param conversationType 会话类型
  1299. * @param targetId 目标 ID
  1300. * @param objectName 消息对象名称,可以用 MessageObjectNames 获取消息类型对应的对象名称
  1301. * @param timestamp 时间戳
  1302. * @param count 数量
  1303. * @param isForward 是否向前获取
  1304. * @param callback 回调函数
  1305. */
  1306. declare function getHistoryMessagesByTimestamp(conversationType: ConversationType, targetId: string, objectNames: ObjectName[], timestamp: number | undefined, count: number | undefined, isForward: boolean | undefined, callback: (result: MessageListResult) => void): void;
  1307. /**
  1308. * 向本地会话插入一条发送消息
  1309. *
  1310. * @param conversationType
  1311. * @param targetId
  1312. * @param sentStatus
  1313. * @param messageContent
  1314. * @param sentTime
  1315. * @param callback 回调函数
  1316. */
  1317. declare function insertOutgoingMessage(conversationType: ConversationType, targetId: string, sentStatus: SentStatus, messageContent: MessageContent, sentTime: number | undefined, callback: (result: MessageResult) => void): any;
  1318. /**
  1319. * 向本地会话插入一条接收消息
  1320. *
  1321. * @param conversationType
  1322. * @param targetId
  1323. * @param senderUserId
  1324. * @param receivedStatus
  1325. * @param messageContent
  1326. * @param sentTime
  1327. * @param callback 回调函数
  1328. */
  1329. declare function insertIncomingMessage(conversationType: ConversationType, targetId: string, senderUserId: string, receivedStatus: number, messageContent: MessageContent, sentTime: number | undefined, callback: (result: MessageResult) => void): void;
  1330. /**
  1331. * 清空某一会话的所有消息
  1332. *
  1333. * @param conversationType
  1334. * @param targetId
  1335. * @param callback 回调函数
  1336. */
  1337. declare function clearMessages(conversationType: ConversationType, targetId: string, callback: (result: BaseResult) => void): void;
  1338. /**
  1339. * 根据消息 ID 删除消息
  1340. *
  1341. * @param ids 消息 ID 列表
  1342. * @param callback 回调函数
  1343. */
  1344. declare function deleteMessagesByIds(ids: number[], callback: (result: BaseResult) => void): void;
  1345. /**
  1346. * 根据会话删除消息
  1347. *
  1348. * @param type 会话类型
  1349. * @param targetId 会话 ID
  1350. * @param callback 回调函数
  1351. */
  1352. declare function deleteMessages(type: ConversationType, targetId: string | undefined, callback: (result: BaseResult) => void): void;
  1353. /**
  1354. * 根据关键字搜索会话
  1355. *
  1356. * @param keyword 关键字
  1357. * @param conversationTypes 会话类型数组
  1358. * @param objectNames 对象名称数组
  1359. * @param callback 回调函数
  1360. */
  1361. declare function searchConversations(keyword: string, conversationTypes: ConversationType[], objectNames: ObjectName[], callback: (result: SearchConversationResult) => void): void;
  1362. /**
  1363. * 搜索消息
  1364. *
  1365. * @param conversationType 会话类型
  1366. * @param targetId 目标 ID
  1367. * @param keyword 关键字
  1368. * @param count 获取数量
  1369. * @param startTime 开始时间
  1370. * @param callback 回调函数
  1371. */
  1372. declare function searchMessages(conversationType: ConversationType, targetId: string, keyword: string, count: number, startTime: number | undefined, callback: (result: MessageListResult) => void): void;
  1373. /**
  1374. * 获取消息
  1375. *
  1376. * @param messageId 消息 ID
  1377. * @param callback 回调函数
  1378. */
  1379. declare function getMessage(messageId: number, callback: (result: MessageResult) => void): void;
  1380. /**
  1381. * 根据消息 UID 获取消息
  1382. *
  1383. * @param messageUId 消息 UID
  1384. * @param callback 回调函数
  1385. */
  1386. declare function getMessageByUId(messageUId: string, callback: (result: MessageResult) => void): void;
  1387. /**
  1388. * 设置消息的附加信息
  1389. *
  1390. * @param messageId 消息 ID
  1391. * @param extra 附加信息
  1392. * @param callback 回调函数
  1393. */
  1394. declare function setMessageExtra(messageId: number, extra: string, callback: (result: BaseResult) => void): void;
  1395. /**
  1396. * 获取消息发送时间
  1397. *
  1398. * @param messageId 消息 ID
  1399. * @param callback 回调函数
  1400. */
  1401. declare function getMessageSendTime(messageId: number, callback: (result: number) => void): void;
  1402. /**
  1403. * 获取会话中的消息数量
  1404. *
  1405. * @param conversationType 会话类型
  1406. * @param targetId 目标 ID
  1407. * @param callback 回调函数
  1408. */
  1409. declare function getMessageCount(conversationType: ConversationType, targetId: string, callback: (result: {
  1410. code: number;
  1411. count?: number;
  1412. }) => void): void;
  1413. /**
  1414. * 获取会话里第一条未读消息
  1415. *
  1416. * @param conversationType 会话类型
  1417. * @param targetId 目标 ID
  1418. * @param callback 回调函数
  1419. */
  1420. declare function getFirstUnreadMessage(conversationType: ConversationType, targetId: string, callback: (result: MessageResult) => void): void;
  1421. /**
  1422. * 获取会话中 @ 提醒自己的消息
  1423. *
  1424. * @param conversationType 会话类型
  1425. * @param targetId 目标 ID
  1426. * @param callback 回调函数
  1427. */
  1428. declare function getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, callback: (messages: MessageListResult) => void): void;
  1429. /**
  1430. * 获取服务端历史消息
  1431. *
  1432. * @param conversationType 会话类型
  1433. * @param targetId 目标 ID
  1434. * @param sentTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息
  1435. * @param count 删除数量
  1436. * @param callback 回调函数
  1437. */
  1438. declare function getRemoteHistoryMessages(conversationType: ConversationType, targetId: string, sentTime: number, count: number, callback: (result: MessageListResult) => void): void;
  1439. /**
  1440. * 清除服务端历史消息
  1441. *
  1442. * @param conversationType 会话类型
  1443. * @param targetId 目标 ID
  1444. * @param recordTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息
  1445. * @param callback 回调函数
  1446. */
  1447. declare function cleanRemoteHistoryMessages(conversationType: ConversationType, targetId: string, recordTime: number, callback: (result: BaseResult) => void): void;
  1448. /**
  1449. * 清除历史消息
  1450. *
  1451. * @param conversationType 会话类型
  1452. * @param targetId 目标 ID
  1453. * @param recordTime 清除消息截止时间戳,为 0 则清除会话所有服务端历史消息
  1454. * @param clearRemote 是否同时删除服务端消息
  1455. * @param callback 回调函数
  1456. */
  1457. declare function cleanHistoryMessages(conversationType: ConversationType, targetId: string, recordTime: number, clearRemote: boolean, callback: (result: BaseResult) => void): void;
  1458. /**
  1459. * 清除服务端历史消息
  1460. *
  1461. * @param conversationType 会话类型
  1462. * @param targetId 目标 ID
  1463. * @param messages 要删除的消息数组,数组大小不能超过 100 条
  1464. */
  1465. /**
  1466. * 获取会话
  1467. *
  1468. * @param conversationType 会话类型
  1469. * @param targetId 目标 ID
  1470. * @param callback 回调函数
  1471. */
  1472. declare function getConversation(conversationType: ConversationType, targetId: string, callback: (result: ConversationResult) => void): void;
  1473. /**
  1474. * 获取会话列表
  1475. *
  1476. * @param conversationTypes 会话类型列表
  1477. * @param count 获取的数量
  1478. * @param timestamp 会话的时间戳(获取这个时间戳之前的会话列表,0 表示从最新开始获取)会话类型
  1479. * @param callback 回调函数
  1480. */
  1481. declare function getConversationList(conversationTypes: ConversationType[] | undefined, count: number | undefined, timestamp: number | undefined, callback: (result: ConversationListResult) => void): void;
  1482. /**
  1483. * 从会话列表中移除某一会话,但是不删除会话内的消息
  1484. *
  1485. * @param conversationType 会话类型
  1486. * @param targetId 目标 ID
  1487. * @param callback 回调函数
  1488. */
  1489. declare function removeConversation(conversationType: ConversationType, targetId: string, callback: (conversation: BaseResult) => void): void;
  1490. /**
  1491. * 设置会话消息提醒状态
  1492. *
  1493. * @param conversationType 会话类型
  1494. * @param targetId 目标 ID
  1495. * @param isBlock 是否屏蔽
  1496. * @param callback 回调函数
  1497. */
  1498. declare function setConversationNotificationStatus(conversationType: ConversationType, targetId: string, isBlock: boolean, callback: (result: statusResult) => void): void;
  1499. /**
  1500. * 获取会话消息提醒状态
  1501. *
  1502. * @param conversationType 会话类型
  1503. * @param targetId 目标 ID
  1504. * @param callback 回调函数
  1505. */
  1506. declare function getConversationNotificationStatus(conversationType: ConversationType, targetId: string, callback: (result: statusResult) => void): void;
  1507. /**
  1508. * 设置是否置顶会话
  1509. *
  1510. * @param conversationType 会话类型
  1511. * @param targetId 目标 ID
  1512. * @param isTop 是否置顶
  1513. * @param callback 回调函数
  1514. */
  1515. declare function setConversationToTop(conversationType: ConversationType, targetId: string, isTop: boolean, callback: (result: BaseResult) => void): void;
  1516. /**
  1517. * 获取置顶会话列表
  1518. *
  1519. * @param conversationTypes 会话类型列表
  1520. * @param callback 回调函数
  1521. */
  1522. declare function getTopConversationList(conversationTypes: ConversationType[] | undefined, callback: (result: ConversationListResult) => void): void;
  1523. /**
  1524. * 保存某一会话的文本消息草稿
  1525. *
  1526. * @param conversationType 会话类型
  1527. * @param targetId 目标 ID
  1528. * @param content 草稿内容
  1529. * @param callback 回调函数
  1530. */
  1531. declare function saveTextMessageDraft(conversationType: ConversationType, targetId: string, content: string, callback: (result: BaseResult) => void): void;
  1532. /**
  1533. * 获取某一会话的文本消息草稿
  1534. *
  1535. * @param conversationType 会话类型
  1536. * @param targetId 目标 ID
  1537. * @param callback 回调函数
  1538. */
  1539. declare function getTextMessageDraft(conversationType: ConversationType, targetId: string, callback: (result: DraftResult) => void): void;
  1540. /**
  1541. * 清除某一会话的文本消息草稿
  1542. *
  1543. * @param conversationType 会话类型
  1544. * @param targetId 目标 ID
  1545. * @param callback 回调函数
  1546. */
  1547. declare function clearTextMessageDraft(conversationType: ConversationType, targetId: string, callback: (result: BaseResult) => void): void;
  1548. /**
  1549. * 获取所有未读消息数
  1550. *
  1551. * @param callback 回调函数
  1552. */
  1553. declare function getTotalUnreadCount(callback: (result: CountResult) => void): void;
  1554. /**
  1555. * 获取指定会话的未读消息数
  1556. *
  1557. * @param conversationType 会话类型
  1558. * @param targetId 目标 ID
  1559. * @param callback 回调函数
  1560. */
  1561. declare function getUnreadCount(conversationType: ConversationType | ConversationType[], targetId: string | undefined, callback: (result: CountResult) => void): void;
  1562. /**
  1563. * 清除某个会话中的未读消息数
  1564. *
  1565. * @param conversationType 会话类型
  1566. * @param targetId 目标 ID
  1567. * @param time 该会话已阅读的最后一条消息的发送时间戳
  1568. * @param callback 回调函数
  1569. */
  1570. declare function clearMessagesUnreadStatus(conversationType: ConversationType, targetId: string, time: number | undefined, callback: (result: BaseResult) => void): void;
  1571. /**
  1572. * 把用户加入黑名单
  1573. *
  1574. * @param userId 用户 ID
  1575. * @param callback 回调函数
  1576. */
  1577. declare function addToBlacklist(userId: string, callback: (result: BaseResult) => void): void;
  1578. /**
  1579. * 把用户从黑名单中移除
  1580. *
  1581. * @param userId 用户 ID
  1582. * @param callback 回调函数
  1583. */
  1584. declare function removeFromBlacklist(userId: string, callback: (result: BaseResult) => void): void;
  1585. /**
  1586. * 获取某用户是否在黑名单中
  1587. *
  1588. * @param userId 用户 ID
  1589. * @param callback 回调函数
  1590. */
  1591. declare function getBlacklistStatus(userId: string, callback: (result: statusResult) => void): void;
  1592. /**
  1593. * 获取黑名单列表
  1594. *
  1595. * @param 回调函数
  1596. */
  1597. declare function getBlacklist(callback: (result: {
  1598. code: number;
  1599. list?: string[];
  1600. }) => void): void;
  1601. /**
  1602. * 加入聊天室,如果已存在,直接加入,否则创建并加入
  1603. *
  1604. * @param targetId 聊天室 ID
  1605. * @param messageCount 默认获取的消息数量,最多 50
  1606. * @param callback 回调函数
  1607. */
  1608. declare function joinChatRoom(targetId: string, messageCount: number | undefined, callback: (result: BaseResult) => void): void;
  1609. /**
  1610. * 加入已存在的聊天室,如果不存在则加入失败
  1611. *
  1612. * @param targetId 聊天室 ID
  1613. * @param messageCount 默认获取的消息数量,最多 50
  1614. * @param callback 回调函数
  1615. */
  1616. declare function joinExistChatRoom(targetId: string, messageCount: number | undefined, callback: (result: BaseResult) => void): void;
  1617. /**
  1618. * 退出聊天室
  1619. *
  1620. * @param targetId 聊天室 ID
  1621. * @param callback 回调函数
  1622. */
  1623. declare function quitChatRoom(targetId: string, callback: (result: BaseResult) => void): void;
  1624. /**
  1625. * 从服务器端获取聊天室的历史消息
  1626. *
  1627. * @param targetId 目标 ID
  1628. * @param recordTime 起始的消息发送时间戳,单位毫秒
  1629. * @param count 要获取的消息数量
  1630. * @param order 拉取顺序
  1631. * @param callback 回调函数
  1632. */
  1633. declare function getRemoteChatRoomHistoryMessages(targetId: string, recordTime: number, count: number, order: TimestampOrder, callback: (result: {
  1634. messages: Message[];
  1635. syncTime: number;
  1636. code: number;
  1637. }) => void): void;
  1638. /**
  1639. * 获取聊天室信息
  1640. *
  1641. * @param targetId 聊天室 ID
  1642. * @param memberCount 聊天室成员数量,最多获取 20 个
  1643. * @param order 返回的聊天室成员排序方式
  1644. * @param callback 回调函数
  1645. */
  1646. declare function getChatRoomInfo(targetId: string, memberCount: number | undefined, order: ChatRoomMemberOrder | undefined, callback: (result: ChatRoomInfoResult) => void): void;
  1647. /**
  1648. * 全局屏蔽某个时间段的消息提醒
  1649. *
  1650. * @param startTime 开始屏蔽消息提醒的时间,格式为HH:MM:SS
  1651. * @param spanMinutes 需要屏蔽消息提醒的分钟数,0 < spanMinutes < 1440
  1652. * @param callback 回调函数
  1653. */
  1654. declare function setNotificationQuietHours(startTime: string, spanMinutes: number, callback: (result: BaseResult) => void): void;
  1655. /**
  1656. * 查询已设置的全局时间段消息提醒屏蔽
  1657. *
  1658. * @param callback 回调函数
  1659. */
  1660. declare function getNotificationQuietHours(callback: (result: {
  1661. startTime: string;
  1662. spanMinutes: number;
  1663. code: number;
  1664. }) => void): void;
  1665. /**
  1666. * 删除已设置的全局时间段消息提醒屏蔽
  1667. *
  1668. * @param callback 回调函数
  1669. */
  1670. declare function removeNotificationQuietHours(callback: (result: BaseResult) => void): void;
  1671. /**
  1672. * 获取离线消息在服务端的存储时间(以天为单位)
  1673. */
  1674. declare function getOfflineMessageDuration(callback: (result: {
  1675. code: number;
  1676. duration: number;
  1677. }) => void): void;
  1678. /**
  1679. * 设置离线消息在服务端的存储时间(以天为单位)
  1680. *
  1681. * @param callback 回调函数
  1682. */
  1683. declare function setOfflineMessageDuration(duration: number, callback: (result: BaseResult) => void): void;
  1684. /**
  1685. * 获取当前用户 ID
  1686. *
  1687. * @param callback 回调函数
  1688. */
  1689. declare function getCurrentUserId(callback: (result: {
  1690. userId: string;
  1691. }) => void): void;
  1692. /**
  1693. * 设置推送语言
  1694. *
  1695. * @param language 推送语言
  1696. * @param callback 回调函数
  1697. */
  1698. declare function setPushLanguageCode(language: PushLanguage, callback: (result: BaseResult) => void): void;
  1699. /**
  1700. * 设置是否显示内容详情
  1701. *
  1702. * @param isShowPushContent 是否显示内容详情
  1703. * @param callback 回调函数
  1704. */
  1705. declare function setPushContentShowStatus(isShowPushContent: boolean, callback: (result: BaseResult) => void): void;
  1706. /**
  1707. * 查询是否显示内容详情
  1708. *
  1709. * @param callback 回调函数
  1710. */
  1711. declare function getPushContentShowStatus(callback: (result: statusResult) => void): void;
  1712. /**
  1713. * 设置推送配置(仅安卓)
  1714. * @param config 推送配置
  1715. */
  1716. declare function setPushConfig(config: PushConfig): void;
  1717. export { BaseResult, ChatRoomInfo, ChatRoomInfoResult, ChatRoomMemberOrder, CommandMessage, CommandNotificationMessage, ConnectErrorCode, ConnectResult, ConnectionListenerResult, ConnectionStatus, ConnectionStatusAndroid, ConnectionStatusIOS, ContactNotificationMessage, Conversation, ConversationListResult, ConversationResult, ConversationType, CountResult, CustomMessage, CustomMessageType, Discussion, DraftResult, ErrorCode, FileMessage, GIFMessage, GroupNotificationMessage, HQVoiceMessage, ImageMessage, InfomationNotificationMessage, LocationMessage, LogInfoResult, MediaMessageCallback, MemberInfo, MentionedInfo, MentionedType, Message, MessageContent, MessageDirection, MessageListResult, MessageObjectNames, MessageResult, ObjectName, ProfileNotificationMessage, ProgressMessageResult, PublicServiceCommandMessage, PublicServiceMenuItem, PublicServiceMenuItemType, PublicServiceProfile, PublicServiceType, PushConfig, PushLanguage, PushNotificationMessage, RCAndroidPushConfig, RCIMEngineSetup, ReadReceipt, ReadReceiptMessage, RealTimeLocationStatus, RecallMessageResult, RecallNotificationMessage, ReceiptRequest, ReceiptResponse, ReceiveMessage, ResponseType, SearchConversationResult, SearchType, SendMessageResult, SendRecallMessageResult, SentMessage, SentProgressMessageCallback, SentStatus, TextMessage, TimestampOrder, TypingStatus, TypingStatusMessage, UniListenerResult, UserInfo, VoiceMessage, addConnectionStatusListener, addLogInfoListener, addReadReceiptReceivedListener, addRecallMessageListener, addReceiptRequestListener, addReceiptResponseListener, addReceiveMessageListener, addToBlacklist, addTypingStatusListener, cancelDownloadMediaMessage, cancelSendMediaMessage, cleanHistoryMessages, cleanRemoteHistoryMessages, clearConnectionStatusListener, clearLogInfoListener, clearMessages, clearMessagesUnreadStatus, clearReadReceiptReceivedListener, clearRecallMessageListener, clearReceiptRequestListener, clearReceiptResponseListener, clearReceiveMessageListener, clearTextMessageDraft, clearTypingStatusListener, connect, deleteMessages, deleteMessagesByIds, disconnect, downloadMediaMessage, getBlacklist, getBlacklistStatus, getBlockedConversationList, getChatRoomInfo, getConnectionStatus, getConversation, getConversationList, getConversationNotificationStatus, getCurrentUserId, getFirstUnreadMessage, getHistoryMessages, getHistoryMessagesByTimestamp, getMessage, getMessageByUId, getMessageCount, getMessageSendTime, getNotificationQuietHours, getOfflineMessageDuration, getPushContentShowStatus, getRemoteChatRoomHistoryMessages, getRemoteHistoryMessages, getTextMessageDraft, getTopConversationList, getTotalUnreadCount, getUnreadCount, getUnreadMentionedMessages, init, initWithSetup, insertIncomingMessage, insertOutgoingMessage, joinChatRoom, joinExistChatRoom, quitChatRoom, recallMessage, removeConversation, removeFromBlacklist, removeNotificationQuietHours, saveTextMessageDraft, searchConversations, searchMessages, sendDirectionalMessage, sendMediaMessage, sendMessage, sendReadReceiptMessage, sendReadReceiptRequest, sendReadReceiptResponse, sendTypingStatus, setConversationNotificationStatus, setConversationToTop, setMessageExtra, setMessageReceivedStatus, setMessageSentStatus, setNotificationQuietHours, setOfflineMessageDuration, setPushConfig, setPushContentShowStatus, setPushLanguageCode, setReconnectKickEnable, setServerInfo, setStatisticServer, statusResult, syncConversationReadStatus };