コード例 #1
0
 def get(self, latest: int) -> Union[Tuple[Resource, int], Response]:
     parser = entity_parser.parse_args()
     entities = {"result": GetLatest.get_entities_get_latest(latest, parser)}
     template = GeoJson.pagination(parser['show'])
     if parser['count']:
         return jsonify(len(entities))
     if parser['download']:
         return Download.download(data=entities, template=template, name=latest)
     return marshal(entities, template), 200
コード例 #2
0
ファイル: entity.py プロジェクト: NinaBrundke/OpenAtlas
 def get(self, id_: int) -> Union[Tuple[Resource, int], Response]:
     parser = entity_parser.parse_args()
     if parser['export'] == 'csv':
         return ApiExportCSV.export_entity(
             GeoJsonEntity.get_entity_by_id(id_))
     entity = GeoJsonEntity.get_entity(GeoJsonEntity.get_entity_by_id(id_),
                                       parser)
     template = GeoJson.geojson_template(parser['show'])
     if parser['download']:
         return Download.download(data=entity, template=template, name=id_)
     return marshal(entity, GeoJson.geojson_template(parser['show'])), 200
コード例 #3
0
 def get(self) -> Union[Tuple[Resource, int], Response]:
     parser = entity_parser.parse_args()
     template = TypeTreeTemplate.type_tree_template()
     type_tree = {'type_tree': GetTypeTree.get_type_tree()}
     if parser['count']:
         return jsonify(len(type_tree['type_tree']))
     if parser['download']:
         return Download.download(data=type_tree,
                                  template=template,
                                  name='type_tree')
     return marshal(type_tree, template), 200
コード例 #4
0
 def get(self, code: str) -> Union[Tuple[Resource, int], Response]:
     parser = entity_parser.parse_args()
     if parser['export'] == 'csv':
         return ApiExportCSV.export_entities(
             GetByCode.get_entities_by_view(code_=code, parser=parser),
             code)
     code_ = Pagination.pagination(GetByCode.get_entities_by_view(
         code_=code, parser=parser),
                                   parser=parser)
     template = GeoJson.pagination(parser['show'])
     if parser['count']:
         return jsonify(code_['pagination']['entities'])
     if parser['download']:
         return Download.download(data=code_, template=template, name=code)
     return marshal(code_, template), 200
コード例 #5
0
ファイル: system_class.py プロジェクト: NinaBrundke/OpenAtlas
 def get(self, system_class: str) -> Union[Tuple[Resource, int], Response]:
     parser = entity_parser.parse_args()
     if parser['export'] == 'csv':
         return ApiExportCSV.export_entities(
             GetBySystemClass.get_entities_by_system_class(system_class=system_class,
                                                           parser=parser), system_class)
     system_class_ = Pagination.pagination(
         GetBySystemClass.get_entities_by_system_class(system_class=system_class, parser=parser),
         parser=parser)
     template = GeoJson.pagination(parser['show'])
     if parser['count']:
         return jsonify(system_class_['pagination']['entities'])
     if parser['download']:
         return Download.download(data=system_class_, template=template, name=system_class)
     return marshal(system_class_, template), 200