{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} module GitHub.Types.Events.CheckRunEvent 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 CheckRunEvent = CheckRunEvent { CheckRunEvent -> Maybe Installation checkRunEventInstallation :: Maybe Installation , CheckRunEvent -> Organization checkRunEventOrganization :: Organization , CheckRunEvent -> Repository checkRunEventRepository :: Repository , CheckRunEvent -> User checkRunEventSender :: User , CheckRunEvent -> Text checkRunEventAction :: Text , CheckRunEvent -> CheckRun checkRunEventCheckRun :: CheckRun } deriving (CheckRunEvent -> CheckRunEvent -> Bool (CheckRunEvent -> CheckRunEvent -> Bool) -> (CheckRunEvent -> CheckRunEvent -> Bool) -> Eq CheckRunEvent forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: CheckRunEvent -> CheckRunEvent -> Bool $c/= :: CheckRunEvent -> CheckRunEvent -> Bool == :: CheckRunEvent -> CheckRunEvent -> Bool $c== :: CheckRunEvent -> CheckRunEvent -> Bool Eq, Int -> CheckRunEvent -> ShowS [CheckRunEvent] -> ShowS CheckRunEvent -> String (Int -> CheckRunEvent -> ShowS) -> (CheckRunEvent -> String) -> ([CheckRunEvent] -> ShowS) -> Show CheckRunEvent forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [CheckRunEvent] -> ShowS $cshowList :: [CheckRunEvent] -> ShowS show :: CheckRunEvent -> String $cshow :: CheckRunEvent -> String showsPrec :: Int -> CheckRunEvent -> ShowS $cshowsPrec :: Int -> CheckRunEvent -> ShowS Show, ReadPrec [CheckRunEvent] ReadPrec CheckRunEvent Int -> ReadS CheckRunEvent ReadS [CheckRunEvent] (Int -> ReadS CheckRunEvent) -> ReadS [CheckRunEvent] -> ReadPrec CheckRunEvent -> ReadPrec [CheckRunEvent] -> Read CheckRunEvent forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [CheckRunEvent] $creadListPrec :: ReadPrec [CheckRunEvent] readPrec :: ReadPrec CheckRunEvent $creadPrec :: ReadPrec CheckRunEvent readList :: ReadS [CheckRunEvent] $creadList :: ReadS [CheckRunEvent] readsPrec :: Int -> ReadS CheckRunEvent $creadsPrec :: Int -> ReadS CheckRunEvent Read) instance Event CheckRunEvent where typeName :: TypeName CheckRunEvent typeName = Text -> TypeName CheckRunEvent forall a. Text -> TypeName a TypeName Text "CheckRunEvent" eventName :: EventName CheckRunEvent eventName = Text -> EventName CheckRunEvent forall a. Text -> EventName a EventName Text "check_run" instance FromJSON CheckRunEvent where parseJSON :: Value -> Parser CheckRunEvent parseJSON (Object Object x) = Maybe Installation -> Organization -> Repository -> User -> Text -> CheckRun -> CheckRunEvent CheckRunEvent (Maybe Installation -> Organization -> Repository -> User -> Text -> CheckRun -> CheckRunEvent) -> Parser (Maybe Installation) -> Parser (Organization -> Repository -> User -> Text -> CheckRun -> CheckRunEvent) 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 -> CheckRun -> CheckRunEvent) -> Parser Organization -> Parser (Repository -> User -> Text -> CheckRun -> CheckRunEvent) 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 -> CheckRun -> CheckRunEvent) -> Parser Repository -> Parser (User -> Text -> CheckRun -> CheckRunEvent) 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 -> CheckRun -> CheckRunEvent) -> Parser User -> Parser (Text -> CheckRun -> CheckRunEvent) 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 -> CheckRun -> CheckRunEvent) -> Parser Text -> Parser (CheckRun -> CheckRunEvent) 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 (CheckRun -> CheckRunEvent) -> Parser CheckRun -> Parser CheckRunEvent forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Object x Object -> Key -> Parser CheckRun forall a. FromJSON a => Object -> Key -> Parser a .: Key "check_run" parseJSON Value _ = String -> Parser CheckRunEvent forall (m :: * -> *) a. MonadFail m => String -> m a fail String "CheckRunEvent" instance ToJSON CheckRunEvent where toJSON :: CheckRunEvent -> Value toJSON CheckRunEvent{Maybe Installation Text Organization User CheckRun Repository checkRunEventCheckRun :: CheckRun checkRunEventAction :: Text checkRunEventSender :: User checkRunEventRepository :: Repository checkRunEventOrganization :: Organization checkRunEventInstallation :: Maybe Installation checkRunEventCheckRun :: CheckRunEvent -> CheckRun checkRunEventAction :: CheckRunEvent -> Text checkRunEventSender :: CheckRunEvent -> User checkRunEventRepository :: CheckRunEvent -> Repository checkRunEventOrganization :: CheckRunEvent -> Organization checkRunEventInstallation :: CheckRunEvent -> Maybe Installation ..} = [Pair] -> Value object [ Key "installation" Key -> Maybe Installation -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Maybe Installation checkRunEventInstallation , Key "organization" Key -> Organization -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Organization checkRunEventOrganization , Key "repository" Key -> Repository -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Repository checkRunEventRepository , Key "sender" Key -> User -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= User checkRunEventSender , Key "action" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text checkRunEventAction , Key "check_run" Key -> CheckRun -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= CheckRun checkRunEventCheckRun ] instance Arbitrary CheckRunEvent where arbitrary :: Gen CheckRunEvent arbitrary = Maybe Installation -> Organization -> Repository -> User -> Text -> CheckRun -> CheckRunEvent CheckRunEvent (Maybe Installation -> Organization -> Repository -> User -> Text -> CheckRun -> CheckRunEvent) -> Gen (Maybe Installation) -> Gen (Organization -> Repository -> User -> Text -> CheckRun -> CheckRunEvent) 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 -> CheckRun -> CheckRunEvent) -> Gen Organization -> Gen (Repository -> User -> Text -> CheckRun -> CheckRunEvent) 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 -> CheckRun -> CheckRunEvent) -> Gen Repository -> Gen (User -> Text -> CheckRun -> CheckRunEvent) 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 -> CheckRun -> CheckRunEvent) -> Gen User -> Gen (Text -> CheckRun -> CheckRunEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen User forall a. Arbitrary a => Gen a arbitrary Gen (Text -> CheckRun -> CheckRunEvent) -> Gen Text -> Gen (CheckRun -> CheckRunEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (CheckRun -> CheckRunEvent) -> Gen CheckRun -> Gen CheckRunEvent forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen CheckRun forall a. Arbitrary a => Gen a arbitrary