-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | hoauth2
--
-- Haskell OAuth2 authentication.
--
-- Tested following services
--
--
@package hoauth2
@version 0.2.2
module Network.OAuth2.OAuth2
-- | Query Parameter Representation
--
-- TODO: add a base endpoint URI.
data OAuth2
OAuth2 :: ByteString -> ByteString -> ByteString -> ByteString -> Maybe ByteString -> Maybe ByteString -> OAuth2
oauthClientId :: OAuth2 -> ByteString
oauthClientSecret :: OAuth2 -> ByteString
oauthOAuthorizeEndpoint :: OAuth2 -> ByteString
oauthAccessTokenEndpoint :: OAuth2 -> ByteString
oauthCallback :: OAuth2 -> Maybe ByteString
oauthAccessToken :: OAuth2 -> Maybe ByteString
-- | Simple Exception representation.
data OAuthException
OAuthException :: String -> OAuthException
-- | The gained Access Token. Use Data.Aeson.decode to decode
-- string to AccessToken.
data AccessToken
AccessToken :: ByteString -> AccessToken
accessToken :: AccessToken -> ByteString
-- | type synonym of query parameters
type QueryParams = [(ByteString, ByteString)]
-- | type synonym of post body content
type PostBody = [(ByteString, ByteString)]
-- | type synonym of a URI
type URI = ByteString
-- | Append query parameters
appendQueryParam :: URI -> QueryParams -> URI
-- | lift value in the Maybe and abonda Nothing
transform' :: [(a, Maybe b)] -> [(a, b)]
-- | Prepare the authorization URL. Redirect to this URL asking for user
-- interactive authentication.
authorizationUrl :: OAuth2 -> URI
-- | Prepare access token URL and the request body query.
accessTokenUrl :: OAuth2 -> ByteString -> (URI, PostBody)
accessTokenUrl' :: OAuth2 -> ByteString -> Maybe ByteString -> (URI, PostBody)
-- | For GET method API.
appendAccessToken :: URI -> OAuth2 -> URI
accessTokenToParam :: ByteString -> [(ByteString, ByteString)]
instance Typeable OAuthException
instance Show OAuth2
instance Eq OAuth2
instance Show OAuthException
instance Eq OAuthException
instance Show AccessToken
instance FromJSON AccessToken
instance Exception OAuthException
module Network.OAuth2.HTTP.HttpClient
-- | Request (POST method) access token URL in order to get
-- AccessToken.
--
-- FIXME: what if requestAccessToken' return error?
requestAccessToken :: OAuth2 -> ByteString -> IO (Maybe AccessToken)
requestAccessToken' :: OAuth2 -> ByteString -> IO ByteString
doSimpleGetRequest :: MonadIO m => String -> m (Response ByteString)
doGetRequest :: MonadIO m => String -> [(ByteString, ByteString)] -> m (Response ByteString)
doPostRequst :: MonadIO m => String -> [(ByteString, ByteString)] -> m (Response ByteString)