webapi- WAI based library for web api

Safe HaskellNone




Provides a client for a web api for a given contract.


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

Given a Request type, create the request and obtain a response. Gives back a Response.

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.

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.


data ClientSettings Source

Datatype representing the settings related to client.




baseUrl :: String

base url of the API being called.

connectionManager :: Manager

connection manager for the connection.

data UnknownClientException Source

This exception is used to signal an irrecoverable error while deserializing the response.