From 94ef340cafcd98c79855e1f1c451be6f6c7da05b Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 2 Jan 2024 15:58:26 +0000 Subject: [PATCH] feat: add release and delete methods --- src/Conversation.ts | 4 ++++ src/Conversations.ts | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Conversation.ts b/src/Conversation.ts index 5e54dff9..10a51c57 100644 --- a/src/Conversation.ts +++ b/src/Conversation.ts @@ -20,4 +20,8 @@ export class Conversation { async create() { await this.chatApi.createConversation(this.conversationId); } + + async delete() { + await this.chatApi.deleteConversation(this.conversationId); + } } diff --git a/src/Conversations.ts b/src/Conversations.ts index 958f4346..ca73b410 100644 --- a/src/Conversations.ts +++ b/src/Conversations.ts @@ -21,4 +21,13 @@ export class Conversations { return conversation; } + + async release(conversationId: string) { + const conversation = this.conversations[conversationId]; + if (!conversation) { + return; + } + delete this.conversations[conversationId]; + await conversation.delete(); + } }