aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/api/v2/category.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-14 08:14:52 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-14 08:14:52 +0200
commit728d34d05a47050262322148f1704dc075971863 (patch)
treef4bc2ae7a29a19abd9cdc3b790489c2e4cdf30a1 /src/web/views/api/v2/category.py
parentRemoved links between current article and the previous/next articles. (diff)
parentBug fix: arguments in the URL weren't processed. (diff)
downloadnewspipe-728d34d05a47050262322148f1704dc075971863.tar.gz
newspipe-728d34d05a47050262322148f1704dc075971863.tar.bz2
newspipe-728d34d05a47050262322148f1704dc075971863.zip
Merge branch 'new-api'
Diffstat (limited to 'src/web/views/api/v2/category.py')
-rw-r--r--src/web/views/api/v2/category.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/web/views/api/v2/category.py b/src/web/views/api/v2/category.py
new file mode 100644
index 00000000..21459fc5
--- /dev/null
+++ b/src/web/views/api/v2/category.py
@@ -0,0 +1,27 @@
+from conf import API_ROOT
+from flask import current_app
+from flask.ext.restful import Api
+
+from web.controllers.category import CategoryController
+from web.views.api.v2.common import (PyAggResourceNew,
+ PyAggResourceExisting,
+ PyAggResourceMulti)
+
+
+class CategoryNewAPI(PyAggResourceNew):
+ controller_cls = CategoryController
+
+
+class CategoryAPI(PyAggResourceExisting):
+ controller_cls = CategoryController
+
+
+class CategoriesAPI(PyAggResourceMulti):
+ controller_cls = CategoryController
+
+
+api = Api(current_app, prefix=API_ROOT)
+api.add_resource(CategoryNewAPI, '/category', endpoint='category_new.json')
+api.add_resource(CategoryAPI, '/category/<int:obj_id>',
+ endpoint='category.json')
+api.add_resource(CategoriesAPI, '/categories', endpoint='categories.json')
bgstack15