public async Task <CommonWeatherDto> FetchAsync(LocationKey locationId)
        {
            var query    = $"apikey={_options.API_KEY}&details=true";
            var response = await PerformQueryService.PerformQueryAsync(_client, _options.WeatherRouter + $"/{locationId.Key}", query);

            return(new CommonWeatherDto((await response.Content.ReadAsAsync <AccuWeatherDto[]>())[0]));
        }
 public async Task <LocationKey> GetLocation(string address)
 {
     return((await(await PerformQueryService.PerformQueryAsync(_client, _options.LocationsRouter + "/search", FormQuery(address))).Content.ReadAsAsync <LocationKey[]>())[0]);
 }
 public async Task <LocationKey> GetLocation(double lat, double lng)
 {
     return(await(await PerformQueryService.PerformQueryAsync(_client, _options.LocationsRouter + "/geoposition/search", FormQuery(lat, lng))).Content.ReadAsAsync <LocationKey>());
 }
示例#4
0
        public async Task <CommonWeatherDto> FetchAsync(string query)
        {
            var response = await PerformQueryService.PerformQueryAsync(_client, _options.WeatherRouter, query);

            return(new CommonWeatherDto(await response.Content.ReadAsAsync <OpenWeatherMapDto>()));
        }