mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
27 lines
722 B
C#
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);
|
||
|
|
}
|