webapi-0.3: WAI based library for web api

Safe HaskellNone




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


Client related functions

client :: forall m r. (CookieOut m r ~ (), ToParam PathParam (PathParam m r), ToParam QueryParam (QueryParam m r), ToParam FormParam (FormParam m r), ToHeader (HeaderIn m r), ToParam FileParam (FileParam m r), FromHeader (HeaderOut m r), Decodings (ContentTypes m r) (ApiOut m r), Decodings (ContentTypes m r) (ApiErr m r), SingMethod m, MkPathFormatString r, PartEncodings (RequestBody m r), ToHListRecTuple (StripContents (RequestBody m 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), 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 (QueryParam m r), MkPathFormatString r, ToParam PathParam (PathParam m r)) => 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.

Connection manager

data Manager :: *

class HasHttpManager a where


getHttpManager :: a -> Manager

Connection manager settings

data ManagerSettings :: *