{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} module GitHub.Types.Events.MembershipEvent 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 MembershipEvent = MembershipEvent { MembershipEvent -> Maybe Installation membershipEventInstallation :: Maybe Installation , MembershipEvent -> Organization membershipEventOrganization :: Organization , MembershipEvent -> User membershipEventSender :: User , MembershipEvent -> Text membershipEventAction :: Text , MembershipEvent -> User membershipEventMember :: User , MembershipEvent -> Text membershipEventScope :: Text , MembershipEvent -> Team membershipEventTeam :: Team } deriving (MembershipEvent -> MembershipEvent -> Bool (MembershipEvent -> MembershipEvent -> Bool) -> (MembershipEvent -> MembershipEvent -> Bool) -> Eq MembershipEvent forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: MembershipEvent -> MembershipEvent -> Bool $c/= :: MembershipEvent -> MembershipEvent -> Bool == :: MembershipEvent -> MembershipEvent -> Bool $c== :: MembershipEvent -> MembershipEvent -> Bool Eq, Int -> MembershipEvent -> ShowS [MembershipEvent] -> ShowS MembershipEvent -> String (Int -> MembershipEvent -> ShowS) -> (MembershipEvent -> String) -> ([MembershipEvent] -> ShowS) -> Show MembershipEvent forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [MembershipEvent] -> ShowS $cshowList :: [MembershipEvent] -> ShowS show :: MembershipEvent -> String $cshow :: MembershipEvent -> String showsPrec :: Int -> MembershipEvent -> ShowS $cshowsPrec :: Int -> MembershipEvent -> ShowS Show, ReadPrec [MembershipEvent] ReadPrec MembershipEvent Int -> ReadS MembershipEvent ReadS [MembershipEvent] (Int -> ReadS MembershipEvent) -> ReadS [MembershipEvent] -> ReadPrec MembershipEvent -> ReadPrec [MembershipEvent] -> Read MembershipEvent forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [MembershipEvent] $creadListPrec :: ReadPrec [MembershipEvent] readPrec :: ReadPrec MembershipEvent $creadPrec :: ReadPrec MembershipEvent readList :: ReadS [MembershipEvent] $creadList :: ReadS [MembershipEvent] readsPrec :: Int -> ReadS MembershipEvent $creadsPrec :: Int -> ReadS MembershipEvent Read) instance Event MembershipEvent where typeName :: TypeName MembershipEvent typeName = Text -> TypeName MembershipEvent forall a. Text -> TypeName a TypeName Text "MembershipEvent" eventName :: EventName MembershipEvent eventName = Text -> EventName MembershipEvent forall a. Text -> EventName a EventName Text "membership" instance FromJSON MembershipEvent where parseJSON :: Value -> Parser MembershipEvent parseJSON (Object Object x) = Maybe Installation -> Organization -> User -> Text -> User -> Text -> Team -> MembershipEvent MembershipEvent (Maybe Installation -> Organization -> User -> Text -> User -> Text -> Team -> MembershipEvent) -> Parser (Maybe Installation) -> Parser (Organization -> User -> Text -> User -> Text -> Team -> MembershipEvent) 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 -> User -> Text -> User -> Text -> Team -> MembershipEvent) -> Parser Organization -> Parser (User -> Text -> User -> Text -> Team -> MembershipEvent) 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 (User -> Text -> User -> Text -> Team -> MembershipEvent) -> Parser User -> Parser (Text -> User -> Text -> Team -> MembershipEvent) 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 -> User -> Text -> Team -> MembershipEvent) -> Parser Text -> Parser (User -> Text -> Team -> MembershipEvent) 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 (User -> Text -> Team -> MembershipEvent) -> Parser User -> Parser (Text -> Team -> MembershipEvent) 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 "member" Parser (Text -> Team -> MembershipEvent) -> Parser Text -> Parser (Team -> MembershipEvent) 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 "scope" Parser (Team -> MembershipEvent) -> Parser Team -> Parser MembershipEvent forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Object x Object -> Key -> Parser Team forall a. FromJSON a => Object -> Key -> Parser a .: Key "team" parseJSON Value _ = String -> Parser MembershipEvent forall (m :: * -> *) a. MonadFail m => String -> m a fail String "MembershipEvent" instance ToJSON MembershipEvent where toJSON :: MembershipEvent -> Value toJSON MembershipEvent{Maybe Installation Text Organization Team User membershipEventTeam :: Team membershipEventScope :: Text membershipEventMember :: User membershipEventAction :: Text membershipEventSender :: User membershipEventOrganization :: Organization membershipEventInstallation :: Maybe Installation membershipEventTeam :: MembershipEvent -> Team membershipEventScope :: MembershipEvent -> Text membershipEventMember :: MembershipEvent -> User membershipEventAction :: MembershipEvent -> Text membershipEventSender :: MembershipEvent -> User membershipEventOrganization :: MembershipEvent -> Organization membershipEventInstallation :: MembershipEvent -> Maybe Installation ..} = [Pair] -> Value object [ Key "installation" Key -> Maybe Installation -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Maybe Installation membershipEventInstallation , Key "organization" Key -> Organization -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Organization membershipEventOrganization , Key "sender" Key -> User -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= User membershipEventSender , Key "action" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text membershipEventAction , Key "member" Key -> User -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= User membershipEventMember , Key "scope" Key -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Text membershipEventScope , Key "team" Key -> Team -> Pair forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv .= Team membershipEventTeam ] instance Arbitrary MembershipEvent where arbitrary :: Gen MembershipEvent arbitrary = Maybe Installation -> Organization -> User -> Text -> User -> Text -> Team -> MembershipEvent MembershipEvent (Maybe Installation -> Organization -> User -> Text -> User -> Text -> Team -> MembershipEvent) -> Gen (Maybe Installation) -> Gen (Organization -> User -> Text -> User -> Text -> Team -> MembershipEvent) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Gen (Maybe Installation) forall a. Arbitrary a => Gen a arbitrary Gen (Organization -> User -> Text -> User -> Text -> Team -> MembershipEvent) -> Gen Organization -> Gen (User -> Text -> User -> Text -> Team -> MembershipEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Organization forall a. Arbitrary a => Gen a arbitrary Gen (User -> Text -> User -> Text -> Team -> MembershipEvent) -> Gen User -> Gen (Text -> User -> Text -> Team -> MembershipEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen User forall a. Arbitrary a => Gen a arbitrary Gen (Text -> User -> Text -> Team -> MembershipEvent) -> Gen Text -> Gen (User -> Text -> Team -> MembershipEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (User -> Text -> Team -> MembershipEvent) -> Gen User -> Gen (Text -> Team -> MembershipEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen User forall a. Arbitrary a => Gen a arbitrary Gen (Text -> Team -> MembershipEvent) -> Gen Text -> Gen (Team -> MembershipEvent) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Text forall a. Arbitrary a => Gen a arbitrary Gen (Team -> MembershipEvent) -> Gen Team -> Gen MembershipEvent forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Gen Team forall a. Arbitrary a => Gen a arbitrary