IProvider.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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\TextToImage;
  8. use RuntimeException;
  9. /**
  10. * This is the interface that is implemented by apps that
  11. * implement a text to image provider
  12. * @since 28.0.0
  13. * @deprecated 30.0.0
  14. */
  15. interface IProvider {
  16. /**
  17. * An arbitrary unique text string identifying this provider
  18. * @since 28.0.0
  19. */
  20. public function getId(): string;
  21. /**
  22. * The localized name of this provider
  23. * @since 28.0.0
  24. */
  25. public function getName(): string;
  26. /**
  27. * Processes a text
  28. *
  29. * @param string $prompt The input text
  30. * @param resource[] $resources The file resources to write the images to
  31. * @return void
  32. * @since 28.0.0
  33. * @throws RuntimeException If the text could not be processed
  34. */
  35. public function generate(string $prompt, array $resources): void;
  36. /**
  37. * The expected runtime for one task with this provider in seconds
  38. * @since 28.0.0
  39. */
  40. public function getExpectedRuntime(): int;
  41. }