network-api-support-0.0.2: Toolkit for building http client libraries over Network.Http.Conduit

Safe HaskellNone

Network.Api.Support.Request

Synopsis

Documentation

type RequestTransformer m = Endo (Request (ResourceT m))Source

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 <>.

setApiKey :: ByteString -> RequestTransformer mSource

Set an api key for use with basic auth.

setParams :: Monad m => [(ByteString, ByteString)] -> RequestTransformer mSource

Set request query parameters.

setHeaders :: [(CI ByteString, ByteString)] -> RequestTransformer mSource

Set request headers.

setMethod :: ByteString -> RequestTransformer mSource

Set the request method to be the specified name.

setBody :: ByteString -> RequestTransformer mSource

Set the request body from the specified byte string.

setBodyLazy :: ByteString -> RequestTransformer mSource

Set the request body from the specified lazy byte string.

setJson :: ToJSON a => a -> RequestTransformer mSource

Set the request body from the value which can be converted to JSON.

(<>) :: Monoid m => m -> m -> m

An infix synonym for mappend.