public List <WeatherBitForecast> getForecast(string city, string countryCode) { List <WeatherBitForecast> forecastList = new List <WeatherBitForecast>(); string response = getResponse(weatherBitAPIEndpoint.getForecastEndpoint(city, countryCode)); using (JsonParser <WeatherBitAPIForecastModel> jsonParser = new JsonParser <WeatherBitAPIForecastModel>()) { WeatherBitAPIForecastModel weatherBitAPIForecastModel = new WeatherBitAPIForecastModel(); weatherBitAPIForecastModel = jsonParser.parse(response); foreach (Unnamedobject unnamedObject in weatherBitAPIForecastModel.data) { forecastList.Add(new WeatherBitForecast(unnamedObject.datetime, unnamedObject.temp)); } } return(forecastList); }
public List <WeatherBitForcast> getForcast(string city) { List <WeatherBitForcast> forcastList = new List <WeatherBitForcast>(); weatherBitEndAPIPoint.endpointType = EndpointType.FORECAST; string response = getResponse(weatherBitEndAPIPoint.getCityEndpoint(city)); using (JsonParser <WeatherBitAPIForecastModel> JsonParser = new JsonParser <WeatherBitAPIForecastModel>()) { WeatherBitAPIForecastModel weatherBitAPIForecastModel = new WeatherBitAPIForecastModel(); weatherBitAPIForecastModel = JsonParser.parse(response, netCoreVersion); foreach (Data data in weatherBitAPIForecastModel.data) { forcastList.Add(new WeatherBitForcast(data.timestamp_local, data.temp)); } } return(forcastList); }