private static BatchResult[] ParsePutTimeSeriesInstancesResponse(TextReader textReader) { PutTimeSeriesInstancesResponse putTimeSeriesInstancesResponse = JsonUtils.ParseJson <PutTimeSeriesInstancesResponse>(textReader); return((putTimeSeriesInstancesResponse ?.put ?.Select(timeSeriesInstanceInfo => new BatchResult(timeSeriesInstanceInfo?.instance?.timeSeriesId, timeSeriesInstanceInfo?.error?.ToString())) .ToArray()) ?? new BatchResult[0]); }
private async Task <Address> TryGetSearchAddressReverseFromCacheAsync(string key) { TableOperation retrieveOperation = TableOperation.Retrieve <CacheEntry>(SearchAddressReversePartitionKey, key); TableResult retrievedResult = await _cacheCloudTable.ExecuteAsync(retrieveOperation); if (retrievedResult.Result != null) { using (var stringReader = new StringReader(((CacheEntry)retrievedResult.Result).Value)) { return(JsonUtils.ParseJson <Address>(stringReader)); } } else { return(null); } }
private static StationObservation[] ParseGetStationObservationsResponse(TextReader textReader) { GetStationObservationsResponse getStationObservationsResponse = JsonUtils.ParseJson <GetStationObservationsResponse>(textReader); if (getStationObservationsResponse != null && getStationObservationsResponse.features != null) { return(getStationObservationsResponse.features .Where(f => f.type == "Feature" && f.properties?.type == "wx:ObservationStation") .Select(f => new StationObservation( stationId: f.properties.station, timestamp: f.properties.timestamp, rawMessage: f.properties.rawMessage, textDescription: f.properties.textDescription, temperature: f.properties.temperature, dewpoint: f.properties.dewpoint, windDirection: f.properties.windDirection, windSpeed: f.properties.windSpeed, windGust: f.properties.windGust, barometricPressure: f.properties.barometricPressure, seaLevelPressure: f.properties.seaLevelPressure, visibility: f.properties.visibility, maxTemperatureLast24Hours: f.properties.maxTemperatureLast24Hours, minTemperatureLast24Hours: f.properties.minTemperatureLast24Hours, precipitationLastHour: f.properties.precipitationLastHour, precipitationLast3Hours: f.properties.precipitationLast3Hours, precipitationLast6Hours: f.properties.precipitationLast6Hours, relativeHumidity: f.properties.relativeHumidity, windChill: f.properties.windChill, heatIndex: f.properties.heatIndex, cloudLayer0: f.properties.cloudLayers.FirstOrDefault())) .ToArray()); } else { return(new StationObservation[0]); } }
private static Station[] ParseGetStationsResponse(TextReader textReader) { GetStationsResponse getStationsResponse = JsonUtils.ParseJson <GetStationsResponse>(textReader); if (getStationsResponse != null && getStationsResponse.features != null) { return(getStationsResponse.features .Where(f => f.type == "Feature" && f.properties?.type == "wx:ObservationStation" && f.geometry?.type == "Point") .Select(f => new Station( id: f.id, shortId: f.properties.stationIdentifier, name: f.properties.name, timeZone: f.properties.timeZone, latitude: f.geometry?.coordinates[1], longitude: f.geometry?.coordinates[0])) .ToArray()); } else { return(new Station[0]); } }
private Address ParseGetSearchAddressReverseResponse(TextReader textReader) { GetSearchAddressReverseResponse getSearchAddressReverseResponse = JsonUtils.ParseJson <GetSearchAddressReverseResponse>(textReader); return(getSearchAddressReverseResponse?.addresses?.FirstOrDefault()?.address); }
private static TimeSeriesInstance[] ParseGetTimeSeriesInstancesResponse(TextReader textReader) { GetTimeSeriesInstancesResponse getTimeSeriesInstancesResponse = JsonUtils.ParseJson <GetTimeSeriesInstancesResponse>(textReader); return((getTimeSeriesInstancesResponse?.instances) ?? new TimeSeriesInstance[0]); }
private static TimeSeriesHierarchy[] ParseGetTimeSeriesHierarchiesResponse(TextReader textReader) { GetTimeSeriesHierarchiesResponse getTimeSeriesHierarchiesResponse = JsonUtils.ParseJson <GetTimeSeriesHierarchiesResponse>(textReader); return((getTimeSeriesHierarchiesResponse?.hierarchies) ?? new TimeSeriesHierarchy[0]); }
private static EnvironmentInfo[] ParseGetEnvironmentsResponse(TextReader textReader) { GetEnvironmentsResponse getEnvironmentsResponse = JsonUtils.ParseJson <GetEnvironmentsResponse>(textReader); return((getEnvironmentsResponse?.environments) ?? new EnvironmentInfo[0]); }