module Web.Ohloh.ContributorFact (
ContributorFact(..),
xpContributorFact
) where
import Text.XML.HXT.Arrow.Pickle
import Web.Ohloh.Common
import Web.Ohloh.ContributorLanguageFact
data ContributorFact = ContributorFact {
cfContributorId :: String,
cfAccountId :: Maybe String,
cfAccountName :: Maybe String,
cfAnalysisId :: String,
cfContributorName :: String,
cfPrimaryLanguageId :: String,
cfPrimaryLanguageNiceName :: String,
cfCommentRatio :: Double,
cfFirstCommitTime :: String,
cfLastCommitTime :: String,
cfManMonths :: Int,
cfCommits :: Int,
cfMedianCommits :: Int,
cfContributorLanguageFacts :: Maybe [ContributorLanguageFact]
} deriving (Eq, Read, Show)
instance XmlPickler ContributorFact where
xpickle = xpContributorFact
instance ReadXmlString ContributorFact
instance ShowXmlString ContributorFact
xpContributorFact :: PU ContributorFact
xpContributorFact =
xpElem "contributor_fact" $
xpWrap (uncurry14 ContributorFact,
\(ContributorFact ci aci acn ai cn pli plnn cr fct lct mm c mc clf) ->
(ci, aci, acn, ai, cn, pli, plnn, cr, fct, lct, mm, c, mc, clf)) $
xp14Tuple (xpElem "contributor_id" xpText0)
(xpOption (xpElem "account_id" xpText0))
(xpOption (xpElem "account_name" xpText0))
(xpElem "analysis_id" xpText0)
(xpElem "contributor_name" xpText0)
(xpElem "primary_language_id" xpText0)
(xpElem "primary_language_nice_name" xpText0)
(xpElem "comment_ratio" xpPrim)
(xpElem "first_commit_time" xpText0)
(xpElem "last_commit_time" xpText0)
(xpElem "man_months" xpInt)
(xpElem "commits" xpInt)
(xpElem "median_commits" xpInt)
(xpOption (xpElem "contributor_language_facts" xpickle))