module GitHub.Types.Events where
import Control.Applicative
import Control.Monad
import Data.Aeson
import Data.Text
import GitHub.Types.Base
data Event
= CommitCommentEventType CommitCommentEvent
| DeploymentEventType DeploymentEvent
| DeploymentStatusEventType DeploymentStatusEvent
deriving (Eq, Show)
data CommitCommentEvent = CommitCommentEvent
{ commitCommentEventRepository :: Repository
} deriving (Eq, Show)
data DeploymentEvent = DeploymentEvent
{ deploymentEventId :: Int
, deploymentEventSha :: Text
, deploymentEventName :: Text
, deploymentEventPayload :: Value
, deploymentEventEnvironment :: Text
, deploymentEventDescription :: Maybe Text
, deploymentEventRepository :: Repository
} deriving (Eq, Show)
instance FromJSON DeploymentEvent where
parseJSON (Object x) = DeploymentEvent
<$> x .: "id"
<*> x .: "sha"
<*> x .: "name"
<*> x .: "payload"
<*> x .: "environment"
<*> x .: "description"
<*> x .: "repository"
parseJSON _ = mzero
data DeploymentStatusEvent = DeploymentStatusEvent
{ deploymentStatusEventState :: State
, deploymentStatusEventTargetUrl :: Text
, deploymentStatusEventDeployment :: Text
, deploymentStatusEventDescription :: Text
} deriving (Eq, Show)