xia_api_flask.rest.Restful
- class xia_api_flask.rest.Restful
Bases:
object
- __init__()
Methods
__init__
()get_action_response
(action_result)get_api_blueprint
(path_name, resource_mapping)Get API Blueprint
get_response
(rest_response)translate_query
(query_obj)Translate the http query object into xia compatible query object
- classmethod get_api_blueprint(path_name: str, resource_mapping: dict, token_manager: Optional[Type[FlaskToken]] = None, auth_client: Optional[AuthClient] = None, recorder: Optional[Type[XiaRecordBook]] = None, listener: Optional[BroadcastListener] = None)
Get API Blueprint
- Parameters
path_name – path name to be registered in application
resource_mapping – resource path to object mapping
token_manager – token management
auth_client – Authorization client. None means no security check
recorder – Consumption report destination of each API Call
listener – Listen to the object changes
- Returns
API Blueprint
- classmethod translate_query(query_obj)
Translate the http query object into xia compatible query object
- Parameters
query_obj – MultiDict
- Returns
dictionary
- Comments:
The normal http parameter cannot distinguish a single item and a list with single item. So the single item will be presented twice at the query string: key=value&key=value will be converted to key=[value]