1
0

ISpeechToTextManager.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\SpeechToText;
  8. use InvalidArgumentException;
  9. use OCP\Files\File;
  10. use OCP\PreConditionNotMetException;
  11. use RuntimeException;
  12. /**
  13. * @since 27.0.0
  14. * @deprecated 30.0.0
  15. */
  16. interface ISpeechToTextManager {
  17. /**
  18. * @since 27.0.0
  19. */
  20. public function hasProviders(): bool;
  21. /**
  22. * @return ISpeechToTextProvider[]
  23. * @since 27.1.0
  24. */
  25. public function getProviders(): array;
  26. /**
  27. * Will schedule a transcription process in the background. The result will become available
  28. * with the \OCP\SpeechToText\Events\TranscriptionFinishedEvent
  29. * You should add context information to the context array to re-identify the transcription result as
  30. * belonging to your transcription request.
  31. *
  32. * @param File $file The media file to transcribe
  33. * @param ?string $userId The user that triggered this request (only for convenience, will be available on the TranscriptEvents)
  34. * @param string $appId The app that triggered this request (only for convenience, will be available on the TranscriptEvents)
  35. * @throws PreConditionNotMetException If no provider was registered but this method was still called
  36. * @throws InvalidArgumentException If the file could not be found or is not of a supported type
  37. * @since 27.0.0
  38. */
  39. public function scheduleFileTranscription(File $file, ?string $userId, string $appId): void;
  40. /**
  41. * Will cancel a scheduled transcription process
  42. *
  43. * @param File $file The media file involved in the transcription
  44. * @param ?string $userId The user that triggered this request
  45. * @param string $appId The app that triggered this request
  46. * @throws InvalidArgumentException If the file could not be found or is not of a supported type
  47. * @since 29.0.0
  48. */
  49. public function cancelScheduledFileTranscription(File $file, ?string $userId, string $appId): void;
  50. /**
  51. * @param File $file The media file to transcribe
  52. * @param ?string $userId The user that triggered this request
  53. * @param string $appId The app that triggered this request
  54. * @returns string The transcription of the passed media file
  55. * @throws PreConditionNotMetException If no provider was registered but this method was still called
  56. * @throws InvalidArgumentException If the file could not be found or is not of a supported type
  57. * @throws RuntimeException If the transcription failed for other reasons
  58. * @since 27.0.0
  59. */
  60. public function transcribeFile(File $file, ?string $userId, string $appId): string;
  61. }