refactor: search for messages which match a patter

Two convenient methods added to search for the messages which match
a pattern. Search is applied on the chat with passed id or across communities
and/or chats with passed ids.
This commit is contained in:
Sale Djenic 2021-11-09 14:59:06 +01:00 committed by saledjenic
parent cdaea151d9
commit a07dc86b8a
1 changed files with 11 additions and 1 deletions

View File

@ -38,4 +38,14 @@ proc fetchMessageByMessageId*(messageId: string): RpcResponse[JsonNode] {.raises
proc fetchReactionsForMessageWithId*(chatId: string, messageId: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [chatId, messageId]
result = callPrivateRPC("emojiReactionsByChatIDMessageID".prefix, payload)
result = callPrivateRPC("emojiReactionsByChatIDMessageID".prefix, payload)
proc fetchAllMessagesFromChatWhichMatchTerm*(chatId: string, searchTerm: string, caseSensitive: bool):
RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [chatId, searchTerm, caseSensitive]
result = callPrivateRPC("allMessagesFromChatWhichMatchTerm".prefix, payload)
proc fetchAllMessagesFromChatsAndCommunitiesWhichMatchTerm*(communityIds: seq[string], chatIds: seq[string],
searchTerm: string, caseSensitive: bool): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [communityIds, chatIds, searchTerm, caseSensitive]
result = callPrivateRPC("allMessagesFromChatsAndCommunitiesWhichMatchTerm".prefix, payload)