Skip to content

Commit c6a761a

Browse files
committed
refactor: extend OCP API for public classes
Signed-off-by: Edward Ly <contact@edward.ly>
1 parent 3d82650 commit c6a761a

5 files changed

Lines changed: 6 additions & 78 deletions

File tree

lib/Event/ContentProviderRegisterEvent.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,5 @@
77

88
namespace OCA\ContextChat\Event;
99

10-
use OCA\ContextChat\Public\ContentManager;
11-
use OCA\ContextChat\Public\IContentProvider;
12-
use OCP\EventDispatcher\Event;
13-
14-
class ContentProviderRegisterEvent extends Event {
15-
public function __construct(
16-
private ContentManager $contentManager,
17-
) {
18-
}
19-
20-
/**
21-
* @param string $appId
22-
* @param string $providerId
23-
* @param class-string<IContentProvider> $providerClass
24-
* @return void
25-
* @since 2.2.2
26-
*/
27-
public function registerContentProvider(string $appId, string $providerId, string $providerClass): void {
28-
$this->contentManager->registerContentProvider($appId, $providerId, $providerClass);
29-
}
10+
class ContentProviderRegisterEvent extends \OCP\ContextChat\Events\ContentProviderRegisterEvent {
3011
}

lib/Public/ContentItem.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,5 @@
77

88
namespace OCA\ContextChat\Public;
99

10-
class ContentItem {
11-
/**
12-
* @param string $itemId
13-
* @param string $providerId
14-
* @param string $title
15-
* @param string $content
16-
* @param string $documentType
17-
* @param \DateTime $lastModified
18-
* @param string[] $users
19-
*/
20-
public function __construct(
21-
public string $itemId,
22-
public string $providerId,
23-
public string $title,
24-
public string $content,
25-
public string $documentType,
26-
public \DateTime $lastModified,
27-
public array $users,
28-
) {
29-
}
10+
class ContentItem extends \OCP\ContextChat\ContentItem {
3011
}

lib/Public/ContentManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
use OCA\ContextChat\Service\ActionScheduler;
1717
use OCA\ContextChat\Service\ProviderConfigService;
1818
use OCP\BackgroundJob\IJobList;
19+
use OCP\ContextChat\IContentManager;
1920
use OCP\EventDispatcher\IEventDispatcher;
2021
use OCP\Server;
2122
use Psr\Container\ContainerExceptionInterface;
2223
use Psr\Container\NotFoundExceptionInterface;
2324

24-
class ContentManager {
25+
class ContentManager implements IContentManager {
2526
public function __construct(
2627
private IJobList $jobList,
2728
private ProviderConfigService $providerConfig,

lib/Public/IContentProvider.php

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,7 @@
88
namespace OCA\ContextChat\Public;
99

1010
/**
11-
* This interface defines methods to implement a content provider
1211
* @since 1.1.0
1312
*/
14-
interface IContentProvider {
15-
/**
16-
* The ID of the provider
17-
*
18-
* @return string
19-
* @since 1.1.0
20-
*/
21-
public function getId(): string;
22-
23-
/**
24-
* The ID of the app making the provider avaialble
25-
*
26-
* @return string
27-
* @since 1.1.0
28-
*/
29-
public function getAppId(): string;
30-
31-
/**
32-
* The absolute URL to the content item
33-
*
34-
* @param string $id
35-
* @return string
36-
* @since 1.1.0
37-
*/
38-
public function getItemUrl(string $id): string;
39-
40-
/**
41-
* Starts the initial import of content items into content chat
42-
*
43-
* @return void
44-
* @since 1.1.0
45-
*/
46-
public function triggerInitialImport(): void;
13+
interface IContentProvider extends \OCP\ContextChat\IContentProvider {
4714
}

lib/Type/UpdateAccessOp.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@
99

1010
namespace OCA\ContextChat\Type;
1111

12-
class UpdateAccessOp {
13-
public const ALLOW = 'allow';
14-
public const DENY = 'deny';
12+
class UpdateAccessOp extends \OCP\ContextChat\Type\UpdateAccessOp {
1513
}

0 commit comments

Comments
 (0)