{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} module GitHub.Types.Events.CreateEvent 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 CreateEvent = CreateEvent { CreateEvent -> Maybe Installation createEventInstallation :: Maybe Installation , CreateEvent -> Organization createEventOrganization :: Organization , CreateEvent -> Repository createEventRepository :: Repository , CreateEvent -> User createEventSender :: User , CreateEvent -> Text createEventDescription :: Text , CreateEvent -> Text createEventMasterBranch :: Text , CreateEvent -> Text createEventPusherType :: Text , CreateEvent -> Text createEventRef :: Text , CreateEvent -> Text createEventRefType :: Text } deriving (CreateEvent -> CreateEvent -> Bool (CreateEvent -> CreateEvent -> Bool) -> (CreateEvent -> CreateEvent -> Bool) -> Eq CreateEvent forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: CreateEvent -> CreateEvent -> Bool $c/= :: CreateEvent -> CreateEvent -> Bool == :: CreateEvent -> CreateEvent -> Bool $c== :: CreateEvent -> CreateEvent -> Bool Eq, Int -> CreateEvent -> ShowS [CreateEvent] -> ShowS CreateEvent -> String (Int -> CreateEvent -> ShowS) -> (CreateEvent -> String) -> ([CreateEvent] -> ShowS) -> Show CreateEvent forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [CreateEvent] -> ShowS $cshowList :: [CreateEvent] -> ShowS show :: CreateEvent -> String $cshow :: CreateEvent -> String showsPrec :: Int -> CreateEvent -> ShowS $cshowsPrec :: Int -> CreateEvent -> ShowS Show, ReadPrec [CreateEvent] ReadPrec CreateEvent Int -> ReadS CreateEvent ReadS [CreateEvent] (Int -> ReadS CreateEvent) -> ReadS [CreateEvent] -> ReadPrec CreateEvent -> ReadPrec [CreateEvent] -> Read CreateEvent forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [CreateEvent] $creadListPrec :: ReadPrec [CreateEvent] readPrec :: ReadPrec CreateEvent $creadPrec :: ReadPrec CreateEvent readList :: ReadS [CreateEvent] $creadList :: ReadS [CreateEvent] readsPrec :: Int -> ReadS CreateEvent $creadsPrec :: Int -> ReadS CreateEvent Read) instance Event CreateEvent where typeName :: TypeName CreateEvent typeName = Text -> TypeName CreateEvent forall a. Text -> TypeName a TypeName Text "CreateEvent" eventName :: EventName CreateEvent eventName = Text -> EventName CreateEvent forall a. Text -> EventName a EventName Text "create" instance FromJSON CreateEvent where parseJSON :: Value -> Parser CreateEvent parseJSON (Object Object x) = Maybe Installation -> Organization -> Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent CreateEvent (Maybe Installation -> Organization -> Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) -> Parser (Maybe Installation) -> Parser (Organization -> Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) 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 -> Text -> Text -> Text -> Text -> CreateEvent) -> Parser Organization -> Parser (Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) 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 -> Text -> Text -> Text -> Text -> CreateEvent) -> Parser Repository -> Parser (User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) 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 -> Text -> Text -> Text -> Text -> CreateEvent) -> Parser User -> Parser (Text -> Text -> Text -> Text -> Text -> CreateEvent) 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 -> Text -> Text -> Text -> Text -> CreateEvent) -> Parser Text -> Parser (Text -> Text -> Text -> Text -> CreateEvent) 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 "description" Parser (Text -> Text -> Text -> Text -> CreateEvent) -> Parser Text -> Parser (Text -> Text -> Text -> CreateEvent) 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 "master_branch" Parser (Text -> Text -> Text -> CreateEvent) -> Parser Text -> Parser (Text -> Text -> CreateEvent) 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 "pusher_type" Parser (Text -> Text -> CreateEvent) -> Parser Text -> Parser (Text -> CreateEvent) 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 "ref" Parser (Text -> CreateEvent) -> Parser Text -> Parser CreateEvent 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 "ref_type" parseJSON Value _ = String -> Parser CreateEvent forall (m :: * -> *) a. MonadFail m => String -> m a fail String "CreateEvent" instance ToJSON CreateEvent where toJSON :: CreateEvent -> Value toJSON CreateEvent{Maybe Installation Text Organization User Repository createEventRefType :: Text createEventRef :: Text createEventPusherType :: Text createEventMasterBranch :: Text createEventDescription :: Text createEventSender :: User createEventRepository :: Repository createEventOrganization :: Organization createEventInstallation :: Maybe Installation createEventRefType :: CreateEvent -> Text createEventRef :: CreateEvent -> Text createEventPusherType :: CreateEvent -> Text createEventMasterBranch :: CreateEvent -> Text createEventDescription :: CreateEvent -> Text createEventSender :: CreateEvent -> User createEventRepository :: CreateEvent -> Repository createEventOrganization :: CreateEvent -> Organization createEventInstallation :: CreateEvent -> Maybe Installation ..} = [Pair] -> Value object [ Key "installation" Key -> Maybe Installation -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Maybe Installation createEventInstallation , Key "organization" Key -> Organization -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Organization createEventOrganization , Key "repository" Key -> Repository -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Repository createEventRepository , Key "sender" Key -> User -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= User createEventSender , Key "description" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text createEventDescription , Key "master_branch" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text createEventMasterBranch , Key "pusher_type" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text createEventPusherType , Key "ref" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text createEventRef , Key "ref_type" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text createEventRefType ] instance Arbitrary CreateEvent where arbitrary :: Gen CreateEvent arbitrary = Maybe Installation -> Organization -> Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent CreateEvent (Maybe Installation -> Organization -> Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) -> Gen (Maybe Installation) -> Gen (Organization -> Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) 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 -> Text -> Text -> Text -> Text -> CreateEvent) -> Gen Organization -> Gen (Repository -> User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) 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 -> Text -> Text -> Text -> Text -> CreateEvent) -> Gen Repository -> Gen (User -> Text -> Text -> Text -> Text -> Text -> CreateEvent) 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 -> Text -> Text -> Text -> Text -> CreateEvent) -> Gen User -> Gen (Text -> Text -> Text -> Text -> Text -> CreateEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen User forall a. Arbitrary a => Gen a arbitrary Gen (Text -> Text -> Text -> Text -> Text -> CreateEvent) -> Gen Text -> Gen (Text -> Text -> Text -> Text -> CreateEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (Text -> Text -> Text -> Text -> CreateEvent) -> Gen Text -> Gen (Text -> Text -> Text -> CreateEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (Text -> Text -> Text -> CreateEvent) -> Gen Text -> Gen (Text -> Text -> CreateEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (Text -> Text -> CreateEvent) -> Gen Text -> Gen (Text -> CreateEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (Text -> CreateEvent) -> Gen Text -> Gen CreateEvent forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary