diff --git a/lib/private/Talk/Broker.php b/lib/private/Talk/Broker.php index a686adeed04..12e6c5fb34b 100644 --- a/lib/private/Talk/Broker.php +++ b/lib/private/Talk/Broker.php @@ -106,4 +106,12 @@ class Broker implements IBroker { $options ?? ConversationOptions::default() ); } + + public function deleteConversation(string $id): void { + if (!$this->hasBackend()) { + throw new NoBackendException("The Talk broker has no registered backend"); + } + + $this->backend->deleteConversation($id); + } } diff --git a/lib/public/Talk/IBroker.php b/lib/public/Talk/IBroker.php index d28771544c8..705c39d2c01 100644 --- a/lib/public/Talk/IBroker.php +++ b/lib/public/Talk/IBroker.php @@ -71,4 +71,15 @@ interface IBroker { public function createConversation(string $name, array $moderators, IConversationOptions $options = null): IConversation; + + /** + * Delete a conversation by id + * + * @param string $id conversation id + * + * @return void + * @throws NoBackendException when Talk is not available + * @since 26.0.0 + */ + public function deleteConversation(string $id): void; } diff --git a/lib/public/Talk/IConversation.php b/lib/public/Talk/IConversation.php index 43698b9069f..efa33c0b357 100644 --- a/lib/public/Talk/IConversation.php +++ b/lib/public/Talk/IConversation.php @@ -30,6 +30,14 @@ namespace OCP\Talk; */ interface IConversation { + /** + * Get the unique token that identifies this conversation + * + * @return string + * @since 26.0.0 + */ + public function getId(): string; + /** * Get the absolute URL to this conversation * diff --git a/lib/public/Talk/ITalkBackend.php b/lib/public/Talk/ITalkBackend.php index 700d5d8c4d3..605a15680d0 100644 --- a/lib/public/Talk/ITalkBackend.php +++ b/lib/public/Talk/ITalkBackend.php @@ -49,4 +49,14 @@ interface ITalkBackend { public function createConversation(string $name, array $moderators, IConversationOptions $options): IConversation; + + /** + * Delete a conversation by id + * + * @param string $id conversation id + * + * @return void + * @since 26.0.0 + */ + public function deleteConversation(string $id): void; }