License | BSD3 |
---|---|
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Provides a client for a web api for a given contract.
- client :: (CookieOut m r ~ (), ToParam (PathParam m r) PathParam, ToParam (QueryParam m r) QueryParam, ToParam (FormParam m r) FormParam, ToHeader (HeaderIn m r), ToParam (FileParam m r) FileParam, FromHeader (HeaderOut m r), Decodings (ContentTypes m r) (ApiOut m r), Decodings (ContentTypes m r) (ApiErr m r), ParamErrToApiErr (ApiErr m r), SingMethod m, MkPathFormatString r) => ClientSettings -> Request m r -> IO (Response m r)
- fromClientResponse :: forall m r. (FromHeader (HeaderOut m r), ParamErrToApiErr (ApiErr m r), Decodings (ContentTypes m r) (ApiOut m r), Decodings (ContentTypes m r) (ApiErr m r), CookieOut m r ~ ()) => Response BodyReader -> IO (Response m r)
- toClientRequest :: forall m r. (ToParam (PathParam m r) PathParam, ToParam (QueryParam m r) QueryParam, ToParam (FormParam m r) FormParam, ToHeader (HeaderIn m r), ToParam (FileParam m r) FileParam, SingMethod m, MkPathFormatString r) => Request -> Request m r -> IO Request
- link :: (ToParam (QueryParam m r) QueryParam, MkPathFormatString r, ToParam (PathParam m r) PathParam) => route m r -> URI -> PathParam m r -> Maybe (QueryParam m r) -> URI
- data ClientSettings = ClientSettings {}
- data UnknownClientException
Client related functions
client :: (CookieOut m r ~ (), ToParam (PathParam m r) PathParam, ToParam (QueryParam m r) QueryParam, ToParam (FormParam m r) FormParam, ToHeader (HeaderIn m r), ToParam (FileParam m r) FileParam, FromHeader (HeaderOut m r), Decodings (ContentTypes m r) (ApiOut m r), Decodings (ContentTypes m r) (ApiErr m r), ParamErrToApiErr (ApiErr m r), SingMethod m, MkPathFormatString r) => ClientSettings -> Request m r -> IO (Response m r) Source
fromClientResponse :: forall m r. (FromHeader (HeaderOut m r), ParamErrToApiErr (ApiErr m r), Decodings (ContentTypes m r) (ApiOut m r), Decodings (ContentTypes m r) (ApiErr m r), CookieOut m r ~ ()) => Response BodyReader -> IO (Response m r) Source
Creates the Response
type from the response body.
toClientRequest :: forall m r. (ToParam (PathParam m r) PathParam, ToParam (QueryParam m r) QueryParam, ToParam (FormParam m r) FormParam, ToHeader (HeaderIn m r), ToParam (FileParam m r) FileParam, SingMethod m, MkPathFormatString r) => Request -> Request m r -> IO Request Source
Creates a request from the Request
type.
link :: (ToParam (QueryParam m r) QueryParam, MkPathFormatString r, ToParam (PathParam m r) PathParam) => route m r -> URI -> PathParam m r -> Maybe (QueryParam m r) -> URI Source
Generate a type safe URL for a given route type. The URI can be used for setting a base URL if required.
Types
data ClientSettings Source
Datatype representing the settings related to client.
ClientSettings | |
|
data UnknownClientException Source
This exception is used to signal an irrecoverable error while deserializing the response.