mu-servant-server-0.4.0.0: Servant servers for Mu definitions
Safe HaskellNone
LanguageHaskell2010

Mu.Servant.Server

Description

This module allows you to serve a Mu Server as an OpenAPI Swagger REST end-point. In particular, it translates to the kind of type-level APIs used by Servant.

Synopsis

Convert Mu to Servant

servantServerHandlers Source #

Arguments

:: forall pname m chn ss handlers. (ServantServiceHandlers ('Package pname ss) m chn ss handlers, ExtraFor ('Package pname ss) ~ EmptyAPI) 
=> (forall a. m a -> Handler a)

how to turn the inner Mu monad into Handler, use toHandler (or a composition with it) in most cases

-> ServerT chn () ('Package pname ss) m handlers

server to be converted

-> Server (PackageAPI ('Package pname ss) handlers) 

Converts a Mu server into Servant server by running all Mu handler actions in the Handler type. This version assumes no additional routes in the Servant server when compared to Mu's.

servantServerHandlersExtra Source #

Arguments

:: forall pname m chn ss handlers. ServantServiceHandlers ('Package pname ss) m chn ss handlers 
=> (forall a. m a -> Handler a)

how to turn the inner Mu monad into Handler, use toHandler (or a composition with it) in most cases

-> Server (ExtraFor ('Package pname ss))

additional handler for the extra route

-> ServerT chn () ('Package pname ss) m handlers

server to be converted

-> Server (PackageAPI ('Package pname ss) handlers) 

Converts a Mu server into Servant server by running all Mu handler actions in the Handler type. This version should be used when additional routes have been added in the Servant version.

toHandler :: ServerErrorIO a -> Handler a Source #

Reinterprets a Mu server action as a Servant handler.

packageAPI :: ServerT chn t pkg s handlers -> Proxy (PackageAPI pkg handlers) Source #

Obtains a Servant API Proxy value for use with functions like serve and layout.

swagger :: forall pname ss handlers chn m. HasSwagger (ServicesAPI ('Package pname ss) ss handlers) => ServerT chn () ('Package pname ss) m handlers -> Swagger Source #

Converts the information from a Mu server into a Swagger document.

Required annotations

data ServantRoute Source #

ServantRoute represents the URL path components of a route. It is used as an AnnotatedPackage domain to override the default path for a Method. When used in an AnnService, the specified TopLevelRoute is used as a prefix for all Methods in that Service. 1. List of components for the route, 2. HTTP method which must be used, 3. HTTP status code of a successful HTTP response from a specific Method. Use 200 for the usual status code.

data ServantContentTypes Source #

ServantContentTypes represents that acceptable content types that can be used when a message in encoded: 1. in a unary (non-streaming) HTTP request/response body, 2. encoded in a streaming HTTP request/response body. It is used as an AnnotatedSchema domain.

data StdMethod #

HTTP standard method (as defined by RFC 2616, and PATCH which is defined by RFC 5789).

Constructors

GET 
POST 
HEAD 
PUT 
DELETE 
TRACE 
CONNECT 
OPTIONS 
PATCH 

Instances

Instances details
Bounded StdMethod 
Instance details

Defined in Network.HTTP.Types.Method

Enum StdMethod 
Instance details

Defined in Network.HTTP.Types.Method

Eq StdMethod 
Instance details

Defined in Network.HTTP.Types.Method

Ord StdMethod 
Instance details

Defined in Network.HTTP.Types.Method

Read StdMethod 
Instance details

Defined in Network.HTTP.Types.Method

Show StdMethod 
Instance details

Defined in Network.HTTP.Types.Method

Ix StdMethod 
Instance details

Defined in Network.HTTP.Types.Method

ReflectMethod 'PATCH 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'OPTIONS 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'CONNECT 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'TRACE 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'DELETE 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'PUT 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'HEAD 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'POST 
Instance details

Defined in Servant.API.Verbs

ReflectMethod 'GET 
Instance details

Defined in Servant.API.Verbs

SwaggerMethod 'PATCH 
Instance details

Defined in Servant.Swagger.Internal

SwaggerMethod 'OPTIONS 
Instance details

Defined in Servant.Swagger.Internal

SwaggerMethod 'DELETE 
Instance details

Defined in Servant.Swagger.Internal

SwaggerMethod 'PUT 
Instance details

Defined in Servant.Swagger.Internal

SwaggerMethod 'HEAD 
Instance details

Defined in Servant.Swagger.Internal

SwaggerMethod 'POST 
Instance details

Defined in Servant.Swagger.Internal

SwaggerMethod 'GET 
Instance details

Defined in Servant.Swagger.Internal