From dcd37d1628ea2026e7c00b41af915461c91b9ddc Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 28 Feb 2024 19:17:24 -0800 Subject: [PATCH] refactor: Replace annotations with attributes Signed-off-by: Christopher Ng --- lib/Controller/ApiController.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index cacf3a4..e38464e 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -30,8 +30,8 @@ use OCA\Files_DownloadLimit\Db\Limit; use OCA\Files_DownloadLimit\Db\LimitMapper; use OCP\AppFramework\Db\DoesNotExistException; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; -use OCP\AppFramework\Http\Response; use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCSController; @@ -55,11 +55,10 @@ public function __construct( } /** - * @NoAdminRequired - * * Set the download limit for a given link share */ - public function setDownloadLimit(string $token, int $limit): Response { + #[NoAdminRequired] + public function setDownloadLimit(string $token, int $limit): DataResponse { $this->validateToken($token); // Count needs to be at least 1 @@ -92,11 +91,10 @@ public function setDownloadLimit(string $token, int $limit): Response { } /** - * @NoAdminRequired - * * Remove the download limit for a given link share */ - public function removeDownloadLimit(string $token): Response { + #[NoAdminRequired] + public function removeDownloadLimit(string $token): DataResponse { $this->validateToken($token); try { @@ -105,16 +103,15 @@ public function removeDownloadLimit(string $token): Response { } catch (DoesNotExistException $e) { // Ignore if does not exists } - + return new DataResponse(); } /** - * @NoAdminRequired - * * Get the download limit for a given link share */ - public function getDownloadLimit(string $token): Response { + #[NoAdminRequired] + public function getDownloadLimit(string $token): DataResponse { $this->validateToken($token); try {