-- 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: This library is under heavy development, currently the -- library is functional but undocumented. Examples of use can be found -- in the pin and postmark client libraries. Basically expect -- improvements and change. @package network-api-support @version 0.0.2 module Network.Api.Support.Security -- | A TLS validator that checks the domain only. Note that this means the -- validator | will not check the cert chain, and can be used on systems -- where Data.Certificate.X509 | falls over as it does not have access to -- local root certs. | | ! Use with caution ! checkDomainOnly :: ByteString -> [X509] -> IO TLSCertificateUsage module Network.Api.Support.Response -- | Response handler. type Responder a = 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 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 m = Endo (Request (ResourceT m)) -- | Set an api key for use with basic auth. setApiKey :: ByteString -> RequestTransformer m -- | Set request query parameters. setParams :: Monad m => [(ByteString, ByteString)] -> RequestTransformer m -- | Set request headers. setHeaders :: [(CI ByteString, ByteString)] -> RequestTransformer m -- | Set the request method to be the specified name. setMethod :: ByteString -> RequestTransformer m -- | Set the request body from the specified byte string. setBody :: ByteString -> RequestTransformer m -- | Set the request body from the specified lazy byte string. setBodyLazy :: ByteString -> RequestTransformer m -- | Set the request body from the value which can be converted to JSON. setJson :: ToJSON a => a -> RequestTransformer m -- | An infix synonym for mappend. (<>) :: Monoid m => m -> m -> m module Network.Api.Support.Core -- | Run a request using the specified settings, method, url and request -- transformer. runRequest :: (MonadIO m, MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m, Failure HttpException m) => ManagerSettings -> StdMethod -> Text -> RequestTransformer m -> Responder b -> m 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' :: (MonadIO m, MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m, Failure HttpException m) => ManagerSettings -> Text -> RequestTransformer m -> Responder b -> m b -- | Toolkit for building http client libraries over Network.Http.Conduit module Network.Api.Support