module Network.HTTP.Req.OAuth2.Internal.Types
( AccessToken(..)
, App(..)
, ClientId(..)
, ClientPair(..)
, ClientSecret(..)
, OAuth2
, ParseError(..)
, RefreshToken(..)
, TokenPair(..)
, UpdateTokenPair
) where
import Control.Exception (Exception)
import Control.Monad.Trans.State.Strict (StateT)
import Data.Text (Text)
import Data.Typeable (Typeable)
import Text.URI (URI)
type OAuth2 = StateT TokenPair IO
newtype ClientId = ClientId Text deriving (Eq, Show)
newtype ClientSecret = ClientSecret Text deriving (Eq, Show)
newtype AccessToken = AccessToken Text deriving Show
newtype RefreshToken = RefreshToken Text deriving Show
data ClientPair = ClientPair ClientId ClientSecret deriving (Eq, Show)
data TokenPair = TokenPair AccessToken RefreshToken deriving Show
type UpdateTokenPair = TokenPair -> IO ()
data App = App
{ appAuthUri :: URI
, appTokenUri :: URI
, appUpdateTokenPair :: UpdateTokenPair
, appClientPair :: ClientPair
}
data ParseError = ParseError String deriving (Show, Typeable)
instance Exception ParseError