Bring back err type param to OAuth2Result

This commit is contained in:
Michael "Gilli" Gilliland 2023-01-31 09:58:05 -05:00
parent 601895c5f8
commit dac09582fb
2 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,7 @@ type Error = TokenRequestError
type Error = OAuth2Error Errors type Error = OAuth2Error Errors
#endif #endif
type OAuth2Result a = Either Error a type OAuth2Result err a = Either err a
authorizationUrl :: OAuth2 -> URI authorizationUrl :: OAuth2 -> URI
authorizationUrl = OAuth2.authorizationUrl . getOAuth2 authorizationUrl = OAuth2.authorizationUrl . getOAuth2
@ -68,14 +68,14 @@ fetchAccessToken
:: Manager :: Manager
-> OAuth2 -> OAuth2
-> ExchangeToken -> ExchangeToken
-> IO (OAuth2Result OAuth2Token) -> IO (OAuth2Result Error OAuth2Token)
fetchAccessToken = fetchAccessTokenBasic fetchAccessToken = fetchAccessTokenBasic
fetchAccessToken2 fetchAccessToken2
:: Manager :: Manager
-> OAuth2 -> OAuth2
-> ExchangeToken -> ExchangeToken
-> IO (OAuth2Result OAuth2Token) -> IO (OAuth2Result Error OAuth2Token)
fetchAccessToken2 = fetchAccessTokenPost fetchAccessToken2 = fetchAccessTokenPost
authGetBS :: Manager -> AccessToken -> URI -> IO (Either ByteString ByteString) authGetBS :: Manager -> AccessToken -> URI -> IO (Either ByteString ByteString)
@ -151,7 +151,7 @@ fetchAccessTokenBasic
:: Manager :: Manager
-> OAuth2 -> OAuth2
-> ExchangeToken -> ExchangeToken
-> IO (OAuth2Result OAuth2Token) -> IO (OAuth2Result Error OAuth2Token)
fetchAccessTokenBasic m o e = runOAuth2 $ f m (getOAuth2 o) e fetchAccessTokenBasic m o e = runOAuth2 $ f m (getOAuth2 o) e
where where
#if MIN_VERSION_hoauth2(2,6,0) #if MIN_VERSION_hoauth2(2,6,0)
@ -166,7 +166,7 @@ fetchAccessTokenPost
:: Manager :: Manager
-> OAuth2 -> OAuth2
-> ExchangeToken -> ExchangeToken
-> IO (OAuth2Result OAuth2Token) -> IO (OAuth2Result Error OAuth2Token)
fetchAccessTokenPost m o e = runOAuth2 $ f m (getOAuth2 o) e fetchAccessTokenPost m o e = runOAuth2 $ f m (getOAuth2 o) e
where where
#if MIN_VERSION_hoauth2(2, 6, 0) #if MIN_VERSION_hoauth2(2, 6, 0)

View File

@ -31,7 +31,7 @@ import Yesod.Core hiding (ErrorResponse)
-- This will be 'fetchAccessToken' or 'fetchAccessToken2' -- This will be 'fetchAccessToken' or 'fetchAccessToken2'
-- --
type FetchToken type FetchToken
= Manager -> OAuth2 -> ExchangeToken -> IO (OAuth2Result OAuth2Token) = Manager -> OAuth2 -> ExchangeToken -> IO (OAuth2Result Error OAuth2Token)
-- | How to take an @'OAuth2Token'@ and retrieve user credentials -- | How to take an @'OAuth2Token'@ and retrieve user credentials
type FetchCreds m = Manager -> OAuth2Token -> IO (Creds m) type FetchCreds m = Manager -> OAuth2Token -> IO (Creds m)