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

Safe Haskell | Safe
Language | Haskell2010

Servant.API.Capture

Synopsis

- data Capture sym a
- data CaptureAll sym a

# Documentation

data Capture sym a #

Capture a value from the request path under a certain type `a`.

Example:

    >>> -- GET /books/:isbn
    >>> type MyApi = "books" :> Capture "isbn" Text :> Get '[JSON] Book

Instances

(ToHttpApiData v, HasLink k sub) => HasLink * ((:>) k * (Capture * sym v) sub) # |
Associated Types type MkLink ((:>) k * (Capture * sym v) sub) (endpoint :: (:>) k * (Capture * sym v) sub) :: * # Methods toLink :: Proxy ((k :> *) (Capture * sym v) sub) endpoint -> Link -> MkLink ((k :> *) (Capture * sym v) sub) endpoint #
type MkLink * ((:>) k * (Capture * sym v) sub) # |
type MkLink * ((:>) k * (Capture * sym v) sub) = v -> MkLink k sub

data CaptureAll sym a #

Capture all remaining values from the request path under a certain type `a`.

Example:

    >>> -- GET /src/*
    >>> type MyAPI = "src" :> CaptureAll "segments" Text :> Get '[JSON] SourceFile

Instances

(ToHttpApiData v, HasLink k sub) => HasLink * ((:>) k * (CaptureAll * sym v) sub) # |
Associated Types type MkLink ((:>) k * (CaptureAll * sym v) sub) (endpoint :: (:>) k * (CaptureAll * sym v) sub) :: * # Methods toLink :: Proxy ((k :> *) (CaptureAll * sym v) sub) endpoint -> Link -> MkLink ((k :> *) (CaptureAll * sym v) sub) endpoint #
type MkLink * ((:>) k * (CaptureAll * sym v) sub) # |
type MkLink * ((:>) k * (CaptureAll * sym v) sub) = [v] -> MkLink k sub