From b80801a8a415882fff59dca23ea3663f50d0dac6 Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Thu, 24 Jul 2025 11:38:54 +0200 Subject: [PATCH 1/2] Add weather icon URL properties to ForecastItem Introduced Icon, Icon2x, Icon4x, and IconName properties to provide easy access to weather icon URLs and icon name based on the first WeatherInfo entry. These properties are marked with [JsonIgnore] to avoid serialization. --- .../Models/ForecastItem.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/OpenWeatherMapSharp/Models/ForecastItem.cs b/src/OpenWeatherMapSharp/Models/ForecastItem.cs index f498a57..5525e3e 100644 --- a/src/OpenWeatherMapSharp/Models/ForecastItem.cs +++ b/src/OpenWeatherMapSharp/Models/ForecastItem.cs @@ -82,5 +82,33 @@ public class ForecastItem [JsonIgnore] public DateTime Date => DateUnix.ToDateTime(); + + /// + /// Weather icon URL (default size). + /// + [JsonIgnore] + public string Icon + => $"https://openweathermap.org/img/wn/{WeatherInfos?[0]?.Icon}.png"; + + /// + /// Weather icon URL (2x resolution). + /// + [JsonIgnore] + public string Icon2x + => $"https://openweathermap.org/img/wn/{WeatherInfos?[0]?.Icon}@2x.png"; + + /// + /// Weather icon URL (4x resolution). + /// + [JsonIgnore] + public string Icon4x + => $"https://openweathermap.org/img/wn/{WeatherInfos?[0]?.Icon}@4x.png"; + + /// + /// Weather icon name. + /// + [JsonIgnore] + public string IconName + => WeatherInfos?[0]?.Icon; } } From 9e9238aea4c30667d2ff06ac811c7f148992a72d Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Thu, 24 Jul 2025 11:39:00 +0200 Subject: [PATCH 2/2] Bump version to 4.1.0 and update release notes Updated the project version to 4.1.0 and revised the release notes to mention the addition of icon URLs to ForecastItem. --- src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj b/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj index a5b5864..42a432c 100644 --- a/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj +++ b/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj @@ -4,7 +4,7 @@ netstandard2.0 True OpenWeatherMapSharp - 4.0.1 + 4.1.0 Thomas Sebastian Jensen tsjdev-apps.de An unofficial .NET API wrapper for OpenWeatherMap.org @@ -15,7 +15,7 @@ icon.png OpenWeatherMap; Api; Mock; Wrapper; free; Weather - - Fix icon urls + - Add icon urls to ForecastItem en README.md