neptune-backend-0.3.0: Neptune Client
Safe HaskellNone
LanguageHaskell2010

Neptune.Backend.Client

Description

 
Synopsis

Dispatch

Lbs

dispatchLbs Source #

Arguments

:: (Produces req accept, MimeType contentType) 
=> Manager

http-client Connection manager

-> NeptuneBackendConfig

config

-> NeptuneBackendRequest req contentType res accept

request

-> IO (Response ByteString)

response

send a request returning the raw http response

Mime

data MimeResult res Source #

pair of decoded http body and http response

Constructors

MimeResult 

Fields

Instances

Instances details
Functor MimeResult Source # 
Instance details

Defined in Neptune.Backend.Client

Methods

fmap :: (a -> b) -> MimeResult a -> MimeResult b #

(<$) :: a -> MimeResult b -> MimeResult a #

Foldable MimeResult Source # 
Instance details

Defined in Neptune.Backend.Client

Methods

fold :: Monoid m => MimeResult m -> m #

foldMap :: Monoid m => (a -> m) -> MimeResult a -> m #

foldMap' :: Monoid m => (a -> m) -> MimeResult a -> m #

foldr :: (a -> b -> b) -> b -> MimeResult a -> b #

foldr' :: (a -> b -> b) -> b -> MimeResult a -> b #

foldl :: (b -> a -> b) -> b -> MimeResult a -> b #

foldl' :: (b -> a -> b) -> b -> MimeResult a -> b #

foldr1 :: (a -> a -> a) -> MimeResult a -> a #

foldl1 :: (a -> a -> a) -> MimeResult a -> a #

toList :: MimeResult a -> [a] #

null :: MimeResult a -> Bool #

length :: MimeResult a -> Int #

elem :: Eq a => a -> MimeResult a -> Bool #

maximum :: Ord a => MimeResult a -> a #

minimum :: Ord a => MimeResult a -> a #

sum :: Num a => MimeResult a -> a #

product :: Num a => MimeResult a -> a #

Traversable MimeResult Source # 
Instance details

Defined in Neptune.Backend.Client

Methods

traverse :: Applicative f => (a -> f b) -> MimeResult a -> f (MimeResult b) #

sequenceA :: Applicative f => MimeResult (f a) -> f (MimeResult a) #

mapM :: Monad m => (a -> m b) -> MimeResult a -> m (MimeResult b) #

sequence :: Monad m => MimeResult (m a) -> m (MimeResult a) #

Show res => Show (MimeResult res) Source # 
Instance details

Defined in Neptune.Backend.Client

Methods

showsPrec :: Int -> MimeResult res -> ShowS #

show :: MimeResult res -> String #

showList :: [MimeResult res] -> ShowS #

data MimeError Source #

pair of unrender/parser error and http response

Constructors

MimeError 

Fields

Instances

Instances details
Eq MimeError Source # 
Instance details

Defined in Neptune.Backend.Client

Show MimeError Source # 
Instance details

Defined in Neptune.Backend.Client

dispatchMime Source #

Arguments

:: forall req contentType res accept. (Produces req accept, MimeUnrender accept res, MimeType contentType) 
=> Manager

http-client Connection manager

-> NeptuneBackendConfig

config

-> NeptuneBackendRequest req contentType res accept

request

-> IO (MimeResult res)

response

send a request returning the MimeResult

dispatchMime' Source #

Arguments

:: (Produces req accept, MimeUnrender accept res, MimeType contentType) 
=> Manager

http-client Connection manager

-> NeptuneBackendConfig

config

-> NeptuneBackendRequest req contentType res accept

request

-> IO (Either MimeError res)

response

like dispatchMime, but only returns the decoded http body

Unsafe

dispatchLbsUnsafe Source #

Arguments

:: (MimeType accept, MimeType contentType) 
=> Manager

http-client Connection manager

-> NeptuneBackendConfig

config

-> NeptuneBackendRequest req contentType res accept

request

-> IO (Response ByteString)

response

like dispatchReqLbs, but does not validate the operation is a Producer of the "accept" MimeType. (Useful if the server's response is undocumented)

dispatchInitUnsafe Source #

Arguments

:: Manager

http-client Connection manager

-> NeptuneBackendConfig

config

-> InitRequest req contentType res accept

init request

-> IO (Response ByteString)

response

dispatch an InitRequest

InitRequest

newtype InitRequest req contentType res accept Source #

wraps an http-client Request with request/response type parameters

Constructors

InitRequest 

Instances

Instances details
Show (InitRequest req contentType res accept) Source # 
Instance details

Defined in Neptune.Backend.Client

Methods

showsPrec :: Int -> InitRequest req contentType res accept -> ShowS #

show :: InitRequest req contentType res accept -> String #

showList :: [InitRequest req contentType res accept] -> ShowS #

_toInitRequest Source #

Arguments

:: (MimeType accept, MimeType contentType) 
=> NeptuneBackendConfig

config

-> NeptuneBackendRequest req contentType res accept

request

-> IO (InitRequest req contentType res accept)

initialized request

Build an http-client Request record from the supplied config and request

modifyInitRequest :: InitRequest req contentType res accept -> (Request -> Request) -> InitRequest req contentType res accept Source #

modify the underlying Request

modifyInitRequestM :: Monad m => InitRequest req contentType res accept -> (Request -> m Request) -> m (InitRequest req contentType res accept) Source #

modify the underlying Request (monadic)

Logging

runConfigLog :: MonadIO m => NeptuneBackendConfig -> LogExec m Source #

Run a block using the configured logger instance

runConfigLogWithExceptions :: (MonadCatch m, MonadIO m) => Text -> NeptuneBackendConfig -> LogExec m Source #

Run a block using the configured logger instance (logs exceptions)