Shpadoinkle-router-0.3.0.1: A single page application rounter for Shpadoinkle based on Servant.

Safe HaskellNone
LanguageHaskell2010

Shpadoinkle.Router.Client

Description

Helper for querying the server from client side code using a derived client. This module exists to save you from having to use CPP yourself.

Synopsis

Documentation

runXHR :: ClientM a -> JSM a Source #

Run the ClientM from Servant as an XHR request.

runXHR' :: ClientM a -> ClientEnv -> JSM a Source #

Run the ClientM from Servant as an XHR request with a customized base URL.

data Scheme Source #

URI scheme to use

Constructors

Http

http://

Https

https://

Instances
Eq Scheme 
Instance details

Defined in Servant.Client.Core.BaseUrl

Data Scheme 
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 :: (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 
Instance details

Defined in Servant.Client.Core.BaseUrl

Show Scheme 
Instance details

Defined in Servant.Client.Core.BaseUrl

Generic Scheme 
Instance details

Defined in Servant.Client.Core.BaseUrl

Associated Types

type Rep Scheme :: Type -> Type Source #

Lift Scheme 
Instance details

Defined in Servant.Client.Core.BaseUrl

Methods

lift :: Scheme -> Q Exp Source #

type Rep Scheme 
Instance details

Defined in Servant.Client.Core.BaseUrl

type Rep Scheme = D1 (MetaData "Scheme" "Servant.Client.Core.BaseUrl" "servant-client-core-0.16-G73kHISuefHHMQ5tSmiWmL" 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"}

data ResponseF a Source #

Instances
Functor ResponseF 
Instance details

Defined in Servant.Client.Core.Response

Methods

fmap :: (a -> b) -> ResponseF a -> ResponseF b Source #

(<$) :: a -> ResponseF b -> ResponseF a Source #

Foldable ResponseF 
Instance details

Defined in Servant.Client.Core.Response

Methods

fold :: Monoid m => ResponseF m -> m Source #

foldMap :: Monoid m => (a -> m) -> ResponseF a -> m Source #

foldr :: (a -> b -> b) -> b -> ResponseF a -> b Source #

foldr' :: (a -> b -> b) -> b -> ResponseF a -> b Source #

foldl :: (b -> a -> b) -> b -> ResponseF a -> b Source #

foldl' :: (b -> a -> b) -> b -> ResponseF a -> b Source #

foldr1 :: (a -> a -> a) -> ResponseF a -> a Source #

foldl1 :: (a -> a -> a) -> ResponseF a -> a Source #

toList :: ResponseF a -> [a] Source #

null :: ResponseF a -> Bool Source #

length :: ResponseF a -> Int Source #

elem :: Eq a => a -> ResponseF a -> Bool Source #

maximum :: Ord a => ResponseF a -> a Source #

minimum :: Ord a => ResponseF a -> a Source #

sum :: Num a => ResponseF a -> a Source #

product :: Num a => ResponseF a -> a Source #

Traversable ResponseF 
Instance details

Defined in Servant.Client.Core.Response

Methods

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

sequenceA :: Applicative f => ResponseF (f a) -> f (ResponseF a) Source #

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

sequence :: Monad m => ResponseF (m a) -> m (ResponseF a) Source #

Eq a => Eq (ResponseF a) 
Instance details

Defined in Servant.Client.Core.Response

Show a => Show (ResponseF a) 
Instance details

Defined in Servant.Client.Core.Response

Generic (ResponseF a) 
Instance details

Defined in Servant.Client.Core.Response

Associated Types

type Rep (ResponseF a) :: Type -> Type Source #

Methods

from :: ResponseF a -> Rep (ResponseF a) x Source #

to :: Rep (ResponseF a) x -> ResponseF a Source #

NFData a => NFData (ResponseF a) 
Instance details

Defined in Servant.Client.Core.Response

Methods

rnf :: ResponseF a -> () Source #

type Rep (ResponseF a) 
Instance details

Defined in Servant.Client.Core.Response

type Rep (ResponseF a) = D1 (MetaData "ResponseF" "Servant.Client.Core.Response" "servant-client-core-0.16-G73kHISuefHHMQ5tSmiWmL" False) (C1 (MetaCons "Response" PrefixI True) ((S1 (MetaSel (Just "responseStatusCode") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Status) :*: S1 (MetaSel (Just "responseHeaders") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Seq Header))) :*: (S1 (MetaSel (Just "responseHttpVersion") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 HttpVersion) :*: S1 (MetaSel (Just "responseBody") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))))

data ClientError Source #

A type representing possible errors in a request

Note that this type substantially changed in 0.12.

Constructors

FailureResponse (RequestF () (BaseUrl, ByteString)) Response

The server returned an error response including the failing request. requestPath includes the BaseUrl and the path of the request.

DecodeFailure Text Response

The body could not be decoded at the expected type

UnsupportedContentType MediaType Response

The content-type of the response is not supported

InvalidContentTypeHeader Response

The content-type header is invalid

ConnectionError SomeException

There was a connection error, and no response was received

Instances
Eq ClientError 
Instance details

Defined in Servant.Client.Core.ClientError

Show ClientError 
Instance details

Defined in Servant.Client.Core.ClientError

Generic ClientError 
Instance details

Defined in Servant.Client.Core.ClientError

Associated Types

type Rep ClientError :: Type -> Type Source #

NFData ClientError

Note: an exception in ConnectionError might not be evaluated fully, We only rnf its showed value.

Instance details

Defined in Servant.Client.Core.ClientError

Methods

rnf :: ClientError -> () Source #

Exception ClientError 
Instance details

Defined in Servant.Client.Core.ClientError

MonadError ClientError ClientM 
Instance details

Defined in Servant.Client.JS

type Rep ClientError 
Instance details

Defined in Servant.Client.Core.ClientError

class RunClient m => HasClient (m :: Type -> Type) api where Source #

This class lets us define how each API combinator influences the creation of an HTTP request.

Unless you are writing a new backend for servant-client-core or new combinators that you want to support client-generation, you can ignore this class.

Associated Types

type Client (m :: Type -> Type) api :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy api -> Request -> Client m api Source #

hoistClientMonad :: Proxy m -> Proxy api -> (forall x. mon x -> mon' x) -> Client mon api -> Client mon' api Source #

Instances
RunClient m => HasClient m Raw

Pick a Method and specify where the server you want to query is. You get back the full ResponseF.

Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m Raw :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy Raw -> Request -> Client m Raw Source #

hoistClientMonad :: Proxy m -> Proxy Raw -> (forall x. mon x -> mon' x) -> Client mon Raw -> Client mon' Raw Source #

RunClient m => HasClient m EmptyAPI

The client for EmptyAPI is simply EmptyClient.

type MyAPI = "books" :> Get '[JSON] [Book] -- GET /books
        :<|> "nothing" :> EmptyAPI

myApi :: Proxy MyApi
myApi = Proxy

getAllBooks :: ClientM [Book]
(getAllBooks :<|> EmptyClient) = client myApi
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m EmptyAPI :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy EmptyAPI -> Request -> Client m EmptyAPI Source #

hoistClientMonad :: Proxy m -> Proxy EmptyAPI -> (forall x. mon x -> mon' x) -> Client mon EmptyAPI -> Client mon' EmptyAPI Source #

(HasClient m a, HasClient m b) => HasClient m (a :<|> b)

A client querying function for a :<|> b will actually hand you one function for querying a and another one for querying b, stitching them together with :<|>, which really is just like a pair.

type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
        :<|> "books" :> ReqBody '[JSON] Book :> Post Book -- POST /books

myApi :: Proxy MyApi
myApi = Proxy

getAllBooks :: ClientM [Book]
postNewBook :: Book -> ClientM Book
(getAllBooks :<|> postNewBook) = client myApi
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (a :<|> b) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (a :<|> b) -> Request -> Client m (a :<|> b) Source #

hoistClientMonad :: Proxy m -> Proxy (a :<|> b) -> (forall x. mon x -> mon' x) -> Client mon (a :<|> b) -> Client mon' (a :<|> b) Source #

HasClient m subapi => HasClient m (WithNamedContext name context subapi) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (WithNamedContext name context subapi) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (WithNamedContext name context subapi) -> Request -> Client m (WithNamedContext name context subapi) Source #

hoistClientMonad :: Proxy m -> Proxy (WithNamedContext name context subapi) -> (forall x. mon x -> mon' x) -> Client mon (WithNamedContext name context subapi) -> Client mon' (WithNamedContext name context subapi) Source #

(KnownSymbol sym, ToHttpApiData a, HasClient m api, SBoolI (FoldRequired mods)) => HasClient m (QueryParam' mods sym a :> api)

If you use a QueryParam in one of your endpoints in your API, the corresponding querying function will automatically take an additional argument of the type specified by your QueryParam, enclosed in Maybe.

If you give Nothing, nothing will be added to the query string.

If you give a non-Nothing value, this function will take care of inserting a textual representation of this value in the query string.

You can control how values for your type are turned into text by specifying a ToHttpApiData instance for your type.

Example:

type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]

myApi :: Proxy MyApi
myApi = Proxy

getBooksBy :: Maybe Text -> ClientM [Book]
getBooksBy = client myApi
-- then you can just use "getBooksBy" to query that endpoint.
-- 'getBooksBy Nothing' for all books
-- 'getBooksBy (Just "Isaac Asimov")' to get all books by Isaac Asimov
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (QueryParam' mods sym a :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (QueryParam' mods sym a :> api) -> Request -> Client m (QueryParam' mods sym a :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (QueryParam' mods sym a :> api) -> (forall x. mon x -> mon' x) -> Client mon (QueryParam' mods sym a :> api) -> Client mon' (QueryParam' mods sym a :> api) Source #

(KnownSymbol sym, ToHttpApiData a, HasClient m api) => HasClient m (QueryParams sym a :> api)

If you use a QueryParams in one of your endpoints in your API, the corresponding querying function will automatically take an additional argument, a list of values of the type specified by your QueryParams.

If you give an empty list, nothing will be added to the query string.

Otherwise, this function will take care of inserting a textual representation of your values in the query string, under the same query string parameter name.

You can control how values for your type are turned into text by specifying a ToHttpApiData instance for your type.

Example:

type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]

myApi :: Proxy MyApi
myApi = Proxy

getBooksBy :: [Text] -> ClientM [Book]
getBooksBy = client myApi
-- then you can just use "getBooksBy" to query that endpoint.
-- 'getBooksBy []' for all books
-- 'getBooksBy ["Isaac Asimov", "Robert A. Heinlein"]'
--   to get all books by Asimov and Heinlein
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (QueryParams sym a :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (QueryParams sym a :> api) -> Request -> Client m (QueryParams sym a :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (QueryParams sym a :> api) -> (forall x. mon x -> mon' x) -> Client mon (QueryParams sym a :> api) -> Client mon' (QueryParams sym a :> api) Source #

(KnownSymbol sym, HasClient m api) => HasClient m (QueryFlag sym :> api)

If you use a QueryFlag in one of your endpoints in your API, the corresponding querying function will automatically take an additional Bool argument.

If you give False, nothing will be added to the query string.

Otherwise, this function will insert a value-less query string parameter under the name associated to your QueryFlag.

Example:

type MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book]

myApi :: Proxy MyApi
myApi = Proxy

getBooks :: Bool -> ClientM [Book]
getBooks = client myApi
-- then you can just use "getBooks" to query that endpoint.
-- 'getBooksBy False' for all books
-- 'getBooksBy True' to only get _already published_ books
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (QueryFlag sym :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (QueryFlag sym :> api) -> Request -> Client m (QueryFlag sym :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (QueryFlag sym :> api) -> (forall x. mon x -> mon' x) -> Client mon (QueryFlag sym :> api) -> Client mon' (QueryFlag sym :> api) Source #

(MimeRender ct a, HasClient m api) => HasClient m (ReqBody' mods (ct ': cts) a :> api)

If you use a ReqBody in one of your endpoints in your API, the corresponding querying function will automatically take an additional argument of the type specified by your ReqBody. That function will take care of encoding this argument as JSON and of using it as the request body.

All you need is for your type to have a ToJSON instance.

Example:

type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book

myApi :: Proxy MyApi
myApi = Proxy

addBook :: Book -> ClientM Book
addBook = client myApi
-- then you can just use "addBook" to query that endpoint
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (ReqBody' mods (ct ': cts) a :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (ReqBody' mods (ct ': cts) a :> api) -> Request -> Client m (ReqBody' mods (ct ': cts) a :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (ReqBody' mods (ct ': cts) a :> api) -> (forall x. mon x -> mon' x) -> Client mon (ReqBody' mods (ct ': cts) a :> api) -> Client mon' (ReqBody' mods (ct ': cts) a :> api) Source #

(HasClient m api, MimeRender ctype chunk, FramingRender framing, ToSourceIO chunk a) => HasClient m (StreamBody' mods framing ctype a :> api) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (StreamBody' mods framing ctype a :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (StreamBody' mods framing ctype a :> api) -> Request -> Client m (StreamBody' mods framing ctype a :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (StreamBody' mods framing ctype a :> api) -> (forall x. mon x -> mon' x) -> Client mon (StreamBody' mods framing ctype a :> api) -> Client mon' (StreamBody' mods framing ctype a :> api) Source #

(KnownSymbol path, HasClient m api) => HasClient m (path :> api)

Make the querying function append path to the request path.

Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (path :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (path :> api) -> Request -> Client m (path :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (path :> api) -> (forall x. mon x -> mon' x) -> Client mon (path :> api) -> Client mon' (path :> api) Source #

HasClient m api => HasClient m (Vault :> api) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Vault :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Vault :> api) -> Request -> Client m (Vault :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (Vault :> api) -> (forall x. mon x -> mon' x) -> Client mon (Vault :> api) -> Client mon' (Vault :> api) Source #

HasClient m api => HasClient m (RemoteHost :> api) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (RemoteHost :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (RemoteHost :> api) -> Request -> Client m (RemoteHost :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (RemoteHost :> api) -> (forall x. mon x -> mon' x) -> Client mon (RemoteHost :> api) -> Client mon' (RemoteHost :> api) Source #

(KnownSymbol capture, ToHttpApiData a, HasClient m api) => HasClient m (Capture' mods capture a :> api)

If you use a Capture in one of your endpoints in your API, the corresponding querying function will automatically take an additional argument of the type specified by your Capture. That function will take care of inserting a textual representation of this value at the right place in the request path.

You can control how values for this type are turned into text by specifying a ToHttpApiData instance for your type.

Example:

type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book

myApi :: Proxy MyApi
myApi = Proxy

getBook :: Text -> ClientM Book
getBook = client myApi
-- then you can just use "getBook" to query that endpoint
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Capture' mods capture a :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Capture' mods capture a :> api) -> Request -> Client m (Capture' mods capture a :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (Capture' mods capture a :> api) -> (forall x. mon x -> mon' x) -> Client mon (Capture' mods capture a :> api) -> Client mon' (Capture' mods capture a :> api) Source #

(KnownSymbol capture, ToHttpApiData a, HasClient m sublayout) => HasClient m (CaptureAll capture a :> sublayout)

If you use a CaptureAll in one of your endpoints in your API, the corresponding querying function will automatically take an additional argument of a list of the type specified by your CaptureAll. That function will take care of inserting a textual representation of this value at the right place in the request path.

You can control how these values are turned into text by specifying a ToHttpApiData instance of your type.

Example:

type MyAPI = "src" :> CaptureAll Text -> Get '[JSON] SourceFile

myApi :: Proxy
myApi = Proxy
getSourceFile :: [Text] -> ClientM SourceFile
getSourceFile = client myApi
-- then you can use "getSourceFile" to query that endpoint
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (CaptureAll capture a :> sublayout) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (CaptureAll capture a :> sublayout) -> Request -> Client m (CaptureAll capture a :> sublayout) Source #

hoistClientMonad :: Proxy m -> Proxy (CaptureAll capture a :> sublayout) -> (forall x. mon x -> mon' x) -> Client mon (CaptureAll capture a :> sublayout) -> Client mon' (CaptureAll capture a :> sublayout) Source #

(KnownSymbol sym, ToHttpApiData a, HasClient m api, SBoolI (FoldRequired mods)) => HasClient m (Header' mods sym a :> api)

If you use a Header in one of your endpoints in your API, the corresponding querying function will automatically take an additional argument of the type specified by your Header, wrapped in Maybe.

That function will take care of encoding this argument as Text in the request headers.

All you need is for your type to have a ToHttpApiData instance.

Example:

newtype Referer = Referer { referrer :: Text }
  deriving (Eq, Show, Generic, ToHttpApiData)

           -- GET /view-my-referer
type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get '[JSON] Referer

myApi :: Proxy MyApi
myApi = Proxy

viewReferer :: Maybe Referer -> ClientM Book
viewReferer = client myApi
-- then you can just use "viewRefer" to query that endpoint
-- specifying Nothing or e.g Just "http://haskell.org/" as arguments
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Header' mods sym a :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Header' mods sym a :> api) -> Request -> Client m (Header' mods sym a :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (Header' mods sym a :> api) -> (forall x. mon x -> mon' x) -> Client mon (Header' mods sym a :> api) -> Client mon' (Header' mods sym a :> api) Source #

HasClient m api => HasClient m (HttpVersion :> api)

Using a HttpVersion combinator in your API doesn't affect the client functions.

Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (HttpVersion :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (HttpVersion :> api) -> Request -> Client m (HttpVersion :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (HttpVersion :> api) -> (forall x. mon x -> mon' x) -> Client mon (HttpVersion :> api) -> Client mon' (HttpVersion :> api) Source #

HasClient m api => HasClient m (Summary desc :> api)

Ignore Summary in client functions.

Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Summary desc :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Summary desc :> api) -> Request -> Client m (Summary desc :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (Summary desc :> api) -> (forall x. mon x -> mon' x) -> Client mon (Summary desc :> api) -> Client mon' (Summary desc :> api) Source #

HasClient m api => HasClient m (Description desc :> api)

Ignore Description in client functions.

Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Description desc :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Description desc :> api) -> Request -> Client m (Description desc :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (Description desc :> api) -> (forall x. mon x -> mon' x) -> Client mon (Description desc :> api) -> Client mon' (Description desc :> api) Source #

HasClient m api => HasClient m (IsSecure :> api) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (IsSecure :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (IsSecure :> api) -> Request -> Client m (IsSecure :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (IsSecure :> api) -> (forall x. mon x -> mon' x) -> Client mon (IsSecure :> api) -> Client mon' (IsSecure :> api) Source #

HasClient m api => HasClient m (AuthProtect tag :> api) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (AuthProtect tag :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (AuthProtect tag :> api) -> Request -> Client m (AuthProtect tag :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (AuthProtect tag :> api) -> (forall x. mon x -> mon' x) -> Client mon (AuthProtect tag :> api) -> Client mon' (AuthProtect tag :> api) Source #

HasClient m api => HasClient m (BasicAuth realm usr :> api) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (BasicAuth realm usr :> api) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (BasicAuth realm usr :> api) -> Request -> Client m (BasicAuth realm usr :> api) Source #

hoistClientMonad :: Proxy m -> Proxy (BasicAuth realm usr :> api) -> (forall x. mon x -> mon' x) -> Client mon (BasicAuth realm usr :> api) -> Client mon' (BasicAuth realm usr :> api) Source #

(RunClient m, MimeUnrender ct a, ReflectMethod method, cts' ~ (ct ': cts)) => HasClient m (Verb method status cts' a) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Verb method status cts' a) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Verb method status cts' a) -> Request -> Client m (Verb method status cts' a) Source #

hoistClientMonad :: Proxy m -> Proxy (Verb method status cts' a) -> (forall x. mon x -> mon' x) -> Client mon (Verb method status cts' a) -> Client mon' (Verb method status cts' a) Source #

(RunClient m, ReflectMethod method) => HasClient m (Verb method status cts NoContent) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Verb method status cts NoContent) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Verb method status cts NoContent) -> Request -> Client m (Verb method status cts NoContent) Source #

hoistClientMonad :: Proxy m -> Proxy (Verb method status cts NoContent) -> (forall x. mon x -> mon' x) -> Client mon (Verb method status cts NoContent) -> Client mon' (Verb method status cts NoContent) Source #

(RunClient m, MimeUnrender ct a, BuildHeadersTo ls, ReflectMethod method, cts' ~ (ct ': cts)) => HasClient m (Verb method status cts' (Headers ls a)) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Verb method status cts' (Headers ls a)) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Verb method status cts' (Headers ls a)) -> Request -> Client m (Verb method status cts' (Headers ls a)) Source #

hoistClientMonad :: Proxy m -> Proxy (Verb method status cts' (Headers ls a)) -> (forall x. mon x -> mon' x) -> Client mon (Verb method status cts' (Headers ls a)) -> Client mon' (Verb method status cts' (Headers ls a)) Source #

(RunClient m, BuildHeadersTo ls, ReflectMethod method) => HasClient m (Verb method status cts (Headers ls NoContent)) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Verb method status cts (Headers ls NoContent)) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Verb method status cts (Headers ls NoContent)) -> Request -> Client m (Verb method status cts (Headers ls NoContent)) Source #

hoistClientMonad :: Proxy m -> Proxy (Verb method status cts (Headers ls NoContent)) -> (forall x. mon x -> mon' x) -> Client mon (Verb method status cts (Headers ls NoContent)) -> Client mon' (Verb method status cts (Headers ls NoContent)) Source #

(RunStreamingClient m, MimeUnrender ct chunk, ReflectMethod method, FramingUnrender framing, FromSourceIO chunk a) => HasClient m (Stream method status framing ct a) 
Instance details

Defined in Servant.Client.Core.HasClient

Associated Types

type Client m (Stream method status framing ct a) :: Type Source #

Methods

clientWithRoute :: Proxy m -> Proxy (Stream method status framing ct a) -> Request -> Client m (Stream method status framing ct a) Source #

hoistClientMonad :: Proxy m -> Proxy (Stream method status framing ct a) -> (forall x. mon x -> mon' x) -> Client mon (Stream method status framing ct a) -> Client mon' (Stream method status framing ct a) Source #

data BaseUrl Source #

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

Constructors

BaseUrl 

Fields

Instances
Eq BaseUrl 
Instance details

Defined in Servant.Client.Core.BaseUrl

Data BaseUrl 
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 :: (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 
Instance details

Defined in Servant.Client.Core.BaseUrl

Show BaseUrl 
Instance details

Defined in Servant.Client.Core.BaseUrl

Generic BaseUrl 
Instance details

Defined in Servant.Client.Core.BaseUrl

Associated Types

type Rep BaseUrl :: Type -> Type Source #

Lift BaseUrl 
Instance details

Defined in Servant.Client.Core.BaseUrl

Methods

lift :: BaseUrl -> Q Exp Source #

NFData BaseUrl 
Instance details

Defined in Servant.Client.Core.BaseUrl

Methods

rnf :: BaseUrl -> () Source #

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

Defined in Servant.Client.Core.BaseUrl

ToJSONKey BaseUrl
>>> :{
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
>>> 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 
Instance details

Defined in Servant.Client.Core.BaseUrl

type Rep BaseUrl 
Instance details

Defined in Servant.Client.Core.BaseUrl

type Rep BaseUrl = D1 (MetaData "BaseUrl" "Servant.Client.Core.BaseUrl" "servant-client-core-0.16-G73kHISuefHHMQ5tSmiWmL" False) (C1 (MetaCons "BaseUrl" PrefixI True) ((S1 (MetaSel (Just "baseUrlScheme") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Scheme) :*: S1 (MetaSel (Just "baseUrlHost") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) :*: (S1 (MetaSel (Just "baseUrlPort") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: S1 (MetaSel (Just "baseUrlPath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))))

withStreamingRequestJSM :: Maybe AbortController -> Request -> (StreamingResponse -> JSM a) -> ClientM a Source #

A variation on Servant.Client.Core.withStreamingRequest where the continuation / callback passed as the second argument is in the JSM monad as opposed to the IO monad. Executes the given request and passes the response data stream to the provided continuation / callback.

newtype ClientEnv Source #

Constructors

ClientEnv 

Fields

Instances
Eq ClientEnv 
Instance details

Defined in Servant.Client.JS

Show ClientEnv 
Instance details

Defined in Servant.Client.JS

MonadReader ClientEnv ClientM 
Instance details

Defined in Servant.Client.JS

newtype ClientM a Source #

Instances
Monad ClientM 
Instance details

Defined in Servant.Client.JS

Methods

(>>=) :: ClientM a -> (a -> ClientM b) -> ClientM b Source #

(>>) :: ClientM a -> ClientM b -> ClientM b Source #

return :: a -> ClientM a Source #

fail :: String -> ClientM a Source #

Functor ClientM 
Instance details

Defined in Servant.Client.JS

Methods

fmap :: (a -> b) -> ClientM a -> ClientM b Source #

(<$) :: a -> ClientM b -> ClientM a Source #

Applicative ClientM 
Instance details

Defined in Servant.Client.JS

Methods

pure :: a -> ClientM a Source #

(<*>) :: ClientM (a -> b) -> ClientM a -> ClientM b Source #

liftA2 :: (a -> b -> c) -> ClientM a -> ClientM b -> ClientM c Source #

(*>) :: ClientM a -> ClientM b -> ClientM b Source #

(<*) :: ClientM a -> ClientM b -> ClientM a Source #

MonadJSM ClientM 
Instance details

Defined in Servant.Client.JS

Methods

liftJSM' :: JSM a -> ClientM a Source #

MonadIO ClientM 
Instance details

Defined in Servant.Client.JS

Methods

liftIO :: IO a -> ClientM a Source #

MonadThrow ClientM 
Instance details

Defined in Servant.Client.JS

Methods

throwM :: Exception e => e -> ClientM a Source #

MonadCatch ClientM 
Instance details

Defined in Servant.Client.JS

Methods

catch :: Exception e => ClientM a -> (e -> ClientM a) -> ClientM a Source #

Alt ClientM 
Instance details

Defined in Servant.Client.JS

RunClient ClientM 
Instance details

Defined in Servant.Client.JS

RunStreamingClient ClientM 
Instance details

Defined in Servant.Client.JS

MonadReader ClientEnv ClientM 
Instance details

Defined in Servant.Client.JS

MonadError ClientError ClientM 
Instance details

Defined in Servant.Client.JS

MonadBase IO ClientM 
Instance details

Defined in Servant.Client.JS

Methods

liftBase :: IO α -> ClientM α Source #

MonadBaseControl IO ClientM 
Instance details

Defined in Servant.Client.JS

Associated Types

type StM ClientM a :: Type Source #

Generic (ClientM a) 
Instance details

Defined in Servant.Client.JS

Associated Types

type Rep (ClientM a) :: Type -> Type Source #

Methods

from :: ClientM a -> Rep (ClientM a) x Source #

to :: Rep (ClientM a) x -> ClientM a Source #

type StM ClientM a 
Instance details

Defined in Servant.Client.JS

type Rep (ClientM a) 
Instance details

Defined in Servant.Client.JS

type Rep (ClientM a) = D1 (MetaData "ClientM" "Servant.Client.JS" "servant-client-js-0.1.0.0-4A9OV0za5azE5cDQfCiuNW" True) (C1 (MetaCons "ClientM" PrefixI True) (S1 (MetaSel (Just "runClientM'") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ReaderT ClientEnv (ExceptT ClientError JSM) a))))