yeim-uni-sdk.min.d.ts 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456
  1. export declare module './yeim-uni-sdk.min.js' {
  2. /**
  3. *
  4. * YeIM-Uni-SDK
  5. * 可以私有化部署的全开源即时通讯js-sdk,仅需集成 SDK 即可轻松实现聊天能力,支持Web或uni-app项目接入使用,满足通信需要。
  6. *
  7. * @author wzJun1
  8. * @link https://github.com/wzJun1/YeIM-Uni-SDK
  9. * @doc https://wzjun1.netlify.app/ye_plugins/sdk/yeimunisdk
  10. * @copyright wzJun1 2022, 2023. All rights reserved.
  11. * @license Apache-2.0
  12. *
  13. */
  14. declare class YeIMUniSDK {
  15. /**
  16. * 初始化SDK
  17. *
  18. * @param options 配置项
  19. * @param options.baseURL - YeIMServer http url (如无特殊需求,服务端启动后仅需修改ip或者域名即可)
  20. * @param options.socketURL - YeIMServer socket url(如无特殊需求,服务端启动后仅需修改ip或者域名即可)
  21. * @param options.logLevel - SDK 日志等级
  22. * @param options.reConnectInterval - socket 重连时间间隔
  23. * @param options.reConnectTotal - socket 最大重连次数,0不限制一直重连
  24. * @param options.heartInterval - socket 心跳时间间隔(默认30s)
  25. * @param options.notification - APP离线通知配置
  26. * @returns {YeIMUniSDK} YeIMUniSDK实例化对象
  27. */
  28. static init(options : {
  29. /**
  30. * YeIMServer http url (如无特殊需求,服务端启动后仅需修改ip或者域名即可)
  31. */
  32. baseURL : string;
  33. /**
  34. * YeIMServer socket url(如无特殊需求,服务端启动后仅需修改ip或者域名即可)
  35. */
  36. socketURL : string;
  37. /**
  38. * SDK 日志等级
  39. * 0 普通日志,日志量较多,接入时建议使用
  40. * 1 关键性日志,日志量较少,生产环境时建议使用
  41. * 2 无日志级别,SDK 将不打印任何日志
  42. */
  43. logLevel ?: number;
  44. /**
  45. * socket 重连时间间隔
  46. */
  47. reConnectInterval ?: number;
  48. /**
  49. * socket 最大重连次数,0不限制一直重连
  50. */
  51. reConnectTotal ?: number;
  52. /**
  53. * socket 心跳时间间隔(默认30s)
  54. */
  55. heartInterval ?: number;
  56. /**
  57. * APP离线通知配置
  58. */
  59. notification ?: object;
  60. }) : YeIMUniSDK;
  61. /**
  62. * 获取SDK实例化对象
  63. */
  64. static getInstance() : YeIMUniSDK?;
  65. /**
  66. * 连接登录YeIM
  67. *
  68. * @param options 配置项
  69. * @param options.userId 已注册的用户ID字符串
  70. * @param options.token 登录token,由请求服务端Http接口换取
  71. * @param {(result)=>void} [options.success] - 成功回调
  72. * @param {(error)=>void} [options.fail] - 失败回调
  73. * @returns {void}
  74. */
  75. connect(options : {
  76. userId : string,
  77. token : string,
  78. success ?: (result : any) => void,
  79. fail ?: (error : any) => void
  80. }) : void;
  81. /**
  82. * 创建文本消息
  83. *
  84. * @param {Options} options - 创建消息参数对象
  85. *
  86. * @param {String} options.toId - 接受者用户ID
  87. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  88. * @param {Object} options.body - 文本消息对象
  89. * @param {String} options.body.text - 文本消息内容
  90. * @param {String} options.extra - 自定义扩展数据
  91. *
  92. * @return {(Object|Message)} Message 消息对象
  93. *
  94. */
  95. createTextMessage(options : {
  96. toId : string,
  97. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  98. body : {
  99. text : string
  100. },
  101. extra ?: string
  102. }) : Message | Object;
  103. /**
  104. * 创建群聊 @ 艾特消息
  105. *
  106. * @param {Options} options - 创建消息参数对象
  107. *
  108. * @param {String} options.toId - 群ID
  109. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊 当前消息仅支持群里
  110. * @param {Body} options.body - 文本消息对象
  111. * @param {String} options.body.text - 文本消息内容
  112. * @param {Array<String>} options.body.atUserIdList - 要艾特的用户ID列表
  113. * @param {String} options.extra - 自定义扩展数据
  114. *
  115. * @return {(Object|Message)} Message 消息对象
  116. *
  117. */
  118. createTextAtMessage(options : {
  119. toId : string,
  120. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  121. body : {
  122. text : string,
  123. atUserIdList : Array<string>
  124. },
  125. extra ?: string
  126. }) : Message | Object;
  127. /**
  128. * 创建图片消息
  129. *
  130. * 仅支持单张图片
  131. *
  132. * @param {Options} options - 创建消息参数对象
  133. *
  134. * @param {String} options.toId - 接受者用户ID
  135. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  136. * @param {Body} options.body - 图片消息对象
  137. * @param {File} options.body.file - 图片消息对象
  138. * @param {String} options.body.file.tempFilePath - 本地图片文件临时路径
  139. * @param {Number} options.body.file.width - 图片宽度
  140. * @param {Number} options.body.file.height - 图片高度
  141. * @param {String} options.extra - 自定义扩展数据
  142. *
  143. * @return {(Object|Message)} Message 消息对象
  144. *
  145. */
  146. createImageMessage(options : {
  147. toId : string,
  148. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  149. body : {
  150. file : {
  151. tempFilePath : string,
  152. width : number,
  153. height : number
  154. }
  155. },
  156. extra ?: string
  157. }) : Message | Object;
  158. /**
  159. * 创建图片Url直发消息
  160. *
  161. * 仅支持单张图片
  162. *
  163. * @param {Options} options - 创建消息参数对象
  164. *
  165. * @param {String} options.toId - 接受者用户ID
  166. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  167. * @param {Body} options.body - 图片消息对象
  168. * @param {String} options.body.originalUrl - 原图网络Url
  169. * @param {Number} options.body.originalWidth - 原图宽度
  170. * @param {Number} options.body.originalHeight - 原图高度
  171. * @param {String} options.body.thumbnailUrl - 缩略图网络Url
  172. * @param {Number} options.body.thumbnailWidth - 缩略图宽度
  173. * @param {Number} options.body.thumbnailHeight - 缩略图高度
  174. * @param {String} options.extra - 自定义扩展数据
  175. *
  176. * @return {(Object|Message)} Message 消息对象
  177. *
  178. */
  179. createImageMessageFromUrl(options : {
  180. toId : string,
  181. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  182. body : {
  183. originalUrl : string,
  184. originalWidth : number,
  185. originalHeight : number,
  186. thumbnailUrl : string,
  187. thumbnailWidth : number,
  188. thumbnailHeight : number
  189. },
  190. extra ?: string
  191. }) : Message | Object;
  192. /**
  193. * 创建语音消息
  194. *
  195. * 仅支持AAC格式音频
  196. *
  197. * @param {Options} options - 创建消息参数对象
  198. *
  199. * @param {String} options.toId - 接受者用户ID
  200. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  201. * @param {Body} options.body - 音频消息对象
  202. * @param {File} options.body.file - 音频文件信息
  203. * @param {String} options.body.file.tempFilePath - 本地音频文件临时路径
  204. * @param {Number} options.body.file.duration - 音频时长,单位秒
  205. * @param {String} options.extra - 自定义扩展数据
  206. *
  207. * @return {(Object|Message)} Message 消息对象
  208. *
  209. */
  210. createAudioMessage(options : {
  211. toId : string,
  212. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  213. body : {
  214. file : {
  215. tempFilePath : string,
  216. duration : number
  217. }
  218. },
  219. extra ?: string
  220. }) : Message | Object;
  221. /**
  222. * 创建语音Url直发消息
  223. *
  224. * @param {Options} options - 创建消息参数对象
  225. *
  226. * @param {String} options.toId - 接受者用户ID
  227. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  228. * @param {Body} options.body - 音频消息对象
  229. * @param {String} options.body.audioUrl - 音频网络Url
  230. * @param {Number} options.body.duration - 音频时长,单位秒
  231. * @param {String} options.extra - 自定义扩展数据
  232. *
  233. * @return {(Object|Message)} Message 消息对象
  234. *
  235. */
  236. createAudioMessageFromUrl(options : {
  237. toId : string,
  238. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  239. body : {
  240. tempFilePath : string,
  241. duration : number
  242. },
  243. extra ?: string
  244. }) : Message | Object;
  245. /**
  246. * 创建小视频消息
  247. *
  248. * @param {Options} options - 创建消息参数对象
  249. *
  250. * @param {String} options.toId - 接受者用户ID
  251. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  252. * @param {Body} options.body - 视频消息对象
  253. * @param {File} options.body.file - 视频文件信息
  254. * @param {String} options.body.file.tempFilePath - 本地小视频文件临时路径
  255. * @param {Number} options.body.file.duration - 视频时长
  256. * @param {Number} options.body.file.width - 视频宽度
  257. * @param {Number} options.body.file.height - 视频高度
  258. * @param {String} options.extra - 自定义扩展数据
  259. *
  260. * @return {(Object|Message)} Message 消息对象
  261. *
  262. */
  263. createVideoMessage(options : {
  264. toId : string,
  265. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  266. body : {
  267. file : {
  268. tempFilePath : string,
  269. duration : number,
  270. width : number,
  271. height : number
  272. }
  273. },
  274. extra ?: string
  275. }) : Message | Object;
  276. /**
  277. * 创建小视频Url直发消息
  278. *
  279. * @param {Options} options - 创建消息参数对象
  280. *
  281. * @param {String} options.toId - 接受者用户ID
  282. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  283. * @param {Body} options.body - 视频消息对象
  284. * @param {String} options.body.videoUrl - 视频网络Url
  285. * @param {String} options.body.thumbnailUrl - 视频缩略图网络Url
  286. * @param {Number} options.body.duration - 视频时长
  287. * @param {Number} options.body.width - 视频宽度
  288. * @param {Number} options.body.height - 视频高度
  289. * @param {String} options.extra - 自定义扩展数据
  290. *
  291. * @return {(Object|Message)} Message 消息对象
  292. *
  293. */
  294. createVideoMessageFromUrl(options : {
  295. toId : string,
  296. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  297. body : {
  298. videoUrl : string,
  299. thumbnailUrl : string,
  300. duration : number,
  301. width : number,
  302. height : number
  303. },
  304. extra ?: string
  305. }) : Message | Object;
  306. /**
  307. * 创建位置消息
  308. *
  309. * @param {Options} options - 创建消息参数对象
  310. *
  311. * { "toId": "接受者用户ID", "conversationType": YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE, body: { address: "地址名称", description: "地址详细描述", longitude: 105.000000, latitude: 31.000000 }}
  312. *
  313. * @param {String} options.toId - 接受者用户ID
  314. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  315. * @param {Body} options.body - 位置消息对象
  316. * @param {String} options.body.address - 地址名称
  317. * @param {String} options.body.description - 地址详细描述
  318. * @param {Number} options.body.longitude - 经度
  319. * @param {Number} options.body.latitude - 纬度
  320. * @param {String} options.extra - 自定义扩展数据
  321. *
  322. * @return {(Object|Message)} Message 消息对象
  323. *
  324. */
  325. createLocationMessage(options : {
  326. toId : string,
  327. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  328. body : {
  329. address : string,
  330. description : string,
  331. longitude : number,
  332. latitude : number
  333. },
  334. extra ?: string
  335. }) : Message | Object;
  336. /**
  337. * 创建自定义消息
  338. *
  339. * 自定义消息内容放在body字段
  340. *
  341. * @param {Options} options - 创建消息参数对象
  342. *
  343. * { "toId": "接受者用户ID", "conversationType": YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE, body: {} }
  344. *
  345. * @param {String} options.toId - 接受者用户ID
  346. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  347. * @param {Body} options.body - 自定义消息内容
  348. * @param {String|Object} options.body.custom - 消息内容
  349. * @param {String} options.extra - 自定义扩展数据
  350. *
  351. * @return {(Object|Message)} Message 消息对象
  352. *
  353. */
  354. createCustomMessage(options : {
  355. toId : string,
  356. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  357. body : {
  358. custom : string | object
  359. },
  360. extra ?: string
  361. }) : Message | Object;
  362. /**
  363. * 创建合并消息
  364. *
  365. * @param {Options} options - 创建消息参数对象
  366. *
  367. * @param {String} options.toId - 接受者用户ID
  368. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  369. * @param {Body} options.body - 文本消息对象
  370. * @param {String} options.body.title - 合并消息的标题
  371. * @param {Array<Message>} options.body.messageList - 合并消息的标题
  372. * @param {Array<String>} options.body.summaryList - 合并消息的标题
  373. * @param {String} options.extra - 自定义扩展数据
  374. *
  375. * @return {(Object|Message)} Message 消息对象
  376. *
  377. */
  378. createMergerMessage(options : {
  379. toId : string,
  380. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  381. body : {
  382. title : string,
  383. messageList : Array<T>,
  384. summaryList : Array<string>
  385. },
  386. extra ?: string
  387. }) : Message | Object;
  388. /**
  389. * 创建转发消息
  390. *
  391. * @param {Options} options - 创建消息参数对象
  392. *
  393. * @param {String} options.toId - 接受者用户ID
  394. * @param {String} options.conversationType - 会话类型(私聊、群聊)定义在YeIMUniSDKDefines,YeIMUniSDKDefines.CONVERSATION_TYPE.PRIVATE = 私聊,YeIMUniSDKDefines.CONVERSATION_TYPE.GROUP = 群聊
  395. * @param {Body} options.body - 文本消息对象
  396. * @param {Message} options.body.message - 要转发的消息
  397. * @param {String} options.extra - 自定义扩展数据
  398. *
  399. * @return {(Object|Message)} Message 消息对象
  400. *
  401. */
  402. createForwardMessage(options : {
  403. toId : string,
  404. conversationType : YeIMUniSDKDefines.CONVERSATION_TYPE,
  405. body : {
  406. message : Message | object,
  407. },
  408. extra ?: string
  409. }) : Message | Object;
  410. /**
  411. *
  412. * 通用上传接口
  413. *
  414. * @param {Options} options
  415. * @param {String} options.filename - 文件名称(需带后缀)
  416. * @param {String} options.filepath - 本地文件临时路径
  417. * @param {(result)=>void} [options.success] - 成功回调
  418. * @param {(error)=>void} [options.fail] - 失败回调
  419. * @param {(progress)=>void} [options.onProgress] - 上传进度回调
  420. *
  421. */
  422. upload(options : {
  423. filename : string,
  424. filepath : string,
  425. success ?: (result : any) => void,
  426. fail ?: (error : any) => void
  427. }) : void;
  428. /**
  429. *
  430. * @version 1.1.7
  431. *
  432. * 获取历史消息记录
  433. *
  434. * @param {Options} options - 参数对象
  435. *
  436. * @param {String} options.nextMessageId - 下次拉取的开始ID
  437. * @param {String} options.conversationId - 会话ID
  438. * @param {Number} options.limit - 拉取数量,默认:20
  439. * @param {(result)=>void} options.success - 成功回调
  440. * @param {(error)=>void} options.fail - 失败回调
  441. *
  442. */
  443. getHistoryMessageList(options : {
  444. nextMessageId ?: string,
  445. conversationId : string,
  446. limit ?: number,
  447. success ?: (result : any) => void,
  448. fail ?: (error : any) => void
  449. }) : void;
  450. /**
  451. *
  452. * 删除消息
  453. *
  454. * @param {Options} options - 参数对象
  455. *
  456. * @param {Message} message - 要删除的消息对象
  457. * @param {(result)=>void} options.success - 成功回调
  458. * @param {(error)=>void} options.fail - 失败回调
  459. *
  460. */
  461. deleteMessage(options : {
  462. message : Message | object,
  463. success ?: (result : any) => void,
  464. fail ?: (error : any) => void
  465. }) : void;
  466. /**
  467. *
  468. * 撤回消息
  469. *
  470. * @param {Options} options - 参数对象
  471. *
  472. * @param {Message} message - 要撤回的消息对象
  473. * @param {(result)=>void} options.success - 成功回调
  474. * @param {(error)=>void} options.fail - 失败回调
  475. *
  476. */
  477. revokeMessage(options : {
  478. message : Message | object,
  479. success ?: (result : any) => void,
  480. fail ?: (error : any) => void
  481. }) : void;
  482. /**
  483. * 根据会话ID获取本地会话详情
  484. *
  485. * @param {String} conversationId - 会话ID
  486. * @return {Conversation} conversation
  487. */
  488. getConversation(conversationId : string) : Conversation | object;
  489. /**
  490. * 获取本地会话列表
  491. *
  492. * @param {Options} options - 参数对象
  493. *
  494. * @param {String} options.page - 页码
  495. * @param {String} options.limit - 每页数量
  496. * @param {(result)=>{}} [options.success] - 成功回调
  497. * @param {(error)=>{}} [options.fail] - 失败回调
  498. */
  499. getConversationList(options : {
  500. page : number,
  501. limit : number,
  502. success ?: (result : any) => void,
  503. fail ?: (error : any) => void
  504. }) : void;
  505. /**
  506. * 根据会话ID删除会话和聊天记录(包括云端)
  507. *
  508. * @param {Object} conversationId
  509. * @return {void}
  510. */
  511. deleteConversation(conversationId : string) : void;
  512. /**
  513. * 清除指定会话未读数
  514. *
  515. * 云端同时发送给对端已读事件(私聊)
  516. *
  517. * @param {String} conversationId - 会话ID
  518. * @return {void}
  519. */
  520. clearConversationUnread(conversationId : string) : void;
  521. /**
  522. *
  523. * 发送消息统一入口
  524. *
  525. * @param {Options} options - 参数对象
  526. *
  527. * @param {Message} options.message - 消息对象
  528. * @param {(result)=>void} [options.success] - 成功回调
  529. * @param {(error)=>void} [options.fail] - 失败回调
  530. *
  531. * @example
  532. * sendMessage({
  533. message: message,
  534. success: (result) => {},
  535. fail: (error) => {}
  536. });
  537. */
  538. sendMessage(options : {
  539. message : Message | Object | undefined,
  540. success ?: (result : any) => void,
  541. fail ?: (error : any) => void
  542. }) : void;
  543. /**
  544. *
  545. * 获取用户信息
  546. *
  547. * @param {Options} options - 参数对象
  548. *
  549. * @param {String} options.userId - 用户ID
  550. * @param {(result)=>void} [options.success] - 成功回调
  551. * @param {(error)=>void} [options.fail] - 失败回调
  552. *
  553. */
  554. getUserInfo(options : {
  555. userId : string,
  556. success ?: (result : any) => void,
  557. fail ?: (error : any) => void
  558. }) : void;
  559. /**
  560. *
  561. * 更新我的用户资料
  562. *
  563. * @param {Options} options - 参数对象
  564. *
  565. * @param {String} options.nickname - 昵称
  566. * @param {String} options.avatarUrl - 头像地址
  567. * @param {Number} options.gender - 性别,0=未知,1=男性,2=女性
  568. * @param {Number} options.mobile - 电话
  569. * @param {String} options.email - 邮箱
  570. * @param {String} options.birthday - 生日
  571. * @param {String} options.motto - 个性签名
  572. * @param {String} options.extend - 用户自定义扩展字段
  573. * @param {Number} options.addFriendType - 好友添加我的方式
  574. * @param {(result)=>void} [options.success] - 成功回调
  575. * @param {(error)=>void} [options.fail] - 失败回调
  576. *
  577. */
  578. updateUserInfo(options : {
  579. nickname ?: string,
  580. avatarUrl ?: string,
  581. gender ?: number,
  582. mobile ?: number,
  583. email ?: string,
  584. birthday ?: string,
  585. motto ?: string,
  586. extend ?: string,
  587. addFriendType ?: YeIMUniSDKDefines.USER.ADDFRIEND,
  588. success ?: (result : any) => void,
  589. fail ?: (error : any) => void
  590. }) : void;
  591. /**
  592. *
  593. * 获取黑名单列表
  594. *
  595. * @param {Options} options - 参数对象
  596. *
  597. * @param {(result)=>void} [options.success] - 成功回调
  598. * @param {(error)=>void} [options.fail] - 失败回调
  599. *
  600. */
  601. getBlackUserList(options : {
  602. success ?: (result : any) => void,
  603. fail ?: (error : any) => void
  604. }) : void;
  605. /**
  606. *
  607. * 添加用户到黑名单
  608. *
  609. *
  610. * @param {Options} options - 参数对象
  611. *
  612. *
  613. * @param {Array<String>} options.members - 用户ID列表
  614. * @param {(result)=>void} [options.success] - 成功回调
  615. * @param {(error)=>void} [options.fail] - 失败回调
  616. *
  617. * @example
  618. * addToBlackUserList({
  619. members: ["user1", "user2"],
  620. success: (result) => {},
  621. fail: (error) => {}
  622. });
  623. */
  624. addToBlackUserList(options : {
  625. members : Array<string>
  626. success ?: (result : any) => void,
  627. fail ?: (error : any) => void
  628. }) : void;
  629. /**
  630. *
  631. * 把用户移出黑名单
  632. *
  633. *
  634. * @param {Options} options - 参数对象
  635. *
  636. *
  637. * @param {Array<String>} options.members - 用户ID列表
  638. * @param {(result)=>void} [options.success] - 成功回调
  639. * @param {(error)=>void} [options.fail] - 失败回调
  640. *
  641. * @example
  642. * removeFromBlacklist({
  643. members: ["user1", "user2"],
  644. success: (result) => {},
  645. fail: (error) => {}
  646. });
  647. */
  648. removeFromBlacklist(options : {
  649. members : Array<string>
  650. success ?: (result : any) => void,
  651. fail ?: (error : any) => void
  652. }) : void;
  653. /**
  654. * 添加IM事件监听器
  655. * @param {Object} event - 事件类型 YeIMUniSDKDefines.EVENT
  656. * @param {(result)=>void} callback 监听回调方法
  657. */
  658. addEventListener(event : string, callback : (result : any) => void);
  659. /**
  660. * 移除IM事件监听器
  661. * @param {Object} event - 事件类型 YeIMUniSDKDefines.EVENT
  662. * @param {(result)=>void} callback 监听回调方法
  663. */
  664. removeEventListener(event : string, callback : (result : any) => void);
  665. /**
  666. *
  667. * 创建群组
  668. *
  669. * @param {Options} options - 参数对象
  670. *
  671. * @param {String} options.name - 群名称
  672. * @param {String} options.avatarUrl - 群头像
  673. * @param {String} [options.groupId] - 群ID,未填写时系统自动生成
  674. * @param {Number} [options.joinMode] - 群申请处理方式 - YeIMUniSDKDefines.GROUP.JOINMODE
  675. * @param {String} [options.introduction] - 群简介
  676. * @param {String} [options.notification] - 群公告
  677. * @param {Array<String>} [options.members] - 创建群聊初始化成员(用户ID数组)
  678. * @param {(result)=>void} [options.success] - 成功回调
  679. * @param {(error)=>void} [options.fail] - 失败回调
  680. *
  681. * @example
  682. * createGroup({
  683. name: "",
  684. avatarUrl: "",
  685. success: (result) => {},
  686. fail: (error) => {}
  687. });
  688. */
  689. createGroup(options : {
  690. name : string,
  691. avatarUrl : string,
  692. groupId ?: string,
  693. joinMode ?: number,
  694. introduction ?: string,
  695. notification ?: string,
  696. members ?: Array<string>,
  697. success ?: (result : any) => void,
  698. fail ?: (error : any) => void
  699. }) : void;
  700. /**
  701. *
  702. * 解散群组
  703. *
  704. * 仅群主可操作
  705. *
  706. * @param {Options} options - 参数对象
  707. *
  708. * @param {String} [options.groupId] - 群ID
  709. * @param {(result)=>void} [options.success] - 成功回调
  710. * @param {(error)=>void} [options.fail] - 失败回调
  711. *
  712. * @example
  713. * dissolveGroup({
  714. groupId: "",
  715. success: (result) => {},
  716. fail: (error) => {}
  717. });
  718. */
  719. dissolveGroup(options : {
  720. groupId : string,
  721. success ?: (result : any) => void,
  722. fail ?: (error : any) => void
  723. }) : void;
  724. /**
  725. *
  726. * 更新群组资料
  727. *
  728. * @param {Options} options - 参数对象
  729. *
  730. * @param {String} [options.groupId] - 群ID
  731. * @param {String} [options.name] - 群名称
  732. * @param {String} [options.avatarUrl] - 群头像
  733. * @param {YeIMUniSDKDefines.GROUP.JOINMODE} [options.joinMode] - 群申请处理方式
  734. * @param {String} [options.introduction] - 群简介
  735. * @param {String} [options.notification] - 群公告
  736. * @param {Number} [options.isMute] - 全体禁言 0,1
  737. * @param {(result)=>void} [options.success] - 成功回调
  738. * @param {(error)=>void} [options.fail] - 失败回调
  739. *
  740. * @example
  741. * updateGroup({
  742. groupId: "",
  743. name: "",
  744. avatarUrl: "",
  745. success: (result) => {},
  746. fail: (error) => {}
  747. });
  748. */
  749. updateGroup(options : {
  750. groupId : string,
  751. name ?: string,
  752. avatarUrl ?: string,
  753. joinMode ?: number,
  754. introduction ?: string,
  755. notification ?: string,
  756. members ?: Array<string>,
  757. success ?: (result : any) => void,
  758. fail ?: (error : any) => void
  759. }) : void;
  760. /**
  761. *
  762. * 通过群ID获取群组资料
  763. *
  764. * @param {Options} options - 参数对象
  765. *
  766. * @param {String} options.groupId - 群ID
  767. * @param {(result)=>void} [options.success] - 成功回调
  768. * @param {(error)=>void} [options.fail] - 失败回调
  769. *
  770. * @example
  771. * getGroup({
  772. groupId: "",
  773. success: (result) => {},
  774. fail: (error) => {}
  775. });
  776. */
  777. getGroup(options : {
  778. groupId : string,
  779. success ?: (result : any) => void,
  780. fail ?: (error : any) => void
  781. }) : void;
  782. /**
  783. *
  784. * 转让群主
  785. *
  786. * 仅群主可操作
  787. *
  788. * @param {Options} options - 参数对象
  789. *
  790. * @param {String} [options.groupId] - 群ID
  791. * @param {String} [options.userId] - 转让用户ID
  792. * @param {(result)=>void} [options.success] - 成功回调
  793. * @param {(error)=>void} [options.fail] - 失败回调
  794. *
  795. * @example
  796. * transferLeader({
  797. groupId: "",
  798. userId: "",
  799. success: (result) => {},
  800. fail: (error) => {}
  801. });
  802. */
  803. transferLeader(options : {
  804. groupId : string,
  805. userId : string,
  806. success ?: (result : any) => void,
  807. fail ?: (error : any) => void
  808. }) : void;
  809. /**
  810. *
  811. * 获取我的群组列表
  812. *
  813. * @param {Options} options - 参数对象
  814. *
  815. * @param {(result)=>void} [options.success] - 成功回调
  816. * @param {(error)=>void} [options.fail] - 失败回调
  817. *
  818. * @example
  819. * getGroupList({
  820. success: (result) => {},
  821. fail: (error) => {}
  822. });
  823. */
  824. getGroupList(options : {
  825. success ?: (result : any) => void,
  826. fail ?: (error : any) => void
  827. }) : void;
  828. /**
  829. *
  830. * 用户申请入群
  831. *
  832. * IM内用户均可调用此接口申请进入传入的群组ID的群,根据群申请处理方式不同,可能直接进入,也可能等待审核
  833. *
  834. * @param {Options} options - 参数对象
  835. *
  836. * @param {String} options.groupId - 群ID
  837. * @param {(result)=>void} [options.success] - 成功回调
  838. * @param {(error)=>void} [options.fail] - 失败回调
  839. *
  840. * @example
  841. * joinGroup({
  842. groupId: "",
  843. success: (result) => {},
  844. fail: (error) => {}
  845. });
  846. */
  847. joinGroup(options : {
  848. groupId : string,
  849. success ?: (result : any) => void,
  850. fail ?: (error : any) => void
  851. }) : void;
  852. /**
  853. *
  854. * 退出群组
  855. *
  856. * @param {Options} options - 参数对象
  857. *
  858. * @param {String} options.groupId - 群ID
  859. * @param {(result)=>void} [options.success] - 成功回调
  860. * @param {(error)=>void} [options.fail] - 失败回调
  861. *
  862. * @example
  863. * leaveGroup({
  864. groupId: "",
  865. success: (result) => {},
  866. fail: (error) => {}
  867. });
  868. */
  869. leaveGroup(options : {
  870. groupId : string,
  871. success ?: (result : any) => void,
  872. fail ?: (error : any) => void
  873. }) : void;
  874. /**
  875. *
  876. * 添加群成员
  877. *
  878. * 不限权限,IM内用户均可调用此接口,但根据群申请处理方式不同,可能直接进入,也可能等待审核
  879. *
  880. * @param {Options} options - 参数对象
  881. *
  882. * @param {String} options.groupId - 群ID
  883. * @param {Array<String>} options.members - 用户ID列表
  884. * @param {(result)=>void} [options.success] - 成功回调
  885. * @param {(error)=>void} [options.fail] - 失败回调
  886. *
  887. * @example
  888. * addGroupUsers({
  889. groupId: "",
  890. members: ["user1", "user2"],
  891. success: (result) => {},
  892. fail: (error) => {}
  893. });
  894. */
  895. addGroupUsers(options : {
  896. groupId : string,
  897. members : Array<string>,
  898. success ?: (result : any) => void,
  899. fail ?: (error : any) => void
  900. }) : void;
  901. /**
  902. *
  903. * 移除群成员
  904. *
  905. * 仅群主可使用此接口
  906. *
  907. * @param {Object} options - 参数对象
  908. *
  909. * @param {String} options.groupId - 群ID
  910. * @param {Array<String>} options.members - 用户ID列表
  911. * @param {(result)=>void} [options.success] - 成功回调
  912. * @param {(error)=>void} [options.fail] - 失败回调
  913. *
  914. * @example
  915. * removeGroupUsers({
  916. groupId: "",
  917. members: ["user1", "user2"],
  918. success: (result) => {},
  919. fail: (error) => {}
  920. });
  921. */
  922. removeGroupUsers(options : {
  923. groupId : string,
  924. members : Array<string>,
  925. success ?: (result : any) => void,
  926. fail ?: (error : any) => void
  927. }) : void;
  928. /**
  929. *
  930. * 设置群管理员
  931. *
  932. * 仅群主可操作此接口
  933. *
  934. * @param {Options} options - 参数对象
  935. *
  936. * @param {String} options.groupId - 群ID
  937. * @param {String} options.userId - 要设置的用户ID
  938. * @param {Number} options.isAdmin - 是否设置管理员,0=取消,1=设置
  939. * @param {(result)=>void} [options.success] - 成功回调
  940. * @param {(error)=>void} [options.fail] - 失败回调
  941. *
  942. * @example
  943. * setAdminstrator({
  944. groupId: "",
  945. userId: "",
  946. isAdmin: 1,
  947. success: (result) => {},
  948. fail: (error) => {}
  949. });
  950. */
  951. setAdminstrator(options : {
  952. groupId : string,
  953. userId : string,
  954. isAdmin : number,
  955. success ?: (result : any) => void,
  956. fail ?: (error : any) => void
  957. }) : void;
  958. /**
  959. *
  960. * 禁言群成员
  961. *
  962. * 群组中群主或管理员可调用此接口禁言群成员,每次设置的分钟数均从操作时间开始算起,设置0则取消禁言
  963. *
  964. * @param {Options} options - 参数对象
  965. *
  966. * @param {String} options.groupId - 群ID
  967. * @param {String} options.userId - 禁言用户ID
  968. * @param {Number} options.time - 禁言分钟数
  969. * @param {(result)=>void} [options.success] - 成功回调
  970. * @param {(error)=>void} [options.fail] - 失败回调
  971. *
  972. * @example
  973. * setMute({
  974. groupId: "group_1",
  975. userId: "user1",
  976. time: 10,
  977. success: (result) => {},
  978. fail: (error) => {}
  979. });
  980. */
  981. setMute(options : {
  982. groupId : string,
  983. userId : string,
  984. time : number,
  985. success ?: (result : any) => void,
  986. fail ?: (error : any) => void
  987. }) : void;
  988. /**
  989. *
  990. * 获取群组用户入群申请列表
  991. *
  992. * 群主或管理员调用此接口可获取名下所有群组入群申请列表
  993. *
  994. * @param {Options} options - 参数对象
  995. *
  996. * @param {(result)=>void} [options.success] - 成功回调
  997. * @param {(error)=>void} [options.fail] - 失败回调
  998. *
  999. * @example
  1000. * getGroupApplyList({
  1001. success: (result) => {},
  1002. fail: (error) => {}
  1003. });
  1004. */
  1005. getGroupApplyList(options : {
  1006. success ?: (result : any) => void,
  1007. fail ?: (error : any) => void
  1008. }) : void;
  1009. /**
  1010. *
  1011. * 处理群组用户入群申请
  1012. *
  1013. * 申请记录所在的群组中群主或管理员可调用此接口处理申请
  1014. *
  1015. * @param {Options} options - 参数对象
  1016. *
  1017. * @param {Number} options.id - 申请记录的ID
  1018. * @param {Number} options.status - 处理结果 YeIMUniSDKDefines.GROUP.APPLYSTATU
  1019. * @param {(result)=>void} [options.success] - 成功回调
  1020. * @param {(error)=>void} [options.fail] - 失败回调
  1021. *
  1022. * @example
  1023. * handleApply({
  1024. id: 5,
  1025. status: YeIMUniSDKDefines.GROUP.APPLYSTATUS.AGREE,
  1026. success: (result) => {},
  1027. fail: (error) => {}
  1028. });
  1029. */
  1030. handleApply(options : {
  1031. id : number,
  1032. status : number
  1033. success ?: (result : any) => void,
  1034. fail ?: (error : any) => void
  1035. }) : void;
  1036. /**
  1037. *
  1038. * 获取群成员列表
  1039. *
  1040. * @param {Options} options - 参数对象
  1041. *
  1042. * @param {String} options.groupId - 群ID
  1043. * @param {(result)=>void} [options.success] - 成功回调
  1044. * @param {(error)=>void} [options.fail] - 失败回调
  1045. *
  1046. * @example
  1047. * getGroupUserList({
  1048. groupId: "group_1",
  1049. success: (result) => {},
  1050. fail: (error) => {}
  1051. });
  1052. */
  1053. getGroupUserList(options : {
  1054. groupId : string,
  1055. success ?: (result : any) => void,
  1056. fail ?: (error : any) => void
  1057. }) : void;
  1058. /**
  1059. *
  1060. * 从云端获取好友列表
  1061. *
  1062. * @param {Options} options - 参数对象
  1063. *
  1064. * @param {Boolean} options.cloud - 是否从云端拉取
  1065. * @param {Number} options.profile - 资料类型,0=简略资料,1=详细资料 (云端拉取有效)
  1066. * @param {Number} options.page - 页码
  1067. * @param {Number} options.limit - 每页数量
  1068. *
  1069. * @param {(result)=>{}} [options.success] - 成功回调
  1070. * @param {(error)=>{}} [options.fail] - 失败回调
  1071. */
  1072. getFriendList(options : {
  1073. cloud ?: boolean,
  1074. profile ?: number,
  1075. page ?: number,
  1076. limit ?: number,
  1077. success ?: (result : any) => void,
  1078. fail ?: (error : any) => void
  1079. }) : void;
  1080. /**
  1081. *
  1082. * 从云端获取好友申请列表
  1083. *
  1084. * @param {Options} options - 参数对象
  1085. *
  1086. * @param {Boolean} options.cloud - 是否从云端拉取
  1087. * @param {Number} options.type - 类型,0=发给我申请,1=我发出去的申请 (云端拉取有效)
  1088. * @param {Number} options.page - 页码
  1089. * @param {Number} options.limit - 每页数量
  1090. *
  1091. * @param {(result)=>{}} [options.success] - 成功回调
  1092. * @param {(error)=>{}} [options.fail] - 失败回调
  1093. */
  1094. getFriendApplyList(options : {
  1095. cloud ?: boolean,
  1096. type ?: number,
  1097. page ?: number,
  1098. limit ?: number,
  1099. success ?: (result : any) => void,
  1100. fail ?: (error : any) => void
  1101. }) : void;
  1102. /**
  1103. *
  1104. * 将全部好友申请设置为已读状态
  1105. *
  1106. * @param {Options} options - 参数对象
  1107. *
  1108. * @param {(result)=>{}} [options.success] - 成功回调
  1109. * @param {(error)=>{}} [options.fail] - 失败回调
  1110. */
  1111. setApplyListRead(options : {
  1112. success ?: (result : any) => void,
  1113. fail ?: (error : any) => void
  1114. }) : void;
  1115. /**
  1116. *
  1117. * 添加好友
  1118. *
  1119. * @param {Options} options - 参数对象
  1120. *
  1121. * @param {String} options.userId - 用户ID
  1122. * @param {String} options.remark - 好友备注
  1123. * @param {String} options.extraMessage - 附言
  1124. *
  1125. * @param {(result)=>{}} [options.success] - 成功回调
  1126. * @param {(error)=>{}} [options.fail] - 失败回调
  1127. */
  1128. addFriend(options : {
  1129. userId : string,
  1130. remark ?: string,
  1131. extraMessage ?: string,
  1132. success ?: (result : any) => void,
  1133. fail ?: (error : any) => void
  1134. }) : void;
  1135. /**
  1136. *
  1137. * 删除好友
  1138. *
  1139. * @param {Options} options - 参数对象
  1140. *
  1141. * @param {Array<String>} options.members - 好友ID列表
  1142. *
  1143. * @param {(result)=>{}} [options.success] - 成功回调
  1144. * @param {(error)=>{}} [options.fail] - 失败回调
  1145. */
  1146. deleteFriend(options : {
  1147. members : Array<string>,
  1148. success ?: (result : any) => void,
  1149. fail ?: (error : any) => void
  1150. }) : void;
  1151. /**
  1152. *
  1153. * 更新好友资料
  1154. *
  1155. * @param {Options} options - 参数对象
  1156. *
  1157. * @param {String} options.userId - 好友ID
  1158. * @param {String} options.remark - 好友备注
  1159. * @param {String} options.extend - 自定义扩展字段
  1160. *
  1161. * @param {(result)=>{}} [options.success] - 成功回调
  1162. * @param {(error)=>{}} [options.fail] - 失败回调
  1163. */
  1164. updateFriend(options : {
  1165. userId : string,
  1166. remark ?: string,
  1167. extend ?: string,
  1168. success ?: (result : any) => void,
  1169. fail ?: (error : any) => void
  1170. }) : void;
  1171. /**
  1172. *
  1173. * 同意好友申请
  1174. *
  1175. * @param {Options} options - 参数对象
  1176. *
  1177. * @param {Number} options.id - 申请ID
  1178. * @param {String} options.remark - 备注
  1179. *
  1180. * @param {(result)=>{}} [options.success] - 成功回调
  1181. * @param {(error)=>{}} [options.fail] - 失败回调
  1182. */
  1183. acceptApply(options : {
  1184. id : number,
  1185. remark ?: string,
  1186. success ?: (result : any) => void,
  1187. fail ?: (error : any) => void
  1188. }) : void;
  1189. /**
  1190. *
  1191. * 拒绝好友申请
  1192. *
  1193. * @param {Options} options - 参数对象
  1194. *
  1195. * @param {Number} options.id - 申请ID
  1196. *
  1197. * @param {(result)=>{}} [options.success] - 成功回调
  1198. * @param {(error)=>{}} [options.fail] - 失败回调
  1199. */
  1200. refuseApply(options : {
  1201. id : number,
  1202. success ?: (result : any) => void,
  1203. fail ?: (error : any) => void
  1204. }) : void;
  1205. /**
  1206. * 断开连接,此操作不会重连
  1207. */
  1208. disConnect() : void;
  1209. /**
  1210. * 获取当前连接状态
  1211. *
  1212. * 0:连接中 1:连接已打开 2:连接关闭中 3:连接已关闭
  1213. * @returns {number}
  1214. */
  1215. readyState() : number;
  1216. /**
  1217. * 设置APP在前台
  1218. */
  1219. intoApp() : void;
  1220. /**
  1221. * 设置APP已进入后台
  1222. */
  1223. leaveApp() : void;
  1224. }
  1225. interface Message {
  1226. }
  1227. interface Conversation {
  1228. }
  1229. /**
  1230. * YeIMUniSDK预定义常量
  1231. */
  1232. declare const YeIMUniSDKDefines = {
  1233. /**
  1234. * 事件类型
  1235. */
  1236. EVENT: {
  1237. /**
  1238. * 网络状态变化
  1239. */
  1240. NET_CHANGED,
  1241. /**
  1242. * 会话列表变化
  1243. */
  1244. CONVERSATION_LIST_CHANGED,
  1245. /**
  1246. * 收到消息
  1247. */
  1248. MESSAGE_RECEIVED,
  1249. /**
  1250. * 撤回消息
  1251. */
  1252. MESSAGE_REVOKED,
  1253. /**
  1254. * 私聊会话已读回执
  1255. */
  1256. PRIVATE_READ_RECEIPT,
  1257. /**
  1258. * 用户被踢下线
  1259. */
  1260. KICKED_OUT
  1261. },
  1262. /**
  1263. * 会话类型
  1264. */
  1265. CONVERSATION_TYPE: {
  1266. /**
  1267. * 私聊
  1268. */
  1269. PRIVATE,
  1270. /**
  1271. * 群聊
  1272. */
  1273. GROUP
  1274. },
  1275. /**
  1276. * 消息类型
  1277. */
  1278. MESSAGE_TYPE: {
  1279. /**
  1280. * 文本消息
  1281. */
  1282. TEXT,
  1283. /**
  1284. * 文本 @ 消息
  1285. */
  1286. TEXT_AT,
  1287. /**
  1288. * 图片消息
  1289. */
  1290. IMAGE,
  1291. /**
  1292. * 语音消息
  1293. */
  1294. AUDIO,
  1295. /**
  1296. * 小视频消息
  1297. */
  1298. VIDEO,
  1299. /**
  1300. * 位置消息
  1301. */
  1302. LOCATION,
  1303. /**
  1304. * 自定义消息
  1305. */
  1306. CUSTOM,
  1307. /**
  1308. * 合并消息
  1309. */
  1310. MERGER,
  1311. /**
  1312. * 转发消息
  1313. */
  1314. FORWARD,
  1315. /**
  1316. * 群聊系统通知
  1317. */
  1318. GROUP_SYS_NOTICE
  1319. },
  1320. /**
  1321. * 用户相关常量
  1322. */
  1323. USER: {
  1324. /**
  1325. * 加好友验证方式
  1326. */
  1327. ADDFRIEND: {
  1328. /**
  1329. * 允许任何人添加自己为好友
  1330. */
  1331. ALLOW,
  1332. /**
  1333. * 需要经过自己确认才能添加自己为好友
  1334. */
  1335. CONFIRM,
  1336. /**
  1337. * 拒绝加好友
  1338. */
  1339. DENY
  1340. }
  1341. },
  1342. /**
  1343. * 群组相关常量
  1344. */
  1345. GROUP: {
  1346. /**
  1347. * 群申请处理方式
  1348. */
  1349. JOINMODE: {
  1350. /**
  1351. * 自有加入,不需要申请和审核,不需要被邀请人允许。
  1352. */
  1353. FREE,
  1354. /**
  1355. * 验证加入,需要申请,以及群主或管理员的同意才能入群
  1356. */
  1357. CHECK,
  1358. /**
  1359. * 禁止加入
  1360. */
  1361. FORBIDDEN
  1362. },
  1363. /**
  1364. * 入群申请处理结果
  1365. */
  1366. APPLYSTATUS: {
  1367. /**
  1368. * 待处理
  1369. */
  1370. PENDING,
  1371. /**
  1372. * 同意
  1373. */
  1374. AGREE,
  1375. /**
  1376. * 拒绝
  1377. */
  1378. REFUSE
  1379. }
  1380. },
  1381. }
  1382. }