diff options
Diffstat (limited to 'umosapi/api.py')
-rw-r--r-- | umosapi/api.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/umosapi/api.py b/umosapi/api.py index 0b48079..ef83c18 100644 --- a/umosapi/api.py +++ b/umosapi/api.py @@ -28,11 +28,22 @@ api = Api( uobject = UObject(app) + +class fieldsDict(fields.Raw): + __schema_type__ = ["Dict"] + __schema_example__ = {"key": "token"} + + user_model = api.model('UObject', { 'name': fields.String( required=True, description='Name of the uobject', example='Player' + ), + 'datas': fieldsDict( + required=False, + description='Datas of the uobject in JSON format', + example={"key": "token"} ) }) @@ -53,7 +64,7 @@ class Register(Resource): def post(self): """ Register new uobject """ args = request.get_json(force=True) - status = uobject.register(args.get('name')) + status = uobject.register(args.get('name'), args.get('datas')) return loads('{"msg": "'+status['msg']+'"}'), status['code'] |