Class: QgsServerQueryStringParameter¶
Holds the information regarding a query string input parameter and its validation.
The class is extendable through custom validators (C++ only) and/or by
subclassing and overriding the value()
method.
Added in version 3.10.
Enums
The Type enum represents the parameter type |
Methods
Returns parameter description |
|
Returns |
|
Returns the name of the parameter |
|
Sets validator description |
|
Set the parameter's hidden status, parameters are not hidden by default. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsServerQueryStringParameter. See the FAQ for more details.
Extracts the value from the request context by validating the parameter value and converting it to its proper Type. |
Static Methods
Returns the name of the type |
- class qgis.server.QgsServerQueryStringParameter[source]¶
Bases:
object
- __init__(name: str | None, required: bool = False, type: QgsServerQueryStringParameter.Type = QgsServerQueryStringParameter.Type.String, description: str | None = '', defaultValue: Any = None)
Constructs a QgsServerQueryStringParameter object.
- Parameters:
name (Optional[str]) – parameter name
required (bool = False)
type (QgsServerQueryStringParameter.Type = QgsServerQueryStringParameter.Type.String) – the parameter type
description (Optional[str] = '') – parameter description
defaultValue (Any = None) – default value, it is ignored if the parameter is required
- __init__(a0: QgsServerQueryStringParameter)
- Parameters:
- class Type(*values)¶
Bases:
IntEnum
The Type enum represents the parameter type
String
: Parameter is a stringInteger
: Parameter is an integerDouble
: Parameter is a doubleBoolean
: Parameter is a booleanList
: Parameter is a (comma separated) list of strings, the handler will perform any further required conversion of the list values
- Boolean = 1¶
- Double = 6¶
- Integer = 4¶
- List = 11¶
- String = 10¶
Returns
True
if the parameter is hidden from the schema.Hidden params can be useful to implement legacy parameters or parameters that can be accepted without being advertised.
Added in version 3.28.
- Return type:
bool
- setDescription(self, description: str | None)[source]¶
Sets validator
description
- Parameters:
description (Optional[str])
- setHidden(self, hidden: bool)[source]¶
Set the parameter’s
hidden
status, parameters are not hidden by default.Added in version 3.28.
- Parameters:
hidden (bool)
- static typeName(type: QgsServerQueryStringParameter.Type) str [source]¶
Returns the name of the
type
- Parameters:
- Return type:
str
- virtual value(self, context: QgsServerApiContext) Any [source]¶
Extracts the value from the request
context
by validating the parameter value and converting it to its proper Type. If the value is not set and a default was not provided an invalid QVariant is returned.Validation steps:
required
can convert to proper Type
custom validator (if set - not available in Python bindings)
See also
setCustomValidator()
(not available in Python bindings)- Return type:
Any
- Returns:
the parameter value or an invalid QVariant if not found (and not required)
- Raises:
QgsServerApiBadRequestError – if validation fails
- Parameters:
context (QgsServerApiContext)