diff options
-rw-r--r-- | apps/cloud_federation_api/lib/Capabilities.php | 6 | ||||
-rw-r--r-- | lib/private/OCM/Model/OCMProvider.php | 8 | ||||
-rw-r--r-- | lib/public/OCM/IOCMProvider.php | 7 |
3 files changed, 17 insertions, 4 deletions
diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index cd44d13117a..9b04145caa2 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -28,14 +28,12 @@ declare(strict_types=1); namespace OCA\CloudFederationAPI; -use OC\OCM\Model\OCMResource; use OCP\Capabilities\ICapability; use OCP\IURLGenerator; use OCP\OCM\Exceptions\OCMArgumentException; use OCP\OCM\IOCMProvider; class Capabilities implements ICapability { - public const API_VERSION = '1.0-proposal1'; public function __construct( @@ -74,12 +72,12 @@ class Capabilities implements ICapability { $this->provider->setEndPoint(substr($url, 0, $pos)); - $resource = new OCMResource(); + $resource = $this->provider->createNewResourceType(); $resource->setName('file') ->setShareTypes(['user', 'group']) ->setProtocols(['webdav' => '/public.php/webdav/']); - $this->provider->setResourceTypes([$resource]); + $this->provider->addResourceType($resource); return ['ocm' => $this->provider->jsonSerialize()]; } diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php index 1a8d943f79f..a72dd282dad 100644 --- a/lib/private/OCM/Model/OCMProvider.php +++ b/lib/private/OCM/Model/OCMProvider.php @@ -96,6 +96,14 @@ class OCMProvider implements IOCMProvider { } /** + * create a new resource to later add it with {@see IOCMProvider::addResourceType()} + * @return IOCMResource + */ + public function createNewResourceType(): IOCMResource { + return new OCMResource(); + } + + /** * @param IOCMResource $resource * * @return $this diff --git a/lib/public/OCM/IOCMProvider.php b/lib/public/OCM/IOCMProvider.php index 6eebf13a589..6df7eed370c 100644 --- a/lib/public/OCM/IOCMProvider.php +++ b/lib/public/OCM/IOCMProvider.php @@ -91,6 +91,13 @@ interface IOCMProvider extends JsonSerializable { public function getEndPoint(): string; /** + * create a new resource to later add it with {@see addResourceType()} + * @return IOCMResource + * @since 28.0.0 + */ + public function createNewResourceType(): IOCMResource; + + /** * add a single resource to the object * * @param IOCMResource $resource |