예제 #1
0
 def get() -> Union[Tuple[Resource, int], Response]:
     parser = default.parse_args()
     node = {"types": GetNodeOverview.get_node_overview()}
     template = NodesOverviewTemplate.node_overview_template()
     if parser['download']:
         return download(node, template, 'types')
     return marshal(node, template), 200
예제 #2
0
 def get() -> Union[Tuple[Resource, int], Response]:
     parser = entity_.parse_args()
     type_tree = {'typeTree': GetTypeTree.get_type_tree()}
     if parser['count']:
         return jsonify(len(type_tree['type_tree']))
     template = TypeTreeTemplate.type_tree_template()
     if parser['download']:
         return download(type_tree, template, 'type_tree')
     return marshal(type_tree, template), 200
예제 #3
0
 def resolve_entity(
         entity: Entity,
         parser: Dict[str, Any]) \
         -> Union[Response, Dict[str, Any], Tuple[Any, int]]:
     if parser['export'] == 'csv':
         return ApiExportCSV.export_entity(entity)
     result = GetEntity.get_format(entity, parser)
     if parser['download']:
         return download(result, GetEntity.get_template(parser), entity.id)
     return marshal(result, GetEntity.get_template(parser)), 200
예제 #4
0
 def get() -> Union[int, Response, Tuple[Any, int]]:
     parser = gis.parse_args()
     output = {
         'type': 'FeatureCollection',
         'features': GetGeometricEntities.get_geometries(parser)
     }
     if parser['count']:
         return jsonify(len(output['features']))
     if parser['download']:
         return download(output, GeometriesTemplate.geometries_template(),
                         'geometries')
     return marshal(output, GeometriesTemplate.geometries_template()), 200
예제 #5
0
 def resolve_entity(
         entity: Entity,
         parser: Dict[str, Any]) \
         -> Union[Response, Dict[str, Any], Tuple[Any, int]]:
     if parser['export'] == 'csv':
         return ApiExportCSV.export_entity(entity)
     result = GetEntity.get_format(entity, parser)
     if parser['format'] in app.config['RDF_FORMATS']:
         return Response(
             rdf_output(result, parser),
             mimetype=app.config['RDF_FORMATS'][parser['format']])
     if parser['download']:
         return download(result, GetEntity.get_template(parser), entity.id)
     return marshal(result, GetEntity.get_template(parser)), 200
예제 #6
0
 def get() -> Union[Tuple[Resource, int], Response]:
     parser = language.parse_args()
     lang = parser['lang']
     content = {
         'intro': Ct.get_translation('intro_for_frontend', lang),
         'contact': Ct.get_translation('contact_for_frontend', lang),
         'siteName': Ct.get_translation('site_name_for_frontend', lang),
         'imageSizes': app.config['IMAGE_SIZE'],
         'legalNotice': Ct.get_translation('legal_notice_for_frontend', lang)
     }
     template = ContentTemplate.content_template()
     if parser['download']:
         return download(content, template, 'content')
     return marshal(content, template), 200