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.6 KiB
PHP
Raw 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
2023-06-16 14:58:23 +00:00
use OCA\Epubreader\Service\MetadataService;
2020-04-21 20:37:42 +00:00
use OCP\AppFramework\Controller;
2023-06-16 14:58:23 +00:00
use OCP\IRequest;
2020-04-21 20:37:42 +00:00
class MetadataController extends Controller {
2023-06-16 14:58:23 +00:00
private $metadataService;
2020-04-21 20:37:42 +00:00
/**
* @param string $AppName
* @param IRequest $request
2023-06-16 14:58:23 +00:00
* @param MetadataService $metadataService
2020-04-21 20:37:42 +00:00
*/
2023-06-16 14:58:23 +00:00
public function __construct($AppName,
IRequest $request,
MetadataService $metadataService) {
2020-04-21 20:37:42 +00:00
parent::__construct($AppName, $request);
2023-06-16 14:58:23 +00:00
$this->metadataService = $metadataService;
}
2020-04-21 20:37:42 +00:00
/**
2023-06-16 14:58:23 +00:00
* @brief write metadata
*
* @NoAdminRequired
*
* @param int $fileId
* @param string $value
*
2020-04-21 20:37:42 +00:00
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
2023-06-16 14:58:23 +00:00
public function setAll($fileId, $value) {
return $this->metadataService->setAll($fileId, $value);
}
2020-04-21 20:37:42 +00:00
/**
2023-06-16 14:58:23 +00:00
* @brief return metadata item
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @param int $fileId
* @param string $name
*
2020-04-21 20:37:42 +00:00
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
2023-06-16 14:58:23 +00:00
public function get($fileId, $name) {
return $this->metadataService->get($fileId, $name);
}
2020-04-21 20:37:42 +00:00
/**
2023-06-16 14:58:23 +00:00
* @brief write metadata item
*
* @NoAdminRequired
*
* @param int $fileId
* @param string $name
* @param string $value
*
2020-04-21 20:37:42 +00:00
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
2023-06-16 14:58:23 +00:00
public function set($fileId, $name, $value) {
return $this->metadataService->set($fileId, $name, $value);
2020-04-21 20:37:42 +00:00
}
}