Code/API/ILichessBoardEventStream.cs

Interface for an unstarted Lichess board event stream. It defines events for receiving lines, errors, and completion, exposes a Completion Task, and a Start method. It also implements IAsyncDisposable for async cleanup.

Networking
#nullable enable annotations

namespace LichessNET.API;

/// <summary>
/// An unstarted Lichess board event stream.
/// </summary>
public interface ILichessBoardEventStream : IAsyncDisposable
{
    event Action<ILichessBoardEventStream, JsonElement>? LineReceived;
    event Action<ILichessBoardEventStream, Exception>? ErrorReceived;
    event Action<ILichessBoardEventStream>? Completed;

    Task Completion { get; }

    void Start();
}