1
0

IEditor.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
  5. *
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\DirectEditing;
  25. use OCP\AppFramework\Http\Response;
  26. /**
  27. * @since 18.0.0
  28. */
  29. interface IEditor {
  30. /**
  31. * Return a unique identifier for the editor
  32. *
  33. * e.g. richdocuments
  34. *
  35. * @since 18.0.0
  36. * @return string
  37. */
  38. public function getId(): string;
  39. /**
  40. * Return a readable name for the editor
  41. *
  42. * e.g. Collabora Online
  43. *
  44. * @since 18.0.0
  45. * @return string
  46. */
  47. public function getName(): string;
  48. /**
  49. * A list of mimetypes that should open the editor by default
  50. *
  51. * @since 18.0.0
  52. * @return string[]
  53. */
  54. public function getMimetypes(): array;
  55. /**
  56. * A list of mimetypes that can be opened in the editor optionally
  57. *
  58. * @since 18.0.0
  59. * @return string[]
  60. */
  61. public function getMimetypesOptional(): array;
  62. /**
  63. * Return a list of file creation options to be presented to the user
  64. *
  65. * @since 18.0.0
  66. * @return ACreateFromTemplate[]|ACreateEmpty[]
  67. */
  68. public function getCreators(): array;
  69. /**
  70. * Return if the view is able to securely view a file without downloading it to the browser
  71. *
  72. * @since 18.0.0
  73. * @return bool
  74. */
  75. public function isSecure(): bool;
  76. /**
  77. * Return a template response for displaying the editor
  78. *
  79. * open can only be called once when the client requests the editor with a one-time-use token
  80. * For handling editing and later requests, editors need to implement their own token handling and take care of invalidation
  81. *
  82. * This behavior is similar to the current direct editing implementation in collabora where we generate a one-time token and switch over to the regular wopi token for the actual editing/saving process
  83. *
  84. * @since 18.0.0
  85. * @return Response
  86. */
  87. public function open(IToken $token): Response;
  88. }