chats API for mobile (#230)

Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com>
This commit is contained in:
Evgeny Poberezkin
2022-01-28 10:41:09 +00:00
committed by GitHub
parent edc9560d36
commit c3a8ae1eb5
5 changed files with 177 additions and 147 deletions
+9 -2
View File
@@ -1,4 +1,5 @@
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
@@ -77,7 +78,10 @@ instance ToJSON HelpSection where
toEncoding = J.genericToEncoding . enumJSON $ dropPrefix "HS"
data ChatCommand
= ChatHelp HelpSection
= APIGetChats
| APIGetChat ChatType Int64
| APIGetChatItems Int
| ChatHelp HelpSection
| Welcome
| AddContact
| Connect (Maybe AConnectionRequestUri)
@@ -112,7 +116,9 @@ data ChatCommand
deriving (Show)
data ChatResponse
= CRNewChatItem {chatItem :: AChatItem}
= CRApiChats {chats :: [AChatPreview]}
| CRApiDirectChat {chat :: Chat 'CTDirect}
| CRNewChatItem {chatItem :: AChatItem}
| CRCmdAccepted {corr :: CorrId}
| CRChatHelp {helpSection :: HelpSection}
| CRWelcome {user :: User}
@@ -190,6 +196,7 @@ data ChatError
| ChatErrorMessage {errorMessage :: String}
| ChatErrorAgent {agentError :: AgentErrorType}
| ChatErrorStore {storeError :: StoreError}
| ChatErrorNotImplemented
deriving (Show, Exception, Generic)
instance ToJSON ChatError where