-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | High level HTTP client for Haskell -- -- Please see README.md @package http-dispatch @version 0.5.0.2 module Network.HTTP.Dispatch.Types type Url = String type Headers = [Header] type Body = ByteString data HTTPRequestMethod GET :: HTTPRequestMethod PUT :: HTTPRequestMethod POST :: HTTPRequestMethod PATCH :: HTTPRequestMethod DELETE :: HTTPRequestMethod type Header = (ByteString, ByteString) data HTTPRequest HTTPRequest :: HTTPRequestMethod -> String -> [Header] -> Maybe ByteString -> HTTPRequest [reqMethod] :: HTTPRequest -> HTTPRequestMethod [reqUrl] :: HTTPRequest -> String [reqHeaders] :: HTTPRequest -> [Header] [reqBody] :: HTTPRequest -> Maybe ByteString data HTTPResponse HTTPResponse :: Int -> [Header] -> ByteString -> HTTPResponse [respStatus] :: HTTPResponse -> Int [respHeaders] :: HTTPResponse -> [Header] [respBody] :: HTTPResponse -> ByteString header :: String -> String -> Header withHeader :: HTTPRequest -> Header -> HTTPRequest withHeaders :: HTTPRequest -> [Header] -> HTTPRequest withBody :: HTTPRequest -> ByteString -> HTTPRequest withMethod :: HTTPRequest -> HTTPRequestMethod -> HTTPRequest dropHeaderWithKey :: HTTPRequest -> ByteString -> HTTPRequest instance GHC.Show.Show Network.HTTP.Dispatch.Types.HTTPResponse instance GHC.Classes.Eq Network.HTTP.Dispatch.Types.HTTPResponse instance GHC.Show.Show Network.HTTP.Dispatch.Types.HTTPRequest instance GHC.Classes.Eq Network.HTTP.Dispatch.Types.HTTPRequest instance GHC.Show.Show Network.HTTP.Dispatch.Types.HTTPRequestMethod instance GHC.Classes.Eq Network.HTTP.Dispatch.Types.HTTPRequestMethod module Network.HTTP.Dispatch.Headers -- | Create a new content type header contentType :: String -> Header -- | Return a JSON content type header contentJSON :: Header -- | Return an XML content type header contentXML :: Header -- | Helper to generate Basic authentication basicAuth :: ByteString -> ByteString -> Header module Network.HTTP.Dispatch.Internal.Request -- | Transforms a dispatch request into a low level http-client request toRequest :: HTTPRequest -> IO Request runRequest :: Runnable a => a -> IO HTTPResponse instance Network.HTTP.Dispatch.Internal.Request.Runnable Network.HTTP.Dispatch.Types.HTTPRequest module Network.HTTP.Dispatch.Core data HTTPRequest HTTPRequest :: HTTPRequestMethod -> String -> [Header] -> Maybe ByteString -> HTTPRequest [reqMethod] :: HTTPRequest -> HTTPRequestMethod [reqUrl] :: HTTPRequest -> String [reqHeaders] :: HTTPRequest -> [Header] [reqBody] :: HTTPRequest -> Maybe ByteString data HTTPResponse HTTPResponse :: Int -> [Header] -> ByteString -> HTTPResponse [respStatus] :: HTTPResponse -> Int [respHeaders] :: HTTPResponse -> [Header] [respBody] :: HTTPResponse -> ByteString data HTTPRequestMethod GET :: HTTPRequestMethod PUT :: HTTPRequestMethod POST :: HTTPRequestMethod PATCH :: HTTPRequestMethod DELETE :: HTTPRequestMethod runRequest :: Runnable a => a -> IO HTTPResponse -- | Make a simple HTTP GET request -- --
-- get "http://google.com"
--
-- HTTPRequest { reqMethod = GET
-- , reqUrl = "http://google.com"
-- , reqHeaders = []
-- , reqBody = Nothing
-- }
--
get :: Url -> HTTPRequest
-- | Make a simple HTTP GET request with headers
--
--
-- getWithHeaders "http://google.com" [header Content-Type "application/json"]
--
-- HTTPRequest { reqMethod = GET
-- , reqUrl = "http://google.com"
-- , reqHeaders = [(Content-Type,"application/json")]
-- , reqBody = Nothing
-- }
--
getWithHeaders :: String -> [Header] -> HTTPRequest
-- | Make a simple HTTP POST request
post :: Url -> Body -> HTTPRequest
-- | Make a HTTP POST request with headers
postWithHeaders :: Url -> Headers -> Body -> HTTPRequest
-- | Make a HTTP PUT request
put :: Url -> Body -> HTTPRequest
-- | Make a HTTP PUT request with headers
putWithHeaders :: Url -> Headers -> Body -> HTTPRequest
-- | Make a HTTP PATCH request
patch :: Url -> Body -> HTTPRequest
-- | Make a HTTP PATCH request with headers
patchWithHeaders :: Url -> Headers -> Body -> HTTPRequest
-- | Make a HTTP DELETE request
delete :: Url -> HTTPRequest
-- | Make a HTTP DELETE request with headers
deleteWithHeaders :: Url -> Headers -> HTTPRequest
-- | Add query params to a request URL
--
--
-- withQueryParams (get "http://google.com") [("foo", "bar")]
--
-- HTTPRequest { reqMethod = GET
-- , reqUrl = "http://google.com?foo=bar"
-- , reqHeaders = []
-- , reqBody = Nothing
-- }
--
withQueryParams :: HTTPRequest -> [(String, String)] -> HTTPRequest