{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, StandaloneDeriving #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
module Web.Authenticate.OAuth.IO
{-# DEPRECATED "This module is deprecated; rewrite your code using MonadResource" #-}
(
module Web.Authenticate.OAuth,
getAccessToken,
getTemporaryCredential, getTemporaryCredentialWithScope,
getTemporaryCredentialProxy, getTemporaryCredential',
getTokenCredential,
getAccessTokenProxy, getTokenCredentialProxy,
getAccessToken'
) where
import Network.HTTP.Client
import qualified Web.Authenticate.OAuth as OA
import Web.Authenticate.OAuth hiding
(getAccessToken,
getTemporaryCredential, getTemporaryCredentialWithScope,
getTemporaryCredentialProxy, getTemporaryCredential',
getTokenCredential, getTemporaryCredentialWithScope,
getAccessTokenProxy, getTemporaryCredentialProxy,
getTokenCredentialProxy,
getAccessToken', getTemporaryCredential')
import Control.Monad.IO.Class
import qualified Data.ByteString.Char8 as BS
getTemporaryCredential :: MonadIO m
=> OA.OAuth
-> m OA.Credential
getTemporaryCredential :: OAuth -> m Credential
getTemporaryCredential = IO Credential -> m Credential
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credential -> m Credential)
-> (OAuth -> IO Credential) -> OAuth -> m Credential
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ManagerSettings -> (Manager -> IO Credential) -> IO Credential
forall a. ManagerSettings -> (Manager -> IO a) -> IO a
withManager ManagerSettings
defaultManagerSettings ((Manager -> IO Credential) -> IO Credential)
-> (OAuth -> Manager -> IO Credential) -> OAuth -> IO Credential
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OAuth -> Manager -> IO Credential
forall (m :: * -> *). MonadIO m => OAuth -> Manager -> m Credential
OA.getTemporaryCredential
getTemporaryCredentialWithScope :: MonadIO m
=> BS.ByteString
-> OAuth
-> m Credential
getTemporaryCredentialWithScope :: ByteString -> OAuth -> m Credential
getTemporaryCredentialWithScope ByteString
bs OAuth
oa =
IO Credential -> m Credential
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credential -> m Credential) -> IO Credential -> m Credential
forall a b. (a -> b) -> a -> b
$ ManagerSettings -> (Manager -> IO Credential) -> IO Credential
forall a. ManagerSettings -> (Manager -> IO a) -> IO a
withManager ManagerSettings
defaultManagerSettings ((Manager -> IO Credential) -> IO Credential)
-> (Manager -> IO Credential) -> IO Credential
forall a b. (a -> b) -> a -> b
$ ByteString -> OAuth -> Manager -> IO Credential
forall (m :: * -> *).
MonadIO m =>
ByteString -> OAuth -> Manager -> m Credential
OA.getTemporaryCredentialWithScope ByteString
bs OAuth
oa
getTemporaryCredentialProxy :: MonadIO m
=> Maybe Proxy
-> OAuth
-> m Credential
getTemporaryCredentialProxy :: Maybe Proxy -> OAuth -> m Credential
getTemporaryCredentialProxy Maybe Proxy
p OAuth
oa = IO Credential -> m Credential
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credential -> m Credential) -> IO Credential -> m Credential
forall a b. (a -> b) -> a -> b
$ ManagerSettings -> (Manager -> IO Credential) -> IO Credential
forall a. ManagerSettings -> (Manager -> IO a) -> IO a
withManager ManagerSettings
defaultManagerSettings ((Manager -> IO Credential) -> IO Credential)
-> (Manager -> IO Credential) -> IO Credential
forall a b. (a -> b) -> a -> b
$ (Request -> Request) -> OAuth -> Manager -> IO Credential
forall (m :: * -> *).
MonadIO m =>
(Request -> Request) -> OAuth -> Manager -> m Credential
OA.getTemporaryCredential' (Maybe Proxy -> Request -> Request
addMaybeProxy Maybe Proxy
p) OAuth
oa
getTemporaryCredential' :: MonadIO m
=> (Request -> Request)
-> OAuth
-> m Credential
getTemporaryCredential' :: (Request -> Request) -> OAuth -> m Credential
getTemporaryCredential' Request -> Request
hook OAuth
oa = IO Credential -> m Credential
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credential -> m Credential) -> IO Credential -> m Credential
forall a b. (a -> b) -> a -> b
$ ManagerSettings -> (Manager -> IO Credential) -> IO Credential
forall a. ManagerSettings -> (Manager -> IO a) -> IO a
withManager ManagerSettings
defaultManagerSettings ((Manager -> IO Credential) -> IO Credential)
-> (Manager -> IO Credential) -> IO Credential
forall a b. (a -> b) -> a -> b
$ (Request -> Request) -> OAuth -> Manager -> IO Credential
forall (m :: * -> *).
MonadIO m =>
(Request -> Request) -> OAuth -> Manager -> m Credential
OA.getTemporaryCredential' Request -> Request
hook OAuth
oa
getAccessToken, getTokenCredential
:: MonadIO m
=> OAuth
-> Credential
-> m Credential
getAccessToken :: OAuth -> Credential -> m Credential
getAccessToken OAuth
oa Credential
cr = IO Credential -> m Credential
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credential -> m Credential) -> IO Credential -> m Credential
forall a b. (a -> b) -> a -> b
$ ManagerSettings -> (Manager -> IO Credential) -> IO Credential
forall a. ManagerSettings -> (Manager -> IO a) -> IO a
withManager ManagerSettings
defaultManagerSettings ((Manager -> IO Credential) -> IO Credential)
-> (Manager -> IO Credential) -> IO Credential
forall a b. (a -> b) -> a -> b
$ OAuth -> Credential -> Manager -> IO Credential
forall (m :: * -> *).
MonadIO m =>
OAuth -> Credential -> Manager -> m Credential
OA.getAccessToken OAuth
oa Credential
cr
getAccessTokenProxy, getTokenCredentialProxy
:: MonadIO m
=> Maybe Proxy
-> OAuth
-> Credential
-> m Credential
getAccessTokenProxy :: Maybe Proxy -> OAuth -> Credential -> m Credential
getAccessTokenProxy Maybe Proxy
p OAuth
oa Credential
cr = IO Credential -> m Credential
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credential -> m Credential) -> IO Credential -> m Credential
forall a b. (a -> b) -> a -> b
$ ManagerSettings -> (Manager -> IO Credential) -> IO Credential
forall a. ManagerSettings -> (Manager -> IO a) -> IO a
withManager ManagerSettings
defaultManagerSettings ((Manager -> IO Credential) -> IO Credential)
-> (Manager -> IO Credential) -> IO Credential
forall a b. (a -> b) -> a -> b
$ Maybe Proxy -> OAuth -> Credential -> Manager -> IO Credential
forall (m :: * -> *).
MonadIO m =>
Maybe Proxy -> OAuth -> Credential -> Manager -> m Credential
OA.getAccessTokenProxy Maybe Proxy
p OAuth
oa Credential
cr
getAccessToken' :: MonadIO m
=> (Request -> Request)
-> OAuth
-> Credential
-> m Credential
getAccessToken' :: (Request -> Request) -> OAuth -> Credential -> m Credential
getAccessToken' Request -> Request
hook OAuth
oa Credential
cr = IO Credential -> m Credential
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credential -> m Credential) -> IO Credential -> m Credential
forall a b. (a -> b) -> a -> b
$ ManagerSettings -> (Manager -> IO Credential) -> IO Credential
forall a. ManagerSettings -> (Manager -> IO a) -> IO a
withManager ManagerSettings
defaultManagerSettings ((Manager -> IO Credential) -> IO Credential)
-> (Manager -> IO Credential) -> IO Credential
forall a b. (a -> b) -> a -> b
$ (Request -> Request)
-> OAuth -> Credential -> Manager -> IO Credential
forall (m :: * -> *).
MonadIO m =>
(Request -> Request)
-> OAuth -> Credential -> Manager -> m Credential
OA.getAccessToken' Request -> Request
hook OAuth
oa Credential
cr
getTokenCredential :: OAuth -> Credential -> m Credential
getTokenCredential = OAuth -> Credential -> m Credential
forall (m :: * -> *).
MonadIO m =>
OAuth -> Credential -> m Credential
getAccessToken
getTokenCredentialProxy :: Maybe Proxy -> OAuth -> Credential -> m Credential
getTokenCredentialProxy = Maybe Proxy -> OAuth -> Credential -> m Credential
forall (m :: * -> *).
MonadIO m =>
Maybe Proxy -> OAuth -> Credential -> m Credential
getAccessTokenProxy