This repository has been archived on 2024-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
epubreader/lib/Controller/MetadataController.php

81 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2020-04-21 20:37:42 +00:00
<?php
/**
* @author Frank de Lange
* @copyright 2017 Frank de Lange
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Epubreader\Controller;
2020-04-21 20:37:42 +00:00
use OCP\IRequest;
use OCP\AppFramework\Controller;
use OCA\Epubreader\Service\MetadataService;
2020-04-21 20:37:42 +00:00
class MetadataController extends Controller {
private $metadataService;
/**
* @param string $AppName
* @param IRequest $request
* @param MetadataService $metadataService
*/
public function __construct($AppName,
IRequest $request,
MetadataService $metadataService ) {
parent::__construct($AppName, $request);
$this->metadataService = $metadataService;
}
/**
* @brief write metadata
*
* @NoAdminRequired
*
* @param int $fileId
* @param string $value
*
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
public function setAll($fileId, $value) {
return $this->metadataService->setAll($fileId, $value);
}
/**
* @brief return metadata item
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @param int $fileId
* @param string $name
*
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
public function get($fileId, $name) {
return $this->metadataService->get($fileId, $name);
}
/**
* @brief write metadata item
*
* @NoAdminRequired
*
* @param int $fileId
* @param string $name
* @param string $value
*
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
public function set($fileId, $name, $value) {
return $this->metadataService->set($fileId, $name, $value);
}
}