hoauth-0.1.3: A Haskell implementation of OAuth 1.0a protocol.

Safe HaskellNone

Network.Protocol.OAuth.Request

Synopsis

Documentation

data Request Source

The HTTP request which must be properly authenticated with oauth. It is not meant to represent the full HTTP request, instead the data which matters for oauth authentication.

Constructors

HTTP 

Fields

ssl :: Bool

True means HTTPS and false means HTTP

method :: HTTPMethod
 
host :: String

The hostname or ip address (e.g. bitforest.org)

port :: Int

The tcp port (e.g. 80)

path :: String

The request path (e.g. /foo/bar/)

params :: [Parameter]

The request parameters (both GET and POST)

data HTTPMethod Source

The possible HTTP methods

Constructors

GET 
POST 
DELETE 
PUT 

type Parameter = (String, Maybe String)Source

A pair which represents a parameter (key,value).

class PercentEncoding a whereSource

Refer to http://en.wikipedia.org/wiki/Percent-encoding for more information

Methods

encode :: a -> ByteStringSource

Encodes an a type to bytestring.

encodes :: [a] -> ByteStringSource

Encodes a list of a types into bytestring.

decode :: ByteString -> (a, ByteString)Source

Decodes a single a type out of an encoded string.

decodes :: ByteString -> [a]Source

Decodes the whole string into a list of a types.

nonce_and_timestamp :: Request -> IO RequestSource

Generates the oauth_nonce and oauth_timestamp parameters.

append_param :: Request -> (String, Maybe String) -> RequestSource

Convenience function to append an item in request's parameters list

show_url :: Request -> ByteStringSource

Show the entire url, including possibly any oauth parameter which may be present.

show_oauthurl :: Request -> ByteStringSource

The URL to perform the oauth request

show_oauthheaderSource

Arguments

:: String

The realm

-> Request 
-> ByteString

The Authorization/WWW-Authenticate header

The Authorization or WWW-Authenticated headers to perform oauth authentication.

show_urlencoded :: [Parameter] -> ByteStringSource

Produces a urlencoded string. For convenience, it sorts the parameters first, as demands the oauth protocol.

read_urlencoded :: ByteString -> [Parameter]Source

Parses a urlencoded string.

(>>+) :: Request -> (String, Maybe String) -> RequestSource

Convenience operator to append an item in request's parameters list