1
0

ATemplate.php 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\DirectEditing;
  7. use JsonSerializable;
  8. /**
  9. * Class ATemplate
  10. *
  11. * @since 18.0.0
  12. */
  13. abstract class ATemplate implements JsonSerializable {
  14. /**
  15. * Return a unique id so the app can identify the template
  16. *
  17. * @since 18.0.0
  18. * @return string
  19. */
  20. abstract public function getId(): string;
  21. /**
  22. * Return a title that is displayed to the user
  23. *
  24. * @since 18.0.0
  25. * @return string
  26. */
  27. abstract public function getTitle(): string;
  28. /**
  29. * Return a link to the template preview image
  30. *
  31. * @since 18.0.0
  32. * @return string
  33. */
  34. abstract public function getPreview(): string;
  35. /**
  36. * @since 18.0.0
  37. */
  38. public function jsonSerialize(): array {
  39. return [
  40. 'id' => $this->getId(),
  41. 'title' => $this->getTitle(),
  42. 'preview' => $this->getPreview(),
  43. ];
  44. }
  45. }