X-Git-Url: http://www.average.org/gitweb/?p=pdns-pipe-nmc.git;a=blobdiff_plain;f=NmcRpc.hs;fp=NmcRpc.hs;h=1f73a732f450ee5ceaff5da7cf0ec6449a0fe9e0;hp=0000000000000000000000000000000000000000;hb=35cea210f8d3a22afd24848441b5d34702d83239;hpb=f2dbb98dde41abe69d0bc9c3ee70eda0eeb12670 diff --git a/NmcRpc.hs b/NmcRpc.hs new file mode 100644 index 0000000..1f73a73 --- /dev/null +++ b/NmcRpc.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE OverloadedStrings #-} + +module NmcRpc ( NmcRes(..) + ) where + +import Data.ByteString.Lazy (ByteString) +import Data.Text as T (unpack) +import Data.List.Split +import Data.Char +import Data.Map as M (Map, lookup) +import Control.Applicative ((<$>), (<*>), empty) +import Data.Aeson + +data NmcRes = NmcRes { resName :: String + , resValue :: ByteString -- string with NmcDom + , resTxid :: String + , resAddress :: String + , resExpires_in :: Int + } deriving (Show) +instance FromJSON NmcRes where + parseJSON (Object o) = NmcRes + <$> o .: "name" + <*> o .: "value" + <*> o .: "txid" + <*> o .: "address" + <*> o .: "expires_in" + parseJSON _ = empty