more work on api
This commit is contained in:
15
Pilz.Networking/Api/ApiResponseT.cs
Normal file
15
Pilz.Networking/Api/ApiResponseT.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Net;
|
||||
|
||||
namespace Pilz.Networking.Api;
|
||||
|
||||
public record class ApiResponse<T>(
|
||||
HttpStatusCode StatusCode,
|
||||
T? Message)
|
||||
where T : ApiMessage
|
||||
{
|
||||
public void EnsureOk()
|
||||
{
|
||||
if (StatusCode != HttpStatusCode.OK)
|
||||
throw new Exception("Api return is not ok!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user