module Web.Ohloh.Enlistment (
Enlistment(..),
xpEnlistment
) where
import Data.Lens.Common
import Text.XML.HXT.Arrow.Pickle
import Web.Ohloh.Common
import Web.Ohloh.Lens.IdL
import Web.Ohloh.Repository
data Enlistment = Enlistment {
enId :: String,
enProjectId :: String,
enRepositoryId :: String,
enRepository :: Repository
} deriving (Eq, Read, Show)
instance XmlPickler Enlistment where
xpickle = xpEnlistment
instance ReadXmlString Enlistment
instance ShowXmlString Enlistment
xpEnlistment :: PU Enlistment
xpEnlistment =
xpElem "enlistment" $
xpWrap (uncurry4 Enlistment,
\(Enlistment i pi ri r) ->
(i, pi, ri, r)) $
xp4Tuple (xpElem "id" xpText0)
(xpElem "project_id" xpText0)
(xpElem "repository_id" xpText0)
xpRepository
instance IdL Enlistment where
idL = lens enId $ \id en -> en { enId = id }