pushover-0.1.0.0: A Haskell Pushover API library

Safe HaskellNone
LanguageHaskell2010

Network.Pushover.Execute

Contents

Description

This module exposes a set of functions used for constructing and submitting requests to the Pushover API.

Each function has two versions: a monadic version and a non-monadic version. The monadic versions are designed for use within an existing monad transformer stack within an existing application. The non-monadic versions are designed for standalone use.

Synopsis

Regular functions

sendMessage :: APIToken -> UserKey -> Message -> IO Response Source #

Send a request to the Pushover API.

Requires a pair of Pushover tokens, together with a Message value. These are used to construct a defaultRequest which is then sent to the API.

sendRequest :: Request -> IO Response Source #

Send a request to the Pushover API.

This is similar to sendMessage, except that a constructed Request must be passed instead of the tokens and message.

createRequest :: APIToken -> UserKey -> Message -> Request Source #

Create a standard Pushover request.

This is an alias of the defaultRequest function.

Monadic functions

sendMessageM :: (Error e, MonadError e m, MonadIO m, MonadReader r m, PushoverReader r) => Message -> m Response Source #

Send a request to the Pushover API.

This function is designed for use within an existing monad transformer stack to make it easy to send Pushover notifications from inside existing software.

The relevant tokens are read from a PushoverReader MonadReader instance. These are then used to construct a defaultRequest containing the passed Message value.

sendRequestM :: (Error e, MonadError e m, MonadIO m) => Request -> m Response Source #

Send a request to the Pushover API.

This function is designed for use within an existing monad transformer stack to make it easy to send Pushover notifications from inside existing software.

This is similar to sendMessageM, except that a constructed Request must be passed instead of just the message.

createRequestM :: (MonadReader r m, PushoverReader r) => Message -> m Request Source #

Create a standard Pushover request.

This is similar to createRequest, except that token information is read from within the monad stack.

data PushoverException Source #

Defines possible exceptions which can be thrown from execution commands.

Constructors

ResponseDecodeException

This exception is thrown when a response is malformed and cannot be decoded.

InvalidTokenCharactersException

This exception is thrown when a token cannot be constructed because it contains invalid characters.

InvalidTokenLengthException

This exception is thrown when a token cannot be constructed because it is an incorrect length.

PushoverException String

This is a generic exception for other errors in Pushover.