github-webhook-handler-0.0.2: GitHub WebHook Handler

Safe HaskellNone
LanguageHaskell2010

GitHub.WebHook.Handler

Documentation

data Handler m Source

Constructors

Handler 

Fields

hSecretKey :: Maybe String

Optional key which is used to authenticate the incoming request.

hBody :: m ByteString

Action which is used to read the request body.

hHeader :: ByteString -> m (Maybe ByteString)

Action which is used to retrieve a particular header from the request.

hAction :: Either Error (UUID, Event) -> m ()

Action which is executed once we've processed all the information in the request. GitHub includes a unique UUID in each request.

data Error Source

Constructors

InvalidRequest

The incoming request is not well-formed. If that happens it means GitHub screwed something up, or changed the format of the request.

ParseError !Text

The request looks valid but we failed to parse the payload. This could be because our parsing code is wrong, or because GitHub added a new event type which we don't handle yet.

UnsignedRequest

We were expecting a signed request but no signature was included. Such requests are rejected beause we don't want to accept requests from untrusted sources.

InvalidSignature

A signature was included in the request but it did not match the secret key which was providid to the handler. Usually points to a configuration error on either end.

runHandler :: Monad m => Handler m -> m () Source