-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Toolkit for building http client libraries over Network.Http.Conduit
--
-- Toolkit for building http client libraries over Network.Http.Conduit.
--
-- Note: Examples of use can be found in the pin and postmark
-- client libraries.
@package network-api-support
@version 0.3.2
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 GHC.Classes.Eq a => GHC.Classes.Eq (Network.Api.Support.Response.JsonResult a)
instance GHC.Show.Show a => GHC.Show.Show (Network.Api.Support.Response.JsonResult a)
instance GHC.Base.Functor Network.Api.Support.Response.JsonResult
instance GHC.Base.Applicative Network.Api.Support.Response.JsonResult
instance GHC.Base.Monad Network.Api.Support.Response.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.
(<>) :: Monoid m => m -> m -> m
infixr 6 <>
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
-- | Run a request using the specified settings, method, url and request
-- transformer.
--
-- Prefer this to runRequest as recreating the manager every time is very
-- inefficient.
runRequestWith :: Manager -> StdMethod -> Text -> RequestTransformer -> Responder b -> IO b
-- | Run a request using the specified manager, 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.
--
-- Prefer this to runRequest' as recreating the manager every time is
-- very inefficient.
runRequestWith' :: Manager -> Text -> RequestTransformer -> Responder b -> IO b
-- | Toolkit for building http client libraries over Network.Http.Conduit
module Network.Api.Support