summaryrefslogtreecommitdiffstats
path: root/appinfo
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-05-02 16:55:11 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-05-02 16:55:11 +0200
commitc8c01278d837b3ecc01636fdd5b2d52638833687 (patch)
treebe9a12ebe3734978486623427e914d8b4db9982c /appinfo
parentdf91fdfa373cacef6aa20998a00b8fbcfd164d1b (diff)
implement all routes and function bodies for api calls
Diffstat (limited to 'appinfo')
-rw-r--r--appinfo/api.php184
-rw-r--r--appinfo/routes.php17
2 files changed, 186 insertions, 15 deletions
diff --git a/appinfo/api.php b/appinfo/api.php
new file mode 100644
index 000000000..d018fef23
--- /dev/null
+++ b/appinfo/api.php
@@ -0,0 +1,184 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCA\News;
+
+use \OCA\News\DependencyInjection\DIContainer;
+use \OCA\News\External\External;
+
+
+/**
+ * Folder API
+ */
+\OCP\API::register('get', '/apps/news/folders',
+ function($params) {
+ return External::main('FolderAPI', 'getAll', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('get', '/apps/news/folders/{folderId}',
+ function($urlParams) {
+ return External::main('FolderAPI', 'get', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('post', '/apps/news/folders',
+ function($urlParams) {
+ return External::main('FolderAPI', 'create', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('delete', '/apps/news/folders/{folderId}',
+ function($urlParams) {
+ return External::main('FolderAPI', 'delete', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('put', '/apps/news/folders/{folderId}',
+ function($urlParams) {
+ return External::main('FolderAPI', 'update', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+
+/**
+ * Feed API
+ */
+\OCP\API::register('get', '/apps/news/feeds',
+ function($urlParams) {
+ return External::main('FeedAPI', 'getAll', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('get', '/apps/news/feeds/{feedId}',
+ function($urlParams) {
+ return External::main('FeedAPI', 'get', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('post', '/apps/news/feeds/{feedId}',
+ function($urlParams) {
+ return External::main('FeedAPI', 'create', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('delete', '/apps/news/feeds/{feedId}',
+ function($urlParams) {
+ return External::main('FeedAPI', 'delete', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('put', '/apps/news/feeds/{feedId}/move',
+ function($urlParams) {
+ return External::main('FeedAPI', 'move', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('get', '/apps/news/feeds/{feedId}/read',
+ function($urlParams) {
+ return External::main('FeedAPI', 'read', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+/**
+ * Item API
+ */
+\OCP\API::register('get', '/apps/news/items',
+ function($urlParams) {
+ return External::main('ItemAPI', 'getAll', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('get', '/apps/news/items/updated',
+ function($urlParams) {
+ return External::main('ItemAPI', 'getUpdated', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('get', '/apps/news/items/{itemId}',
+ function($urlParams) {
+ return External::main('ItemAPI', 'get', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('put', '/apps/news/items/{itemId}/read',
+ function($urlParams) {
+ return External::main('ItemAPI', 'read', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('put', '/apps/news/items/{itemId}/unread',
+ function($urlParams) {
+ return External::main('ItemAPI', 'unread', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('put', '/apps/news/items/{feedId}/{guidHash}/star',
+ function($urlParams) {
+ return External::main('ItemAPI', 'star', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+);
+
+\OCP\API::register('put', '/apps/news/items/{feedId}/{guidHash}/unstar',
+ function($urlParams) {
+ return External::main('ItemAPI', 'unstar', $params, new DIContainer());
+ },
+ 'news',
+ \OC_API::USER_AUTH
+); \ No newline at end of file
diff --git a/appinfo/routes.php b/appinfo/routes.php
index c82a011b3..1acf11334 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -29,11 +29,9 @@ use \OCA\AppFramework\App;
use \OCA\News\DependencyInjection\DIContainer;
-
/**
* Webinterface
*/
-
$this->create('news_index', '/')->get()->action(
function($params){
App::main('PageController', 'index', $params, new DIContainer());
@@ -202,16 +200,5 @@ $this->create('news_usersettings_language', '/usersettings/language')->get()->ac
);
-
-/**
- * Feed API
- */
-\OCP\API::register('get', '/apps/news/feeds',
- function($urlParams) {
- $container = new DIContainer();
- $response = $container['FeedAPI']->getAll($urlParams);
- return new \OC_OCS_Result($response);
- },
- 'news',
- \OC_API::USER_AUTH
-);
+// include external API
+require_once __DIR__ . '/api.php'; \ No newline at end of file