hoauth-0.1.1: A Haskell implementation of OAuth 1.0 protocol.Source codeContentsIndex
Network.Protocol.OAuth.Request
Synopsis
data Request = HTTP {
ssl :: Bool
method :: HTTPMethod
host :: String
port :: Int
path :: String
params :: [Parameter]
}
data HTTPMethod
= GET
| POST
| DELETE
| PUT
type Parameter = (String, Maybe String)
class PercentEncoding a where
encode :: a -> ByteString
encodes :: [a] -> ByteString
decode :: ByteString -> (a, ByteString)
decodes :: ByteString -> [a]
append_param :: Request -> String -> Maybe String -> Request
apply :: Request -> (Request -> Request) -> Request
show_url :: Request -> ByteString
show_oauthurl :: Request -> ByteString
show_oauthheader :: String -> Request -> ByteString
show_urlencoded :: [Parameter] -> ByteString
read_urlencoded :: ByteString -> [Parameter]
(>>+) :: Request -> (String, Maybe String) -> Request
(>>|) :: Request -> (Request -> Request) -> Request
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
ssl :: BoolTrue means HTTPS and false means HTTP
method :: HTTPMethod
host :: StringThe hostname or ip address (e.g. bitforest.org)
port :: IntThe tcp port (e.g. 80)
path :: StringThe request path (e.g. /foo/bar/)
params :: [Parameter]The request parameters (both GET and POST)
show/hide Instances
data HTTPMethod Source
The possible HTTP methods
Constructors
GET
POST
DELETE
PUT
show/hide Instances
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.
show/hide Instances
append_param :: Request -> String -> Maybe String -> RequestSource
Convenience function to append an item in request's parameters list
apply :: Request -> (Request -> Request) -> RequestSource
Applies a function to the request
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
:: StringThe realm
-> Request
-> ByteStringThe 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
(>>|) :: Request -> (Request -> Request) -> RequestSource
Applies a function to the request
Produced by Haddock version 2.6.0