pusher-http-haskell-0.3.0.0: Haskell client library for the Pusher HTTP API

Copyright(c) Will Sewell, 2015
LicenseMIT
Maintainerme@willsewell.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Network.Pusher.Internal.HTTP

Description

A layer on top of the HTTP functions in the Wreq library which lifts the return values to the typclasses we are using in this library. Non 200 responses are converted into MonadError errors.

Synopsis

Documentation

class Monad m => MonadHTTP m where Source

These functions essentially abstract the corresponding functions from the Wreq library.

get Source

Arguments

:: (FromJSON a, Functor m, MonadError Text m, MonadHTTP m) 
=> Manager 
-> ByteString

The API endpoint, for example http://api.pusherapp.com/apps/123/events

-> [(ByteString, ByteString)]

List of query string parameters as key-value tuples

-> m a

The body of the response

Issue an HTTP GET request. On a 200 response, the response body is returned. On failure, an error will be thrown into the MonadError instance.

post :: (ToJSON a, Functor m, MonadError Text m, MonadHTTP m) => Manager -> ByteString -> [(ByteString, ByteString)] -> a -> m () Source

Issue an HTTP POST request.