| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Servant.PY.Internal
Synopsis
- type PythonGenerator = [PythonRequest] -> Text
- data ReturnStyle
- data PythonRequest
- data PyRequestArgs = PyRequestArgs {}
- data CommonGeneratorOptions = CommonGeneratorOptions {
- functionNameBuilder :: FunctionName -> Text
- requestBody :: Text
- urlPrefix :: Text
- indentation :: Proxy Indent -> Text
- returnMode :: ReturnStyle
- defCommonGeneratorOptions :: CommonGeneratorOptions
- defaultPyIndent :: Proxy Indent -> Text
- indent :: Proxy Indent
- type Indent = (" " :: Symbol)
- indenter :: Int -> Proxy Indent -> Text
- makePyUrl :: CommonGeneratorOptions -> PythonRequest -> Text -> Text
- makePyUrl' :: forall f. CommonGeneratorOptions -> Req f -> Text -> Text
- segmentToStr :: Segment f -> Text
- capturesToFormatArgs :: [Segment f] -> [Text]
- toValidFunctionName :: Text -> Text
- functionName :: CommonGeneratorOptions -> PythonRequest -> Text
- toPyHeader :: HeaderArg f -> Text
- retrieveHeaders :: PythonRequest -> [Text]
- getHeaderDict :: PythonRequest -> Text
- retrieveHeaderText :: forall f. HeaderArg f -> Text
- toPyDict :: Text -> [Text] -> Text
- toPyParams :: Text -> [QueryArg f] -> Text
- getParams :: Text -> PythonRequest -> Text
- paramNames :: PythonRequest -> [Text]
- captures :: PythonRequest -> [Text]
- getMethod :: PythonRequest -> Text
- hasBody :: PythonRequest -> Bool
- withFormattedCaptures :: Text -> [Segment f] -> Text
- buildDocString :: PythonRequest -> CommonGeneratorOptions -> Text -> Text
- buildHeaderDict :: [HeaderArg f] -> Text
- functionArguments :: forall f. Req f -> Text
- formatBuilder :: Text -> Text
- remainingReqCall :: PyRequestArgs -> Int -> Text
Documentation
type PythonGenerator = [PythonRequest] -> Text Source #
data ReturnStyle Source #
Constructors
| DangerMode | |
| RawResponse |
data PythonRequest Source #
Constructors
| TypedPythonRequest (Req Text) | |
| UnTypedPythonRequest (Req NoContent) |
Instances
| Eq PythonRequest Source # | |
Defined in Servant.PY.Internal Methods (==) :: PythonRequest -> PythonRequest -> Bool # (/=) :: PythonRequest -> PythonRequest -> Bool # | |
| Show PythonRequest Source # | |
Defined in Servant.PY.Internal Methods showsPrec :: Int -> PythonRequest -> ShowS # show :: PythonRequest -> String # showList :: [PythonRequest] -> ShowS # | |
data PyRequestArgs Source #
Constructors
| PyRequestArgs | |
Instances
| Show PyRequestArgs Source # | |
Defined in Servant.PY.Internal Methods showsPrec :: Int -> PyRequestArgs -> ShowS # show :: PyRequestArgs -> String # showList :: [PyRequestArgs] -> ShowS # | |
data CommonGeneratorOptions Source #
This structure is used by specific implementations to let you customize the output
Constructors
| CommonGeneratorOptions | |
Fields
| |
defCommonGeneratorOptions :: CommonGeneratorOptions Source #
Default options.
> defCommonGeneratorOptions = CommonGeneratorOptions
> { functionNameBuilder = snakeCase
> , requestBody = "body"
> , urlPrefix = ""
> , indentation = " " -- 4 spaces
> , returnMode = DangerMode
> }
makePyUrl :: CommonGeneratorOptions -> PythonRequest -> Text -> Text Source #
makePyUrl' :: forall f. CommonGeneratorOptions -> Req f -> Text -> Text Source #
segmentToStr :: Segment f -> Text Source #
capturesToFormatArgs :: [Segment f] -> [Text] Source #
toValidFunctionName :: Text -> Text Source #
Attempts to reduce the function name provided to that allowed by .Foreign
For valid Python function identifiers see the following: https://docs.python.org/3.2/reference/lexical_analysis.html#identifiers valid start chars: Lu, Ll, Lt, Lm, Lo, Nl, the underscore valid continuation chars: valid start chars <> Mn, Mc, Nd, Pc
toPyHeader :: HeaderArg f -> Text Source #
retrieveHeaders :: PythonRequest -> [Text] Source #
getHeaderDict :: PythonRequest -> Text Source #
retrieveHeaderText :: forall f. HeaderArg f -> Text Source #
paramNames :: PythonRequest -> [Text] Source #
captures :: PythonRequest -> [Text] Source #
getMethod :: PythonRequest -> Text Source #
hasBody :: PythonRequest -> Bool Source #
buildDocString :: PythonRequest -> CommonGeneratorOptions -> Text -> Text Source #
buildHeaderDict :: [HeaderArg f] -> Text Source #
functionArguments :: forall f. Req f -> Text Source #
formatBuilder :: Text -> Text Source #
remainingReqCall :: PyRequestArgs -> Int -> Text Source #