mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-01-11 19:58:28 +01:00
Update .Compat for hoauth2-2.9.0
The only breaking change seems to be the error type, which we were already wrapping in `CPP` and our own `Errors` synonym for 2.7. All this change does is add a 2.9 case and move some thing around so it's syntactically nicer.
This commit is contained in:
parent
1aa3f29509
commit
3700a89ada
@ -16,21 +16,13 @@ module Network.OAuth.OAuth2.Compat
|
||||
import Data.ByteString.Lazy (ByteString)
|
||||
import Data.Text (Text)
|
||||
import Network.HTTP.Conduit (Manager)
|
||||
import Network.OAuth.OAuth2
|
||||
( AccessToken (..)
|
||||
, ExchangeToken (..)
|
||||
, OAuth2Token (..)
|
||||
, RefreshToken (..)
|
||||
)
|
||||
import qualified Network.OAuth.OAuth2 as OAuth2
|
||||
#if MIN_VERSION_hoauth2(2,7,0)
|
||||
import Network.OAuth.OAuth2
|
||||
(AccessToken(..), ExchangeToken(..), OAuth2Token(..), RefreshToken(..))
|
||||
import Network.OAuth.OAuth2.TokenRequest (TokenRequestError)
|
||||
#else
|
||||
import Network.OAuth.OAuth2
|
||||
( AccessToken(..)
|
||||
, ExchangeToken(..)
|
||||
, OAuth2Error
|
||||
, OAuth2Token(..)
|
||||
, RefreshToken(..)
|
||||
)
|
||||
import qualified Network.OAuth.OAuth2.TokenRequest as LegacyTokenRequest
|
||||
#endif
|
||||
import URI.ByteString
|
||||
|
||||
#if MIN_VERSION_hoauth2(2,2,0)
|
||||
@ -38,6 +30,20 @@ import Control.Monad.Trans.Except (ExceptT, runExceptT)
|
||||
import Data.Maybe (fromMaybe)
|
||||
#endif
|
||||
|
||||
#if MIN_VERSION_hoauth2(2,9,0)
|
||||
import Network.OAuth.OAuth2.TokenRequest (TokenResponseError)
|
||||
type Errors = TokenResponseError
|
||||
#elif MIN_VERSION_hoauth2(2,7,0)
|
||||
import Network.OAuth.OAuth2.TokenRequest (TokenRequestError)
|
||||
type Errors = TokenRequestError
|
||||
#else
|
||||
import qualified Network.OAuth.OAuth2.TokenRequest as LegacyTokenRequest
|
||||
import Network.OAuth.OAuth2 (OAuth2Error)
|
||||
type Errors = OAuth2Error LegacyTokenRequest.Errors
|
||||
#endif
|
||||
|
||||
{-# ANN module ("HLint: ignore Use fewer imports" :: String) #-}
|
||||
|
||||
data OAuth2 = OAuth2
|
||||
{ oauth2ClientId :: Text
|
||||
, oauth2ClientSecret :: Maybe Text
|
||||
@ -46,12 +52,6 @@ data OAuth2 = OAuth2
|
||||
, oauth2RedirectUri :: Maybe (URIRef Absolute)
|
||||
}
|
||||
|
||||
#if MIN_VERSION_hoauth2(2,7,0)
|
||||
type Errors = TokenRequestError
|
||||
#else
|
||||
type Errors = OAuth2Error LegacyTokenRequest.Errors
|
||||
#endif
|
||||
|
||||
type OAuth2Result err a = Either err a
|
||||
|
||||
authorizationUrl :: OAuth2 -> URI
|
||||
|
||||
Loading…
Reference in New Issue
Block a user