From: Eugene Crosser Date: Mon, 24 Mar 2014 12:59:45 +0000 (+0400) Subject: prototype own JsonRpc implementation X-Git-Tag: 0.9.0.0~129 X-Git-Url: http://average.org/gitweb/?a=commitdiff_plain;h=dc93b41b2b38777c077e7327fe019e9a10acc8b9;p=pdns-pipe-nmc.git prototype own JsonRpc implementation --- diff --git a/Data/JsonRpc.hs b/Data/JsonRpc.hs new file mode 100644 index 0000000..b1879bc --- /dev/null +++ b/Data/JsonRpc.hs @@ -0,0 +1,29 @@ +module JsonRpc ( JsonRpcRequest(..) + , JsonRpcNotification(..) + , JsonRpcResponse(..) + ) where + +import Data.ByteString (ByteString) +import Control.Applicative ((<$>), (<*>), empty) +import Data.Aeson + +data JsonRpcRequest = JsonRpcRequest { jrpcReqMethod :: ByteString + , jrpcReqParams :: [ByteString] + , jrpcReqId :: ByteString + } deriving (Show) + +data JsonRpcNotification = JsonRpcNotification { jrpcNtfMethod :: ByteString + , jrpcNtfParams :: [ByteString] + } deriving (Show) + +data JsonRpcError = JsonRpcError { jrpcErrCode :: Int + , jrpcErrMessage :: ByteString + , jrpcErrData :: Maybe Value + } deriving (Show) + +data JsonRpcResponse = JsonRpcResponse { jrpcRspResult :: Maybe Value + , jrpcRspError :: JsonRpcError + , jrpcRspId :: ByteString + } deriving (Show) + +