← All source files

V18 / 8d896b8a86e5

ProviderClient.Home.cs

Lilith/Core/HomeAutomation/ProviderClient.Home.cs

Unchanged from the preceding version
CS
using Lilith.Core.HomeAutomation;

namespace Lilith.Core.Providers;

public abstract partial class ProviderClient
{
    public HomeSession? Home { get; private set; }
    public void ConfigureHome(HomeOptions options)
    {
        using var operation=EnterOperation();
        if(Home is not null) throw new InvalidOperationException("Home configuration is fixed for this session.");
        Home=new(options);
    }
    public async Task<string> DecideHomeAsync(string id,bool approve,CancellationToken ct=default)
    {
        using var operation=EnterOperation();
        return (await (Home??throw new InvalidOperationException("Home automation is not configured.")).DecideAsync(id,approve,ct)).ToReply();
    }
}