|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * SPDX-FileCopyrightText: 2024-2025 Nextcloud GmbH and Nextcloud contributors |
| 7 | + * SPDX-License-Identifier: AGPL-3.0-or-later |
| 8 | + */ |
| 9 | + |
| 10 | +namespace OCP\ContextChat; |
| 11 | + |
| 12 | +/** |
| 13 | + * @since 32.0.0 |
| 14 | + */ |
| 15 | +interface IContentManager { |
| 16 | + /** |
| 17 | + * Checks if the context chat app is enabled or not |
| 18 | + * |
| 19 | + * @return bool |
| 20 | + * @since 32.0.0 |
| 21 | + */ |
| 22 | + public function isContextChatAvailable(): bool; |
| 23 | + |
| 24 | + /** |
| 25 | + * @param string $appId |
| 26 | + * @param string $providerId |
| 27 | + * @param class-string<IContentProvider> $providerClass |
| 28 | + * @return void |
| 29 | + * @since 32.0.0 |
| 30 | + */ |
| 31 | + public function registerContentProvider(string $appId, string $providerId, string $providerClass): void; |
| 32 | + |
| 33 | + /** |
| 34 | + * Emits an event to collect all content providers |
| 35 | + * |
| 36 | + * @return void |
| 37 | + * @since 32.0.0 |
| 38 | + */ |
| 39 | + public function collectAllContentProviders(): void; |
| 40 | + |
| 41 | + /** |
| 42 | + * Providers can use this to submit content for indexing in context chat |
| 43 | + * |
| 44 | + * @param string $appId |
| 45 | + * @param ContentItem[] $items |
| 46 | + * @return void |
| 47 | + * @since 32.0.0 |
| 48 | + */ |
| 49 | + public function submitContent(string $appId, array $items): void; |
| 50 | + |
| 51 | + /** |
| 52 | + * Update access for a content item for specified users. |
| 53 | + * This modifies the access list for the content item, |
| 54 | + * allowing or denying access to the specified users. |
| 55 | + * If no user has access to the content item, it will be removed from the knowledge base. |
| 56 | + * |
| 57 | + * @param string $appId |
| 58 | + * @param string $providerId |
| 59 | + * @param string $itemId |
| 60 | + * @param Type\UpdateAccessOp::* $op |
| 61 | + * @param array $userIds |
| 62 | + * @return void |
| 63 | + * @since 32.0.0 |
| 64 | + */ |
| 65 | + public function updateAccess(string $appId, string $providerId, string $itemId, string $op, array $userIds): void; |
| 66 | + |
| 67 | + /** |
| 68 | + * Update access for content items from the given provider for specified users. |
| 69 | + * If no user has access to the content item, it will be removed from the knowledge base. |
| 70 | + * |
| 71 | + * @param string $appId |
| 72 | + * @param string $providerId |
| 73 | + * @param Type\UpdateAccessOp::* $op |
| 74 | + * @param array $userIds |
| 75 | + * @return void |
| 76 | + * @since 32.0.0 |
| 77 | + */ |
| 78 | + public function updateAccessProvider(string $appId, string $providerId, string $op, array $userIds): void; |
| 79 | + |
| 80 | + /** |
| 81 | + * Update access for a content item for specified users declaratively. |
| 82 | + * This overwrites the access list for the content item, |
| 83 | + * allowing only the specified users access to it. |
| 84 | + * |
| 85 | + * @param string $appId |
| 86 | + * @param string $providerId |
| 87 | + * @param string $itemId |
| 88 | + * @param array $userIds |
| 89 | + * @return void |
| 90 | + * @since 32.0.0 |
| 91 | + */ |
| 92 | + public function updateAccessDeclarative(string $appId, string $providerId, string $itemId, array $userIds): void; |
| 93 | + |
| 94 | + /** |
| 95 | + * Delete all content items and access lists for a provider. |
| 96 | + * This does not unregister the provider itself. |
| 97 | + * |
| 98 | + * @param string $appId |
| 99 | + * @param string $providerId |
| 100 | + * @return void |
| 101 | + * @since 32.0.0 |
| 102 | + */ |
| 103 | + public function deleteProvider(string $appId, string $providerId): void; |
| 104 | + |
| 105 | + /** |
| 106 | + * Remove a content item from the knowledge base of context chat. |
| 107 | + * |
| 108 | + * @param string $appId |
| 109 | + * @param string $providerId |
| 110 | + * @param string[] $itemIds |
| 111 | + * @return void |
| 112 | + * @since 32.0.0 |
| 113 | + */ |
| 114 | + public function deleteContent(string $appId, string $providerId, array $itemIds): void; |
| 115 | +} |
0 commit comments