DirectEditingCapabilities.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. protected DirectEditingService $directEditingService;
  14. protected IURLGenerator $urlGenerator;
  15. public function __construct(DirectEditingService $directEditingService, IURLGenerator $urlGenerator) {
  16. $this->directEditingService = $directEditingService;
  17. $this->urlGenerator = $urlGenerator;
  18. }
  19. /**
  20. * @return array{files: array{directEditing: array{url: string, etag: string, supportsFileId: bool}}}
  21. */
  22. public function getCapabilities() {
  23. return [
  24. 'files' => [
  25. 'directEditing' => [
  26. 'url' => $this->urlGenerator->linkToOCSRouteAbsolute('files.DirectEditing.info'),
  27. 'etag' => $this->directEditingService->getDirectEditingETag(),
  28. 'supportsFileId' => true,
  29. ]
  30. ],
  31. ];
  32. }
  33. }