summaryrefslogtreecommitdiffstats
path: root/appinfo
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2013-03-06 10:27:50 +0100
committerAlessandro Cosentino <cosenal@gmail.com>2013-03-06 10:27:50 +0100
commit3c87c2be39c609a3d68c133358ab91a40480b745 (patch)
tree0fa508a1552c34ef55ab9cfbd175d2fc5af4c8f6 /appinfo
parentc4349e0c2ee6a6600b8e661e776c2e1a4b131e0e (diff)
api calls are anonymous functions now
Diffstat (limited to 'appinfo')
-rw-r--r--appinfo/bootstrap.php24
-rw-r--r--appinfo/routes.php40
2 files changed, 47 insertions, 17 deletions
diff --git a/appinfo/bootstrap.php b/appinfo/bootstrap.php
index 10ddeadc6..ae011cc45 100644
--- a/appinfo/bootstrap.php
+++ b/appinfo/bootstrap.php
@@ -46,11 +46,11 @@ namespace OCA\News;
\OC::$CLASSPATH['OCA\News\NewsController'] = 'apps/news/controller/news.controller.php';
\OC::$CLASSPATH['OCA\News\NewsAjaxController'] = 'apps/news/controller/news.ajax.controller.php';
-\OC::$CLASSPATH['OCA\News\FolderBL'] = 'apps/news/folder.bl.php';
-\OC::$CLASSPATH['OCA\News\FeedBL'] = 'apps/news/feed.bl.php';
+\OC::$CLASSPATH['OCA\News\FolderBl'] = 'apps/news/folder.bl.php';
+\OC::$CLASSPATH['OCA\News\FeedBl'] = 'apps/news/feed.bl.php';
-\OC::$CLASSPATH['OCA\News\API_Folder'] = 'apps/news/external_api/folder.php';
-\OC::$CLASSPATH['OCA\News\API_Feed'] = 'apps/news/external_api/feed.php';
+\OC::$CLASSPATH['OCA\News\FolderApi'] = 'apps/news/external_api/folder.php';
+\OC::$CLASSPATH['OCA\News\FeedApi'] = 'apps/news/external_api/feed.php';
/**
@@ -115,23 +115,23 @@ function createDIContainer(){
/**
* BUSINESS LAYER OBJECTS
*/
- $newsContainer['FolderBL'] = $newsContainer->share(function($c){
- return new FolderBL($c['FolderMapper']);
+ $newsContainer['FolderBl'] = $newsContainer->share(function($c){
+ return new FolderBl($c['FolderMapper']);
});
- $newsContainer['FeedBL'] = $newsContainer->share(function($c){
- return new FeedBL($c['FeedMapper']);
+ $newsContainer['FeedBl'] = $newsContainer->share(function($c){
+ return new FeedBl($c['FeedMapper']);
});
/**
* EXTERNAL API LAYER
*/
- $newsContainer['API_Folder'] = $newsContainer->share(function($c){
- return new API_Folder($c['FolderBL']);
+ $newsContainer['FolderApi'] = $newsContainer->share(function($c){
+ return new FolderApi($c['FolderBl']);
});
- $newsContainer['API_Feed'] = $newsContainer->share(function($c){
- return new API_Feed($c['FeedBL']);
+ $newsContainer['FeedApi'] = $newsContainer->share(function($c){
+ return new FeedApi($c['FeedBl']);
});
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 0370ecb93..1427d4443 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -205,24 +205,54 @@ $this->create('news_ajax_importOPML', '/import')->action(
/**
* External API
*/
+
/**
* Feed API
*/
+
\OCP\API::register(
- 'get', '/news/feeds', array('OCA\News\API_Feed', 'getAll'), 'news', \OC_API::USER_AUTH
+ 'get', '/news/feeds',
+ function($urlParams) {
+ $container = createDIContainer();
+ return $container['FeedApi']->getAll($urlParams);
+ },
+ 'news', \OC_API::USER_AUTH
);
\OCP\API::register(
- 'get', '/news/feeds/{feedid}', array('OCA\News\API_Feed', 'getById'), 'news', \OC_API::USER_AUTH
+ 'get', '/news/feeds/{feedid}',
+ function($urlParams) {
+ $container = createDIContainer();
+ return $container['FeedApi']->getById($urlParams);
+ },
+ 'news', \OC_API::USER_AUTH
);
\OCP\API::register(
- 'post', '/news/feeds/create', array('OCA\News\API_Feed', 'create'), 'news', \OC_API::USER_AUTH
+ 'post', '/news/feeds/create',
+ function($urlParams) {
+ $container = createDIContainer();
+ return $container['FeedApi']->create($urlParams);
+ },
+ 'news', \OC_API::USER_AUTH
);
+
/**
* Folder API
*/
+
\OCP\API::register(
- 'get', '/news/folders', array('OCA\News\API_Folder', 'getAll'), 'news', \OC_API::USER_AUTH
+ 'get', '/news/folders',
+ function($urlParams) {
+ $container = createDIContainer();
+ return $container['FolderApi']->getAll($urlParams);
+ },
+ 'news', \OC_API::USER_AUTH
);
+
\OCP\API::register(
- 'post', '/news/folders/create', array('OCA\News\API_Folder', 'create'), 'news', \OC_API::USER_AUTH
+ 'post', '/news/folders/create',
+ function($urlParams) {
+ $container = createDIContainer();
+ return $container['FolderApi']->create($urlParams);
+ },
+ 'news', \OC_API::USER_AUTH
); \ No newline at end of file