core: add FromJSON instance to ChatResponse (#3129)

* Start adding FromJSON instances to ChatResponse

* progress

* FromJSON instance for ChatResponse compiles

* restore removed encodings

* remove comment

* diff

* update simplexmq, use TH for JSON

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
Alexander Bondarenko
2023-10-05 21:49:20 +03:00
committed by GitHub
parent 27e8a81c9f
commit fc9db9c381
18 changed files with 483 additions and 209 deletions

View File

@@ -1,14 +1,14 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
module Simplex.Chat.Remote.Types where
import Control.Concurrent.Async (Async)
import Data.Aeson (ToJSON (..))
import qualified Data.Aeson.TH as J
import Data.Int (Int64)
import Data.Text (Text)
import GHC.Generics (Generic)
import qualified Simplex.Messaging.Crypto as C
import Simplex.Messaging.TMap (TMap)
import Simplex.Messaging.Transport.Client (TransportHost)
@@ -37,7 +37,9 @@ data RemoteCtrl = RemoteCtrl
fingerprint :: C.KeyHash,
accepted :: Maybe Bool
}
deriving (Show, Generic, ToJSON)
deriving (Show)
$(J.deriveJSON J.defaultOptions ''RemoteCtrl)
data RemoteHostSession
= RemoteHostSessionStarting