NIMSDK-AOS  10.5.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;
49 
50 import java.util.ArrayList;
51 import java.util.List;
52 import java.util.Map;
53 import java.util.Set;
54 
58 @NIMService("消息服务")
59 public interface MsgService {
60 
67  String MSG_CHATTING_ACCOUNT_ALL = "all";
68 
75  String MSG_CHATTING_ACCOUNT_NONE = null;
76 
89  InvocationFuture<Void> sendMessage(IMMessage msg, boolean resend);
90 
105  InvocationFuture<Void> replyMessage(IMMessage msg, IMMessage replyMsg, boolean resend);
106 
107 
118  AbortableFuture<FileAttachment> sendFile(FileAttachment attachment);
119 
129  InvocationFuture<Void> insertLocalMessage(IMMessage msg, String fromAccount);
130 
140  InvocationFuture<Void> saveMessageToLocal(IMMessage msg, boolean notify);
141 
152  InvocationFuture<Void> saveMessageToLocalEx(IMMessage msg, boolean notify, long time);
153 
164  AbortableFuture<Void> downloadAttachment(IMMessage msg, boolean thumb);
165 
172  List<IMMessage> queryMessageListByUuidBlock(List<String> uuids);
173 
180  InvocationFuture<List<IMMessage>> queryMessageListByUuid(List<String> uuids);
181 
188  List<IMMessage> queryMessageListByServerIdBlock(List<String> serverIds);
189 
198  InvocationFuture<List<IMMessage>> queryMessageListByType(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit);
199 
208  InvocationFuture<List<IMMessage>> queryMessageListByType(MsgTypeEnum msgTypeEnum, Long maxTime,
209  int limit);
210 
220  List<IMMessage> queryMessageListBySubtypeBlock(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit, int subtype);
221 
230  InvocationFuture<List<IMMessage>> queryMessageListBySubtype(MsgTypeEnum msgTypeEnum, IMMessage anchor, int limit, int subtype);
231 
244  InvocationFuture<List<IMMessage>> queryMessageList(String account, SessionTypeEnum sessionType, long offset,
245  int limit);
246 
257  InvocationFuture<List<IMMessage>> queryMessageListEx(IMMessage anchor, QueryDirectionEnum direction, int limit,
258  boolean asc);
259 
269  List<IMMessage> queryMessageListExBlock(IMMessage anchor, QueryDirectionEnum direction, int limit,
270  boolean asc);
271 
281  InvocationFuture<List<IMMessage>> queryMessageListExTime(IMMessage anchor, long toTime,
282  QueryDirectionEnum direction, int limit);
283 
296  @Deprecated
297  InvocationFuture<List<IMMessage>> queryMessageListByTypes(List<MsgTypeEnum> types, IMMessage anchor, long toTime,
298  QueryDirectionEnum direction, int limit, boolean asc);
299 
311  InvocationFuture<List<IMMessage>> queryMessageListByTypesV2(List<MsgTypeEnum> types, IMMessage anchor, long toTime,
312  QueryDirectionEnum direction, int limit, boolean asc);
313 
321  InvocationFuture<Long> queryRoamMsgHasMoreTime(String sessionId, SessionTypeEnum sessionType);
322 
330  long queryRoamMsgHasMoreTimeBlock(String sessionId, SessionTypeEnum sessionType);
331 
339  InvocationFuture<Long> queryRoamMsgHasMoreTagServerId(String sessionId, SessionTypeEnum sessionType);
340 
341 
349  long queryRoamMsgHasMoreTagServerIdBlock(String sessionId, SessionTypeEnum sessionType);
350 
358  InvocationFuture<List<IMMessage>> pullHistoryById(List<MessageKey> msgKeyList, boolean persist);
359 
367  IMMessage queryLastMessage(String account, SessionTypeEnum sessionType);
368 
377  InvocationFuture<List<IMMessage>> pullMessageHistory(IMMessage anchor, int limit, boolean persist);
378 
379 
390  InvocationFuture<List<IMMessage>> pullMessageHistory(IMMessage anchor, int limit, boolean persist, boolean persistClear);
391 
403  InvocationFuture<List<IMMessage>> pullMessageHistoryEx(IMMessage anchor, long toTime, int limit,
404  QueryDirectionEnum direction, boolean persist);
405 
417  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
418  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes);
419 
432  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
433  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist);
434 
448  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
449  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist,
450  boolean persistClear);
451 
466  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
467  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist,
468  boolean persistClear, IMMessageFilter customFilter);
469 
485  InvocationFuture<List<IMMessage>> pullMessageHistoryExType(IMMessage anchor, long toTime, int limit,
486  QueryDirectionEnum direction, MsgTypeEnum[] msgTypes, boolean persist,
487  boolean persistClear, IMMessageFilter customFilter, boolean updateUnread);
488 
499 
509  InvocationFuture<List<IMMessage>> pullMessageHistoryOrderByTime(
511 
523 
541  InvocationFuture<List<IMMessage>> searchMessageHistory(String keyword, List<String> fromAccounts, IMMessage anchor,
542  int limit);
543 
544 
563  InvocationFuture<List<IMMessage>> searchMessageHistory(String keyword, List<String> fromAccounts,
564  IMMessage anchor, QueryDirectionEnum direction, int limit);
565 
581  InvocationFuture<List<IMMessage>> searchAllMessageHistory(String keyword, List<String> fromAccounts, long time,
582  int limit);
583 
592  InvocationFuture<List<IMMessage>> searchMessage(SessionTypeEnum sessionType, String sessionId, MsgSearchOption option);
593 
600  InvocationFuture<List<IMMessage>> searchAllMessage(MsgSearchOption option);
601 
602 
603 
604 
612  InvocationFuture<List<MsgIndexRecord>> searchAllSession(String query, int limit);
613 
621  List<MsgIndexRecord> searchAllSessionBlock(String query, int limit);
622 
631  InvocationFuture<List<MsgIndexRecord>> searchSession(String query, SessionTypeEnum sessionType, String sessionId);
632 
641  List<MsgIndexRecord> searchSessionBlock(String query, SessionTypeEnum sessionType, String sessionId);
642 
649  void deleteChattingHistory(IMMessage message);
650 
657  void deleteChattingHistory(IMMessage message, boolean ignore);
658 
665  void deleteChattingHistory(List<IMMessage> msgList, boolean ignore);
666 
673  void clearChattingHistory(String account, SessionTypeEnum sessionType);
674 
682  void clearChattingHistory(String account, SessionTypeEnum sessionType, boolean ignore);
683 
691  InvocationFuture<Void> clearMsgDatabase(boolean clearRecent);
692 
701  InvocationFuture<Long> deleteMsgSelf(IMMessage msg, String ext);
702 
710  InvocationFuture<Long> deleteMsgSelf(List<IMMessage> msgList, String ext);
711 
718  boolean everBeenDeleted(IMMessage message);
719 
730  void setChattingAccount(String account, SessionTypeEnum sessionType);
731 
737  int getTotalUnreadCount();
738 
745  int getTotalUnreadCount(boolean notify);
746 
753  int getUnreadCountBySessionType(SessionTypeEnum sessionType);
754 
762  InvocationFuture<List<IMMessage>> queryUnreadMessageList(String sessionId,SessionTypeEnum sessionType);
769  List<IMMessage> queryUnreadMessageListBlock(String sessionId,SessionTypeEnum sessionType);
770 
779  InvocationFuture<Void> clearUnreadCount(String account, SessionTypeEnum sessionType);
780 
789  InvocationFuture<List<SessionAckInfo>> clearUnreadCount(List<Pair<String, SessionTypeEnum>> sessionKeyList);
790 
798  InvocationFuture<List<SessionAckInfo>> clearUnreadCount(SessionTypeEnum sessionType);
799 
800 
805  void clearAllUnreadCount();
806 
814  InvocationFuture<Void> sendMessageReceipt(String sessionId, IMMessage message);
815 
826  void updateIMMessageStatus(IMMessage message);
827 
833  void updateIMMessage(IMMessage message);
834 
846  void registerCustomAttachmentParser(MsgAttachmentParser customParser);
847 
855  InvocationFuture<Void> sendCustomNotification(CustomNotification notification);
856 
862  InvocationFuture<List<RecentContact>> queryRecentContacts();
863 
869  List<RecentContact> queryRecentContactsBlock();
870 
880  InvocationFuture<List<RecentContact>> queryRecentContacts(int limit);
881 
882 
894  InvocationFuture<List<RecentContact>> queryRecentContacts(RecentContact anchor,QueryDirectionEnum direction,int limit);
895 
902  List<RecentContact> queryRecentContactsBlock(int limit);
903 
915  List<RecentContact> queryRecentContactsBlock(RecentContact anchor,QueryDirectionEnum direction,int limit);
916 
917 
924  InvocationFuture<List<RecentContact>> queryRecentContacts(MsgTypeEnum filterMsgType);
925 
932  List<RecentContact> queryRecentContactsBlock(MsgTypeEnum filterMsgType);
933 
934 
941  InvocationFuture<List<RecentContact>> queryRecentContacts(Set<MsgTypeEnum> filterMsgTypeSet);
942 
949  List<RecentContact> queryRecentContactsBlock(Set<MsgTypeEnum> filterMsgTypeSet);
950 
957  void updateRecent(RecentContact recent);
958 
959 
966  void updateRecentAndNotify(RecentContact recent);
967 
968 
975  void updateRecentByMessage(IMMessage message, boolean needNotify);
976 
977 
983  void updateRoamMsgHasMoreTag(IMMessage newTag);
984 
991  void deleteRecentContact(RecentContact recent);
992 
1000  void deleteRecentContact2(String account, SessionTypeEnum sessionType);
1001 
1010  InvocationFuture<Void> deleteRoamingRecentContact(String contactId, SessionTypeEnum sessionTypeEnum);
1011 
1022  InvocationFuture<Void> deleteRecentContact(String account, SessionTypeEnum sessionType, DeleteTypeEnum deleteType, boolean sendAck);
1023 
1030  void deleteRoamMsgHasMoreTag(String sessionId, SessionTypeEnum sessionType);
1031 
1040  AbortableFuture<String> transVoiceToText(String voiceUrl, String path, long duration);
1041 
1051  AbortableFuture<String> transVoiceToTextAtScene(String voiceUrl, String path, long duration, String sceneKey);
1052 
1053 
1064  AbortableFuture<String> transVoiceToTextEnableForce(String voiceUrl, String path, long duration, String sceneKey,
1065  boolean enableForceUploadFile);
1066 
1078  InvocationFuture<ArrayList<IMMessage>> searchRoamingMsg(String otherAccid, long fromTime, long endTime, String keyword, int limit, boolean reverse);
1079 
1086  void registerIMMessageFilter(IMMessageFilter filter);
1087 
1094  void registerShouldShowNotificationWhenRevokeFilter(ShowNotificationWhenRevokeFilter filter);
1095 
1103  InvocationFuture<Void> revokeMessage(IMMessage message);
1104 
1105 
1114  InvocationFuture<Void> revokeMessageEx(IMMessage message, String customApnsText, Map<String, Object> pushPayload);
1115 
1116 
1126  InvocationFuture<Void> revokeMessage(IMMessage message, String customApnsText,
1127  Map<String, Object> pushPayload, boolean shouldNotifyBeCount);
1128 
1139  InvocationFuture<Void> revokeMessage(IMMessage message, String customApnsText,
1140  Map<String, Object> pushPayload, boolean shouldNotifyBeCount,
1141  String postscript);
1142 
1154  InvocationFuture<Void> revokeMessage(IMMessage message, String customApnsText,
1155  Map<String, Object> pushPayload, boolean shouldNotifyBeCount,
1156  String postscript, String attach);
1157 
1164  InvocationFuture<Void> importRecentSessions(List<Pair<String, SessionTypeEnum>> sessions);
1165 
1166 
1174  LocalAntiSpamResult checkLocalAntiSpam(String content, String replacement);
1175 
1189  RecentContact createEmptyRecentContact(String contactId, SessionTypeEnum sessionType, long tag, long time,
1190  boolean saveToDB);
1191 
1205  RecentContact createEmptyRecentContact(String contactId, SessionTypeEnum sessionType, long tag, long time,
1206  boolean saveToDB, boolean withLastMsg);
1207 
1208 
1216  RecentContact queryRecentContact(String contactId, SessionTypeEnum sessionType);
1217 
1218 
1229  InvocationFuture<Void> cancelUploadAttachment(IMMessage imMessage);
1230 
1231 
1252  AbortableFuture<Void> exportAllMessage(IMsgExportProcessor exportProcessor, boolean safeMode);
1253 
1254 
1277  AbortableFuture<Void> importAllMessage(IMsgImportProcessor iMsgImportProcessor, boolean safeMode);
1278 
1285  void clearServerHistory(String sessionId, boolean deleteRoam);
1286 
1287 
1294  void clearServerHistory(String sessionId, SessionTypeEnum sessionType);
1295 
1306  void clearServerHistory(String sessionId, SessionTypeEnum sessionType, boolean deleteRoam);
1307 
1316  void clearServerHistory(String sessionId, SessionTypeEnum sessionType, boolean sync, String ext);
1317 
1318 
1327  void deleteRangeHistory(String account, SessionTypeEnum sessionType, long startTime, long endTime);
1328 
1342  InvocationFuture<RecentSessionList> queryMySessionList(long minTimestamp, Long maxTimestamp, Integer needLastMsg, Integer limit, Integer hasMore);
1343 
1350  InvocationFuture<RecentSessionList> queryMySessionList(QueryMySessionOption option);
1351 
1359  InvocationFuture<RecentSession> queryMySession(@NonNull String sessionId);
1360 
1369  InvocationFuture<Void> updateMySession(@NonNull String sessionId, @NonNull String ext);
1370 
1378  InvocationFuture<Void> deleteMySession(@NonNull String[] sessionIdArr);
1379 
1391  InvocationFuture<ThreadTalkHistory> queryThreadTalkHistory(IMMessage anchor, long fromTime, long toTime,
1392  int limit, QueryDirectionEnum direction, boolean persist);
1393 
1401  InvocationFuture<ThreadTalkHistory> queryThreadTalkHistory(MessageKey threadMessageKey, QueryThreadTalkHistoryOption option);
1402 
1412  int queryReplyCountInThreadTalkBlock(IMMessage msg);
1413 
1422  InvocationFuture<Void> addQuickComment(IMMessage msg, long replyType, String ext);
1423 
1437  InvocationFuture<Long> addQuickComment(IMMessage msg, long replyType, String ext, boolean needPush,
1438  boolean needBadge, String pushTitle, String pushContent,
1439  Map<String, Object> pushPayload);
1440 
1449  InvocationFuture<Void> removeQuickComment(IMMessage msg, long replyType, String ext);
1450 
1464  InvocationFuture<Long> removeQuickComment(IMMessage msg, long replyType, String ext, boolean needPush,
1465  boolean needBadge, String pushTitle, String pushContent,
1466  Map<String, Object> pushPayload);
1473  InvocationFuture<List<QuickCommentOptionWrapper>> queryQuickComment(List<IMMessage> msgList);
1474 
1484  InvocationFuture<CollectInfo> addCollect(int type, String date, String ext, String uniqueId);
1485 
1492  InvocationFuture<Integer> removeCollect(List<Pair<Long, Long>> collectInfo);
1493 
1501  InvocationFuture<CollectInfo> updateCollect(CollectInfo info, String ext);
1502 
1511  InvocationFuture<CollectInfo> updateCollect(long infoId, long createTime, String ext);
1512 
1519  InvocationFuture<CollectInfoPage> queryCollect(int limit);
1520 
1530  InvocationFuture<CollectInfoPage> queryCollect(CollectInfo anchor, long toTime, int limit, QueryDirectionEnum direction);
1531 
1543  InvocationFuture<CollectInfoPage> queryCollect(CollectInfo anchor, long toTime, int limit, QueryDirectionEnum direction, int type, boolean persist);
1544 
1552  InvocationFuture<Long> addMsgPin(IMMessage msg, String ext);
1553 
1561  InvocationFuture<Long> updateMsgPin(IMMessage msg, String ext);
1562 
1570  InvocationFuture<Long> removeMsgPin(IMMessage msg, String ext);
1571 
1580  InvocationFuture<MsgPinSyncResponseOptionWrapper> syncMsgPin(SessionTypeEnum sessionType, String sessionId, long timestamp);
1581 
1589  List<MsgPinDbOption> queryMsgPinBlock(String sessionId, SessionTypeEnum sessionType);
1590 
1599  InvocationFuture<StickTopSessionInfo> addStickTopSession(String sessionId, SessionTypeEnum sessionType, String ext);
1600 
1609  InvocationFuture<Void> removeStickTopSession(String sessionId, SessionTypeEnum sessionType, String ext);
1610 
1619  InvocationFuture<StickTopSessionInfo> updateStickTopSession(String sessionId, SessionTypeEnum sessionType, String ext);
1620 
1626  List<StickTopSessionInfo> queryStickTopSessionBlock();
1627 
1628 
1636  boolean isStickTopSession(String sessionId, SessionTypeEnum sessionType);
1637 
1646  void migrateMessages(String from, String to, boolean changeFrom);
1647 }
带有文件的附件类型的基类 描述文件的相关信息
聊天消息全文检索结果记录
可中断操作的调用跟踪接口。
历史消息牵移时导出时自定义处理器,导出时参考IMsgExportProcessor
NIM消息实体数据结构。 第三方APP不要调用设置类接口,调用之后不会被持久化
Definition: IMMessage.java:12
消息本身发送/接收状态,附件状态见AttachStatusEnum
历史消息牵移时导出时自定义处理器
消息的关键信息,通过这些信息可以从服务端查询到该消息的完整部分
Definition: MessageKey.java:17
云信消息服务接口类,提供消息发送、消息查询、历史消息、消息扩展功能、获取未读数、已读回执、会话列表等...
Definition: MsgService.java:59
SDK nos token场景配置,不配置的话,走默认值,默认值只有以下3种场景:
自定义通知。 区别于IMMessage,SDK仅透传该类型消息,不负责解析和存储。消息内容由第三方APP自由扩展。 ...
请求Thread聊天里的消息列表得到的信息