IManager.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\DirectEditing;
  8. use OCP\AppFramework\Http\Response;
  9. use OCP\Files\NotPermittedException;
  10. use RuntimeException;
  11. /**
  12. * Interface IManager
  13. *
  14. * @since 18.0.0
  15. */
  16. interface IManager {
  17. /**
  18. * Register a new editor
  19. *
  20. * @since 18.0.0
  21. * @param IEditor $directEditor
  22. */
  23. public function registerDirectEditor(IEditor $directEditor): void;
  24. /**
  25. * Open the editing page for a provided token
  26. *
  27. * @since 18.0.0
  28. * @param string $token
  29. * @return Response
  30. */
  31. public function edit(string $token): Response;
  32. /**
  33. * Create a new token based on the file path and editor details
  34. *
  35. * @since 18.0.0
  36. * @param string $path
  37. * @param string $editorId
  38. * @param string $creatorId
  39. * @param null $templateId
  40. * @return string
  41. * @throws NotPermittedException
  42. * @throws RuntimeException
  43. */
  44. public function create(string $path, string $editorId, string $creatorId, $templateId = null): string;
  45. /**
  46. * Get the token details for a given token
  47. *
  48. * @since 18.0.0
  49. * @param string $token
  50. * @return IToken
  51. */
  52. public function getToken(string $token): IToken;
  53. /**
  54. * Cleanup expired tokens
  55. *
  56. * @since 18.0.0
  57. * @return int number of deleted tokens
  58. */
  59. public function cleanup(): int;
  60. /**
  61. * Check if direct editing is enabled
  62. *
  63. * @since 20.0.0
  64. * @return bool
  65. */
  66. public function isEnabled(): bool;
  67. /**
  68. * @since 24.0.0
  69. * @return IEditor[]
  70. */
  71. public function getEditors(): array;
  72. }