Example #1
0
        /// <summary>
        ///     Gets by name.
        /// </summary>
        /// <typeparam name="T">Generic type parameter.</typeparam>
        /// <param name="cityName">Name of the city.</param>
        /// <param name="metric">  The metric.</param>
        /// <param name="language">The language.</param>
        /// <param name="count">   The count.</param>
        /// <param name="accuracy">The accuracy.</param>
        /// <returns>
        ///     The by name.
        /// </returns>
        internal Task <T> GetByName <T>(string cityName, MetricSystem metric, OpenWeatherMapLanguage language, int?count, Accuracy?accuracy)
        {
            Ensure.ArgumentNotNullOrEmptyString(cityName, "cityName");
            Ensure.ArgumentNotNull(metric, "metric");
            Ensure.ArgumentNotNull(language, "language");

            this.Request.Parameters.Add("q", cityName.UrlEncode());
            if (metric != MetricSystem.Internal)
            {
                this.Request.Parameters.Add("units", metric.ToString().ToLowerInvariant());
            }

            if (language != OpenWeatherMapLanguage.EN)
            {
                this.Request.Parameters.Add("lang", language.ToString().ToLowerInvariant());
            }

            if (count.HasValue)
            {
                this.Request.Parameters.Add("cnt", count.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (accuracy.HasValue)
            {
                this.Request.Parameters.Add("type", accuracy.Value.ToString().ToLowerInvariant());
            }

            return(this.RunGetRequest <T>());
        }
        /// <summary>
        ///     Gets Forecast by coordinates.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <param name="daily">      if set to <c>true</c> [daily].</param>
        /// <param name="metric">     The metric.</param>
        /// <param name="language">   The language.</param>
        /// <param name="count">      The count.</param>
        /// <returns>
        ///     Task {ForecastResponse}.
        /// </returns>
        /// <seealso cref="M:OpenWeatherMap.IForecastClient.GetByCoordinates(Coordinates,bool,MetricSystem,OpenWeatherMapLanguage,int?)"/>
        public Task<ForecastResponse> GetByCoordinates(Coordinates coordinates, bool daily = false, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN, int? count = null)
        {
            if (daily)
            {
                this.Request.Uri = this.Request.Uri.AddSegment("daily");
            }

            return this.GetByCoordinates<ForecastResponse>(coordinates, metric, language, count, null);
        }
Example #3
0
        /// <summary>
        /// Gets by city identifier.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="cityId">The city identifier.</param>
        /// <param name="metric">The metric.</param>
        /// <param name="language">The language.</param>
        /// <param name="count">The count.</param>
        /// <returns>Task{``0}.</returns>
        internal Task <T> GetByCityId <T>(int cityId, MetricSystem metric, OpenWeatherMapLanguage language, int?count)
        {
            Ensure.ArgumentNotNull(metric, "metric");
            Ensure.ArgumentNotNull(language, "language");

            Request.Parameters.Add("id", cityId.ToString(CultureInfo.InvariantCulture));

            if (metric != MetricSystem.Internal)
            {
                Request.Parameters.Add("units", metric.ToString().ToLowerInvariant());
            }

            if (language != OpenWeatherMapLanguage.EN)
            {
                Request.Parameters.Add("lang", language.ToString().ToLowerInvariant());
            }

            if (count.HasValue)
            {
                Request.Parameters.Add("cnt", count.Value.ToString(CultureInfo.InvariantCulture));
            }
            return(RunGetRequest <T>());
        }
 /// <summary>
 ///     Gets Current weather by city name.
 /// </summary>
 /// <param name="cityName">The city Name.</param>
 /// <param name="metric">  The metric.</param>
 /// <param name="language">The language.</param>
 /// <returns>
 ///     The <see cref="Task"/>.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ICurrentWeatherClient.GetByName(string,MetricSystem,OpenWeatherMapLanguage)"/>
 public Task<CurrentWeatherResponse> GetByName(string cityName, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
 {
     return this.GetByName<CurrentWeatherResponse>(cityName, metric, language, null, null);
 }
 /// <summary>
 ///     Gets Current weather by coordinates.
 /// </summary>
 /// <param name="coordinates">The coordinates.</param>
 /// <param name="metric">     The metric system.</param>
 /// <param name="language">   The language.</param>
 /// <returns>
 ///     Task {CurrentWeatherResponse}.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ICurrentWeatherClient.GetByCoordinates(Coordinates,MetricSystem,OpenWeatherMapLanguage)"/>
 public Task<CurrentWeatherResponse> GetByCoordinates(Coordinates coordinates, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
 {
     return this.GetByCoordinates<CurrentWeatherResponse>(coordinates, metric, language, null, null);
 }
 /// <summary>
 ///     Gets Current weather by city identifier.
 /// </summary>
 /// <param name="cityId">  The city identifier.</param>
 /// <param name="metric">  The metric.</param>
 /// <param name="language">The language.</param>
 /// <returns>
 ///     The by city identifier.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ICurrentWeatherClient.GetByCityId(int,MetricSystem,OpenWeatherMapLanguage)"/>
 public Task<CurrentWeatherResponse> GetByCityId(int cityId, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
 {
     return this.GetByCityId<CurrentWeatherResponse>(cityId, metric, language, null);
 }
Example #7
0
 /// <summary>
 /// Gets Forecast by city identifier.
 /// </summary>
 /// <param name="cityId">The city identifier.</param>
 /// <param name="daily">if set to <c>true</c> [daily].</param>
 /// <param name="metric">The metric.</param>
 /// <param name="language">The language.</param>
 /// <param name="count">The count.</param>
 /// <returns>Task{ForecastResponse}.</returns>
 public Task <ForecastResponse> GetByCityId(int cityId, bool daily = false, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN, int?count = null)
 {
     if (daily)
     {
         Request.Uri = Request.Uri.AddSegment("daily");
     }
     return(base.GetByCityId <ForecastResponse>(cityId, metric, language, count));
 }
Example #8
0
 /// <summary>
 /// Search by coordinates.
 /// </summary>
 /// <param name="coordinates">The coordinates.</param>
 /// <param name="metric">The metric.</param>
 /// <param name="language">The language.</param>
 /// <param name="count">The count.</param>
 /// <param name="accuracy">The accuracy.</param>
 /// <returns>Task{SearchResponse}.</returns>
 public Task <SearchResponse> GetByCoordinates(Coordinates coordinates, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN, int?count = null, Accuracy?accuracy = null)
 {
     return(base.GetByCoordinates <SearchResponse>(coordinates, metric, language, count, accuracy));
 }
Example #9
0
        /// <summary>
        ///     Gets by coordinates.
        /// </summary>
        /// <typeparam name="T">Generic type parameter.</typeparam>
        /// <param name="coordinates">The coordinates.</param>
        /// <param name="metric">     The metric.</param>
        /// <param name="language">   The language.</param>
        /// <param name="count">      The count.</param>
        /// <param name="accuracy">   The accuracy.</param>
        /// <returns>
        ///     The by coordinates.
        /// </returns>
        internal Task <T> GetByCoordinates <T>(Coordinates coordinates, MetricSystem metric, OpenWeatherMapLanguage language, int?count, Accuracy?accuracy)
        {
            Ensure.ArgumentNotNull(metric, "metric");
            Ensure.ArgumentNotNull(language, "language");
            Ensure.ArgumentNotNull(coordinates, "coordinates");
            Ensure.ArgumentNotNull(coordinates.Latitude, "coordinates.Latitude");
            Ensure.ArgumentNotNull(coordinates.Longitude, "coordinates.Longitude");

            this.Request.Parameters.Add("lat", coordinates.Latitude.ToString(CultureInfo.InvariantCulture));
            this.Request.Parameters.Add("lon", coordinates.Longitude.ToString(CultureInfo.InvariantCulture));

            if (metric != MetricSystem.Internal)
            {
                this.Request.Parameters.Add("units", metric.ToString().ToLowerInvariant());
            }

            if (language != OpenWeatherMapLanguage.EN)
            {
                this.Request.Parameters.Add("lang", language.ToString().ToLowerInvariant());
            }

            if (count.HasValue)
            {
                this.Request.Parameters.Add("cnt", count.Value.ToString(CultureInfo.InvariantCulture));
            }

            if (accuracy.HasValue)
            {
                this.Request.Parameters.Add("type", accuracy.Value.ToString().ToLowerInvariant());
            }

            return(this.RunGetRequest <T>());
        }
Example #10
0
 /// <summary>
 ///     Gets Current weather by coordinates.
 /// </summary>
 /// <param name="coordinates">The coordinates.</param>
 /// <param name="metric">     The metric system.</param>
 /// <param name="language">   The language.</param>
 /// <returns>
 ///     Task {CurrentWeatherResponse}.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ICurrentWeatherClient.GetByCoordinates(Coordinates,MetricSystem,OpenWeatherMapLanguage)"/>
 public Task <CurrentWeatherResponse> GetByCoordinates(Coordinates coordinates, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
 {
     return(this.GetByCoordinates <CurrentWeatherResponse>(coordinates, metric, language, null, null));
 }
Example #11
0
 /// <summary>
 ///     Gets Current weather by city name.
 /// </summary>
 /// <param name="cityName">The city Name.</param>
 /// <param name="metric">  The metric.</param>
 /// <param name="language">The language.</param>
 /// <returns>
 ///     The <see cref="Task"/>.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ICurrentWeatherClient.GetByName(string,MetricSystem,OpenWeatherMapLanguage)"/>
 public Task <CurrentWeatherResponse> GetByName(string cityName, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
 {
     return(this.GetByName <CurrentWeatherResponse>(cityName, metric, language, null, null));
 }
Example #12
0
        /// <summary>
        ///     Gets Forecast by coordinates.
        /// </summary>
        /// <param name="coordinates">The coordinates.</param>
        /// <param name="daily">      if set to <c>true</c> [daily].</param>
        /// <param name="metric">     The metric.</param>
        /// <param name="language">   The language.</param>
        /// <param name="count">      The count.</param>
        /// <returns>
        ///     Task {ForecastResponse}.
        /// </returns>
        /// <seealso cref="M:OpenWeatherMap.IForecastClient.GetByCoordinates(Coordinates,bool,MetricSystem,OpenWeatherMapLanguage,int?)"/>
        public Task <ForecastResponse> GetByCoordinates(Coordinates coordinates, bool daily = false, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN, int?count = null)
        {
            if (daily)
            {
                this.Request.Uri = this.Request.Uri.AddSegment("daily");
            }

            return(this.GetByCoordinates <ForecastResponse>(coordinates, metric, language, count, null));
        }
Example #13
0
        /// <summary>
        ///     Gets by zip code.
        /// </summary>
        /// <typeparam name="T">Generic type parameter.</typeparam>
        /// <param name="zip">Zip Code for loacation.</param>
        /// <param name="metric">  The metric.</param>
        /// <param name="language">The language.</param>
        /// <param name="count">   The count.</param>
        /// <param name="accuracy">The accuracy.</param>
        /// <returns>
        ///     By zip code.
        /// </returns>
        public Task <ForecastResponse> GetByZipCode(string zip, bool daily = false, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
        {
            if (daily)
            {
                this.Request.Uri = this.Request.Uri.AddSegment("daily");
            }

            return(this.GetByZipCode <ForecastResponse>(zip, metric, language, null, null));
        }
 /// <summary>
 ///     Search by city name.
 /// </summary>
 /// <param name="cityName">Name of the city.</param>
 /// <param name="metric">  The metric.</param>
 /// <param name="language">The language.</param>
 /// <param name="count">   The count.</param>
 /// <param name="accuracy">The accuracy.</param>
 /// <returns>
 ///     Task {SearchResponse}.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ISearchClient.GetByName(string,MetricSystem,OpenWeatherMapLanguage,int?,Accuracy?)"/>
 public Task<SearchResponse> GetByName(string cityName, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN, int? count = null, Accuracy? accuracy = null)
 {
     return this.GetByName<SearchResponse>(cityName, metric, language, count, accuracy);
 }
 /// <summary>
 ///     Search by coordinates.
 /// </summary>
 /// <param name="coordinates">The coordinates.</param>
 /// <param name="metric">     The metric.</param>
 /// <param name="language">   The language.</param>
 /// <param name="count">      The count.</param>
 /// <param name="accuracy">   The accuracy.</param>
 /// <returns>
 ///     Task {SearchResponse}.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ISearchClient.GetByCoordinates(Coordinates,MetricSystem,OpenWeatherMapLanguage,int?,Accuracy?)"/>
 public Task<SearchResponse> GetByCoordinates(Coordinates coordinates, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN, int? count = null, Accuracy? accuracy = null)
 {
     return this.GetByCoordinates<SearchResponse>(coordinates, metric, language, count, accuracy);
 }
Example #16
0
 /// <summary>
 ///     Gets Current weather by city identifier.
 /// </summary>
 /// <param name="cityId">  The city identifier.</param>
 /// <param name="metric">  The metric.</param>
 /// <param name="language">The language.</param>
 /// <returns>
 ///     The by city identifier.
 /// </returns>
 /// <seealso cref="M:OpenWeatherMap.ICurrentWeatherClient.GetByCityId(int,MetricSystem,OpenWeatherMapLanguage)"/>
 public Task <CurrentWeatherResponse> GetByCityId(int cityId, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
 {
     return(this.GetByCityId <CurrentWeatherResponse>(cityId, metric, language, null));
 }
Example #17
0
 /// <summary>
 ///     Gets by zip code.
 /// </summary>
 /// <typeparam name="T">Generic type parameter.</typeparam>
 /// <param name="zip">Zip Code for loacation.</param>
 /// <param name="metric">  The metric.</param>
 /// <param name="language">The language.</param>
 /// <param name="count">   The count.</param>
 /// <param name="accuracy">The accuracy.</param>
 /// <returns>
 ///     By zip code.
 /// </returns>
 public Task <CurrentWeatherResponse> GetByZipCode(string zip, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN)
 {
     return(this.GetByZipCode <CurrentWeatherResponse>(zip, metric, language, null, null));
 }
Example #18
0
        public OpenWeatherMapCatcher()
        {
            CultureInfo currentCulture = ServiceRegistration.Get <ILocalization>().CurrentCulture;

            _dateFormat   = currentCulture.DateTimeFormat;
            _metricSystem = new RegionInfo(currentCulture.Name).IsMetric ? MetricSystem.Metric : MetricSystem.Imperial;
            if (!Enum.TryParse(currentCulture.TwoLetterISOLanguageName, true, out _language))
            {
                _language = OpenWeatherMapLanguage.EN;
            }

            // Start with a random key
            _keyIndex = new Random(DateTime.Now.Millisecond).Next(KEYS.Length);
            _settings.SettingsChanged += (sender, args) => ApiToken = _settings.Settings.ApiKey;

            #region Weather code translation

            // See https://openweathermap.org/weather-conditions
            // See https://github.com/ronie/weather.openweathermap.extended/blob/master/resources/lib/utils.py#L118
            _weatherCodeTranslation[200] = 4;
            _weatherCodeTranslation[200] = 4;
            _weatherCodeTranslation[201] = 4;
            _weatherCodeTranslation[202] = 3;
            _weatherCodeTranslation[210] = 4;
            _weatherCodeTranslation[211] = 4;
            _weatherCodeTranslation[212] = 3;
            _weatherCodeTranslation[221] = 38;
            _weatherCodeTranslation[230] = 4;
            _weatherCodeTranslation[231] = 4;
            _weatherCodeTranslation[232] = 4;
            _weatherCodeTranslation[300] = 9;
            _weatherCodeTranslation[301] = 9;
            _weatherCodeTranslation[302] = 9;
            _weatherCodeTranslation[310] = 9;
            _weatherCodeTranslation[311] = 9;
            _weatherCodeTranslation[312] = 9;
            _weatherCodeTranslation[313] = 9;
            _weatherCodeTranslation[314] = 9;
            _weatherCodeTranslation[321] = 9;
            _weatherCodeTranslation[500] = 11;
            _weatherCodeTranslation[501] = 11;
            _weatherCodeTranslation[502] = 11;
            _weatherCodeTranslation[503] = 11;
            _weatherCodeTranslation[504] = 11;
            _weatherCodeTranslation[511] = 11;
            _weatherCodeTranslation[520] = 11;
            _weatherCodeTranslation[521] = 11;
            _weatherCodeTranslation[522] = 11;
            _weatherCodeTranslation[531] = 40;
            _weatherCodeTranslation[600] = 14;
            _weatherCodeTranslation[601] = 16;
            _weatherCodeTranslation[602] = 41;
            _weatherCodeTranslation[611] = 18;
            _weatherCodeTranslation[612] = 6;
            _weatherCodeTranslation[615] = 5;
            _weatherCodeTranslation[616] = 5;
            _weatherCodeTranslation[620] = 14;
            _weatherCodeTranslation[621] = 46;
            _weatherCodeTranslation[622] = 43;
            _weatherCodeTranslation[701] = 20;
            _weatherCodeTranslation[711] = 22;
            _weatherCodeTranslation[721] = 21;
            _weatherCodeTranslation[731] = 19;
            _weatherCodeTranslation[741] = 20;
            _weatherCodeTranslation[751] = 19;
            _weatherCodeTranslation[761] = 19;
            _weatherCodeTranslation[762] = 19;
            _weatherCodeTranslation[771] = 2;
            _weatherCodeTranslation[781] = 0;
            _weatherCodeTranslation[800] = 32;
            _weatherCodeTranslation[801] = 34;
            _weatherCodeTranslation[802] = 30;
            _weatherCodeTranslation[803] = 30;
            _weatherCodeTranslation[804] = 28;
            _weatherCodeTranslation[900] = 0;
            _weatherCodeTranslation[901] = 1;
            _weatherCodeTranslation[902] = 2;
            _weatherCodeTranslation[903] = 25;
            _weatherCodeTranslation[904] = 36;
            _weatherCodeTranslation[905] = 24;
            _weatherCodeTranslation[906] = 17;
            _weatherCodeTranslation[951] = 33;
            _weatherCodeTranslation[952] = 24;
            _weatherCodeTranslation[953] = 24;
            _weatherCodeTranslation[954] = 24;
            _weatherCodeTranslation[955] = 24;
            _weatherCodeTranslation[956] = 24;
            _weatherCodeTranslation[957] = 23;
            _weatherCodeTranslation[958] = 23;
            _weatherCodeTranslation[959] = 23;
            _weatherCodeTranslation[960] = 4;
            _weatherCodeTranslation[961] = 3;
            _weatherCodeTranslation[962] = 2;

            _weatherCodeTranslationNight[200] = 47;
            _weatherCodeTranslationNight[201] = 47;
            _weatherCodeTranslationNight[202] = 47;
            _weatherCodeTranslationNight[210] = 47;
            _weatherCodeTranslationNight[211] = 47;
            _weatherCodeTranslationNight[212] = 47;
            _weatherCodeTranslationNight[221] = 47;
            _weatherCodeTranslationNight[230] = 47;
            _weatherCodeTranslationNight[231] = 47;
            _weatherCodeTranslationNight[232] = 47;
            _weatherCodeTranslationNight[300] = 45;
            _weatherCodeTranslationNight[301] = 45;
            _weatherCodeTranslationNight[302] = 45;
            _weatherCodeTranslationNight[310] = 45;
            _weatherCodeTranslationNight[311] = 45;
            _weatherCodeTranslationNight[312] = 45;
            _weatherCodeTranslationNight[313] = 45;
            _weatherCodeTranslationNight[314] = 45;
            _weatherCodeTranslationNight[321] = 45;
            _weatherCodeTranslationNight[500] = 45;
            _weatherCodeTranslationNight[501] = 45;
            _weatherCodeTranslationNight[502] = 45;
            _weatherCodeTranslationNight[503] = 45;
            _weatherCodeTranslationNight[504] = 45;
            _weatherCodeTranslationNight[511] = 45;
            _weatherCodeTranslationNight[520] = 45;
            _weatherCodeTranslationNight[521] = 45;
            _weatherCodeTranslationNight[522] = 45;
            _weatherCodeTranslationNight[531] = 45;
            _weatherCodeTranslationNight[600] = 46;
            _weatherCodeTranslationNight[601] = 46;
            _weatherCodeTranslationNight[602] = 46;
            _weatherCodeTranslationNight[611] = 46;
            _weatherCodeTranslationNight[612] = 46;
            _weatherCodeTranslationNight[615] = 46;
            _weatherCodeTranslationNight[616] = 46;
            _weatherCodeTranslationNight[620] = 46;
            _weatherCodeTranslationNight[621] = 46;
            _weatherCodeTranslationNight[622] = 46;
            _weatherCodeTranslationNight[701] = 29;
            _weatherCodeTranslationNight[711] = 29;
            _weatherCodeTranslationNight[721] = 29;
            _weatherCodeTranslationNight[731] = 29;
            _weatherCodeTranslationNight[741] = 29;
            _weatherCodeTranslationNight[751] = 29;
            _weatherCodeTranslationNight[761] = 29;
            _weatherCodeTranslationNight[762] = 29;
            _weatherCodeTranslationNight[771] = 29;
            _weatherCodeTranslationNight[781] = 29;
            _weatherCodeTranslationNight[800] = 31;
            _weatherCodeTranslationNight[801] = 33;
            _weatherCodeTranslationNight[802] = 29;
            _weatherCodeTranslationNight[803] = 29;
            _weatherCodeTranslationNight[804] = 27;
            _weatherCodeTranslationNight[900] = 29;
            _weatherCodeTranslationNight[901] = 29;
            _weatherCodeTranslationNight[902] = 27;
            _weatherCodeTranslationNight[903] = 33;
            _weatherCodeTranslationNight[904] = 31;
            _weatherCodeTranslationNight[905] = 27;
            _weatherCodeTranslationNight[906] = 45;
            _weatherCodeTranslationNight[951] = 31;
            _weatherCodeTranslationNight[952] = 31;
            _weatherCodeTranslationNight[953] = 33;
            _weatherCodeTranslationNight[954] = 33;
            _weatherCodeTranslationNight[955] = 29;
            _weatherCodeTranslationNight[956] = 29;
            _weatherCodeTranslationNight[957] = 29;
            _weatherCodeTranslationNight[958] = 27;
            _weatherCodeTranslationNight[959] = 27;
            _weatherCodeTranslationNight[960] = 27;
            _weatherCodeTranslationNight[961] = 45;
            _weatherCodeTranslationNight[962] = 45;

            #endregion
        }
Example #19
0
 /// <summary>
 /// Search by city name.
 /// </summary>
 /// <param name="cityName">Name of the city.</param>
 /// <param name="metric">The metric.</param>
 /// <param name="language">The language.</param>
 /// <param name="count">The count.</param>
 /// <param name="accuracy">The accuracy.</param>
 /// <returns>Task{SearchResponse}.</returns>
 public Task <SearchResponse> GetByName(string cityName, MetricSystem metric = MetricSystem.Internal, OpenWeatherMapLanguage language = OpenWeatherMapLanguage.EN, int?count = null, Accuracy?accuracy = null)
 {
     return(base.GetByName <SearchResponse>(cityName, metric, language, count, accuracy));
 }