servant-client-core-0.19: Core functionality and class for client function generation for servant APIs
Safe Haskell None
Language Haskell2010

Servant.Client.Core.BaseUrl

Synopsis

Documentation

data BaseUrl Source #

Simple data type to represent the target of HTTP requests for servant's automatically-generated clients.

Constructors

BaseUrl

Fields

Instances

Instances details
Eq BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Data BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> BaseUrl -> c BaseUrl Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c BaseUrl Source #

toConstr :: BaseUrl -> Constr Source #

dataTypeOf :: BaseUrl -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c BaseUrl ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c BaseUrl ) Source #

gmapT :: ( forall b. Data b => b -> b) -> BaseUrl -> BaseUrl Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> BaseUrl -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> BaseUrl -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> BaseUrl -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> BaseUrl -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> BaseUrl -> m BaseUrl Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> BaseUrl -> m BaseUrl Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> BaseUrl -> m BaseUrl Source #

Ord BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Show BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Generic BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

ToJSON BaseUrl Source #
>>> traverse_ (LBS8.putStrLn . encode) $ parseBaseUrl "api.example.com"
"http://api.example.com"
Instance details

Defined in Servant.Client.Core.BaseUrl

ToJSONKey BaseUrl Source #
>>> :{
traverse_ (LBS8.putStrLn . encode) $ do
  u1 <- parseBaseUrl "api.example.com"
  u2 <- parseBaseUrl "example.com"
  return $ Map.fromList [(u1, 'x'), (u2, 'y')]
:}
{"http://api.example.com":"x","http://example.com":"y"}
Instance details

Defined in Servant.Client.Core.BaseUrl

FromJSON BaseUrl Source #
>>> parseBaseUrl "api.example.com" >>= decode . encode :: Maybe BaseUrl
Just (BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""})
Instance details

Defined in Servant.Client.Core.BaseUrl

FromJSONKey BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

NFData BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Lift BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

type Rep BaseUrl Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

data Scheme Source #

URI scheme to use

Constructors

Http

http://

Https

https://

Instances

Instances details
Eq Scheme Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Data Scheme Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Scheme -> c Scheme Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c Scheme Source #

toConstr :: Scheme -> Constr Source #

dataTypeOf :: Scheme -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c Scheme ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c Scheme ) Source #

gmapT :: ( forall b. Data b => b -> b) -> Scheme -> Scheme Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Scheme -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Scheme -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> Scheme -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> Scheme -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Scheme -> m Scheme Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Scheme -> m Scheme Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Scheme -> m Scheme Source #

Ord Scheme Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Show Scheme Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Generic Scheme Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

Lift Scheme Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

type Rep Scheme Source #
Instance details

Defined in Servant.Client.Core.BaseUrl

type Rep Scheme = D1 (' MetaData "Scheme" "Servant.Client.Core.BaseUrl" "servant-client-core-0.19-DAS79QGMO4DL64AFO0JBqz" ' False ) ( C1 (' MetaCons "Http" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "Https" ' PrefixI ' False ) ( U1 :: Type -> Type ))

showBaseUrl :: BaseUrl -> String Source #

>>> showBaseUrl <$> parseBaseUrl "api.example.com"
"http://api.example.com"

parseBaseUrl :: MonadThrow m => String -> m BaseUrl Source #

>>> parseBaseUrl "api.example.com"
BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}

Note: trailing slash is removed

>>> parseBaseUrl "api.example.com/"
BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}
>>> parseBaseUrl "api.example.com/dir/"
BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = "/dir"}