    {-# LANGUAGE DeriveDataTypeable, OverloadedStrings, StandaloneDeriving #-}
    {-# LANGUAGE CPP #-}
    {-# OPTIONS_GHC -Wall -fno-warn-orphans #-}
    -- | This Module provides interface for the instance of 'MonadIO' instead of 'MonadIO'.
    -- What this module do is just adding 'withManager' or 'runResourceT'.
    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

    -- | Get temporary credential for requesting acces token.
    getTemporaryCredential :: MonadIO m
                           => OA.OAuth        -- ^ OAuth Application
                           -> m OA.Credential -- ^ Temporary Credential (Request Token & Secret).
    getTemporaryCredential :: forall (m :: * -> *). MonadIO m => OAuth -> m Credential
    getTemporaryCredential = IO Credential -> m Credential
    forall a. IO a -> m a
    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

    -- | Get temporary credential for requesting access token with Scope parameter.
    getTemporaryCredentialWithScope :: MonadIO m
                                    => BS.ByteString -- ^ Scope parameter string
                                    -> OAuth         -- ^ OAuth Application
                                    -> m Credential -- ^ Temporay Credential (Request Token & Secret).
    getTemporaryCredentialWithScope :: forall (m :: * -> *).
    MonadIO m =>
    ByteString -> OAuth -> m Credential
    getTemporaryCredentialWithScope ByteString
    bs OAuth
    oa =
      IO Credential -> m Credential
    forall a. IO a -> m a
    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

    -- | Get temporary credential for requesting access token via the proxy.
    getTemporaryCredentialProxy :: MonadIO m
                                => Maybe Proxy   -- ^ Proxy
                                -> OAuth         -- ^ OAuth Application
                                -> m Credential -- ^ Temporary Credential (Request Token & Secret).
    getTemporaryCredentialProxy :: forall (m :: * -> *).
    MonadIO m =>
    Maybe Proxy -> OAuth -> m Credential
    getTemporaryCredentialProxy Maybe Proxy
    p OAuth
    oa = IO Credential -> m Credential
    forall a. IO a -> m a
    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)                                 -- ^ Request Hook
                            -> OAuth                      -- ^ OAuth Application
                            -> m Credential -- ^ Temporary Credential (Request Token & Secret).
    getTemporaryCredential' :: forall (m :: * -> *).
    MonadIO m =>
    (Request -> Request) -> OAuth -> m Credential
    getTemporaryCredential' Request -> Request
    hook OAuth
    oa = IO Credential -> m Credential
    forall a. IO a -> m a
    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

    -- | Get Access token.
    getAccessToken, getTokenCredential
                   :: MonadIO m
                   => OAuth         -- ^ OAuth Application
                   -> Credential    -- ^ Temporary Credential with oauth_verifier
                   -> m Credential -- ^ Token Credential (Access Token & Secret)
    getAccessToken :: forall (m :: * -> *).
    MonadIO m =>
    OAuth -> Credential -> m Credential
    getAccessToken OAuth
    oa Credential
    cr = IO Credential -> m Credential
    forall a. IO a -> m a
    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

    -- | Get Access token via the proxy.
    getAccessTokenProxy, getTokenCredentialProxy
                   :: MonadIO m
                   => Maybe Proxy   -- ^ Proxy
                   -> OAuth         -- ^ OAuth Application
                   -> Credential    -- ^ Temporary Credential with oauth_verifier
                   -> m Credential -- ^ Token Credential (Access Token & Secret)
    getAccessTokenProxy :: forall (m :: * -> *).
    MonadIO m =>
    Maybe Proxy -> OAuth -> Credential -> m Credential
    getAccessTokenProxy Maybe Proxy
    p OAuth
    oa Credential
    cr = IO Credential -> m Credential
    forall a. IO a -> m a
    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)                                 -- ^ Request Hook
                    -> OAuth                      -- ^ OAuth Application
                    -> Credential                 -- ^ Temporary Credential with oauth_verifier
                    -> m Credential     -- ^ Token Credential (Access Token & Secret)
    getAccessToken' :: forall (m :: * -> *).
    MonadIO m =>
    (Request -> Request) -> OAuth -> Credential -> m Credential
    getAccessToken' Request -> Request
    hook OAuth
    oa Credential
    cr = IO Credential -> m Credential
    forall a. IO a -> m a
    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 :: forall (m :: * -> *).
    MonadIO m =>
    OAuth -> Credential -> m Credential
    getTokenCredential = OAuth -> Credential -> m Credential
    forall (m :: * -> *).
    MonadIO m =>
    OAuth -> Credential -> m Credential
    getAccessToken
    getTokenCredentialProxy :: forall (m :: * -> *).
    MonadIO m =>
    Maybe Proxy -> OAuth -> Credential -> m Credential
    getTokenCredentialProxy = Maybe Proxy -> OAuth -> Credential -> m Credential
    forall (m :: * -> *).
    MonadIO m =>
    Maybe Proxy -> OAuth -> Credential -> m Credential
    getAccessTokenProxy