# -*- coding: utf-8 -*-
from flask import request
from flask_restplus import Api, Resource, fields, reqparse

from .server import GetGeometry
from .server import GetCities
from .server import GetCity
from .server import GetAttribute

api = Api(
        version='0.1', title='Building Server API',
        description='API for accessing Building Server',
        )

# -----------------------------------------------------------------------------
# basic api
# -----------------------------------------------------------------------------
@api.route("/info")
class Test(Resource):

    def get(self):
        return "Building Server / Oslandia / contact@oslandia.com"

# -----------------------------------------------------------------------------
# core api
# -----------------------------------------------------------------------------
# getGeometry
getgeom_parser = reqparse.RequestParser()
getgeom_parser.add_argument('city', type=str, required=True)
getgeom_parser.add_argument('tile', type=str, required=True)
getgeom_parser.add_argument('format', type=str, required=False)
getgeom_parser.add_argument('attributes', type=str, required=False)


@api.route("/getGeometry")
class APIGetGeometry(Resource):

    @api.expect(getgeom_parser, validate=True)
    def get(self):
        args = getgeom_parser.parse_args()
        return GetGeometry().run(args)


# getCities
@api.route("/getCities")
class APIGetCities(Resource):

    def get(self):
        return GetCities().run()


# getCity
getcity_parser = reqparse.RequestParser()
getcity_parser.add_argument('city', type=str, required=True)


@api.route("/getCity")
class APIGetCity(Resource):

    @api.expect(getcity_parser, validate=True)
    def get(self):
        args = getcity_parser.parse_args()
        return GetCity().run(args)


# getAttribute
getattr_parser = reqparse.RequestParser()
getattr_parser.add_argument('city', type=str, required=True)
getattr_parser.add_argument('gid', type=str, required=True)
getattr_parser.add_argument('attribute', type=str, required=True)


@api.route("/getAttribute")
class APIGetAttribute(Resource):

    @api.expect(getattr_parser, validate=True)
    def get(self):
        args = getattr_parser.parse_args()
        return GetAttribute().run(args)

7f6e81a955690fe37e620ae514b113d2af8faf5b
<mask token>


@api.route('/getGeometry')
class APIGetGeometry(Resource):

    @api.expect(getgeom_parser, validate=True)
    def get(self):
        args = getgeom_parser.parse_args()
        return GetGeometry().run(args)


@api.route('/getCities')
class APIGetCities(Resource):

    def get(self):
        return GetCities().run()


<mask token>


@api.route('/getCity')
class APIGetCity(Resource):

    @api.expect(getcity_parser, validate=True)
    def get(self):
        args = getcity_parser.parse_args()
        return GetCity().run(args)


<mask token>


@api.route('/getAttribute')
class APIGetAttribute(Resource):

    @api.expect(getattr_parser, validate=True)
    def get(self):
        args = getattr_parser.parse_args()
        return GetAttribute().run(args)

<mask token>


@api.route('/info')
class Test(Resource):

    def get(self):
        return 'Building Server / Oslandia / contact@oslandia.com'


<mask token>
getgeom_parser.add_argument('city', type=str, required=True)
getgeom_parser.add_argument('tile', type=str, required=True)
getgeom_parser.add_argument('format', type=str, required=False)
getgeom_parser.add_argument('attributes', type=str, required=False)


@api.route('/getGeometry')
class APIGetGeometry(Resource):

    @api.expect(getgeom_parser, validate=True)
    def get(self):
        args = getgeom_parser.parse_args()
        return GetGeometry().run(args)


@api.route('/getCities')
class APIGetCities(Resource):

    def get(self):
        return GetCities().run()


<mask token>
getcity_parser.add_argument('city', type=str, required=True)


@api.route('/getCity')
class APIGetCity(Resource):

    @api.expect(getcity_parser, validate=True)
    def get(self):
        args = getcity_parser.parse_args()
        return GetCity().run(args)


<mask token>
getattr_parser.add_argument('city', type=str, required=True)
getattr_parser.add_argument('gid', type=str, required=True)
getattr_parser.add_argument('attribute', type=str, required=True)


@api.route('/getAttribute')
class APIGetAttribute(Resource):

    @api.expect(getattr_parser, validate=True)
    def get(self):
        args = getattr_parser.parse_args()
        return GetAttribute().run(args)

<mask token>
api = Api(version='0.1', title='Building Server API', description=
    'API for accessing Building Server')


@api.route('/info')
class Test(Resource):

    def get(self):
        return 'Building Server / Oslandia / contact@oslandia.com'


getgeom_parser = reqparse.RequestParser()
getgeom_parser.add_argument('city', type=str, required=True)
getgeom_parser.add_argument('tile', type=str, required=True)
getgeom_parser.add_argument('format', type=str, required=False)
getgeom_parser.add_argument('attributes', type=str, required=False)


