add more helper methods
This commit is contained in:
@@ -5,9 +5,11 @@ namespace Pilz.Net.Api;
|
||||
public record class ApiResponse(
|
||||
HttpStatusCode StatusCode)
|
||||
{
|
||||
public bool IsOk => StatusCode != HttpStatusCode.OK;
|
||||
|
||||
public void EnsureOk()
|
||||
{
|
||||
if (StatusCode != HttpStatusCode.OK)
|
||||
if (!IsOk)
|
||||
throw new Exception("Api return is not ok!");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user