-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added an endpoint that provides the latest occupancy estimation
- Loading branch information
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
CentralHub.Api.Model/Responses/Measurements/GetLatestOccupancyResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace CentralHub.Api.Model.Responses.AggregatedMeasurements; | ||
|
||
public sealed class GetLatestOccupancyResponse | ||
{ | ||
[JsonConstructor] | ||
public GetLatestOccupancyResponse(int? occupancy, bool success) | ||
{ | ||
EstimatedOccupancy = occupancy; | ||
Success = success; | ||
} | ||
|
||
public bool Success { get; } | ||
|
||
public int? EstimatedOccupancy { get; } | ||
|
||
public static GetLatestOccupancyResponse CreateUnsuccessful() | ||
{ | ||
return new GetLatestOccupancyResponse(null, false); | ||
} | ||
|
||
public static GetLatestOccupancyResponse CreateSuccessful(int occupancy) | ||
{ | ||
return new GetLatestOccupancyResponse(occupancy, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters