diff options
Diffstat (limited to 'lib/public/SpeechToText')
-rw-r--r-- | lib/public/SpeechToText/Events/AbstractTranscriptionEvent.php (renamed from lib/public/SpeechToText/Events/TranscriptionFinishedEvent.php) | 32 | ||||
-rw-r--r-- | lib/public/SpeechToText/Events/TranscriptionFailedEvent.php | 24 | ||||
-rw-r--r-- | lib/public/SpeechToText/Events/TranscriptionSuccessfulEvent.php | 26 |
3 files changed, 54 insertions, 28 deletions
diff --git a/lib/public/SpeechToText/Events/TranscriptionFinishedEvent.php b/lib/public/SpeechToText/Events/AbstractTranscriptionEvent.php index 245ccd413e9..5b00315f74c 100644 --- a/lib/public/SpeechToText/Events/TranscriptionFinishedEvent.php +++ b/lib/public/SpeechToText/Events/AbstractTranscriptionEvent.php @@ -30,15 +30,12 @@ use OCP\EventDispatcher\Event; /** * @since 27.0.0 */ -class TranscriptionFinishedEvent extends Event { +abstract class AbstractTranscriptionEvent extends Event { /** * @since 27.0.0 */ public function __construct( - private bool $successful, - private string $transcription, - private string $errorMessage, - private array $context + private int $fileIdId ) { parent::__construct(); } @@ -46,28 +43,7 @@ class TranscriptionFinishedEvent extends Event { /** * @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; + 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 @@ +<?php + +namespace OCP\SpeechToText\Events; + +class TranscriptionFailedEvent extends AbstractTranscriptionEvent { + + /** + * @since 27.0.0 + */ + public function __construct( + int $fileId, + private string $errorMessage + ) { + parent::__construct($fileId); + } + + /** + * @since 27.0.0 + * @return string The error message + */ + public function getErrorMessage(): string { + return $this->errorMessage; + } +} 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 @@ +<?php + +namespace OCP\SpeechToText\Events; + +use OCP\Files\File; + +class TranscriptionSuccessfulEvent extends AbstractTranscriptionEvent { + + /** + * @since 27.0.0 + */ + public function __construct( + int $fileId, + private string $transcript + ) { + parent::__construct($fileId); + } + + /** + * @since 27.0.0 + * @return string The transcript of the media file + */ + public function getTranscript(): string { + return $this->transcript; + } +} |