public float getCurrentWeather(string cityName) { float temperature = 0f; restClient.endpoint = weatherBitEndpoint.getCurrentWeatherByCityNameEndpoint(cityName); string response = restClient.makeRequest(); JSONParser <WeatherBitWeatherModel> jsonParser = new JSONParser <WeatherBitWeatherModel>(); WeatherBitWeatherModel deserialisedWeatherBitWeatherModel = jsonParser.ParseJSON(response, Parser.Version.NETCore3); temperature = deserialisedWeatherBitWeatherModel.data[0].temp; return(temperature); }
public float getCurrentTemperature(string city, EndpointType endpointType) { float temperature = 0f; restClient.endpoint = weatherBitEndpoint.getByCityNameEndpoint(city, endpointType); string response = restClient.makeRequest(); //Console.WriteLine(response); JSONParser <WeatherBitWeatherModel> jsonParser = new JSONParser <WeatherBitWeatherModel>(); WeatherBitWeatherModel deserialisedOpenWeatherMapModel = new WeatherBitWeatherModel(); deserialisedOpenWeatherMapModel = jsonParser.parseJSON(response, Parser.Version.NETCore2); temperature = deserialisedOpenWeatherMapModel.data[0].temp; return(temperature); }