summaryrefslogtreecommitdiffstats
path: root/lib/Controller/RecordingController.php
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-12-12 14:26:59 -0300
committerVitor Mattos <vitor@php.rio>2022-12-12 14:26:59 -0300
commitb06786de2583d81a4abe5177ff4a44a27fdce155 (patch)
treeb596960fac12e3f28b9ec82f6a3d7540db687b79 /lib/Controller/RecordingController.php
parent0f179b79d5817cc93b1f8e3653c5010cc7f5ea46 (diff)
Moved methods of recording api to specific controller
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib/Controller/RecordingController.php')
-rw-r--r--lib/Controller/RecordingController.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/Controller/RecordingController.php b/lib/Controller/RecordingController.php
new file mode 100644
index 000000000..c361863e6
--- /dev/null
+++ b/lib/Controller/RecordingController.php
@@ -0,0 +1,66 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2022 Vitor Mattos <vitor@php.rio>
+ *
+ * @author Vitor Mattos <vitor@php.rio>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Talk\Controller;
+
+use OCA\Talk\Service\RoomService;
+use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\DataResponse;
+use OCP\IRequest;
+
+class RecordingController extends AEnvironmentAwareController {
+ private RoomService $roomService;
+
+ public function __construct(string $appName,
+ IRequest $request,
+ RoomService $roomService) {
+ parent::__construct($appName, $request);
+ $this->roomService = $roomService;
+ }
+
+ /**
+ * @PublicPage
+ * @RequireCallEnabled
+ * @RequireModeratorParticipant
+ * @RequireCallRecording
+ */
+ public function startRecording(int $status): DataResponse {
+ if (!$this->roomService->startRecording($this->room, $status)) {
+ return new DataResponse([], Http::STATUS_BAD_REQUEST);
+ }
+ return new DataResponse();
+ }
+
+ /**
+ * @PublicPage
+ * @RequireCallEnabled
+ * @RequireModeratorParticipant
+ * @RequireCallRecording
+ */
+ public function stopRecording(): DataResponse {
+ $this->roomService->stopRecording($this->room);
+ return new DataResponse();
+ }
+}