NIMSDK-AOS  9.15.0
MsgService.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.msg;
2 
3 import android.util.Pair;
4 
5 import com.netease.nimlib.NimNosSceneKeyConstant;
6 import com.netease.nimlib.apt.annotation.NIMService;
7 import com.netease.nimlib.notifier.support26.annotation.NonNull;
50 
51 import java.util.ArrayList;
52 import java.util.List;
53 import java.util.Map;
54 import java.util.Set;
55 
59 @NIMService("消息服务")
60 public interface MsgService {
61 
68  String MSG_CHATTING_ACCOUNT_ALL = "all";
69 
76  String MSG_CHATTING_ACCOUNT_NONE = null;
77 
90  InvocationFuture<Void> sendMessage(IMMessage msg, boolean resend);
91 
106  InvocationFuture<Void> replyMessage(IMMessage msg, IMMessage replyMsg, boolean resend);
107 
108 
119  AbortableFuture<FileAttachment> sendFile(FileAttachment attachment);
120 
130  InvocationFuture<Void> insertLocalMessage(IMMessage msg, String fromAccount);
131 
141  InvocationFuture<Void> saveMessageToLocal(IMMessage msg, boolean notify);
142 
153  InvocationFuture<Void> saveMessageToLocalEx(IMMessage msg, boolean notify, long time);
154 
165  AbortableFuture<Void> downloadAttachment(IMMessage msg, boolean thumb);
166 
173  List<IMMessage> queryMessageListByUuidBlock(List<String> uuids);
174 
181  InvocationFuture<List<IMMessage>> queryMessageListByUuid(List<String> uuids);
182 
189  List<IMMessage> queryMessageListByServerIdBlock(List<String> serverIds);
190 
199  InvocationFuture<List<IMMessage>> queryMessageListByType(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit);
200 
209  InvocationFuture<List<IMMessage>> queryMessageListByType(MsgTypeEnum msgTypeEnum, Long maxTime,
210  int limit);
211 
221  List<IMMessage> queryMessageListBySubtypeBlock(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit, int subtype);
222 
231  InvocationFuture<List<IMMessage>> queryMessageListBySubtype(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit, int subtype);
232 
245  InvocationFuture<List<IMMessage>> queryMessageList(String account, SessionTypeEnum sessionType, long offset,
246  int limit);
247 
258  InvocationFuture<List<IMMessage>> queryMessageListEx(IMMessage anchor, QueryDirectionEnum direction, int limit,
259  boolean asc);
260 
270  List<IMMessage> queryMessageListExBlock(IMMessage anchor, QueryDirectionEnum direction, int limit,
271  boolean asc);
272 
282  InvocationFuture<List<IMMessage>> queryMessageListExTime(IMMessage anchor, long toTime,
283  QueryDirectionEnum direction, int limit);
284 
297  @Deprecated
298  InvocationFuture<List<IMMessage>> queryMessageListByTypes(List<MsgTypeEnum> types, IMMessage anchor, long toTime,
299  QueryDirectionEnum direction, int limit, boolean asc);
300 
312  InvocationFuture<List<IMMessage>> queryMessageListByTypesV2(List<MsgTypeEnum> types, IMMessage anchor, long toTime,
313  QueryDirectionEnum direction, int limit, boolean asc);
314 
322  InvocationFuture<Long> queryRoamMsgHasMoreTime(String sessionId, SessionTypeEnum sessionType);
323 
331  long queryRoamMsgHasMoreTimeBlock(String sessionId, SessionTypeEnum sessionType);
332 
340  InvocationFuture<Long> queryRoamMsgHasMoreTagServerId(String sessionId, SessionTypeEnum sessionType);
341 
342 
350  long queryRoamMsgHasMoreTagServerIdBlock(String sessionId, SessionTypeEnum sessionType);
351 
359  InvocationFuture<List<IMMessage>> pullHistoryById(List<MessageKey> msgKeyList, boolean persist);
360 
368  IMMessage queryLastMessage(String account, SessionTypeEnum sessionType);
369 
378  InvocationFuture<List<IMMessage>> pullMessageHistory(IMMessage anchor, int limit, boolean persist);
379 
380 
391  InvocationFuture<List<IMMessage>> pullMessageHistory(IMMessage anchor, int limit, boolean persist, boolean persistClear);
392 
404  InvocationFuture<List<IMMessage>> pullMessageHistoryEx(IMMessage anchor, long toTime, int limit,
405  QueryDirectionEnum direction, boolean persist);
406 
418  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
419  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes);
420 
433  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
434  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist);
435 
449  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
450  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist,
451  boolean persistClear);
452 
467  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
468  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist,
469  boolean persistClear, IMMessageFilter customFilter);
470 
486  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
487  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist,
488  boolean persistClear, IMMessageFilter customFilter, boolean updateUnread);
489 
500 
510  InvocationFuture<List<IMMessage>> pullMessageHistoryOrderByTime(
512 
524 
542  InvocationFuture<List<IMMessage>> searchMessageHistory(String keyword, List<String> fromAccounts, IMMessage anchor,
543  int limit);
544 
545 
564  InvocationFuture<List<IMMessage>> searchMessageHistory(String keyword, List<String> fromAccounts,
565  IMMessage anchor, QueryDirectionEnum direction, int limit);
566 
582  InvocationFuture<List<IMMessage>> searchAllMessageHistory(String keyword, List<String> fromAccounts, long time,
583  int limit);
584 
593  InvocationFuture<List<IMMessage>> searchMessage(SessionTypeEnum sessionType, String sessionId, MsgSearchOption option);
594 
601  InvocationFuture<List<IMMessage>> searchAllMessage(MsgSearchOption option);
602 
603 
604 
605 
613  InvocationFuture<List<MsgIndexRecord>> searchAllSession(String query, int limit);
614 
622  List<MsgIndexRecord> searchAllSessionBlock(String query, int limit);
623 
632  InvocationFuture<List<MsgIndexRecord>> searchSession(String query, SessionTypeEnum sessionType, String sessionId);
633 
642  List<MsgIndexRecord> searchSessionBlock(String query, SessionTypeEnum sessionType, String sessionId);
643 
650  void deleteChattingHistory(IMMessage message);
651 
658  void deleteChattingHistory(IMMessage message, boolean ignore);
659 
666  void deleteChattingHistory(List<IMMessage> msgList, boolean ignore);
667 
674  void clearChattingHistory(String account, SessionTypeEnum sessionType);
675 
683  void clearChattingHistory(String account, SessionTypeEnum sessionType, boolean ignore);
684 
692  InvocationFuture<Void> clearMsgDatabase(boolean clearRecent);
693 
702  InvocationFuture<Long> deleteMsgSelf(IMMessage msg, String ext);
703 
711  InvocationFuture<Long> deleteMsgSelf(List<IMMessage> msgList, String ext);
712 
719  boolean everBeenDeleted(IMMessage message);
720 
731  void setChattingAccount(String account, SessionTypeEnum sessionType);
732 
738  int getTotalUnreadCount();
739 
746  int getTotalUnreadCount(boolean notify);
747 
754  int getUnreadCountBySessionType(SessionTypeEnum sessionType);
755 
763  InvocationFuture<List<IMMessage>> queryUnreadMessageList(String sessionId,SessionTypeEnum sessionType);
770  List<IMMessage> queryUnreadMessageListBlock(String sessionId,SessionTypeEnum sessionType);
771 
780  InvocationFuture<Void> clearUnreadCount(String account, SessionTypeEnum sessionType);
781 
790  InvocationFuture<List<SessionAckInfo>> clearUnreadCount(List<Pair<String, SessionTypeEnum>> sessionKeyList);
791 
799  InvocationFuture<List<SessionAckInfo>> clearUnreadCount(SessionTypeEnum sessionType);
800 
801 
806  void clearAllUnreadCount();
807 
815  InvocationFuture<Void> sendMessageReceipt(String sessionId, IMMessage message);
816 
827  void updateIMMessageStatus(IMMessage message);
828 
834  void updateIMMessage(IMMessage message);
835 
847  void registerCustomAttachmentParser(MsgAttachmentParser customParser);
848 
856  InvocationFuture<Void> sendCustomNotification(CustomNotification notification);
857 
863  InvocationFuture<List<RecentContact>> queryRecentContacts();
864 
870  List<RecentContact> queryRecentContactsBlock();
871 
881  InvocationFuture<List<RecentContact>> queryRecentContacts(int limit);
882 
883 
895  InvocationFuture<List<RecentContact>> queryRecentContacts(RecentContact anchor,QueryDirectionEnum direction,int limit);
896 
903  List<RecentContact> queryRecentContactsBlock(int limit);
904 
916  List<RecentContact> queryRecentContactsBlock(RecentContact anchor,QueryDirectionEnum direction,int limit);
917 
918 
925  InvocationFuture<List<RecentContact>> queryRecentContacts(MsgTypeEnum filterMsgType);
926 
933  List<RecentContact> queryRecentContactsBlock(MsgTypeEnum filterMsgType);
934 
935 
942  InvocationFuture<List<RecentContact>> queryRecentContacts(Set<MsgTypeEnum> filterMsgTypeSet);
943 
950  List<RecentContact> queryRecentContactsBlock(Set<MsgTypeEnum> filterMsgTypeSet);
951 
958  void updateRecent(RecentContact recent);
959 
960 
967  void updateRecentAndNotify(RecentContact recent);
968 
969 
976  void updateRecentByMessage(IMMessage message, boolean needNotify);
977 
978 
984  void updateRoamMsgHasMoreTag(IMMessage newTag);
985 
992  void deleteRecentContact(RecentContact recent);
993 
1001  void deleteRecentContact2(String account, SessionTypeEnum sessionType);
1002 
1011  InvocationFuture<Void> deleteRoamingRecentContact(String contactId, SessionTypeEnum sessionTypeEnum);
1012 
1023  InvocationFuture<Void> deleteRecentContact(String account, SessionTypeEnum sessionType, DeleteTypeEnum deleteType, boolean sendAck);
1024 
1031  void deleteRoamMsgHasMoreTag(String sessionId, SessionTypeEnum sessionType);
1032 
1041  AbortableFuture<String> transVoiceToText(String voiceUrl, String path, long duration);
1042 
1052  AbortableFuture<String> transVoiceToTextAtScene(String voiceUrl, String path, long duration, String sceneKey);
1053 
1054 
1065  AbortableFuture<String> transVoiceToTextEnableForce(String voiceUrl, String path, long duration, String sceneKey,
1066  boolean enableForceUploadFile);
1067 
1079  InvocationFuture<ArrayList<IMMessage>> searchRoamingMsg(String otherAccid, long fromTime, long endTime, String keyword, int limit, boolean reverse);
1080 
1087  void registerIMMessageFilter(IMMessageFilter filter);
1088 
1095  void registerShouldShowNotificationWhenRevokeFilter(ShowNotificationWhenRevokeFilter filter);
1096 
1104  InvocationFuture<Void> revokeMessage(IMMessage message);
1105 
1106 
1115  InvocationFuture<Void> revokeMessageEx(IMMessage message, String customApnsText, Map<String, Object> pushPayload);
1116 
1117 
1127  InvocationFuture<Void> revokeMessage(IMMessage message, String customApnsText,
1128  Map<String, Object> pushPayload, boolean shouldNotifyBeCount);
1129 
1140  InvocationFuture<Void> revokeMessage(IMMessage message, String customApnsText,
1141  Map<String, Object> pushPayload, boolean shouldNotifyBeCount,
1142  String postscript);
1143 
1155  InvocationFuture<Void> revokeMessage(IMMessage message, String customApnsText,
1156  Map<String, Object> pushPayload, boolean shouldNotifyBeCount,
1157  String postscript, String attach);
1158 
1165  InvocationFuture<Void> importRecentSessions(List<Pair<String, SessionTypeEnum>> sessions);
1166 
1167 
1175  LocalAntiSpamResult checkLocalAntiSpam(String content, String replacement);
1176 
1190  RecentContact createEmptyRecentContact(String contactId, SessionTypeEnum sessionType, long tag, long time,
1191  boolean saveToDB);
1192 
1206  RecentContact createEmptyRecentContact(String contactId, SessionTypeEnum sessionType, long tag, long time,
1207  boolean saveToDB, boolean withLastMsg);
1208 
1209 
1217  RecentContact queryRecentContact(String contactId, SessionTypeEnum sessionType);
1218 
1219 
1230  InvocationFuture<Void> cancelUploadAttachment(IMMessage imMessage);
1231 
1232 
1253  AbortableFuture<Void> exportAllMessage(IMsgExportProcessor exportProcessor, boolean safeMode);
1254 
1255 
1278  AbortableFuture<Void> importAllMessage(IMsgImportProcessor iMsgImportProcessor, boolean safeMode);
1279 
1286  void clearServerHistory(String sessionId, boolean deleteRoam);
1287 
1288 
1295  void clearServerHistory(String sessionId, SessionTypeEnum sessionType);
1296 
1307  void clearServerHistory(String sessionId, SessionTypeEnum sessionType, boolean deleteRoam);
1308 
1317  void clearServerHistory(String sessionId, SessionTypeEnum sessionType, boolean sync, String ext);
1318 
1319 
1328  void deleteRangeHistory(String account, SessionTypeEnum sessionType, long startTime, long endTime);
1329 
1343  InvocationFuture<RecentSessionList> queryMySessionList(long minTimestamp, Long maxTimestamp, Integer needLastMsg, Integer limit, Integer hasMore);
1344 
1351  InvocationFuture<RecentSessionList> queryMySessionList(QueryMySessionOption option);
1352 
1360  InvocationFuture<RecentSession> queryMySession(@NonNull String sessionId);
1361 
1370  InvocationFuture<Void> updateMySession(@NonNull String sessionId, @NonNull String ext);
1371 
1379  InvocationFuture<Void> deleteMySession(@NonNull String[] sessionIdArr);
1380 
1392  InvocationFuture<ThreadTalkHistory> queryThreadTalkHistory(IMMessage anchor, long fromTime, long toTime,
1393  int limit, QueryDirectionEnum direction, boolean persist);
1394 
1402  InvocationFuture<ThreadTalkHistory> queryThreadTalkHistory(MessageKey threadMessageKey, QueryThreadTalkHistoryOption option);
1403 
1413  int queryReplyCountInThreadTalkBlock(IMMessage msg);
1414 
1423  InvocationFuture<Void> addQuickComment(IMMessage msg, long replyType, String ext);
1424 
1438  InvocationFuture<Long> addQuickComment(IMMessage msg, long replyType, String ext, boolean needPush,
1439  boolean needBadge, String pushTitle, String pushContent,
1440  Map<String, Object> pushPayload);
1441 
1450  InvocationFuture<Void> removeQuickComment(IMMessage msg, long replyType, String ext);
1451 
1465  InvocationFuture<Long> removeQuickComment(IMMessage msg, long replyType, String ext, boolean needPush,
1466  boolean needBadge, String pushTitle, String pushContent,
1467  Map<String, Object> pushPayload);
1474  InvocationFuture<List<QuickCommentOptionWrapper>> queryQuickComment(List<IMMessage> msgList);
1475 
1485  InvocationFuture<CollectInfo> addCollect(int type, String date, String ext, String uniqueId);
1486 
1493  InvocationFuture<Integer> removeCollect(List<Pair<Long, Long>> collectInfo);
1494 
1502  InvocationFuture<CollectInfo> updateCollect(CollectInfo info, String ext);
1503 
1512  InvocationFuture<CollectInfo> updateCollect(long infoId, long createTime, String ext);
1513 
1520  InvocationFuture<CollectInfoPage> queryCollect(int limit);
1521 
1531  InvocationFuture<CollectInfoPage> queryCollect(CollectInfo anchor, long toTime, int limit, QueryDirectionEnum direction);
1532 
1544  InvocationFuture<CollectInfoPage> queryCollect(CollectInfo anchor, long toTime, int limit, QueryDirectionEnum direction, int type, boolean persist);
1545 
1553  InvocationFuture<Long> addMsgPin(IMMessage msg, String ext);
1554 
1562  InvocationFuture<Long> updateMsgPin(IMMessage msg, String ext);
1563 
1571  InvocationFuture<Long> removeMsgPin(IMMessage msg, String ext);
1572 
1581  InvocationFuture<MsgPinSyncResponseOptionWrapper> syncMsgPin(SessionTypeEnum sessionType, String sessionId, long timestamp);
1582 
1590  List<MsgPinDbOption> queryMsgPinBlock(String sessionId, SessionTypeEnum sessionType);
1591 
1600  InvocationFuture<StickTopSessionInfo> addStickTopSession(String sessionId, SessionTypeEnum sessionType, String ext);
1601 
1610  InvocationFuture<Void> removeStickTopSession(String sessionId, SessionTypeEnum sessionType, String ext);
1611 
1620  InvocationFuture<StickTopSessionInfo> updateStickTopSession(String sessionId, SessionTypeEnum sessionType, String ext);
1621 
1627  List<StickTopSessionInfo> queryStickTopSessionBlock();
1628 
1629 
1637  boolean isStickTopSession(String sessionId, SessionTypeEnum sessionType);
1638 
1647  void migrateMessages(String from, String to, boolean changeFrom);
1648 }
带有文件的附件类型的基类 描述文件的相关信息
聊天消息全文检索结果记录
可中断操作的调用跟踪接口。
历史消息牵移时导出时自定义处理器,导出时参考IMsgExportProcessor
NIM消息实体数据结构。 第三方APP不要调用设置类接口,调用之后不会被持久化
Definition: IMMessage.java:10
消息本身发送/接收状态,附件状态见AttachStatusEnum
历史消息牵移时导出时自定义处理器
SDK 核心接口类,用于初始化 SDK,获取各个服务能力接口,获取当前状态等功能。
Definition: NIMClient.java:19
查询服务端 Thread 历史消息接口的分页参数
消息的关键信息,通过这些信息可以从服务端查询到该消息的完整部分
Definition: MessageKey.java:17
云信消息服务接口类,提供消息发送、消息查询、历史消息、消息扩展功能、获取未读数、已读回执、会话列表等...
Definition: MsgService.java:60
SDK nos token场景配置,不配置的话,走默认值,默认值只有以下3种场景:
自定义通知。 区别于IMMessage,SDK仅透传该类型消息,不负责解析和存储。消息内容由第三方APP自由扩展。 ...
请求Thread聊天里的消息列表得到的信息