. * */ namespace OCA\News\External; use \OCA\AppFramework\Core\API; use \OCA\AppFramework\Controller\Controller; use \OCA\AppFramework\Http\Request; use \OCA\News\BusinessLayer\ItemBusinessLayer; use \OCA\News\BusinessLayer\BusinessLayerException; class ItemAPI extends Controller { private $itemBusinessLayer; public function __construct(API $api, Request $request, ItemBusinessLayer $itemBusinessLayer){ parent::__construct($api, $request); $this->itemBusinessLayer = $itemBusinessLayer; } public function getAll() { $result = array( 'items' => array() ); $userId = $this->api->getUserId(); $batchSize = (int) $this->params('batchSize'); $offset = (int) $this->params('offset', 0); $type = (int) $this->params('type'); $id = (int) $this->params('id'); $showAll = $this->params('getRead') === 'true'; $items = $this->itemBusinessLayer->findAll( $id, $type, $batchSize, $offset, $showAll, $userId ); foreach ($items as $item) { array_push($result['items'], $item->toAPI()); } return new NewsAPIResult($result); } public function getUpdated() { } public function get() { } public function read() { } public function unread() { } public function star() { } public function unstar() { } }