blob: c0129197566898479375525f89978739dd570353 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\OCM\Events;
use OCP\EventDispatcher\Event;
use OCP\OCM\IOCMProvider;
/**
* Use this event to register additional OCM resources before the API returns
* them in the OCM provider list and capability
*
* @since 28.0.0
*/
class ResourceTypeRegisterEvent extends Event {
/**
* @param IOCMProvider $provider
* @since 28.0.0
*/
public function __construct(
protected IOCMProvider $provider,
) {
parent::__construct();
}
/**
* @param string $name
* @param list<string> $shareTypes List of supported share recipients, e.g. 'user', 'group', …
* @param array<string, string> $protocols List of supported protocols and their location,
* e.g. ['webdav' => '/remote.php/webdav/']
* @since 28.0.0
*/
public function registerResourceType(string $name, array $shareTypes, array $protocols): void {
$resourceType = $this->provider->createNewResourceType();
$resourceType->setName($name)
->setShareTypes($shareTypes)
->setProtocols($protocols);
$this->provider->addResourceType($resourceType);
}
}
|