aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/api
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-10-12 22:36:01 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-26 23:46:32 +0100
commit2c0e17cb977a1e8782799b337df8b1583d019906 (patch)
tree75563e440e9eac14950fa1a71a83e64df20e52d0 /src/web/views/api
parentfixing sqlalchemy resolving warning (diff)
downloadnewspipe-2c0e17cb977a1e8782799b337df8b1583d019906.tar.gz
newspipe-2c0e17cb977a1e8782799b337df8b1583d019906.tar.bz2
newspipe-2c0e17cb977a1e8782799b337df8b1583d019906.zip
bootstraping react
Diffstat (limited to 'src/web/views/api')
-rw-r--r--src/web/views/api/category.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/web/views/api/category.py b/src/web/views/api/category.py
new file mode 100644
index 00000000..7923279a
--- /dev/null
+++ b/src/web/views/api/category.py
@@ -0,0 +1,31 @@
+from flask import g
+
+from web.controllers.category import CategoryController
+from web.views.api.common import (PyAggResourceNew,
+ PyAggResourceExisting,
+ PyAggResourceMulti)
+
+
+CAT_ATTRS = {'name': {'type': str},
+ 'user_id': {'type': int}}
+
+
+class CategoryNewAPI(PyAggResourceNew):
+ controller_cls = CategoryController
+ attrs = CAT_ATTRS
+
+
+class CategoryAPI(PyAggResourceExisting):
+ controller_cls = CategoryController
+ attrs = CAT_ATTRS
+
+
+class CategoriesAPI(PyAggResourceMulti):
+ controller_cls = CategoryController
+ attrs = CAT_ATTRS
+
+
+g.api.add_resource(CategoryNewAPI, '/category', endpoint='category_new.json')
+g.api.add_resource(CategoryAPI, '/category/<int:obj_id>',
+ endpoint='category.json')
+g.api.add_resource(CategoriesAPI, '/categories', endpoint='categories.json')
bgstack15