Safe Haskell | None |
---|---|
Language | Haskell98 |
Combinators for specifying the input/output dictionaries of a
Handler
. The combinators can be combined using (
.
)
.
- stringI :: Dict h p Nothing o e -> Dict h p (Just String) o e
- xmlTextI :: Dict h p Nothing o e -> Dict h p (Just Text) o e
- fileI :: Dict h p Nothing o e -> Dict h p (Just ByteString) o e
- readI :: (Info i, Read i, Show i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e
- xmlI :: (Typeable i, XmlPickler i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e
- rawXmlI :: Dict h p Nothing o e -> Dict h p (Just ByteString) o e
- jsonI :: (Typeable i, FromJSON i, JSONSchema i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e
- rawJsonI :: Dict h p Nothing o e -> Dict h p (Just ByteString) o e
- rawJsonAndXmlI :: Dict h p Nothing o e -> Dict h p (Just (Either Json Xml)) o e
- stringO :: Dict h p i Nothing e -> Dict h p i (Just String) e
- fileO :: Dict h p i Nothing e -> Dict h p i (Just (ByteString, String, Bool)) e
- xmlO :: (Typeable o, XmlPickler o, FromMaybe o o' ~ o) => Dict h p i o' e -> Dict h p i (Just o) e
- rawXmlO :: Dict h p i Nothing e -> Dict h p i (Just ByteString) e
- jsonO :: (Typeable o, ToJSON o, JSONSchema o, FromMaybe o o' ~ o) => Dict h p i o' e -> Dict h p i (Just o) e
- rawJsonO :: Dict h p i Nothing e -> Dict h p i (Just ByteString) e
- rawJsonAndXmlO :: Dict h p i Nothing e -> Dict h p i (Just ByteString) e
- multipartO :: Dict h p i Nothing e -> Dict h p i (Just [BodyPart]) e
- jsonE :: (ToResponseCode e, Typeable e, ToJSON e, JSONSchema e, FromMaybe e e' ~ e) => Dict h p i o e' -> Dict h p i o (Just e)
- xmlE :: (ToResponseCode e, Typeable e, XmlPickler e, FromMaybe e e' ~ e) => Dict h p i o e' -> Dict h p i o (Just e)
- xmlJsonI :: (Typeable i, FromJSON i, JSONSchema i, XmlPickler i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e
- xmlJsonO :: (Typeable o, ToJSON o, JSONSchema o, XmlPickler o, FromMaybe o o' ~ o) => Dict h p i o' e -> Dict h p i (Just o) e
- xmlJsonE :: (ToResponseCode e, Typeable e, ToJSON e, JSONSchema e, XmlPickler e, FromMaybe e e' ~ e) => Dict h p i o e' -> Dict h p i o (Just e)
- xmlJson :: (Typeable i, FromJSON i, JSONSchema i, XmlPickler i, Typeable o, ToJSON o, JSONSchema o, XmlPickler o, FromMaybe i i' ~ i, FromMaybe o o' ~ o) => Dict h p i' o' e -> Dict h p (Just i) (Just o) e
- mkHeader :: Header h -> Dict x p i o e -> Dict h p i o e
- addHeader :: Header h -> Dict h' p i o e -> Dict (h, h') p i o e
- mkPar :: Param p -> Dict h x i o e -> Dict h p i o e
- addPar :: Param p -> Dict h p' i o e -> Dict h (p, p') i o e
- someI :: Dict h p i o e -> Dict h p i o e
- someO :: Dict h p i o e -> Dict h p i o e
- someE :: Dict h p i o e -> Dict h p i o e
Input dictionaries
stringI :: Dict h p Nothing o e -> Dict h p (Just String) o e Source #
Allow direct usage of as input as String
.
xmlTextI :: Dict h p Nothing o e -> Dict h p (Just Text) o e Source #
Allow direct usage of as input as raw Xml Text
.
fileI :: Dict h p Nothing o e -> Dict h p (Just ByteString) o e Source #
Allow usage of input as file contents, represented as a ByteString
.
readI :: (Info i, Read i, Show i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e Source #
xmlI :: (Typeable i, XmlPickler i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e Source #
The input can be read into some instance of XmlPickler
.
rawXmlI :: Dict h p Nothing o e -> Dict h p (Just ByteString) o e Source #
The input can be used as an XML ByteString
.
jsonI :: (Typeable i, FromJSON i, JSONSchema i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e Source #
The input can be read into some instance of Json
.
rawJsonI :: Dict h p Nothing o e -> Dict h p (Just ByteString) o e Source #
The input can be used as a JSON ByteString
.
rawJsonAndXmlI :: Dict h p Nothing o e -> Dict h p (Just (Either Json Xml)) o e Source #
The input can be used as a JSON or XML ByteString
.
An API client can send either format so the handler needs to handle both.
Output dictionaries
fileO :: Dict h p i Nothing e -> Dict h p i (Just (ByteString, String, Bool)) e Source #
Allow file output using a combination of the raw data, the file name, and an attachment flag (causing the file to be downloaded by browsers instead of shown). The mime type will be determined from the file extension by your web server library, or "application/octet-stream" with an unknown extension.
xmlO :: (Typeable o, XmlPickler o, FromMaybe o o' ~ o) => Dict h p i o' e -> Dict h p i (Just o) e Source #
Allow output as XML using the XmlPickler
type class.
rawXmlO :: Dict h p i Nothing e -> Dict h p i (Just ByteString) e Source #
Allow output as raw XML represented as a ByteString
.
jsonO :: (Typeable o, ToJSON o, JSONSchema o, FromMaybe o o' ~ o) => Dict h p i o' e -> Dict h p i (Just o) e Source #
Allow output as JSON using the Json
type class.
rawJsonO :: Dict h p i Nothing e -> Dict h p i (Just ByteString) e Source #
Allow output as raw JSON represented as a ByteString
.
rawJsonAndXmlO :: Dict h p i Nothing e -> Dict h p i (Just ByteString) e Source #
Allow output as raw JSON and XML represented as ByteString
s.
Both values are needed since the accept header determines which one
to send.
multipartO :: Dict h p i Nothing e -> Dict h p i (Just [BodyPart]) e Source #
Allow output as multipart. Writes out the ByteStrings separated by boundaries, with content type 'multipart/mixed'.
Error dictionaries
jsonE :: (ToResponseCode e, Typeable e, ToJSON e, JSONSchema e, FromMaybe e e' ~ e) => Dict h p i o e' -> Dict h p i o (Just e) Source #
Allow error output as JSON using the Json
type class.
xmlE :: (ToResponseCode e, Typeable e, XmlPickler e, FromMaybe e e' ~ e) => Dict h p i o e' -> Dict h p i o (Just e) Source #
Allow error output as XML using the XmlPickler
type class.
Composed dictionaries
xmlJsonI :: (Typeable i, FromJSON i, JSONSchema i, XmlPickler i, FromMaybe i i' ~ i) => Dict h p i' o e -> Dict h p (Just i) o e Source #
The input can be read into some instance of both Json
and XmlPickler
.
xmlJsonO :: (Typeable o, ToJSON o, JSONSchema o, XmlPickler o, FromMaybe o o' ~ o) => Dict h p i o' e -> Dict h p i (Just o) e Source #
Allow output as JSON using the Json
type class and allow output as XML
using the XmlPickler
type class.
xmlJsonE :: (ToResponseCode e, Typeable e, ToJSON e, JSONSchema e, XmlPickler e, FromMaybe e e' ~ e) => Dict h p i o e' -> Dict h p i o (Just e) Source #
Allow error output as JSON using the Json
type class and allow output as
XML using the XmlPickler
type class.
xmlJson :: (Typeable i, FromJSON i, JSONSchema i, XmlPickler i, Typeable o, ToJSON o, JSONSchema o, XmlPickler o, FromMaybe i i' ~ i, FromMaybe o o' ~ o) => Dict h p i' o' e -> Dict h p (Just i) (Just o) e Source #
The input can be read into some instance of both Json
and XmlPickler
and allow output as JSON using the Json
type class and allow output as XML
using the XmlPickler
type class.
Header dictionaries
mkHeader :: Header h -> Dict x p i o e -> Dict h p i o e Source #
Set custom sub-dictionary for recognizing headers.
addHeader :: Header h -> Dict h' p i o e -> Dict (h, h') p i o e Source #
Add custom sub-dictionary for recognizing headers.
Parameter dictionaries
mkPar :: Param p -> Dict h x i o e -> Dict h p i o e Source #
Set custom sub-dictionary for recognizing parameters.
addPar :: Param p -> Dict h p' i o e -> Dict h (p, p') i o e Source #
Add custom sub-dictionary for recognizing parameters.
Deprecated
someI :: Dict h p i o e -> Dict h p i o e Source #
Deprecated: This can be safely removed, it is now just the identity.
Open up input type for extension with custom dictionaries.