]> www.average.org Git - pdns-pipe-nmc.git/blob - Data/JsonRpc.hs
prototype own JsonRpc implementation
[pdns-pipe-nmc.git] / Data / JsonRpc.hs
1 module JsonRpc  ( JsonRpcRequest(..)
2                 , JsonRpcNotification(..)
3                 , JsonRpcResponse(..)
4                 ) where
5
6 import Data.ByteString (ByteString)
7 import Control.Applicative ((<$>), (<*>), empty)
8 import Data.Aeson
9
10 data JsonRpcRequest = JsonRpcRequest { jrpcReqMethod :: ByteString
11                                      , jrpcReqParams :: [ByteString]
12                                      , jrpcReqId     :: ByteString
13                                      } deriving (Show)
14
15 data JsonRpcNotification = JsonRpcNotification { jrpcNtfMethod :: ByteString
16                                                , jrpcNtfParams :: [ByteString]
17                                                } deriving (Show)
18
19 data JsonRpcError = JsonRpcError { jrpcErrCode    :: Int
20                                  , jrpcErrMessage :: ByteString
21                                  , jrpcErrData    :: Maybe Value
22                                  } deriving (Show)
23
24 data JsonRpcResponse = JsonRpcResponse { jrpcRspResult :: Maybe Value
25                                        , jrpcRspError  :: JsonRpcError
26                                        , jrpcRspId     :: ByteString
27                                        } deriving (Show)
28
29