{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} module GitHub.Types.Events.MilestoneEvent where import Data.Aeson (FromJSON (..), ToJSON (..), object) import Data.Aeson.Types (Value (..), (.:), (.:?), (.=)) import Data.Text (Text) import Test.QuickCheck.Arbitrary (Arbitrary (..)) import GitHub.Types.Base import GitHub.Types.Event data MilestoneEvent = MilestoneEvent { MilestoneEvent -> Maybe Installation milestoneEventInstallation :: Maybe Installation , MilestoneEvent -> Organization milestoneEventOrganization :: Organization , MilestoneEvent -> Repository milestoneEventRepository :: Repository , MilestoneEvent -> User milestoneEventSender :: User , MilestoneEvent -> Text milestoneEventAction :: Text , MilestoneEvent -> Milestone milestoneEventMilestone :: Milestone } deriving (MilestoneEvent -> MilestoneEvent -> Bool (MilestoneEvent -> MilestoneEvent -> Bool) -> (MilestoneEvent -> MilestoneEvent -> Bool) -> Eq MilestoneEvent forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: MilestoneEvent -> MilestoneEvent -> Bool $c/= :: MilestoneEvent -> MilestoneEvent -> Bool == :: MilestoneEvent -> MilestoneEvent -> Bool $c== :: MilestoneEvent -> MilestoneEvent -> Bool Eq, Int -> MilestoneEvent -> ShowS [MilestoneEvent] -> ShowS MilestoneEvent -> String (Int -> MilestoneEvent -> ShowS) -> (MilestoneEvent -> String) -> ([MilestoneEvent] -> ShowS) -> Show MilestoneEvent forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [MilestoneEvent] -> ShowS $cshowList :: [MilestoneEvent] -> ShowS show :: MilestoneEvent -> String $cshow :: MilestoneEvent -> String showsPrec :: Int -> MilestoneEvent -> ShowS $cshowsPrec :: Int -> MilestoneEvent -> ShowS Show, ReadPrec [MilestoneEvent] ReadPrec MilestoneEvent Int -> ReadS MilestoneEvent ReadS [MilestoneEvent] (Int -> ReadS MilestoneEvent) -> ReadS [MilestoneEvent] -> ReadPrec MilestoneEvent -> ReadPrec [MilestoneEvent] -> Read MilestoneEvent forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [MilestoneEvent] $creadListPrec :: ReadPrec [MilestoneEvent] readPrec :: ReadPrec MilestoneEvent $creadPrec :: ReadPrec MilestoneEvent readList :: ReadS [MilestoneEvent] $creadList :: ReadS [MilestoneEvent] readsPrec :: Int -> ReadS MilestoneEvent $creadsPrec :: Int -> ReadS MilestoneEvent Read) instance Event MilestoneEvent where typeName :: TypeName MilestoneEvent typeName = Text -> TypeName MilestoneEvent forall a. Text -> TypeName a TypeName Text "MilestoneEvent" eventName :: EventName MilestoneEvent eventName = Text -> EventName MilestoneEvent forall a. Text -> EventName a EventName Text "milestone" instance FromJSON MilestoneEvent where parseJSON :: Value -> Parser MilestoneEvent parseJSON (Object Object x) = Maybe Installation -> Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent MilestoneEvent (Maybe Installation -> Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent) -> Parser (Maybe Installation) -> Parser (Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Object x Object -> Key -> Parser (Maybe Installation) forall a. FromJSON a => Object -> Key -> Parser (Maybe a) .:? Key "installation" Parser (Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent) -> Parser Organization -> Parser (Repository -> User -> Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Object x Object -> Key -> Parser Organization forall a. FromJSON a => Object -> Key -> Parser a .: Key "organization" Parser (Repository -> User -> Text -> Milestone -> MilestoneEvent) -> Parser Repository -> Parser (User -> Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Object x Object -> Key -> Parser Repository forall a. FromJSON a => Object -> Key -> Parser a .: Key "repository" Parser (User -> Text -> Milestone -> MilestoneEvent) -> Parser User -> Parser (Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Object x Object -> Key -> Parser User forall a. FromJSON a => Object -> Key -> Parser a .: Key "sender" Parser (Text -> Milestone -> MilestoneEvent) -> Parser Text -> Parser (Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Object x Object -> Key -> Parser Text forall a. FromJSON a => Object -> Key -> Parser a .: Key "action" Parser (Milestone -> MilestoneEvent) -> Parser Milestone -> Parser MilestoneEvent forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Object x Object -> Key -> Parser Milestone forall a. FromJSON a => Object -> Key -> Parser a .: Key "milestone" parseJSON Value _ = String -> Parser MilestoneEvent forall (m :: * -> *) a. MonadFail m => String -> m a fail String "MilestoneEvent" instance ToJSON MilestoneEvent where toJSON :: MilestoneEvent -> Value toJSON MilestoneEvent{Maybe Installation Text Organization User Milestone Repository milestoneEventMilestone :: Milestone milestoneEventAction :: Text milestoneEventSender :: User milestoneEventRepository :: Repository milestoneEventOrganization :: Organization milestoneEventInstallation :: Maybe Installation milestoneEventMilestone :: MilestoneEvent -> Milestone milestoneEventAction :: MilestoneEvent -> Text milestoneEventSender :: MilestoneEvent -> User milestoneEventRepository :: MilestoneEvent -> Repository milestoneEventOrganization :: MilestoneEvent -> Organization milestoneEventInstallation :: MilestoneEvent -> Maybe Installation ..} = [Pair] -> Value object [ Key "installation" Key -> Maybe Installation -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Maybe Installation milestoneEventInstallation , Key "organization" Key -> Organization -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Organization milestoneEventOrganization , Key "repository" Key -> Repository -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Repository milestoneEventRepository , Key "sender" Key -> User -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= User milestoneEventSender , Key "action" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text milestoneEventAction , Key "milestone" Key -> Milestone -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Milestone milestoneEventMilestone ] instance Arbitrary MilestoneEvent where arbitrary :: Gen MilestoneEvent arbitrary = Maybe Installation -> Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent MilestoneEvent (Maybe Installation -> Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent) -> Gen (Maybe Installation) -> Gen (Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen (Maybe Installation) forall a. Arbitrary a => Gen a arbitrary Gen (Organization -> Repository -> User -> Text -> Milestone -> MilestoneEvent) -> Gen Organization -> Gen (Repository -> User -> Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Organization forall a. Arbitrary a => Gen a arbitrary Gen (Repository -> User -> Text -> Milestone -> MilestoneEvent) -> Gen Repository -> Gen (User -> Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Repository forall a. Arbitrary a => Gen a arbitrary Gen (User -> Text -> Milestone -> MilestoneEvent) -> Gen User -> Gen (Text -> Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen User forall a. Arbitrary a => Gen a arbitrary Gen (Text -> Milestone -> MilestoneEvent) -> Gen Text -> Gen (Milestone -> MilestoneEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (Milestone -> MilestoneEvent) -> Gen Milestone -> Gen MilestoneEvent forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Milestone forall a. Arbitrary a => Gen a arbitrary