funbot-client-0.1.0.1: Report events to FunBot over a JSON/HTTP API.

Safe HaskellNone
LanguageHaskell2010

FunBot.Client

Description

Using this module, you can send external events (such as git commits) to a running FunBot instance over HTTP.

Constructing events requires using types from the funbot-ext-events package. But you should not use the ExtEvent constructors from there, because if they change, it will break your code. Instead, use the functions provided below. This way new events can be added without breaking old code.

Synopsis

Documentation

data Bot Source

Reference to running FunBot instance to which you can send events.

data ExtEvent :: *

An event coming from one of the external event sources.

mkBot Source

Arguments

:: URI

URL at which the bot listens to client events.

-> Bool

Whether JSON data should be sent in pretty form, i.e. indented. This may be useful for debugging, but otherwise you should probably pass False here.

-> Bot 

Create a reference to a FunBot instance.

You can parse the URL at runtime using parseURI or at compile time using staticURI (or the uri quasi quoter in the same package).

sendExtEvent :: Bot -> ExtEvent -> IO (Maybe ConnError) Source

Send an event to a bot over HTTP. If successfully sent, return Nothing. If an error occurs, return Just the error details.

mkPushEvent :: Push -> ExtEvent Source

Construct a git push event.

mkTagEvent :: Tag -> ExtEvent Source

Construct a git tag event.

mkMergeRequestEvent :: MergeRequest -> ExtEvent Source

Construct a merge request event.

mkNewsEvent :: NewsItem -> ExtEvent Source

Construct a news item event.

mkPasteEvent :: Paste -> ExtEvent Source

Construct a paste event.