Servant.Client.Core.RunClient

servant-client-core-0.20.2: Core functionality and class for client function generation for servant APIs

Safe Haskell | None
Language | Haskell2010

Servant.Client.Core.RunClient

Description

Types for possible backends to run client-side `Request` queries

Synopsis

- class Monad m => RunClient (m :: Type -> Type) where
  - runRequestAcceptStatus :: Maybe [Status] -> Request -> m Response
  - throwClientError :: ClientError -> m a
- runRequest :: RunClient m => Request -> m Response
- class RunClient m => RunStreamingClient (m :: Type -> Type) where
  - withStreamingRequest :: Request -> (StreamingResponse -> IO a) -> m a
- data ClientF a
  - = RunRequest Request (Response -> a)
  - | Throw ClientError

# Documentation

class Monad m => RunClient (m :: Type -> Type) where #

Methods

runRequestAcceptStatus :: Maybe [Status] -> Request -> m Response #

How to make a request, with an optional list of status codes to not throw exceptions for (default: [200..299]).

throwClientError :: ClientError -> m a #

#### Instances

Instances details

ClientF ~ f => RunClient (Free f) # |
Instance details Defined in Servant.Client.Core.RunClient Methods runRequestAcceptStatus :: Maybe [Status] -> Request -> Free f Response # throwClientError :: ClientError -> Free f a #

runRequest :: RunClient m => Request -> m Response #

How to make a request.

class RunClient m => RunStreamingClient (m :: Type -> Type) where #

Methods

withStreamingRequest :: Request -> (StreamingResponse -> IO a) -> m a #

data ClientF a #

`ClientF` cannot stream.

Compare to `RunClient`.

Constructors

RunRequest Request (Response -> a) |
Throw ClientError |

#### Instances

Instances details

Functor ClientF # |
Instance details Defined in Servant.Client.Core.RunClient Methods fmap :: (a -> b) -> ClientF a -> ClientF b # (<$) :: a -> ClientF b -> ClientF a #