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

Safe HaskellNone
LanguageHaskell2010

Servant.API.Header

Synopsis

Documentation

type Header = Header' '[Optional, Strict] Source #

Extract the given header's value as a value of type a. I.e. header sent by client, parsed by server.

Example:

>>> newtype Referer = Referer Text deriving (Eq, Show)
>>> 
>>> -- GET /view-my-referer
>>> type MyApi = "view-my-referer" :> Header "from" Referer :> Get '[JSON] Referer

data Header' (mods :: [*]) (sym :: Symbol) a Source #

Instances

(KnownSymbol h, ToHttpApiData v) => AddHeader h v (Headers ((:) * fst rest) a) (Headers ((:) * (Header * h v) ((:) * fst rest)) a) Source # 

Methods

addOptionalHeader :: ResponseHeader h v -> Headers ((* ': fst) rest) a -> Headers ((* ': Header * h v) ((* ': fst) rest)) a

(KnownSymbol h, ToHttpApiData x, GetHeaders (HList xs)) => GetHeaders (HList ((:) * (Header * h x) xs)) Source # 

Methods

getHeaders :: HList ((* ': Header * h x) xs) -> [Header] Source #

HasLink * sub => HasLink * ((:>) * (Header' k mods sym a) sub) Source # 

Associated Types

type MkLink ((* :> Header' k mods sym a) sub) (endpoint :: (* :> Header' k mods sym a) sub) :: * Source #

Methods

toLink :: Proxy ((* :> Header' k mods sym a) sub) endpoint -> Link -> MkLink ((* :> Header' k mods sym a) sub) endpoint Source #

(KnownSymbol h, GetHeaders (HList rest), ToHttpApiData v) => GetHeaders (Headers ((:) * (Header * h v) rest) a) Source # 

Methods

getHeaders :: Headers ((* ': Header * h v) rest) a -> [Header] Source #

(FromHttpApiData v, BuildHeadersTo xs, KnownSymbol h) => BuildHeadersTo ((:) * (Header * h v) xs) Source # 

Methods

buildHeadersTo :: [Header] -> HList ((* ': Header * h v) xs) Source #

type MkLink * ((:>) * (Header' k mods sym a) sub) Source # 
type MkLink * ((:>) * (Header' k mods sym a) sub) = MkLink * sub