private async Task <OpenWeatherOneCallModel> doOneCall() { if (ApiHelper.ApiClient != null) { if (ApiKey == null || ApiKey == String.Empty) { String message = "ApiKey null ou vide"; Debug.WriteLine(message); throw new ArgumentException(message); } else { using (HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync(longUrl)) { if (response.IsSuccessStatusCode) { OpenWeatherOneCallModel result = await response.Content.ReadAsAsync <OpenWeatherOneCallModel>(); return(result); } return(null); } } } else { String message = "API Helper Non initialized"; Debug.WriteLine(message); throw new ArgumentException(message); } }
private async Task <OpenWeatherOneCallModel> doOneCall() { if (ApiHelper.ApiClient == null) { throw new ArgumentException("API Helper Client not initialized"); } else { if (ApiKey == null || ApiKey == String.Empty) { throw new ArgumentException("OWApiKey null or empty"); } else { using (HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync(longUrl)) { if (response.IsSuccessStatusCode) { OpenWeatherOneCallModel result = await response.Content.ReadAsAsync <OpenWeatherOneCallModel>(); return(result); } return(null); } } } }
private async Task <OpenWeatherOneCallModel> doOneCall() { using (HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync(longUrl)) { if (response.IsSuccessStatusCode) { OpenWeatherOneCallModel result = await response.Content.ReadAsAsync <OpenWeatherOneCallModel>(); return(result); } return(null); } }
private async Task <OpenWeatherOneCallModel> doOneCall() { using (HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync(longUrl)) { if (response == null) { throw new ArgumentException("Le client http n'a pas été initialisé"); } if (response.IsSuccessStatusCode) { OpenWeatherOneCallModel result = await response.Content.ReadAsAsync <OpenWeatherOneCallModel>(); return(result); } return(null); } }