DirectEditingCapabilities.php 974 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Files;
  8. use OCA\Files\Service\DirectEditingService;
  9. use OCP\Capabilities\ICapability;
  10. use OCP\Capabilities\IInitialStateExcludedCapability;
  11. use OCP\IURLGenerator;
  12. class DirectEditingCapabilities implements ICapability, IInitialStateExcludedCapability {
  13. public function __construct(
  14. protected DirectEditingService $directEditingService,
  15. protected IURLGenerator $urlGenerator,
  16. ) {
  17. }
  18. /**
  19. * @return array{files: array{directEditing: array{url: string, etag: string, supportsFileId: bool}}}
  20. */
  21. public function getCapabilities() {
  22. return [
  23. 'files' => [
  24. 'directEditing' => [
  25. 'url' => $this->urlGenerator->linkToOCSRouteAbsolute('files.DirectEditing.info'),
  26. 'etag' => $this->directEditingService->getDirectEditingETag(),
  27. 'supportsFileId' => true,
  28. ]
  29. ],
  30. ];
  31. }
  32. }