From 8aa2aa2efe53ca0f2cdcb1b7a05812cb9930e52e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 9 Oct 2019 11:51:28 +0200 Subject: [PATCH] Remove unwanted, undocumented and unused methods from Commands controller Signed-off-by: Joas Schilling --- appinfo/routes.php | 18 -------------- lib/Controller/CommandController.php | 37 ---------------------------- 2 files changed, 55 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index a016b6949..f0729ba87 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -383,24 +383,6 @@ return [ 'apiVersion' => 'v1', ], ], - [ - 'name' => 'Command#update', - 'url' => '/api/{apiVersion}/command/{id}', - 'verb' => 'PUT', - 'requirements' => [ - 'apiVersion' => 'v1', - 'id' => '^\d+$', - ], - ], - [ - 'name' => 'Command#destroy', - 'url' => '/api/{apiVersion}/command/{id}', - 'verb' => 'DELETE', - 'requirements' => [ - 'apiVersion' => 'v1', - 'id' => '^\d+$', - ], - ], /** * Webinar diff --git a/lib/Controller/CommandController.php b/lib/Controller/CommandController.php index 68809359b..a64e2bc52 100644 --- a/lib/Controller/CommandController.php +++ b/lib/Controller/CommandController.php @@ -25,8 +25,6 @@ namespace OCA\Talk\Controller; use OCA\Talk\Model\Command; use OCA\Talk\Service\CommandService; -use OCP\AppFramework\Db\DoesNotExistException; -use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\IRequest; @@ -60,39 +58,4 @@ class CommandController extends OCSController { return new DataResponse($result); } - - /** - * @param int $id - * @param int $response - * @param int $enabled - * @return DataResponse - */ - public function update(int $id, int $response, int $enabled): DataResponse { - try { - $command = $this->commandService->updateFromWeb($id, $response, $enabled); - } catch (DoesNotExistException $e) { - return new DataResponse([], Http::STATUS_NOT_FOUND); - } catch (\InvalidArgumentException $e) { - return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); - } - - return new DataResponse($command->asArray()); - } - - /** - * @param int $id - * @return DataResponse - */ - public function destroy(int $id): DataResponse { - try { - $this->commandService->delete($id); - } catch (DoesNotExistException $e) { - return new DataResponse([], Http::STATUS_NOT_FOUND); - } catch (\InvalidArgumentException $e) { - return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); - } - - return new DataResponse(); - } - }