using BotPages.Core.Abstractions;
namespace BotPages.Core;
///
/// Расширения для работы с
///
public static class PageContextStorageExtensions
{
/// Получить состояние по ключу.
public static Task GetStorageAsync(this PageContext ctx, string key, CancellationToken ct)
=> ctx.StateStorage.GetAsync(ctx.SessionKey, key, ct);
/// Сохранить состояние по ключу.
public static Task SetStorageAsync(this PageContext ctx, string key, T state, CancellationToken ct)
=> ctx.StateStorage.SetAsync(ctx.SessionKey, key, state, ct);
/// Удалить состояние по ключу.
public static Task RemoveStorageAsync(this PageContext ctx, string key, CancellationToken ct)
=> ctx.StateStorage.RemoveAsync(ctx.SessionKey, key, ct);
/// Удалить все состояния по ключу.
public static Task ClearStorageAsync(this PageContext ctx, CancellationToken ct)
=> ctx.StateStorage.ClearAsync(ctx.SessionKey, ct);
}