|DataResponse * * 200: OCM Provider details returned * 500: OCM not supported */ #[FrontpageRoute(verb: 'GET', url: '/ocm-provider/')] public function discovery(): DataResponse { try { $cap = Server::get( $this->config->getAppValue( 'core', 'ocm_providers', '\OCA\CloudFederationAPI\Capabilities' ) ); if (!($cap instanceof ICapability)) { throw new Exception('loaded class does not implements OCP\Capabilities\ICapability'); } return new DataResponse( $cap->getCapabilities()['ocm'] ?? ['enabled' => false], Http::STATUS_OK, [ 'X-NEXTCLOUD-OCM-PROVIDERS' => true, 'Content-Type' => 'application/json' ] ); } catch (ContainerExceptionInterface|Exception $e) { $this->logger->error('issue during OCM discovery request', ['exception' => $e]); return new DataResponse( ['message' => '/ocm-provider/ not supported'], Http::STATUS_INTERNAL_SERVER_ERROR ); } } }