Copyright | (c) 2014 Bryan O'Sullivan |
---|---|
License | BSD-style |
Maintainer | bos@serpentine.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell98 |
Network.Wreq.Types
Description
HTTP client types.
Synopsis
- data Options = Options {}
- data Auth
- = BasicAuth ByteString ByteString
- | OAuth2Bearer ByteString
- | OAuth2Token ByteString
- | AWSAuth AWSAuthVersion ByteString ByteString (Maybe ByteString)
- | AWSFullAuth AWSAuthVersion ByteString ByteString (Maybe ByteString) (Maybe (ByteString, ByteString))
- | OAuth1 ByteString ByteString ByteString ByteString
- data AWSAuthVersion = AWSv4
- type ResponseChecker = Request -> Response BodyReader -> IO ()
- data Payload where
- Raw :: ContentType -> RequestBody -> Payload
- class Postable a where
- postPayload :: a -> Request -> IO Request
- class Putable a where
- putPayload :: a -> Request -> IO Request
- data FormParam where
- class FormValue a where
- renderFormValue :: a -> ByteString
- type ContentType = ByteString
- data Link = Link {
- linkURL :: ByteString
- linkParams :: [(ByteString, ByteString)]
- data JSONError = JSONError String
- data Req
- reqURL :: Req -> ByteString
- type Run body = Req -> IO (Response body)
Client configuration
Options for configuring a client.
Constructors
Options | |
Fields
|
Supported authentication types.
Do not use HTTP authentication unless you are using TLS encryption. These authentication tokens can easily be captured and reused by an attacker if transmitted in the clear.
Constructors
BasicAuth ByteString ByteString | Basic authentication. This consists of a plain username and password. |
OAuth2Bearer ByteString | An OAuth2 bearer token. This is treated by many services as the equivalent of a username and password. |
OAuth2Token ByteString | A not-quite-standard OAuth2 bearer token (that seems to be used only by GitHub). This is treated by whoever accepts it as the equivalent of a username and password. |
AWSAuth AWSAuthVersion ByteString ByteString (Maybe ByteString) | Amazon Web Services request signing AWSAuthVersion key secret (optional: session-token) |
AWSFullAuth AWSAuthVersion ByteString ByteString (Maybe ByteString) (Maybe (ByteString, ByteString)) | Amazon Web Services request signing AWSAuthVersion key secret Maybe (service, region) |
OAuth1 ByteString ByteString ByteString ByteString | OAuth1 request signing OAuth1 consumerToken consumerSecret token secret |
data AWSAuthVersion Source #
Constructors
AWSv4 | AWS request signing version 4 |
Instances
Eq AWSAuthVersion Source # | |
Defined in Network.Wreq.Internal.Types Methods (==) :: AWSAuthVersion -> AWSAuthVersion -> Bool (/=) :: AWSAuthVersion -> AWSAuthVersion -> Bool | |
Show AWSAuthVersion Source # | |
Defined in Network.Wreq.Internal.Types Methods showsPrec :: Int -> AWSAuthVersion -> ShowS show :: AWSAuthVersion -> String showList :: [AWSAuthVersion] -> ShowS |
type ResponseChecker = Request -> Response BodyReader -> IO () Source #
A function that checks the result of a HTTP request and potentially returns an exception.
Request payloads
A product type for representing more complex payload types.
Constructors
Raw :: ContentType -> RequestBody -> Payload |
Instances
Putable Payload Source # | |
Defined in Network.Wreq.Types Methods putPayload :: Payload -> Request -> IO Request Source # | |
Postable Payload Source # | |
Defined in Network.Wreq.Types Methods postPayload :: Payload -> Request -> IO Request Source # |
class Postable a where Source #
A type that can be converted into a POST request payload.
Minimal complete definition
Nothing
Methods
postPayload :: a -> Request -> IO Request Source #
default postPayload :: Putable a => a -> Request -> IO Request Source #
Instances
Postable ByteString Source # | |
Defined in Network.Wreq.Types Methods postPayload :: ByteString -> Request -> IO Request Source # | |
Postable ByteString Source # | |
Defined in Network.Wreq.Types Methods postPayload :: ByteString -> Request -> IO Request Source # | |
Postable FormParam Source # | |
Defined in Network.Wreq.Types Methods postPayload :: FormParam -> Request -> IO Request Source # | |
Postable Payload Source # | |
Defined in Network.Wreq.Types Methods postPayload :: Payload -> Request -> IO Request Source # | |
Postable Encoding Source # | |
Defined in Network.Wreq.Types Methods postPayload :: Encoding -> Request -> IO Request Source # | |
Postable Value Source # | |
Defined in Network.Wreq.Types Methods postPayload :: Value -> Request -> IO Request Source # | |
Postable Part Source # | |
Defined in Network.Wreq.Types Methods postPayload :: Part -> Request -> IO Request Source # | |
Postable [(ByteString, ByteString)] Source # | |
Defined in Network.Wreq.Types Methods postPayload :: [(ByteString, ByteString)] -> Request -> IO Request Source # | |
Postable [FormParam] Source # | |
Defined in Network.Wreq.Types Methods postPayload :: [FormParam] -> Request -> IO Request Source # | |
Postable [Part] Source # | |
Defined in Network.Wreq.Types Methods postPayload :: [Part] -> Request -> IO Request Source # | |
Postable (ByteString, ByteString) Source # | |
Defined in Network.Wreq.Types Methods postPayload :: (ByteString, ByteString) -> Request -> IO Request Source # |
class Putable a where Source #
A type that can be converted into a PUT request payload.
Methods
putPayload :: a -> Request -> IO Request Source #
Represent a value in the request body (and perhaps the headers) of a PUT request.
Instances
Putable ByteString Source # | |
Defined in Network.Wreq.Types Methods putPayload :: ByteString -> Request -> IO Request Source # | |
Putable ByteString Source # | |
Defined in Network.Wreq.Types Methods putPayload :: ByteString -> Request -> IO Request Source # | |
Putable FormParam Source # | |
Defined in Network.Wreq.Types Methods putPayload :: FormParam -> Request -> IO Request Source # | |
Putable Payload Source # | |
Defined in Network.Wreq.Types Methods putPayload :: Payload -> Request -> IO Request Source # | |
Putable Encoding Source # | |
Defined in Network.Wreq.Types Methods putPayload :: Encoding -> Request -> IO Request Source # | |
Putable Value Source # | |
Defined in Network.Wreq.Types Methods putPayload :: Value -> Request -> IO Request Source # | |
Putable Part Source # | |
Defined in Network.Wreq.Types Methods putPayload :: Part -> Request -> IO Request Source # | |
Putable [(ByteString, ByteString)] Source # | |
Defined in Network.Wreq.Types Methods putPayload :: [(ByteString, ByteString)] -> Request -> IO Request Source # | |
Putable [FormParam] Source # | |
Defined in Network.Wreq.Types Methods putPayload :: [FormParam] -> Request -> IO Request Source # | |
Putable [Part] Source # | |
Defined in Network.Wreq.Types Methods putPayload :: [Part] -> Request -> IO Request Source # | |
Putable (ByteString, ByteString) Source # | |
Defined in Network.Wreq.Types Methods putPayload :: (ByteString, ByteString) -> Request -> IO Request Source # |
URL-encoded forms
A key/value pair for an application/x-www-form-urlencoded
POST request body.
Instances
Show FormParam Source # | |
Putable FormParam Source # | |
Defined in Network.Wreq.Types Methods putPayload :: FormParam -> Request -> IO Request Source # | |
Postable FormParam Source # | |
Defined in Network.Wreq.Types Methods postPayload :: FormParam -> Request -> IO Request Source # | |
Putable [FormParam] Source # | |
Defined in Network.Wreq.Types Methods putPayload :: [FormParam] -> Request -> IO Request Source # | |
Postable [FormParam] Source # | |
Defined in Network.Wreq.Types Methods postPayload :: [FormParam] -> Request -> IO Request Source # |
class FormValue a where Source #
A type that can be rendered as the value portion of a key/value
pair for use in an application/x-www-form-urlencoded
POST
body. Intended for use with the FormParam
type.
The instances for String
, strict Text
, and lazy
Text
are all encoded using UTF-8 before being
URL-encoded.
The instance for Maybe
gives an empty string on Nothing
,
and otherwise uses the contained type's instance.
Instances
Headers
type ContentType = ByteString Source #
A MIME content type, e.g. "application/octet-stream"
.
An element of a Link
header.
Constructors
Link | |
Fields
|
Errors
Constructors
JSONError String |
Instances
Show JSONError Source # | |
Exception JSONError Source # | |
Defined in Network.Wreq.Internal.Types Methods toException :: JSONError -> SomeException fromException :: SomeException -> Maybe JSONError displayException :: JSONError -> String |
Request handling
reqURL :: Req -> ByteString Source #
Return the URL associated with the given Req
.
This includes the port number if not standard, and the query string if one exists.
type Run body = Req -> IO (Response body) Source #
A function that runs a request and returns the associated response.
Orphan instances
FormValue Double Source # | |
Methods renderFormValue :: Double -> ByteString Source # | |
FormValue Float Source # | |
Methods renderFormValue :: Float -> ByteString Source # | |
FormValue Int Source # | |
Methods renderFormValue :: Int -> ByteString Source # | |
FormValue Int8 Source # | |
Methods renderFormValue :: Int8 -> ByteString Source # | |
FormValue Int16 Source # | |
Methods renderFormValue :: Int16 -> ByteString Source # | |
FormValue Int32 Source # | |
Methods renderFormValue :: Int32 -> ByteString Source # | |
FormValue Int64 Source # | |
Methods renderFormValue :: Int64 -> ByteString Source # | |
FormValue Integer Source # | |
Methods renderFormValue :: Integer -> ByteString Source # | |
FormValue Word Source # | |
Methods renderFormValue :: Word -> ByteString Source # | |
FormValue Word8 Source # | |
Methods renderFormValue :: Word8 -> ByteString Source # | |
FormValue Word16 Source # | |
Methods renderFormValue :: Word16 -> ByteString Source # | |
FormValue Word32 Source # | |
Methods renderFormValue :: Word32 -> ByteString Source # | |
FormValue Word64 Source # | |
Methods renderFormValue :: Word64 -> ByteString Source # | |
FormValue () Source # | |
Methods renderFormValue :: () -> ByteString Source # | |
FormValue String Source # | |
Methods renderFormValue :: String -> ByteString Source # | |
FormValue Text Source # | |
Methods renderFormValue :: Text -> ByteString Source # | |
FormValue ByteString Source # | |
Methods renderFormValue :: ByteString -> ByteString Source # | |
FormValue ByteString Source # | |
Methods renderFormValue :: ByteString -> ByteString0 Source # | |
FormValue Text Source # | |
Methods renderFormValue :: Text -> ByteString Source # | |
FormValue Builder Source # | |
Methods renderFormValue :: Builder -> ByteString Source # | |
Putable ByteString Source # | |
Methods putPayload :: ByteString -> Request -> IO Request Source # | |
Putable ByteString Source # | |
Methods putPayload :: ByteString -> Request -> IO Request Source # | |
Putable FormParam Source # | |
Methods putPayload :: FormParam -> Request -> IO Request Source # | |
Putable Payload Source # | |
Methods putPayload :: Payload -> Request -> IO Request Source # | |
Putable Encoding Source # | |
Methods putPayload :: Encoding -> Request -> IO Request Source # | |
Putable Value Source # | |
Methods putPayload :: Value -> Request -> IO Request Source # | |
Putable Part Source # | |
Methods putPayload :: Part -> Request -> IO Request Source # | |
Postable ByteString Source # | |
Methods postPayload :: ByteString -> Request -> IO Request Source # | |
Postable ByteString Source # | |
Methods postPayload :: ByteString -> Request -> IO Request Source # | |
Postable FormParam Source # | |
Methods postPayload :: FormParam -> Request -> IO Request Source # | |
Postable Payload Source # | |
Methods postPayload :: Payload -> Request -> IO Request Source # | |
Postable Encoding Source # | |
Methods postPayload :: Encoding -> Request -> IO Request Source # | |
Postable Value Source # | |
Methods postPayload :: Value -> Request -> IO Request Source # | |
Postable Part Source # | |
Methods postPayload :: Part -> Request -> IO Request Source # | |
FormValue a => FormValue (Maybe a) Source # | |
Methods renderFormValue :: Maybe a -> ByteString Source # | |
Putable [(ByteString, ByteString)] Source # | |
Methods putPayload :: [(ByteString, ByteString)] -> Request -> IO Request Source # | |
Putable [FormParam] Source # | |
Methods putPayload :: [FormParam] -> Request -> IO Request Source # | |
Putable [Part] Source # | |
Methods putPayload :: [Part] -> Request -> IO Request Source # | |
Postable [(ByteString, ByteString)] Source # | |
Methods postPayload :: [(ByteString, ByteString)] -> Request -> IO Request Source # | |
Postable [FormParam] Source # | |
Methods postPayload :: [FormParam] -> Request -> IO Request Source # | |
Postable [Part] Source # | |
Methods postPayload :: [Part] -> Request -> IO Request Source # | |
Putable (ByteString, ByteString) Source # | |
Methods putPayload :: (ByteString, ByteString) -> Request -> IO Request Source # | |
Postable (ByteString, ByteString) Source # | |
Methods postPayload :: (ByteString, ByteString) -> Request -> IO Request Source # |