Ejemplo n.º 1
0
        public async Task <WeatherForecast> GetForecast(double latitude, double longitude, int days)
        {
            UriBuilder builder = new UriBuilder(_baseEndpoint)
            {
                Path  = "v2.0/forecast/daily",
                Query = $"lat={latitude.ToString(CultureInfo.InvariantCulture)}&lon={longitude.ToString(CultureInfo.InvariantCulture)}&units={_unit}&days={days}&lang={_lang}&key={_serviceKey}"
            };

            WeatherbitForecastDTO weatherResponse = await _requestService.GetAsync <WeatherbitForecastDTO>(builder.Uri);

            WeatherbitMapper weatherbitMapper = new WeatherbitMapper();
            WeatherForecast  weatherForecast  = weatherbitMapper.ToDomainEntities(weatherResponse);

            return(weatherForecast);
        }