-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Automatically derive (jquery) javascript functions to query servant webservices -- -- Automatically derive jquery-based javascript functions to query -- servant webservices. -- -- Example here that serves the generated javascript to a webpage -- that lets you trigger webservice calls. @package servant-jquery @version 0.2.2 module Servant.JQuery jquery :: HasJQ layout => Proxy layout -> JQ layout generateJS :: AjaxReq -> String printJS :: AjaxReq -> IO () type Arg = String data Segment -- | a static path segment. like "/foo" Static :: String -> Segment -- | a capture. like "/:userid" Cap :: Arg -> Segment isCapture :: Segment -> Bool captureArg :: Segment -> Arg jsSegments :: [Segment] -> String segmentToStr :: Segment -> Bool -> String type Path = [Segment] data ArgType Normal :: ArgType Flag :: ArgType List :: ArgType data QueryArg QueryArg :: Arg -> ArgType -> QueryArg _argName :: QueryArg -> Arg _argType :: QueryArg -> ArgType type HeaderArg = String data Url Url :: Path -> [QueryArg] -> Url _path :: Url -> Path _queryStr :: Url -> [QueryArg] defUrl :: Url type FunctionName = String type Method = String data AjaxReq AjaxReq :: Url -> Method -> [HeaderArg] -> Bool -> FunctionName -> AjaxReq _reqUrl :: AjaxReq -> Url _reqMethod :: AjaxReq -> Method _reqHeaders :: AjaxReq -> [HeaderArg] _reqBody :: AjaxReq -> Bool _funcName :: AjaxReq -> FunctionName argType :: Lens' QueryArg ArgType argName :: Lens' QueryArg Arg queryStr :: Lens' Url [QueryArg] path :: Lens' Url Path reqUrl :: Lens' AjaxReq Url reqMethod :: Lens' AjaxReq Method reqHeaders :: Lens' AjaxReq [HeaderArg] reqBody :: Lens' AjaxReq Bool funcName :: Lens' AjaxReq FunctionName jsParams :: [QueryArg] -> String paramToStr :: QueryArg -> Bool -> String defReq :: AjaxReq class HasJQ layout where type family JQ layout :: * jqueryFor :: HasJQ layout => Proxy layout -> AjaxReq -> JQ layout