From a8d3fff648c4c6f5be3e37c09f9168e5b7c0e8f8 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 13 Apr 2023 12:12:07 +0200 Subject: Split TranscriptionFinishedEvent into Successful and Failed events Signed-off-by: Marcel Klehr --- .../Events/AbstractTranscriptionEvent.php | 49 +++++++++++++++ .../Events/TranscriptionFailedEvent.php | 24 +++++++ .../Events/TranscriptionFinishedEvent.php | 73 ---------------------- .../Events/TranscriptionSuccessfulEvent.php | 26 ++++++++ 4 files changed, 99 insertions(+), 73 deletions(-) create mode 100644 lib/public/SpeechToText/Events/AbstractTranscriptionEvent.php create mode 100644 lib/public/SpeechToText/Events/TranscriptionFailedEvent.php delete mode 100644 lib/public/SpeechToText/Events/TranscriptionFinishedEvent.php create mode 100644 lib/public/SpeechToText/Events/TranscriptionSuccessfulEvent.php (limited to 'lib/public/SpeechToText') diff --git a/lib/public/SpeechToText/Events/AbstractTranscriptionEvent.php b/lib/public/SpeechToText/Events/AbstractTranscriptionEvent.php new file mode 100644 index 00000000000..5b00315f74c --- /dev/null +++ b/lib/public/SpeechToText/Events/AbstractTranscriptionEvent.php @@ -0,0 +1,49 @@ + + * + * @author Marcel Klehr + * + * @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 . + * + */ +namespace OCP\SpeechToText\Events; + +use OCP\EventDispatcher\Event; + +/** + * @since 27.0.0 + */ +abstract class AbstractTranscriptionEvent extends Event { + /** + * @since 27.0.0 + */ + public function __construct( + private int $fileIdId + ) { + parent::__construct(); + } + + /** + * @since 27.0.0 + */ + public function getFileId(): int { + return $this->fileIdId; + } +} diff --git a/lib/public/SpeechToText/Events/TranscriptionFailedEvent.php b/lib/public/SpeechToText/Events/TranscriptionFailedEvent.php new file mode 100644 index 00000000000..3a490995c10 --- /dev/null +++ b/lib/public/SpeechToText/Events/TranscriptionFailedEvent.php @@ -0,0 +1,24 @@ +errorMessage; + } +} diff --git a/lib/public/SpeechToText/Events/TranscriptionFinishedEvent.php b/lib/public/SpeechToText/Events/TranscriptionFinishedEvent.php deleted file mode 100644 index 245ccd413e9..00000000000 --- a/lib/public/SpeechToText/Events/TranscriptionFinishedEvent.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * @author Marcel Klehr - * - * @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 . - * - */ -namespace OCP\SpeechToText\Events; - -use OCP\EventDispatcher\Event; - -/** - * @since 27.0.0 - */ -class TranscriptionFinishedEvent extends Event { - /** - * @since 27.0.0 - */ - public function __construct( - private bool $successful, - private string $transcription, - private string $errorMessage, - private array $context - ) { - parent::__construct(); - } - - /** - * @since 27.0.0 - */ - public function getContext(): array { - return $this->context; - } - - /** - * @since 27.0.0 - */ - public function isSuccessful(): bool { - return $this->successful; - } - - /** - * @since 27.0.0 - */ - public function getErrorMessage(): string { - return $this->errorMessage; - } - - /** - * @since 27.0.0 - */ - public function getTranscription(): string { - return $this->transcription; - } -} diff --git a/lib/public/SpeechToText/Events/TranscriptionSuccessfulEvent.php b/lib/public/SpeechToText/Events/TranscriptionSuccessfulEvent.php new file mode 100644 index 00000000000..63644b98f6d --- /dev/null +++ b/lib/public/SpeechToText/Events/TranscriptionSuccessfulEvent.php @@ -0,0 +1,26 @@ +transcript; + } +} -- cgit v1.2.3