Servant.API.Capture

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

Safe Haskell | None
Language | Haskell2010

Servant.API.Capture

Synopsis

- type Capture = Capture' ('[] :: [Type])
- data Capture' (mods :: [Type]) (sym :: Symbol) a
- data CaptureAll (sym :: Symbol) a

# Documentation

type Capture = Capture' ('[] :: [Type]) #

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

data Capture' (mods :: [Type]) (sym :: Symbol) a #

`Capture` which can be modified. For example with `Description`.

#### Instances

Instances details

(ToHttpApiData v, HasLink sub) => HasLink (Capture' mods sym v :> sub :: Type) # |
Instance details Defined in Servant.Links Methods toLink :: (Link -> a) -> Proxy (Capture' mods sym v :> sub) -> Link -> MkLink (Capture' mods sym v :> sub) a #
type MkLink (Capture' mods sym v :> sub :: Type) a # |
Instance details Defined in Servant.Links type MkLink (Capture' mods sym v :> sub :: Type) a = v -> MkLink sub a

data CaptureAll (sym :: Symbol) 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

Instances details

(ToHttpApiData v, HasLink sub) => HasLink (CaptureAll sym v :> sub :: Type) # |
Instance details Defined in Servant.Links Methods toLink :: (Link -> a) -> Proxy (CaptureAll sym v :> sub) -> Link -> MkLink (CaptureAll sym v :> sub) a #
type MkLink (CaptureAll sym v :> sub :: Type) a # |
Instance details Defined in Servant.Links type MkLink (CaptureAll sym v :> sub :: Type) a = [v] -> MkLink sub a