@api.route('/getGeometry')
class APIGetGeometry(Resource):

    @api.expect(getgeom_parser, validate=True)
    def get(self):
        args = getgeom_parser.parse_args()
        return GetGeometry().run(args)


@api.route('/getCities')
class APIGetCities(Resource):

    def get(self):
        return GetCities().run()


getcity_parser = reqparse.RequestParser()
getcity_parser.add_argument('city', type=str, required=True)


@api.route('/getCity')
class APIGetCity(Resource):

    @api.expect(getcity_parser, validate=True)
    def get(self):
        args = getcity_parser.parse_args()
        return GetCity().run(args)


getattr_parser = reqparse.RequestParser()
getattr_parser.add_argument('city', type=str, required=True)
getattr_parser.add_argument('gid', type=str, required=True)
getattr_parser.add_argument('attribute', type=str, required=True)


@api.route('/getAttribute')
class APIGetAttribute(Resource):

    @api.expect(getattr_parser, validate=True)
    def get(self):
        args = getattr_parser.parse_args()
        return GetAttribute().run(args)

from flask import request
from flask_restplus import Api, Resource, fields, reqparse
from .server import GetGeometry
from .server import GetCities
from .server import GetCity
from .server import GetAttribute
api = Api(version='0.1', title='Building Server API', description=
    'API for accessing Building Server')


@api.route('/info')
class Test(Resource):

    def get(self):
        return 'Building Server / Oslandia / contact@oslandia.com'


getgeom_parser = reqparse.RequestParser()
getgeom_parser.add_argument('city', type=str, required=True)
getgeom_parser.add_argument('tile', type=str, required=True)
getgeom_parser.add_argument('format', type=str, required=False)
getgeom_parser.add_argument('attributes', type=str, required=False)


@api.route('/getGeometry')
class APIGetGeometry(Resource):

    @api.expect(getgeom_parser, validate=True)
    def get(self):
        args = getgeom_parser.parse_args()
        return GetGeometry().run(args)


@api.route('/getCities')
class APIGetCities(Resource):

    def get(self):
        return GetCities().run()


getcity_parser = reqparse.RequestParser()
getcity_parser.add_argument('city', type=str, required=True)


@api.route('/getCity')
class APIGetCity(Resource):

    @api.expect(getcity_parser, validate=True)
    def get(self):
        args = getcity_parser.parse_args()
        return GetCity().run(args)


getattr_parser = reqparse.RequestParser()
getattr_parser.add_argument('city', type=str, required=True)
getattr_parser.add_argument('gid', type=str, required=True)
getattr_parser.add_argument('attribute', type=str, required=True)


@api.route('/getAttribute')
class APIGetAttribute(Resource):

    @api.expect(getattr_parser, validate=True)
    def get(self):
        args = getattr_parser.parse_args()
        return GetAttribute().run(args)

# -*- coding: utf-8 -*-
from flask import request
from flask_restplus import Api, Resource, fields, reqparse

from .server import GetGeometry
from .server import GetCities
from .server import GetCity
from .server import GetAttribute

api = Api(
        version='0.1', title='Building Server API',
        description='API for accessing Building Server',
        )

# -----------------------------------------------------------------------------
# basic api
# -----------------------------------------------------------------------------
@api.route("/info")
class Test(Resource):

    def get(self):
        return "Building Server / Oslandia / contact@oslandia.com"

# -----------------------------------------------------------------------------
# core api
# -----------------------------------------------------------------------------
# getGeometry
getgeom_parser = reqparse.RequestParser()
getgeom_parser.add_argument('city', type=str, required=True)
getgeom_parser.add_argument('tile', type=str, required=True)
getgeom_parser.add_argument('format', type=str, required=False)
getgeom_parser.add_argument('attributes', type=str, required=False)


@api.route("/getGeometry")
class APIGetGeometry(Resource):

    @api.expect(getgeom_parser, validate=True)
    def get(self):
        args = getgeom_parser.parse_args()
        return GetGeometry().run(args)


# getCities
@api.route("/getCities")
class APIGetCities(Resource):

    def get(self):
        return GetCities().run()


# getCity
getcity_parser = reqparse.RequestParser()
getcity_parser.add_argument('city', type=str, required=True)


@api.route("/getCity")
class APIGetCity(Resource):

    @api.expect(getcity_parser, validate=True)
    def get(self):
        args = getcity_parser.parse_args()
        return GetCity().run(args)


# getAttribute
getattr_parser = reqparse.RequestParser()
getattr_parser.add_argument('city', type=str, required=True)
getattr_parser.add_argument('gid', type=str, required=True)
getattr_parser.add_argument('attribute', type=str, required=True)


@api.route("/getAttribute")
class APIGetAttribute(Resource):

    @api.expect(getattr_parser, validate=True)
    def get(self):
        args = getattr_parser.parse_args()
        return GetAttribute().run(args)
