public CreatedSinceResult <HosEvent> GetHosEventDataSince(ParameterEntityType entityTypeId, List <long> entityIds, List <byte> eventTypeIds, string sinceToken) { var dataRequest = new HosEventDataRequest { EntityTypeId = entityTypeId, EntityIds = entityIds, EventTypeIds = eventTypeIds }; IHttpRestRequest request = GetRequest(APIControllerRoutes.HosDataController.GETHOSEVENTDATASINCE, HttpMethod.Post); request.AddUrlSegment("sinceToken", sinceToken); request.AddJsonBody(dataRequest); IHttpRestResponse <List <HosEvent> > response = Execute <List <HosEvent> >(request); var sHasMoreItems = GetResponseHeader(response.Headers, "HasMoreItems"); var getSinceToken = GetResponseHeader(response.Headers, "GetSinceToken"); if (!bool.TryParse(sHasMoreItems, out var hasMoreItems)) { throw new Exception("Could not read the HasMoreItems header"); } return(new CreatedSinceResult <HosEvent> { HasMoreItems = hasMoreItems, GetSinceToken = getSinceToken, Items = response.Data }); }
public async Task <CreatedSinceResult <HosEvent> > GetHosEventDataAsync(ParameterEntityType entityTypeId, List <long> entityIds, List <byte> eventTypeIds, DateTime fromDateTime, DateTime toDateTime) { var dataRequest = new HosEventDataRequest { EntityTypeId = entityTypeId, EntityIds = entityIds, EventTypeIds = eventTypeIds }; IHttpRestRequest request = GetRequest(APIControllerRoutes.HosDataController.GETHOSEVENTDATA, HttpMethod.Post); request.AddUrlSegment("from", fromDateTime.ToString(DataFormats.DateTime_Format)); request.AddUrlSegment("to", toDateTime.ToString(DataFormats.DateTime_Format)); request.AddJsonBody(dataRequest); IHttpRestResponse <List <HosEvent> > response = await ExecuteAsync <List <HosEvent> >(request).ConfigureAwait(false); var sHasMoreItems = GetResponseHeader(response.Headers, "HasMoreItems"); var getSinceToken = GetResponseHeader(response.Headers, "GetSinceToken"); if (!bool.TryParse(sHasMoreItems, out var hasMoreItems)) { throw new Exception("Could not read the HasMoreItems header"); } return(new CreatedSinceResult <HosEvent> { HasMoreItems = hasMoreItems, GetSinceToken = getSinceToken, Items = response.Data }); }
public async Task <List <HosEventStartDateTimeByHourChangedSince> > GetHosEventStartDateTimeByHourChangedSinceAsync(ParameterEntityType entityTypeId, List <long> entityIds, List <byte> eventTypeIds, string sinceToken) { var dataRequest = new HosEventDataRequest { EntityTypeId = entityTypeId, EntityIds = entityIds, EventTypeIds = eventTypeIds }; IHttpRestRequest request = GetRequest(APIControllerRoutes.HosDataController.GETHOSEVENTSTARTDATETIMEBYHOUR, HttpMethod.Post); request.AddUrlSegment("sinceToken", sinceToken); request.AddJsonBody(dataRequest); IHttpRestResponse <List <HosEventStartDateTimeByHourChangedSince> > response = await ExecuteAsync <List <HosEventStartDateTimeByHourChangedSince> >(request).ConfigureAwait(false); return(response.Data); }
public async Task <List <HosEventDriverSummary> > GetHosEventDataSummaryAsync(ParameterEntityType entityTypeId, List <long> entityIds, List <byte> eventTypeIds, DateTime fromDateTime, DateTime toDateTime) { var dataRequest = new HosEventDataRequest { EntityTypeId = entityTypeId, EntityIds = entityIds, EventTypeIds = eventTypeIds }; IHttpRestRequest request = GetRequest(APIControllerRoutes.HosDataController.GETHOSEVENTDATASUMMARY, HttpMethod.Post); request.AddUrlSegment("from", fromDateTime.ToString(DataFormats.DateTime_Format)); request.AddUrlSegment("to", toDateTime.ToString(DataFormats.DateTime_Format)); request.AddJsonBody(dataRequest); IHttpRestResponse <List <HosEventDriverSummary> > response = await ExecuteAsync <List <HosEventDriverSummary> >(request).ConfigureAwait(false); return(response.Data); }