using System.Net;

namespace Pilz.Net.Api;

public record class ApiResponse(
    HttpStatusCode StatusCode)
{
    public bool IsOk => StatusCode == HttpStatusCode.OK;

    public void EnsureOk()
    {
        if (!IsOk)
            throw new ApiException("Api return is not ok: " + StatusCode, StatusCode);
    }
}
