2024-04-02 16:38:18 +00:00
|
|
|
using BotSharp.Abstraction.Conversations.Enums;
|
2023-11-01 01:48:12 +00:00
|
|
|
using System.Text.Json;
|
|
|
|
|
|
2023-08-09 21:49:55 +00:00
|
|
|
namespace BotSharp.Abstraction.Conversations;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Conversation state service to track the context in the conversation lifecycle
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IConversationStateService
|
|
|
|
|
{
|
2023-10-27 19:05:18 +00:00
|
|
|
string GetConversationId();
|
2024-04-10 17:45:35 +00:00
|
|
|
Dictionary<string, string> Load(string conversationId, bool isReadOnly = false);
|
2023-09-14 01:41:51 +00:00
|
|
|
string GetState(string name, string defaultValue = "");
|
2023-09-25 22:46:00 +00:00
|
|
|
bool ContainsState(string name);
|
2024-01-02 17:40:08 +00:00
|
|
|
Dictionary<string, string> GetStates();
|
2024-04-02 16:38:18 +00:00
|
|
|
IConversationStateService SetState<T>(string name, T value, bool isNeedVersion = true,
|
2024-04-02 20:39:14 +00:00
|
|
|
int activeRounds = -1, string valueType = StateDataType.String, string source = StateSource.User, bool readOnly = false);
|
2023-11-01 01:48:12 +00:00
|
|
|
void SaveStateByArgs(JsonDocument args);
|
2024-04-03 17:12:31 +00:00
|
|
|
bool RemoveState(string name);
|
2024-05-13 16:51:33 +00:00
|
|
|
void CleanStates(params string[] excludedStates);
|
2023-08-09 21:49:55 +00:00
|
|
|
void Save();
|
|
|
|
|
}
|