{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module GitLab.SystemHooks.GitLabSystemHooks
( receive,
receiveString,
tryFire,
)
where
import qualified Control.Exception as E
import Control.Monad
import Control.Monad.IO.Class
import qualified Control.Monad.Reader as MR
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
import Data.Typeable
import GitLab.SystemHooks.Types
import GitLab.Types
import System.IO.Temp
import System.Posix.Files
receive :: [Rule] -> GitLab ()
receive :: [Rule] -> GitLab ()
receive [Rule]
rules = do
Text
eventContent <- IO Text -> GitLabT IO Text
forall a. IO a -> GitLabT IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO Text
TIO.getContents
Text -> [Rule] -> GitLab ()
receiveString Text
eventContent [Rule]
rules
receiveString :: Text -> [Rule] -> GitLab ()
receiveString :: Text -> [Rule] -> GitLab ()
receiveString Text
eventContent [Rule]
rules = do
Text -> GitLab ()
traceSystemHook Text
eventContent
(Rule -> GitLab ()) -> [Rule] -> GitLab ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (Text -> Rule -> GitLab ()
fire Text
eventContent) [Rule]
rules
traceSystemHook :: Text -> GitLab ()
traceSystemHook :: Text -> GitLab ()
traceSystemHook Text
eventContent = do
GitLabServerConfig
cfg <- GitLabState -> GitLabServerConfig
serverCfg (GitLabState -> GitLabServerConfig)
-> GitLabT IO GitLabState -> GitLabT IO GitLabServerConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GitLabT IO GitLabState
forall r (m :: * -> *). MonadReader r m => m r
MR.ask
IO () -> GitLab ()
forall a. IO a -> GitLabT IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> GitLab ()) -> IO () -> GitLab ()
forall a b. (a -> b) -> a -> b
$
IO () -> (ErrorCall -> IO ()) -> IO ()
forall e a. Exception e => IO a -> (e -> IO a) -> IO a
E.catch
( Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (GitLabServerConfig -> Bool
debugSystemHooks GitLabServerConfig
cfg) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
String
fpath <- String -> String -> IO String
writeSystemTempFile String
"gitlab-system-hook-" (Text -> String
T.unpack Text
eventContent)
IO () -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ String -> FileMode -> IO ()
setFileMode String
fpath FileMode
otherReadMode
)
(\(ErrorCall
_exception :: E.ErrorCall) -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())
orElse :: GitLab Bool -> GitLab Bool -> GitLab Bool
orElse :: GitLab Bool -> GitLab Bool -> GitLab Bool
orElse GitLab Bool
f GitLab Bool
g = do
Bool
x <- GitLab Bool
f
if Bool
x
then Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True
else GitLab Bool
g
fire :: Text -> Rule -> GitLab ()
fire :: Text -> Rule -> GitLab ()
fire Text
contents Rule
rule = do
Bool
result <- Text -> Rule -> GitLab Bool
tryFire Text
contents Rule
rule
Bool -> GitLab () -> GitLab ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
result (GitLab () -> GitLab ()) -> GitLab () -> GitLab ()
forall a b. (a -> b) -> a -> b
$
IO () -> GitLab ()
forall a. IO a -> GitLabT IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (String -> IO ()
putStrLn (String
"fired: " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Rule -> String
labelOf Rule
rule))
where
labelOf :: Rule -> String
labelOf :: Rule -> String
labelOf (Match String
lbl a -> GitLab ()
_) = String
lbl
labelOf (MatchIf String
lbl a -> GitLab Bool
_ a -> GitLab ()
_) = String
lbl
tryFire :: Text -> Rule -> GitLab Bool
tryFire :: Text -> Rule -> GitLab Bool
tryFire Text
contents (Match String
_ a -> GitLab ()
f) = do
Maybe (ProjectCreate -> GitLab Bool)
-> Maybe (ProjectCreate -> GitLab ())
-> Maybe ProjectCreate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((ProjectCreate -> GitLab Bool)
-> Maybe (ProjectCreate -> GitLab Bool)
forall a. a -> Maybe a
Just (\ProjectCreate
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (ProjectCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectCreate -> GitLab ()))
(Text -> Maybe ProjectCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectDestroy -> GitLab Bool)
-> Maybe (ProjectDestroy -> GitLab ())
-> Maybe ProjectDestroy
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((ProjectDestroy -> GitLab Bool)
-> Maybe (ProjectDestroy -> GitLab Bool)
forall a. a -> Maybe a
Just (\ProjectDestroy
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (ProjectDestroy -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectDestroy -> GitLab ()))
(Text -> Maybe ProjectDestroy
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectDestroy)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectRename -> GitLab Bool)
-> Maybe (ProjectRename -> GitLab ())
-> Maybe ProjectRename
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((ProjectRename -> GitLab Bool)
-> Maybe (ProjectRename -> GitLab Bool)
forall a. a -> Maybe a
Just (\ProjectRename
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (ProjectRename -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectRename -> GitLab ()))
(Text -> Maybe ProjectRename
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectRename)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectTransfer -> GitLab Bool)
-> Maybe (ProjectTransfer -> GitLab ())
-> Maybe ProjectTransfer
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((ProjectTransfer -> GitLab Bool)
-> Maybe (ProjectTransfer -> GitLab Bool)
forall a. a -> Maybe a
Just (\ProjectTransfer
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (ProjectTransfer -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectTransfer -> GitLab ()))
(Text -> Maybe ProjectTransfer
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectTransfer)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectUpdate -> GitLab Bool)
-> Maybe (ProjectUpdate -> GitLab ())
-> Maybe ProjectUpdate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((ProjectUpdate -> GitLab Bool)
-> Maybe (ProjectUpdate -> GitLab Bool)
forall a. a -> Maybe a
Just (\ProjectUpdate
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (ProjectUpdate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectUpdate -> GitLab ()))
(Text -> Maybe ProjectUpdate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectUpdate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupMemberUpdate -> GitLab Bool)
-> Maybe (GroupMemberUpdate -> GitLab ())
-> Maybe GroupMemberUpdate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((GroupMemberUpdate -> GitLab Bool)
-> Maybe (GroupMemberUpdate -> GitLab Bool)
forall a. a -> Maybe a
Just (\GroupMemberUpdate
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (GroupMemberUpdate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupMemberUpdate -> GitLab ()))
(Text -> Maybe GroupMemberUpdate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupMemberUpdate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserAddToTeam -> GitLab Bool)
-> Maybe (UserAddToTeam -> GitLab ())
-> Maybe UserAddToTeam
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((UserAddToTeam -> GitLab Bool)
-> Maybe (UserAddToTeam -> GitLab Bool)
forall a. a -> Maybe a
Just (\UserAddToTeam
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (UserAddToTeam -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserAddToTeam -> GitLab ()))
(Text -> Maybe UserAddToTeam
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserAddToTeam)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserUpdateForTeam -> GitLab Bool)
-> Maybe (UserUpdateForTeam -> GitLab ())
-> Maybe UserUpdateForTeam
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((UserUpdateForTeam -> GitLab Bool)
-> Maybe (UserUpdateForTeam -> GitLab Bool)
forall a. a -> Maybe a
Just (\UserUpdateForTeam
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (UserUpdateForTeam -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserUpdateForTeam -> GitLab ()))
(Text -> Maybe UserUpdateForTeam
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserUpdateForTeam)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserRemoveFromTeam -> GitLab Bool)
-> Maybe (UserRemoveFromTeam -> GitLab ())
-> Maybe UserRemoveFromTeam
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((UserRemoveFromTeam -> GitLab Bool)
-> Maybe (UserRemoveFromTeam -> GitLab Bool)
forall a. a -> Maybe a
Just (\UserRemoveFromTeam
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (UserRemoveFromTeam -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserRemoveFromTeam -> GitLab ()))
(Text -> Maybe UserRemoveFromTeam
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserRemoveFromTeam)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserCreate -> GitLab Bool)
-> Maybe (UserCreate -> GitLab ())
-> Maybe UserCreate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((UserCreate -> GitLab Bool) -> Maybe (UserCreate -> GitLab Bool)
forall a. a -> Maybe a
Just (\UserCreate
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (UserCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserCreate -> GitLab ()))
(Text -> Maybe UserCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserRemove -> GitLab Bool)
-> Maybe (UserRemove -> GitLab ())
-> Maybe UserRemove
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((UserRemove -> GitLab Bool) -> Maybe (UserRemove -> GitLab Bool)
forall a. a -> Maybe a
Just (\UserRemove
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (UserRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserRemove -> GitLab ()))
(Text -> Maybe UserRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserFailedLogin -> GitLab Bool)
-> Maybe (UserFailedLogin -> GitLab ())
-> Maybe UserFailedLogin
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((UserFailedLogin -> GitLab Bool)
-> Maybe (UserFailedLogin -> GitLab Bool)
forall a. a -> Maybe a
Just (\UserFailedLogin
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (UserFailedLogin -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserFailedLogin -> GitLab ()))
(Text -> Maybe UserFailedLogin
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserFailedLogin)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserRename -> GitLab Bool)
-> Maybe (UserRename -> GitLab ())
-> Maybe UserRename
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((UserRename -> GitLab Bool) -> Maybe (UserRename -> GitLab Bool)
forall a. a -> Maybe a
Just (\UserRename
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (UserRename -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserRename -> GitLab ()))
(Text -> Maybe UserRename
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserRename)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (KeyCreate -> GitLab Bool)
-> Maybe (KeyCreate -> GitLab ()) -> Maybe KeyCreate -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((KeyCreate -> GitLab Bool) -> Maybe (KeyCreate -> GitLab Bool)
forall a. a -> Maybe a
Just (\KeyCreate
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (KeyCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (KeyCreate -> GitLab ()))
(Text -> Maybe KeyCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe KeyCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (KeyRemove -> GitLab Bool)
-> Maybe (KeyRemove -> GitLab ()) -> Maybe KeyRemove -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((KeyRemove -> GitLab Bool) -> Maybe (KeyRemove -> GitLab Bool)
forall a. a -> Maybe a
Just (\KeyRemove
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (KeyRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (KeyRemove -> GitLab ()))
(Text -> Maybe KeyRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe KeyRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupCreate -> GitLab Bool)
-> Maybe (GroupCreate -> GitLab ())
-> Maybe GroupCreate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((GroupCreate -> GitLab Bool) -> Maybe (GroupCreate -> GitLab Bool)
forall a. a -> Maybe a
Just (\GroupCreate
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (GroupCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupCreate -> GitLab ()))
(Text -> Maybe GroupCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupRemove -> GitLab Bool)
-> Maybe (GroupRemove -> GitLab ())
-> Maybe GroupRemove
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((GroupRemove -> GitLab Bool) -> Maybe (GroupRemove -> GitLab Bool)
forall a. a -> Maybe a
Just (\GroupRemove
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (GroupRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupRemove -> GitLab ()))
(Text -> Maybe GroupRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupRename -> GitLab Bool)
-> Maybe (GroupRename -> GitLab ())
-> Maybe GroupRename
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((GroupRename -> GitLab Bool) -> Maybe (GroupRename -> GitLab Bool)
forall a. a -> Maybe a
Just (\GroupRename
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (GroupRename -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupRename -> GitLab ()))
(Text -> Maybe GroupRename
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupRename)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (NewGroupMember -> GitLab Bool)
-> Maybe (NewGroupMember -> GitLab ())
-> Maybe NewGroupMember
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((NewGroupMember -> GitLab Bool)
-> Maybe (NewGroupMember -> GitLab Bool)
forall a. a -> Maybe a
Just (\NewGroupMember
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (NewGroupMember -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (NewGroupMember -> GitLab ()))
(Text -> Maybe NewGroupMember
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe NewGroupMember)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupMemberRemove -> GitLab Bool)
-> Maybe (GroupMemberRemove -> GitLab ())
-> Maybe GroupMemberRemove
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((GroupMemberRemove -> GitLab Bool)
-> Maybe (GroupMemberRemove -> GitLab Bool)
forall a. a -> Maybe a
Just (\GroupMemberRemove
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (GroupMemberRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupMemberRemove -> GitLab ()))
(Text -> Maybe GroupMemberRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupMemberRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (Push -> GitLab Bool)
-> Maybe (Push -> GitLab ()) -> Maybe Push -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((Push -> GitLab Bool) -> Maybe (Push -> GitLab Bool)
forall a. a -> Maybe a
Just (\Push
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (Push -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (Push -> GitLab ()))
(Text -> Maybe Push
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe Push)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (TagPush -> GitLab Bool)
-> Maybe (TagPush -> GitLab ()) -> Maybe TagPush -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((TagPush -> GitLab Bool) -> Maybe (TagPush -> GitLab Bool)
forall a. a -> Maybe a
Just (\TagPush
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (TagPush -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (TagPush -> GitLab ()))
(Text -> Maybe TagPush
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe TagPush)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (RepositoryUpdate -> GitLab Bool)
-> Maybe (RepositoryUpdate -> GitLab ())
-> Maybe RepositoryUpdate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((RepositoryUpdate -> GitLab Bool)
-> Maybe (RepositoryUpdate -> GitLab Bool)
forall a. a -> Maybe a
Just (\RepositoryUpdate
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (RepositoryUpdate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (RepositoryUpdate -> GitLab ()))
(Text -> Maybe RepositoryUpdate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe RepositoryUpdate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (MergeRequestEvent -> GitLab Bool)
-> Maybe (MergeRequestEvent -> GitLab ())
-> Maybe MergeRequestEvent
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((MergeRequestEvent -> GitLab Bool)
-> Maybe (MergeRequestEvent -> GitLab Bool)
forall a. a -> Maybe a
Just (\MergeRequestEvent
_ -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True))
((a -> GitLab ()) -> Maybe (MergeRequestEvent -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (MergeRequestEvent -> GitLab ()))
(Text -> Maybe MergeRequestEvent
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe MergeRequestEvent)
tryFire Text
contents (MatchIf String
_ a -> GitLab Bool
predF a -> GitLab ()
f) = do
Maybe (ProjectCreate -> GitLab Bool)
-> Maybe (ProjectCreate -> GitLab ())
-> Maybe ProjectCreate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (ProjectCreate -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (ProjectCreate -> GitLab Bool))
((a -> GitLab ()) -> Maybe (ProjectCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectCreate -> GitLab ()))
(Text -> Maybe ProjectCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectDestroy -> GitLab Bool)
-> Maybe (ProjectDestroy -> GitLab ())
-> Maybe ProjectDestroy
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (ProjectDestroy -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (ProjectDestroy -> GitLab Bool))
((a -> GitLab ()) -> Maybe (ProjectDestroy -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectDestroy -> GitLab ()))
(Text -> Maybe ProjectDestroy
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectDestroy)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectRename -> GitLab Bool)
-> Maybe (ProjectRename -> GitLab ())
-> Maybe ProjectRename
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (ProjectRename -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (ProjectRename -> GitLab Bool))
((a -> GitLab ()) -> Maybe (ProjectRename -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectRename -> GitLab ()))
(Text -> Maybe ProjectRename
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectRename)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectTransfer -> GitLab Bool)
-> Maybe (ProjectTransfer -> GitLab ())
-> Maybe ProjectTransfer
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (ProjectTransfer -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (ProjectTransfer -> GitLab Bool))
((a -> GitLab ()) -> Maybe (ProjectTransfer -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectTransfer -> GitLab ()))
(Text -> Maybe ProjectTransfer
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectTransfer)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (ProjectUpdate -> GitLab Bool)
-> Maybe (ProjectUpdate -> GitLab ())
-> Maybe ProjectUpdate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (ProjectUpdate -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (ProjectUpdate -> GitLab Bool))
((a -> GitLab ()) -> Maybe (ProjectUpdate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (ProjectUpdate -> GitLab ()))
(Text -> Maybe ProjectUpdate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe ProjectUpdate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupMemberUpdate -> GitLab Bool)
-> Maybe (GroupMemberUpdate -> GitLab ())
-> Maybe GroupMemberUpdate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (GroupMemberUpdate -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (GroupMemberUpdate -> GitLab Bool))
((a -> GitLab ()) -> Maybe (GroupMemberUpdate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupMemberUpdate -> GitLab ()))
(Text -> Maybe GroupMemberUpdate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupMemberUpdate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserAddToTeam -> GitLab Bool)
-> Maybe (UserAddToTeam -> GitLab ())
-> Maybe UserAddToTeam
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (UserAddToTeam -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (UserAddToTeam -> GitLab Bool))
((a -> GitLab ()) -> Maybe (UserAddToTeam -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserAddToTeam -> GitLab ()))
(Text -> Maybe UserAddToTeam
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserAddToTeam)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserUpdateForTeam -> GitLab Bool)
-> Maybe (UserUpdateForTeam -> GitLab ())
-> Maybe UserUpdateForTeam
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (UserUpdateForTeam -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (UserUpdateForTeam -> GitLab Bool))
((a -> GitLab ()) -> Maybe (UserUpdateForTeam -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserUpdateForTeam -> GitLab ()))
(Text -> Maybe UserUpdateForTeam
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserUpdateForTeam)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserRemoveFromTeam -> GitLab Bool)
-> Maybe (UserRemoveFromTeam -> GitLab ())
-> Maybe UserRemoveFromTeam
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (UserRemoveFromTeam -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (UserRemoveFromTeam -> GitLab Bool))
((a -> GitLab ()) -> Maybe (UserRemoveFromTeam -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserRemoveFromTeam -> GitLab ()))
(Text -> Maybe UserRemoveFromTeam
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserRemoveFromTeam)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserCreate -> GitLab Bool)
-> Maybe (UserCreate -> GitLab ())
-> Maybe UserCreate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (UserCreate -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (UserCreate -> GitLab Bool))
((a -> GitLab ()) -> Maybe (UserCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserCreate -> GitLab ()))
(Text -> Maybe UserCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserRemove -> GitLab Bool)
-> Maybe (UserRemove -> GitLab ())
-> Maybe UserRemove
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (UserRemove -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (UserRemove -> GitLab Bool))
((a -> GitLab ()) -> Maybe (UserRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserRemove -> GitLab ()))
(Text -> Maybe UserRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserFailedLogin -> GitLab Bool)
-> Maybe (UserFailedLogin -> GitLab ())
-> Maybe UserFailedLogin
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (UserFailedLogin -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (UserFailedLogin -> GitLab Bool))
((a -> GitLab ()) -> Maybe (UserFailedLogin -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserFailedLogin -> GitLab ()))
(Text -> Maybe UserFailedLogin
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserFailedLogin)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (UserRename -> GitLab Bool)
-> Maybe (UserRename -> GitLab ())
-> Maybe UserRename
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (UserRename -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (UserRename -> GitLab Bool))
((a -> GitLab ()) -> Maybe (UserRename -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (UserRename -> GitLab ()))
(Text -> Maybe UserRename
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe UserRename)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (KeyCreate -> GitLab Bool)
-> Maybe (KeyCreate -> GitLab ()) -> Maybe KeyCreate -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (KeyCreate -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (KeyCreate -> GitLab Bool))
((a -> GitLab ()) -> Maybe (KeyCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (KeyCreate -> GitLab ()))
(Text -> Maybe KeyCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe KeyCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (KeyRemove -> GitLab Bool)
-> Maybe (KeyRemove -> GitLab ()) -> Maybe KeyRemove -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (KeyRemove -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (KeyRemove -> GitLab Bool))
((a -> GitLab ()) -> Maybe (KeyRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (KeyRemove -> GitLab ()))
(Text -> Maybe KeyRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe KeyRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupCreate -> GitLab Bool)
-> Maybe (GroupCreate -> GitLab ())
-> Maybe GroupCreate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (GroupCreate -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (GroupCreate -> GitLab Bool))
((a -> GitLab ()) -> Maybe (GroupCreate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupCreate -> GitLab ()))
(Text -> Maybe GroupCreate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupCreate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupRemove -> GitLab Bool)
-> Maybe (GroupRemove -> GitLab ())
-> Maybe GroupRemove
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (GroupRemove -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (GroupRemove -> GitLab Bool))
((a -> GitLab ()) -> Maybe (GroupRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupRemove -> GitLab ()))
(Text -> Maybe GroupRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupRename -> GitLab Bool)
-> Maybe (GroupRename -> GitLab ())
-> Maybe GroupRename
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (GroupRename -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (GroupRename -> GitLab Bool))
((a -> GitLab ()) -> Maybe (GroupRename -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupRename -> GitLab ()))
(Text -> Maybe GroupRename
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupRename)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (NewGroupMember -> GitLab Bool)
-> Maybe (NewGroupMember -> GitLab ())
-> Maybe NewGroupMember
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (NewGroupMember -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (NewGroupMember -> GitLab Bool))
((a -> GitLab ()) -> Maybe (NewGroupMember -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (NewGroupMember -> GitLab ()))
(Text -> Maybe NewGroupMember
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe NewGroupMember)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (GroupMemberRemove -> GitLab Bool)
-> Maybe (GroupMemberRemove -> GitLab ())
-> Maybe GroupMemberRemove
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (GroupMemberRemove -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (GroupMemberRemove -> GitLab Bool))
((a -> GitLab ()) -> Maybe (GroupMemberRemove -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (GroupMemberRemove -> GitLab ()))
(Text -> Maybe GroupMemberRemove
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe GroupMemberRemove)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (Push -> GitLab Bool)
-> Maybe (Push -> GitLab ()) -> Maybe Push -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (Push -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (Push -> GitLab Bool))
((a -> GitLab ()) -> Maybe (Push -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (Push -> GitLab ()))
(Text -> Maybe Push
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe Push)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (TagPush -> GitLab Bool)
-> Maybe (TagPush -> GitLab ()) -> Maybe TagPush -> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (TagPush -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (TagPush -> GitLab Bool))
((a -> GitLab ()) -> Maybe (TagPush -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (TagPush -> GitLab ()))
(Text -> Maybe TagPush
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe TagPush)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (RepositoryUpdate -> GitLab Bool)
-> Maybe (RepositoryUpdate -> GitLab ())
-> Maybe RepositoryUpdate
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (RepositoryUpdate -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (RepositoryUpdate -> GitLab Bool))
((a -> GitLab ()) -> Maybe (RepositoryUpdate -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (RepositoryUpdate -> GitLab ()))
(Text -> Maybe RepositoryUpdate
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe RepositoryUpdate)
GitLab Bool -> GitLab Bool -> GitLab Bool
`orElse` Maybe (MergeRequestEvent -> GitLab Bool)
-> Maybe (MergeRequestEvent -> GitLab ())
-> Maybe MergeRequestEvent
-> GitLab Bool
forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf'
((a -> GitLab Bool) -> Maybe (MergeRequestEvent -> GitLab Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab Bool
predF :: Maybe (MergeRequestEvent -> GitLab Bool))
((a -> GitLab ()) -> Maybe (MergeRequestEvent -> GitLab ())
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a -> GitLab ()
f :: Maybe (MergeRequestEvent -> GitLab ()))
(Text -> Maybe MergeRequestEvent
forall a. FromJSON a => Text -> Maybe a
parseEvent Text
contents :: Maybe MergeRequestEvent)
fireIf' :: (Typeable a, Show a) => Maybe (a -> GitLab Bool) -> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf' :: forall a.
(Typeable a, Show a) =>
Maybe (a -> GitLab Bool)
-> Maybe (a -> GitLab ()) -> Maybe a -> GitLab Bool
fireIf' Maybe (a -> GitLab Bool)
castPred Maybe (a -> GitLab ())
castF Maybe a
parsed = do
case Maybe (a -> GitLab Bool)
castPred of
Maybe (a -> GitLab Bool)
Nothing -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
Just a -> GitLab Bool
pred' ->
case Maybe (a -> GitLab ())
castF of
Maybe (a -> GitLab ())
Nothing -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
Just a -> GitLab ()
f' ->
case Maybe a
parsed of
Maybe a
Nothing -> Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
Just a
parsed' -> do
Bool
testPred <- a -> GitLab Bool
pred' a
parsed'
if Bool
testPred
then do
a -> GitLab ()
f' a
parsed'
Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True
else Bool -> GitLab Bool
forall a. a -> GitLabT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False