2018-04-30 10:29:56 -04:00
|
|
|
<?php
|
2023-09-05 08:42:48 -04:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2018-04-30 10:29:56 -04:00
|
|
|
/**
|
2024-05-27 11:39:07 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-04-30 10:29:56 -04:00
|
|
|
*/
|
2025-03-14 04:53:16 -04:00
|
|
|
|
2018-04-30 10:29:56 -04:00
|
|
|
namespace OCA\CloudFederationAPI;
|
|
|
|
|
|
2025-08-12 11:05:37 -04:00
|
|
|
use OC\OCM\OCMDiscoveryService;
|
2018-04-30 10:29:56 -04:00
|
|
|
use OCP\Capabilities\ICapability;
|
2025-04-04 11:07:24 -04:00
|
|
|
use OCP\Capabilities\IInitialStateExcludedCapability;
|
2023-09-05 08:42:48 -04:00
|
|
|
use OCP\OCM\Exceptions\OCMArgumentException;
|
2018-04-30 10:29:56 -04:00
|
|
|
|
2025-04-04 11:07:24 -04:00
|
|
|
class Capabilities implements ICapability, IInitialStateExcludedCapability {
|
2023-09-05 08:42:48 -04:00
|
|
|
public function __construct(
|
2025-08-12 11:05:37 -04:00
|
|
|
private readonly OCMDiscoveryService $ocmDiscoveryService,
|
2023-09-05 08:42:48 -04:00
|
|
|
) {
|
2018-04-30 10:29:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function an app uses to return the capabilities
|
2023-07-13 01:20:55 -04:00
|
|
|
*
|
2025-03-14 04:53:16 -04:00
|
|
|
* @return array<string, array<string, mixed>>
|
2023-09-05 08:42:48 -04:00
|
|
|
* @throws OCMArgumentException
|
2018-04-30 10:29:56 -04:00
|
|
|
*/
|
|
|
|
|
public function getCapabilities() {
|
2025-08-12 11:05:37 -04:00
|
|
|
$provider = $this->ocmDiscoveryService->getLocalOCMProvider(false);
|
|
|
|
|
return ['ocm' => $provider->jsonSerialize()];
|
2018-04-30 10:29:56 -04:00
|
|
|
}
|
|
|
|
|
}
|