servant-0.11: A family of combinators for defining webservices APIs

Safe Haskell | Safe
Language | Haskell2010

Servant.API.ReqBody

Synopsis

- data ReqBody contentTypes a

# Documentation

data ReqBody contentTypes a #

Extract the request body as a value of type `a`.

Example:

    >>> -- POST /books
    >>> type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book

Instances

HasLink k1 sub => HasLink * ((:>) k1 * (ReqBody k ct a) sub) # |
Associated Types type MkLink ((:>) k1 * (ReqBody k ct a) sub) (endpoint :: (:>) k1 * (ReqBody k ct a) sub) :: * # Methods toLink :: Proxy ((k1 :> *) (ReqBody k ct a) sub) endpoint -> Link -> MkLink ((k1 :> *) (ReqBody k ct a) sub) endpoint #
type MkLink * ((:>) k * (ReqBody k1 ct a) sub) # |
type MkLink * ((:>) k * (ReqBody k1 ct a) sub) = MkLink k sub

    >>> import Servant.API
    >>> import Data.Aeson
    >>> import Data.Text
    >>> data Book
    >>> instance ToJSON Book where { toJSON = undefined }