@openim/client-sdk
Version:
JavaScript/TypeScript Client SDK for OpenIM
46 lines (45 loc) • 2.69 kB
TypeScript
import { MsgProto } from '@openim/protocol';
import { MixinApiService } from '../..';
import { SDKMessage, ConversationItem } from '../../../types/entity';
declare class MessageCache {
private instance;
private totalUnreadCount;
private cachedNotNotifyConversationIDs;
private cachedConversations;
private cachedMessages;
private cachedFilterMessageSeqs;
cachedHasReadAndMaxSeqs: Record<string, MsgProto.Seqs | undefined>;
constructor(instance: MixinApiService);
clear: () => void;
getActiveConversationsFromServer: (operationID: string) => Promise<void>;
getTotalUnreadCount: () => number;
setTotalUnreadCount: (count: number, operationID: string) => void;
decreaseTotalUnreadCount: (count: number, operationID: string) => void;
getMaxReadSeqs: (operationID: string, conversationIDs?: never[]) => Promise<void>;
getSortedConversationIDs: (offset: number, count: number) => string[];
getCachedMaxReadSeq: (conversationID: string) => MsgProto.Seqs | undefined;
addCachedMaxReadSeq: (conversationID: string, seqs: MsgProto.Seqs) => void;
updateCachedMaxReadSeq: (convesationID: string, seqs: Partial<MsgProto.Seqs>) => void;
removeCachedMaxReadSeq: (conversationID: string) => void;
getNotNotifyConversationIDs: (operationID: string) => Promise<void>;
isNotNotifyConversation: (conversationID: string) => boolean;
addNotNotifyConversationID: (conversationID: string) => void;
deleteNotNotifyConversationID: (conversationID: string) => void;
getCachedConversation: (conversationID: string) => ConversationItem | undefined;
getAllCachedConversations: () => ConversationItem[];
setCachedConversations: (conversations: ConversationItem[]) => void;
getCachedMessagesBySeqs: (conversationID: string, seqs: number[]) => {
cachedMessages: SDKMessage[];
unCachedSeqs: number[];
};
getCachedMessageByClientMsgIDs: (conversationID: string, clientMsgIDs: string[]) => SDKMessage[];
addMessagesToCache: (conversationID: string, messages: SDKMessage[]) => void;
deleteMessageFromCache: (conversationID: string, seq: number) => void;
clearCachedConversationMessages: (conversationID: string) => void;
markCachedMessagesAsRead: (conversationID: string, seqs?: number[]) => void;
tryUpdateCachedMessages: (conversationID: string, message: Partial<SDKMessage>) => SDKMessage | undefined;
tryUpdateQuotedMessage: (conversationID: string, clientMsgID: string) => void;
addFilterSeqsToCache: (conversationID: string, seqs: number[]) => void;
checkIsFilterSeq: (conversationID: string, seq: number) => boolean | undefined;
}
export default MessageCache;