diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-06-12 20:32:39 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-06-12 20:32:49 +0200 |
commit | 73c02fdaa62dba2f7d6afa2a8eaad6a04b5634d4 (patch) | |
tree | 557ba1b4067212f4826927197272542a2091fd3e /appinfo | |
parent | 836c65b6fa7e9a90f9baf421713641dfcb7a90aa (diff) |
adjust routes for new api
Diffstat (limited to 'appinfo')
-rw-r--r-- | appinfo/api.php | 218 | ||||
-rw-r--r-- | appinfo/routes.php | 149 |
2 files changed, 145 insertions, 222 deletions
diff --git a/appinfo/api.php b/appinfo/api.php deleted file mode 100644 index 5d5a1fee2..000000000 --- a/appinfo/api.php +++ /dev/null @@ -1,218 +0,0 @@ -<?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\AppFramework\External\External; - - -/** - * Generic API - */ -\OCP\API::register('get', '/apps/news/version', - function($params) { - return External::main('NewsAPI', 'version', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -/** - * 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('post', '/apps/news/folders', - function($params) { - return External::main('FolderAPI', 'create', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('delete', '/apps/news/folders/{folderId}', - function($params) { - return External::main('FolderAPI', 'delete', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/folders/{folderId}', - function($params) { - return External::main('FolderAPI', 'update', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/folders/{folderId}/read', - function($params) { - return External::main('FolderAPI', 'read', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -/** - * Feed API - */ -\OCP\API::register('get', '/apps/news/feeds', - function($params) { - return External::main('FeedAPI', 'getAll', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('post', '/apps/news/feeds/{feedId}', - function($params) { - return External::main('FeedAPI', 'create', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('delete', '/apps/news/feeds/{feedId}', - function($params) { - return External::main('FeedAPI', 'delete', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/feeds/{feedId}/move', - function($params) { - return External::main('FeedAPI', 'move', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/feeds/{feedId}/read', - function($params) { - return External::main('FeedAPI', 'read', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -/** - * Item API - */ -\OCP\API::register('get', '/apps/news/items', - function($params) { - return External::main('ItemAPI', 'getAll', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('get', '/apps/news/items/updated', - function($params) { - return External::main('ItemAPI', 'getUpdated', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/{itemId}/read', - function($params) { - return External::main('ItemAPI', 'read', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/{itemId}/unread', - function($params) { - return External::main('ItemAPI', 'unread', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/{feedId}/{guidHash}/star', - function($params) { - return External::main('ItemAPI', 'star', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/{feedId}/{guidHash}/unstar', - function($params) { - return External::main('ItemAPI', 'unstar', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/read', - function($params) { - return External::main('ItemAPI', 'readAll', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/read/multiple', - function($params) { - return External::main('ItemAPI', 'readMultiple', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/unread/multiple', - function($params) { - return External::main('ItemAPI', 'unreadMultiple', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/star/multiple', - function($params) { - return External::main('ItemAPI', 'starMultiple', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); - -\OCP\API::register('put', '/apps/news/items/unstar/multiple', - function($params) { - return External::main('ItemAPI', 'unstarMultiple', $params, new DIContainer()); - }, - 'news', - \OC_API::USER_AUTH -); diff --git a/appinfo/routes.php b/appinfo/routes.php index f290c2e2b..9f30def1d 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -39,7 +39,7 @@ $this->create('news_index', '/')->get()->action( ); /** - * Folders + * Folders */ $this->create('news_folders', '/folders')->get()->action( function($params){ @@ -143,7 +143,7 @@ $this->create('news_feeds_read', '/feeds/{feedId}/read')->post()->action( $this->create('news_feeds_import_googlereader', '/feeds/import/googlereader') ->post()->action( function($params){ - App::main('FeedController', 'importGoogleReader', $params, + App::main('FeedController', 'importGoogleReader', $params, new DIContainer()); } ); @@ -224,5 +224,146 @@ $this->create('news_usersettings_language', '/usersettings/language')->get()->ac ); -// include external API -require_once __DIR__ . '/api.php';
\ No newline at end of file +/** + * Generic API + */ +$this->create('news_api_version', '/api/v1-2/version')->get()->action( + function($params) { + return App::main('NewsAPI', 'version', $params, new DIContainer()); + } +); + +/** + * Folder API + */ +$this->create('news_api_folders_get_all', '/api/v1-2/folders')->get()->action( + function($params) { + return App::main('FolderAPI', 'getAll', $params, new DIContainer()); + } +); + +$this->create('news_api_folders_create', '/api/v1-2/folders')->post()->action( + function($params) { + return App::main('FolderAPI', 'create', $params, new DIContainer()); + } +); + +$this->create('news_api_folders_delete', '/api/v1-2/folders/{folderId}')->delete()->action( + function($params) { + return App::main('FolderAPI', 'delete', $params, new DIContainer()); + } +); + +$this->create('news_api_folders_update', '/api/v1-2/folders/{folderId}')->put()->action( + function($params) { + return App::main('FolderAPI', 'update', $params, new DIContainer()); + } +); + +$this->create('news_api_folders_read', '/api/v1-2/folders/{folderId}/read')->put()->action( + function($params) { + return App::main('FolderAPI', 'read', $params, new DIContainer()); + } +); + +/** + * Feed API + */ +$this->create('news_api_feeds_get_all', '/api/v1-2/feeds')->get()->action( + function($params) { + return App::main('FeedAPI', 'getAll', $params, new DIContainer()); + } +); + +$this->create('news_api_feeds_create', '/api/v1-2/feeds/{feedId}')->post()->action( + function($params) { + return App::main('FeedAPI', 'create', $params, new DIContainer()); + } +); + +$this->create('news_api_feeds_delete', '/api/v1-2/feeds/{feedId}')->delete()->action( + function($params) { + return App::main('FeedAPI', 'delete', $params, new DIContainer()); + } +); + +$this->create('news_api_feeds_move', '/api/v1-2/feeds/{feedId}/move')->put()->action( + function($params) { + return App::main('FeedAPI', 'move', $params, new DIContainer()); + } +); + +$this->create('news_api_feeds_read', '/api/v1-2/feeds/{feedId}/read')->put()->action( + function($params) { + return App::main('FeedAPI', 'read', $params, new DIContainer()); + } +); + +/** + * Item API + */ +$this->create('news_api_items_get_all', '/api/v1-2/items')->get()->action( + function($params) { + return App::main('ItemAPI', 'getAll', $params, new DIContainer()); + } +); + +$this->create('news_api_items_updated', '/api/v1-2/items/updated')->get()->action( + function($params) { + return App::main('ItemAPI', 'getUpdated', $params, new DIContainer()); + } +); + +$this->create('news_api_items_read', '/api/v1-2/items/{itemId}/read')->put()->action( + function($params) { + return App::main('ItemAPI', 'read', $params, new DIContainer()); + } +); + +$this->create('news_api_items_unread', '/api/v1-2/items/{itemId}/unread')->put()->action( + function($params) { + return App::main('ItemAPI', 'unread', $params, new DIContainer()); + } +); + +$this->create('news_api_items_star', '/api/v1-2/items/{feedId}/{guidHash}/star')->put()->action( + function($params) { + return App::main('ItemAPI', 'star', $params, new DIContainer()); + } +); + +$this->create('news_api_items_unstar', '/api/v1-2/items/{feedId}/{guidHash}/unstar')->put()->action( + function($params) { + return App::main('ItemAPI', 'unstar', $params, new DIContainer()); + } +); + +$this->create('news_api_items_read_all', '/api/v1-2/items/read')->put()->action( + function($params) { + return App::main('ItemAPI', 'readAll', $params, new DIContainer()); + } +); + +$this->create('news_api_items_read_multiple', '/api/v1-2/items/read/multiple')->put()->action( + function($params) { + return App::main('ItemAPI', 'readMultiple', $params, new DIContainer()); + } +); + +$this->create('news_api_items_unread_multiple', '/api/v1-2/items/unread/multiple')->put()->action( + function($params) { + return App::main('ItemAPI', 'unreadMultiple', $params, new DIContainer()); + } +); + +$this->create('news_api_items_star_multiple', '/api/v1-2/items/star/multiple')->put()->action( + function($params) { + return App::main('ItemAPI', 'starMultiple', $params, new DIContainer()); + } +); + +$this->create('news_api_items_unstar_multiple', '/api/v1-2/items/unstar/multiple')->put()->action( + function($params) { + return App::main('ItemAPI', 'unstarMultiple', $params, new DIContainer()); + } +); |