module Web.Ohloh.KudoScore (
KudoScore(..),
xpKudoScore
) where
import Text.XML.HXT.Arrow.Pickle
import Web.Ohloh.Common
data KudoScore = KudoScore {
ksCreatedAt :: Maybe String,
ksKudoRank :: Int,
ksPosition :: Int,
ksMaxPosition :: Maybe Int,
ksPositionDelta :: Maybe Int
} deriving (Eq, Read, Show)
instance XmlPickler KudoScore where
xpickle = xpKudoScore
instance ReadXmlString KudoScore
instance ShowXmlString KudoScore
xpKudoScore :: PU KudoScore
xpKudoScore =
xpElem "kudo_score" $
xpWrap (uncurry5 KudoScore,
\(KudoScore ca kr p mp pd) ->
(ca, kr, p, mp, pd)) $
xp5Tuple (xpOption (xpElem "created_at" xpText0))
(xpElem "kudo_rank" xpInt)
(xpElem "position" xpInt)
(xpOption (xpElem "max_position" xpInt))
(xpOption (xpElem "position_delta" xpInt))