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

Safe HaskellSafe
LanguageHaskell2010

Servant.API.Capture

Synopsis

Documentation

data Capture (sym :: Symbol) a Source #

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) Source # 

Associated Types

type MkLink ((* :> k) (Capture * sym v) sub) (endpoint :: (* :> k) (Capture * sym v) sub) :: * Source #

Methods

toLink :: Proxy ((* :> k) (Capture * sym v) sub) endpoint -> Link -> MkLink ((* :> k) (Capture * sym v) sub) endpoint Source #

type MkLink * ((:>) * k (Capture * sym v) sub) Source # 
type MkLink * ((:>) * k (Capture * sym v) sub) = v -> MkLink k sub

data CaptureAll (sym :: Symbol) a Source #

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) Source # 

Associated Types

type MkLink ((* :> k) (CaptureAll * sym v) sub) (endpoint :: (* :> k) (CaptureAll * sym v) sub) :: * Source #

Methods

toLink :: Proxy ((* :> k) (CaptureAll * sym v) sub) endpoint -> Link -> MkLink ((* :> k) (CaptureAll * sym v) sub) endpoint Source #

type MkLink * ((:>) * k (CaptureAll * sym v) sub) Source # 
type MkLink * ((:>) * k (CaptureAll * sym v) sub) = [v] -> MkLink k sub