-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Toolkit for building http client libraries over Network.Http.Conduit -- @package network-api-support @version 0.2.0 module Network.Api.Support.Response -- | Response handler. type Responder a = Request -> Response ByteString -> a -- | Wrap up json parse and decode errors. data JsonResult a ParseError :: Text -> JsonResult a DecodeError :: Text -> JsonResult a JsonSuccess :: a -> JsonResult a -- | Parse and decode body. parseBody :: FromJSON a => ByteString -> JsonResult a -- | Parse and decode body handling error cases and success case. parseBodyWith :: FromJSON a => ByteString -> (Text -> b) -> (Text -> b) -> (a -> b) -> b -- | Lift function handling status code and body into a responder. basicResponder :: (Int -> ByteString -> a) -> Responder a instance Show a => Show (JsonResult a) instance Eq a => Eq (JsonResult a) instance Monad JsonResult instance Applicative JsonResult instance Functor JsonResult module Network.Api.Support.Request -- | A RequestTransformer allows you to build up attributes on the request. -- | RequestTransformer is simply an Endo, and therefore has a Monoid, so -- | can be combined with <>. type RequestTransformer = Endo Request -- | Set an api key for use with basic auth. setApiKey :: ByteString -> RequestTransformer -- | Set URL encoded form params on the request body. setUrlEncodedBody :: [(ByteString, ByteString)] -> RequestTransformer -- | Set request query parameters. setQueryParams :: [(ByteString, Maybe ByteString)] -> RequestTransformer -- | Set request headers. setHeaders :: [(CI ByteString, ByteString)] -> RequestTransformer -- | Set a request headers. setHeader :: (CI ByteString, ByteString) -> RequestTransformer -- | Add a request headers. addHeader :: (CI ByteString, ByteString) -> RequestTransformer -- | Set a request headers. stripHeader :: CI ByteString -> RequestTransformer -- | Register all cookies in cookie jar against request. setCookieJar :: CookieJar -> UTCTime -> RequestTransformer -- | Set the request method to be the specified name. setMethod :: ByteString -> RequestTransformer -- | Set the request body from the specified byte string. setBody :: ByteString -> RequestTransformer -- | Set the request body from the specified lazy byte string. setBodyLazy :: ByteString -> RequestTransformer -- | Set the request body from the value which can be converted to JSON. setJson :: ToJSON a => a -> RequestTransformer -- | An infix synonym for mappend. -- -- Since: 4.5.0.0 (<>) :: Monoid m => m -> m -> m module Network.Api.Support.Core -- | Run a request using the specified settings, method, url and request -- transformer. runRequest :: ManagerSettings -> StdMethod -> Text -> RequestTransformer -> Responder b -> IO b -- | Run a request using the specified settings, url and request -- transformer. The method | can be set using the setMethod transformer. -- This is only useful if you require a | custom http method. Prefer -- runRequest where possible. runRequest' :: ManagerSettings -> Text -> RequestTransformer -> Responder b -> IO b -- | Toolkit for building http client libraries over Network.Http.Conduit module Network.Api.Support