webapi-0.3: WAI based library for web api

LicenseBSD3
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

WebApi.Client

Contents

Description

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

Synopsis

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.

Types

data ClientSettings Source

Datatype representing the settings related to client.

Constructors

ClientSettings 

Fields

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

Methods

getHttpManager :: a -> Manager

Connection manager settings

data ManagerSettings :: *