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