Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- sendMessage :: APIToken -> UserKey -> Message -> IO Response
- sendRequest :: Request -> IO Response
- createRequest :: APIToken -> UserKey -> Message -> Request
- sendMessageM :: (Error e, MonadError e m, MonadIO m, MonadReader r m, PushoverReader r) => Message -> m Response
- sendRequestM :: (Error e, MonadError e m, MonadIO m) => Request -> m Response
- createRequestM :: (MonadReader r m, PushoverReader r) => Message -> m Request
- data PushoverException
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.
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. |