]> www.average.org Git - pdns-pipe-nmc.git/commitdiff
prototype own JsonRpc implementation
authorEugene Crosser <crosser@average.org>
Mon, 24 Mar 2014 12:59:45 +0000 (16:59 +0400)
committerEugene Crosser <crosser@average.org>
Mon, 24 Mar 2014 12:59:45 +0000 (16:59 +0400)
Data/JsonRpc.hs [new file with mode: 0644]

diff --git a/Data/JsonRpc.hs b/Data/JsonRpc.hs
new file mode 100644 (file)
index 0000000..b1879bc
--- /dev/null
@@ -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)
+
+