IProvider.php 1.0 KB

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