Files
telegram-bot/Core/Option/IOptionStorageAdapter.cs
2023-01-05 08:01:18 +03:00

27 lines
722 B
C#

#nullable enable
using System.Threading.Tasks;
namespace Kruzya.TelegramBot.Core.Option;
/// <summary>
/// Implements an interaction with storage for options.
/// </summary>
public interface IOptionStorageAdapter
{
/// <summary>
/// Loads a saved value (if exists) from storage.
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public Task<byte[]?> LoadValueAsync(IOptionKey key);
/// <summary>
/// Saves a passed value to storage.
/// </summary>
/// <param name="key">The unique chat key</param>
/// <param name="value">The serialized value for saving</param>
/// <returns></returns>
public Task SaveValueAsync(IOptionKey key, byte[] value);
}