httpstan-0.3.0.0: Auto-generated API bindings for httpstan
Safe HaskellSafe-Inferred
LanguageHaskell2010

Httpstan.API

Synopsis

Client and Server

data Config Source #

Server or client configuration, specifying the host and port to query or serve on.

Constructors

Config 

Fields

Instances

Instances details
Read Config Source # 
Instance details

Defined in Httpstan.API

Show Config Source # 
Instance details

Defined in Httpstan.API

Eq Config Source # 
Instance details

Defined in Httpstan.API

Methods

(==) :: Config -> Config -> Bool #

(/=) :: Config -> Config -> Bool #

Ord Config Source # 
Instance details

Defined in Httpstan.API

data HttpstanBackend m Source #

Configuration, specifying the full url of the service.

Backend for Httpstan. The backend can be used both for the client and the server. The client generated from the Httpstan OpenAPI spec is a backend that executes actions by sending HTTP requests (see createHttpstanClient). Alternatively, provided a backend, the API can be served using runHttpstanMiddlewareServer.

Constructors

HttpstanBackend 

Fields

runHttpstanServer :: (MonadIO m, MonadThrow m) => Config -> HttpstanBackend (ExceptT ServerError IO) -> m () Source #

Run the Httpstan server at the provided host and port.

runHttpstanMiddlewareServer :: (MonadIO m, MonadThrow m) => Config -> Middleware -> HttpstanBackend (ExceptT ServerError IO) -> m () Source #

Run the Httpstan server at the provided host and port.

runHttpstanClient :: Config -> HttpstanClient a -> ExceptT ClientError IO a Source #

Run requests in the HttpstanClient monad.

runHttpstanClientWithManager :: Manager -> Config -> HttpstanClient a -> ExceptT ClientError IO a Source #

Run requests in the HttpstanClient monad using a custom manager.

callHttpstan :: (MonadIO m, MonadThrow m) => ClientEnv -> HttpstanClient a -> m a Source #

Like runClient, but returns the response or throws a HttpstanClientError

data HttpstanClient a Source #

Instances

Instances details
MonadIO HttpstanClient Source # 
Instance details

Defined in Httpstan.API

Methods

liftIO :: IO a -> HttpstanClient a #

Applicative HttpstanClient Source # 
Instance details

Defined in Httpstan.API

Functor HttpstanClient Source # 
Instance details

Defined in Httpstan.API

Methods

fmap :: (a -> b) -> HttpstanClient a -> HttpstanClient b #

(<$) :: a -> HttpstanClient b -> HttpstanClient a #

Monad HttpstanClient Source # 
Instance details

Defined in Httpstan.API

Servant

type HttpstanAPI = ("v1" :> ("health" :> Verb 'GET 200 '[JSON] NoContent)) :<|> (("v1" :> ("models" :> Verb 'GET 200 '[JSON] V1ModelsGet200Response)) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> Verb 'DELETE 200 '[JSON] NoContent))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("fits" :> (Capture "fit_id" Text :> Verb 'DELETE 200 '[JSON] NoContent))))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("fits" :> (Capture "fit_id" Text :> Verb 'GET 200 '[JSON] NoContent))))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("fits" :> (ReqBody '[JSON] CreateFitRequest :> Verb 'POST 201 '[JSON] Fit))))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("log_prob_grad" :> (ReqBody '[JSON] Bool :> Verb 'POST 200 '[JSON] V1ModelsModelIdLogProbGradPost200Response))))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("log_prob" :> (ReqBody '[JSON] Bool :> Verb 'POST 200 '[JSON] V1ModelsModelIdLogProbPost200Response))))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("params" :> (ReqBody '[JSON] Value :> Verb 'POST 200 '[JSON] V1ModelsModelIdParamsPost200Response))))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("transform_inits" :> (ReqBody '[JSON] Value :> Verb 'POST 200 '[JSON] V1ModelsModelIdTransformInitsPost200Response))))) :<|> (("v1" :> ("models" :> (Capture "model_id" Text :> ("write_array" :> (ReqBody '[JSON] Bool :> Verb 'POST 200 '[JSON] V1ModelsModelIdWriteArrayPost200Response))))) :<|> (("v1" :> ("models" :> (ReqBody '[JSON] CreateModelRequest :> Verb 'POST 201 '[JSON] Model))) :<|> (("v1" :> ("operations" :> (Capture "operation_id" Text :> Verb 'GET 200 '[JSON] Operation))) :<|> Raw)))))))))))) Source #

Servant type-level API, generated from the OpenAPI spec for Httpstan.

Plain WAI Application

serverWaiApplicationHttpstan :: HttpstanBackend (ExceptT ServerError IO) -> Application Source #

Plain Network.Wai Application for the Httpstan server.

Can be used to implement e.g. tests that call the API without a full webserver.