ACreateEmpty.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 OCP\Files\File;
  8. /**
  9. * @since 18.0.0
  10. */
  11. abstract class ACreateEmpty {
  12. /**
  13. * Unique id for the creator to filter templates
  14. *
  15. * e.g. document/spreadsheet/presentation
  16. *
  17. * @since 18.0.0
  18. * @return string
  19. */
  20. abstract public function getId(): string;
  21. /**
  22. * Descriptive name for the create action
  23. *
  24. * e.g Create a new document
  25. *
  26. * @since 18.0.0
  27. * @return string
  28. */
  29. abstract public function getName(): string;
  30. /**
  31. * Default file extension for the new file
  32. *
  33. * @since 18.0.0
  34. * @return string
  35. */
  36. abstract public function getExtension(): string;
  37. /**
  38. * Mimetype of the resulting created file
  39. *
  40. * @since 18.0.0
  41. * @return string
  42. */
  43. abstract public function getMimetype(): string;
  44. /**
  45. * Add content when creating empty files
  46. *
  47. * @since 18.0.0
  48. * @param File $file
  49. */
  50. public function create(File $file, ?string $creatorId = null, ?string $templateId = null): void {
  51. }
  52. }