Skip to content

Commit

Permalink
refactor: Replace annotations with attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Mar 5, 2024
1 parent a8aa47c commit dcd37d1
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit dcd37d1

Please sign in to comment.