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

Safe HaskellSafe
LanguageHaskell2010

Servant.API.QueryParam

Synopsis

Documentation

data QueryFlag sym Source #

Lookup a potentially value-less query string parameter with boolean semantics. If the param sym is there without any value, or if it's there with value "true" or "1", it's interpreted as True. Otherwise, it's interpreted as False.

Example:

>>> -- /books?published
>>> type MyApi = "books" :> QueryFlag "published" :> Get '[JSON] [Book]

Instances

(KnownSymbol sym, HasLink k sub) => HasLink * ((:>) * k (QueryFlag sym) sub) Source # 

Associated Types

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

Methods

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

type MkLink * ((:>) * k (QueryFlag sym) sub) Source # 
type MkLink * ((:>) * k (QueryFlag sym) sub) = Bool -> MkLink k sub

data QueryParam sym a Source #

Lookup the value associated to the sym query string parameter and try to extract it as a value of type a.

Example:

>>> -- /books?author=<author name>
>>> type MyApi = "books" :> QueryParam "author" Text :> Get '[JSON] [Book]

Instances

(KnownSymbol sym, ToHttpApiData v, HasLink k sub) => HasLink * ((:>) * k (QueryParam * sym v) sub) Source # 

Associated Types

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

Methods

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

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

data QueryParams sym a Source #

Lookup the values associated to the sym query string parameter and try to extract it as a value of type [a]. This is typically meant to support query string parameters of the form param[]=val1&param[]=val2 and so on. Note that servant doesn't actually require the []s and will fetch the values just fine with param=val1&param=val2, too.

Example:

>>> -- /books?authors[]=<author1>&authors[]=<author2>&...
>>> type MyApi = "books" :> QueryParams "authors" Text :> Get '[JSON] [Book]

Instances

(KnownSymbol sym, ToHttpApiData v, HasLink k sub) => HasLink * ((:>) * k (QueryParams * sym v) sub) Source # 

Associated Types

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

Methods

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

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