wreq-0.5.2.0: An easy-to-use HTTP client library.

Copyright(c) 2014 Bryan O'Sullivan
LicenseBSD-style
Maintainerbos@serpentine.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell98

Network.Wreq.Types

Contents

Description

HTTP client types.

Synopsis

Client configuration

data Options Source #

Options for configuring a client.

Constructors

Options 

Fields

Instances

data Auth Source #

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)

OAuth1 ByteString ByteString ByteString ByteString

OAuth1 request signing OAuth1 consumerToken consumerSecret token secret

Instances

Eq Auth Source # 

Methods

(==) :: Auth -> Auth -> Bool #

(/=) :: Auth -> Auth -> Bool #

Show Auth Source # 

Methods

showsPrec :: Int -> Auth -> ShowS #

show :: Auth -> String #

showList :: [Auth] -> 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

data Payload where Source #

A product type for representing more complex payload types.

Constructors

Raw :: ContentType -> RequestBody -> Payload 

class Postable a where Source #

A type that can be converted into a POST request payload.

class Putable a where Source #

A type that can be converted into a PUT request payload.

Minimal complete definition

putPayload

Methods

putPayload :: a -> Request -> IO Request Source #

Represent a value in the request body (and perhaps the headers) of a PUT request.

URL-encoded forms

data FormParam where Source #

A key/value pair for an application/x-www-form-urlencoded POST request body.

Constructors

(:=) :: FormValue v => ByteString -> v -> FormParam infixr 3 

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.

Minimal complete definition

renderFormValue

Methods

renderFormValue :: a -> ByteString Source #

Render the given value.

Headers

type ContentType = ByteString Source #

A MIME content type, e.g. "application/octet-stream".

data Link Source #

An element of a Link header.

Constructors

Link 

Errors

data JSONError Source #

The error type used by asJSON and asValue if a failure occurs when parsing a response body as JSON.

Constructors

JSONError String 

Request handling

data Req Source #

A request that is ready to be submitted.

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 # 
FormValue Float Source # 
FormValue Int Source # 
FormValue Int8 Source # 
FormValue Int16 Source # 
FormValue Int32 Source # 
FormValue Int64 Source # 
FormValue Integer Source # 
FormValue Word Source # 
FormValue Word8 Source # 
FormValue Word16 Source # 
FormValue Word32 Source # 
FormValue Word64 Source # 
FormValue () Source # 
FormValue ByteString Source # 
FormValue ByteString Source # 
FormValue Builder Source # 
FormValue String Source # 
FormValue Text Source # 
FormValue Text Source # 
Putable ByteString Source # 
Putable ByteString Source # 
Putable Value Source # 
Putable Part Source # 
Putable FormParam Source # 
Putable Payload Source # 
Postable ByteString Source # 
Postable ByteString Source # 
Postable Value Source # 
Postable Part Source # 
Postable FormParam Source # 
Postable Payload Source # 
FormValue a => FormValue (Maybe a) Source # 
Putable [(ByteString, ByteString)] Source # 
Putable [Part] Source # 
Putable [FormParam] Source # 
Postable [(ByteString, ByteString)] Source # 
Postable [Part] Source # 
Postable [FormParam] Source # 
Putable (ByteString, ByteString) Source # 
Postable (ByteString, ByteString) Source #