Portability | GHC |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com |
Safe Haskell | None |
HTTP client types.
- data Options = Options {}
- data Auth
- 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
- := :: FormValue v => ByteString -> v -> FormParam
- class FormValue a where
- renderFormValue :: a -> ByteString
- type ContentType = ByteString
- data Link = Link {
- linkURL :: ByteString
- linkParams :: [(ByteString, ByteString)]
- data JSONError = JSONError String
Client configuration
Options for configuring a client.
Options | |
|
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.
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. |
Request payloads
A product type for representing more complex payload types.
Raw :: ContentType -> RequestBody -> Payload |
A type that can be converted into a POST request payload.
postPayload :: a -> Request -> IO RequestSource
Represent a value in the request body (and perhaps the headers) of a POST request.
A type that can be converted into a PUT request payload.
putPayload :: a -> Request -> IO RequestSource
Represent a value in the request body (and perhaps the headers) of a PUT request.
URL-encoded forms
A key/value pair for an application/x-www-form-urlencoded
POST request body.
:= :: FormValue v => ByteString -> v -> FormParam |
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.
renderFormValue :: a -> ByteStringSource
Render the given value.
Headers
type ContentType = ByteStringSource
A MIME content type, e.g. "application/octet-stream"
.
An element of a Link
header.
Link | |
|