From b2aebadbd598d4ad74d2538f90559f517fff85a8 Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Sat, 29 Nov 2025 21:22:26 +0100 Subject: [PATCH 1/6] Rename AirPolution* to AirPollution* for consistency Renamed all classes, files, methods, and references from 'AirPolution' to the correct spelling 'AirPollution' across the codebase. This improves naming consistency and clarity throughout the project, including models, service interfaces, implementations, and related unit tests. --- samples/OpenWeatherMapSharp.Console/Program.cs | 8 ++++---- src/OpenWeatherMapSharp/IOpenWeatherMapService.cs | 6 +++--- ...lutionComponents.cs => AirPollutionComponents.cs} | 2 +- .../{AirPolutionEntry.cs => AirPollutionEntry.cs} | 6 +++--- .../{AirPolutionIndex.cs => AirPollutionIndex.cs} | 2 +- .../{AirPolutionRoot.cs => AirPollutionRoot.cs} | 4 ++-- src/OpenWeatherMapSharp/OpenWeatherMapService.cs | 12 ++++++------ .../OpenWeatherMapServiceTests.cs | 12 ++++++------ 8 files changed, 26 insertions(+), 26 deletions(-) rename src/OpenWeatherMapSharp/Models/{AirPolutionComponents.cs => AirPollutionComponents.cs} (97%) rename src/OpenWeatherMapSharp/Models/{AirPolutionEntry.cs => AirPollutionEntry.cs} (86%) rename src/OpenWeatherMapSharp/Models/{AirPolutionIndex.cs => AirPollutionIndex.cs} (91%) rename src/OpenWeatherMapSharp/Models/{AirPolutionRoot.cs => AirPollutionRoot.cs} (85%) diff --git a/samples/OpenWeatherMapSharp.Console/Program.cs b/samples/OpenWeatherMapSharp.Console/Program.cs index dfb4545..68e1575 100644 --- a/samples/OpenWeatherMapSharp.Console/Program.cs +++ b/samples/OpenWeatherMapSharp.Console/Program.cs @@ -88,16 +88,16 @@ OpenWeatherMapServiceResponse weatherResponse AnsiConsole.Write(weatherPanel); // == AIR POLLUTION == -OpenWeatherMapServiceResponse airPollutionResponse - = await openWeatherMapService.GetAirPolutionAsync(geolocation.Latitude, geolocation.Longitude); +OpenWeatherMapServiceResponse airPollutionResponse + = await openWeatherMapService.GetAirPollutionAsync(geolocation.Latitude, geolocation.Longitude); -if (!airPollutionResponse.IsSuccess || airPollutionResponse.Response is not AirPolutionRoot airQuality || airQuality.Entries.Count == 0) +if (!airPollutionResponse.IsSuccess || airPollutionResponse.Response is not AirPollutionRoot airQuality || airQuality.Entries.Count == 0) { AnsiConsole.MarkupLine("[bold red]Unfortunately I can't retrieve air pollution data. Please try again.[/]"); return; } -AirPolutionEntry pollution = airQuality.Entries.First(); +AirPollutionEntry pollution = airQuality.Entries.First(); // Map AQI to meaning string GetAqiMeaning(int aqi) => aqi switch diff --git a/src/OpenWeatherMapSharp/IOpenWeatherMapService.cs b/src/OpenWeatherMapSharp/IOpenWeatherMapService.cs index 14ce7ca..67f2fe7 100644 --- a/src/OpenWeatherMapSharp/IOpenWeatherMapService.cs +++ b/src/OpenWeatherMapSharp/IOpenWeatherMapService.cs @@ -128,7 +128,7 @@ Task>> GetLocationByLatLonAsync( /// Latitude of the location. /// Longitude of the location. /// Current air pollution data wrapped in a service response. - Task> GetAirPolutionAsync( + Task> GetAirPollutionAsync( double latitude, double longitude); @@ -138,7 +138,7 @@ Task> GetAirPolutionAsync( /// Latitude of the location. /// Longitude of the location. /// Air pollution forecast data wrapped in a service response. - Task> GetAirPolutionForecastAsync( + Task> GetAirPollutionForecastAsync( double latitude, double longitude); @@ -150,7 +150,7 @@ Task> GetAirPolutionForecastAsync /// Start of the time range (UTC). /// End of the time range (UTC). /// Historical air pollution data wrapped in a service response. - Task> GetAirPolutionHistoryAsync( + Task> GetAirPollutionHistoryAsync( double latitude, double longitude, DateTime start, diff --git a/src/OpenWeatherMapSharp/Models/AirPolutionComponents.cs b/src/OpenWeatherMapSharp/Models/AirPollutionComponents.cs similarity index 97% rename from src/OpenWeatherMapSharp/Models/AirPolutionComponents.cs rename to src/OpenWeatherMapSharp/Models/AirPollutionComponents.cs index d3ee3e7..92c4deb 100644 --- a/src/OpenWeatherMapSharp/Models/AirPolutionComponents.cs +++ b/src/OpenWeatherMapSharp/Models/AirPollutionComponents.cs @@ -6,7 +6,7 @@ namespace OpenWeatherMapSharp.Models /// Represents the concentration values /// of various air pollutants (in μg/m³). /// - public class AirPolutionComponents + public class AirPollutionComponents { /// /// Carbon monoxide concentration. diff --git a/src/OpenWeatherMapSharp/Models/AirPolutionEntry.cs b/src/OpenWeatherMapSharp/Models/AirPollutionEntry.cs similarity index 86% rename from src/OpenWeatherMapSharp/Models/AirPolutionEntry.cs rename to src/OpenWeatherMapSharp/Models/AirPollutionEntry.cs index 1d222d4..d2192ee 100644 --- a/src/OpenWeatherMapSharp/Models/AirPolutionEntry.cs +++ b/src/OpenWeatherMapSharp/Models/AirPollutionEntry.cs @@ -8,19 +8,19 @@ namespace OpenWeatherMapSharp.Models /// Represents a single entry of air quality data, /// including AQI, components, and timestamp. /// - public class AirPolutionEntry + public class AirPollutionEntry { /// /// Main air quality index (AQI). /// [JsonPropertyName("main")] - public AirPolutionIndex AQI { get; set; } + public AirPollutionIndex AQI { get; set; } /// /// Concentrations of individual air components. /// [JsonPropertyName("components")] - public AirPolutionComponents Components { get; set; } + public AirPollutionComponents Components { get; set; } /// /// Timestamp of the measurement (Unix time in seconds). diff --git a/src/OpenWeatherMapSharp/Models/AirPolutionIndex.cs b/src/OpenWeatherMapSharp/Models/AirPollutionIndex.cs similarity index 91% rename from src/OpenWeatherMapSharp/Models/AirPolutionIndex.cs rename to src/OpenWeatherMapSharp/Models/AirPollutionIndex.cs index c0315f3..b2f5433 100644 --- a/src/OpenWeatherMapSharp/Models/AirPolutionIndex.cs +++ b/src/OpenWeatherMapSharp/Models/AirPollutionIndex.cs @@ -5,7 +5,7 @@ namespace OpenWeatherMapSharp.Models /// /// Represents the air quality index (AQI) value. /// - public class AirPolutionIndex + public class AirPollutionIndex { /// /// Air Quality Index (1 = Good, 5 = Very Poor). diff --git a/src/OpenWeatherMapSharp/Models/AirPolutionRoot.cs b/src/OpenWeatherMapSharp/Models/AirPollutionRoot.cs similarity index 85% rename from src/OpenWeatherMapSharp/Models/AirPolutionRoot.cs rename to src/OpenWeatherMapSharp/Models/AirPollutionRoot.cs index bfc3a5a..e04ed99 100644 --- a/src/OpenWeatherMapSharp/Models/AirPolutionRoot.cs +++ b/src/OpenWeatherMapSharp/Models/AirPollutionRoot.cs @@ -6,7 +6,7 @@ namespace OpenWeatherMapSharp.Models /// /// Root object representing the air quality response from the API. /// - public class AirPolutionRoot + public class AirPollutionRoot { /// /// Geographic coordinates of the measurement location. @@ -18,6 +18,6 @@ public class AirPolutionRoot /// List of air polution measurements. /// [JsonPropertyName("list")] - public List Entries { get; set; } + public List Entries { get; set; } } } diff --git a/src/OpenWeatherMapSharp/OpenWeatherMapService.cs b/src/OpenWeatherMapSharp/OpenWeatherMapService.cs index 1a9ab05..d1f4967 100644 --- a/src/OpenWeatherMapSharp/OpenWeatherMapService.cs +++ b/src/OpenWeatherMapSharp/OpenWeatherMapService.cs @@ -150,24 +150,24 @@ public async Task>> GetLocationB } /// - public async Task> GetAirPolutionAsync(double latitude, double longitude) + public async Task> GetAirPollutionAsync(double latitude, double longitude) { string url = string.Format(Statics.AirPollutionCoordinatesUri, latitude, longitude, _apiKey); - return await HttpService.GetDataAsync(url); + return await HttpService.GetDataAsync(url); } /// - public async Task> GetAirPolutionForecastAsync(double latitude, double longitude) + public async Task> GetAirPollutionForecastAsync(double latitude, double longitude) { string url = string.Format(Statics.AirPollutionCoordinatesForecastUri, latitude, longitude, _apiKey); - return await HttpService.GetDataAsync(url); + return await HttpService.GetDataAsync(url); } /// - public async Task> GetAirPolutionHistoryAsync(double latitude, double longitude, DateTime start, DateTime end) + public async Task> GetAirPollutionHistoryAsync(double latitude, double longitude, DateTime start, DateTime end) { string url = string.Format(Statics.AirPollutionCoordinatesHistoryUri, latitude, longitude, start.ToUnixTimestamp(), end.ToUnixTimestamp(), _apiKey); - return await HttpService.GetDataAsync(url); + return await HttpService.GetDataAsync(url); } } } diff --git a/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs b/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs index e21aebc..8279128 100644 --- a/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs +++ b/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs @@ -275,8 +275,8 @@ public async Task GetAirPollution_ShouldReturnValidResponse() double longitude = 8.69; // Act - OpenWeatherMapServiceResponse response = - await service.GetAirPolutionAsync(latitude, longitude); + OpenWeatherMapServiceResponse response = + await service.GetAirPollutionAsync(latitude, longitude); // Assert Assert.NotNull(response); @@ -298,8 +298,8 @@ public async Task GetAirPollutionForecast_ShouldReturnFutureEntries() double longitude = 8.69; // Act - OpenWeatherMapServiceResponse response = - await service.GetAirPolutionForecastAsync(latitude, longitude); + OpenWeatherMapServiceResponse response = + await service.GetAirPollutionForecastAsync(latitude, longitude); // Assert Assert.NotNull(response); @@ -325,8 +325,8 @@ public async Task GetAirPollutionHistory_ShouldReturnEntriesInTimeRange() DateTime start = end.AddHours(-24); // Act - OpenWeatherMapServiceResponse response = - await service.GetAirPolutionHistoryAsync(latitude, longitude, start, end); + OpenWeatherMapServiceResponse response = + await service.GetAirPollutionHistoryAsync(latitude, longitude, start, end); // Assert Assert.NotNull(response); From 9bd60e7329bdbce5749ebbc6a1c3be18e3ce8a50 Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Sat, 29 Nov 2025 21:25:08 +0100 Subject: [PATCH 2/6] Update target framework to .NET 10.0 Changed the TargetFramework in the console project from net9.0 to net10.0 to use the latest .NET version. --- .../OpenWeatherMapSharp.Console.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj b/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj index f035b45..fa88e44 100644 --- a/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj +++ b/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable From be4b3cd70c5b5120250ec17eddbcc39991974cda Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Sat, 29 Nov 2025 21:25:23 +0100 Subject: [PATCH 3/6] Update test project to target .NET 10.0 Changed the target framework of the unit test project from net9.0 to net10.0 to align with the latest .NET version. --- .../OpenWeatherMapSharp.UnitTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj b/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj index 2dfe0b0..c8bca37 100644 --- a/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj +++ b/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable From 5d60fbfa92e8add9c3621a3604b7c5661ee555c1 Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Sat, 29 Nov 2025 21:25:31 +0100 Subject: [PATCH 4/6] Update NuGet package dependencies to latest versions Upgraded Spectre.Console to 0.54.0 in the console sample, System.Text.Json to 10.0.0 in the main library, and test dependencies (Microsoft.NET.Test.Sdk to 18.0.1, xunit.runner.visualstudio to 3.1.5) in unit tests. This ensures compatibility with the latest features and bug fixes. --- .../OpenWeatherMapSharp.Console.csproj | 2 +- src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj | 2 +- .../OpenWeatherMapSharp.UnitTests.csproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj b/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj index fa88e44..b15a419 100644 --- a/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj +++ b/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj b/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj index 42a432c..f98a614 100644 --- a/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj +++ b/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj @@ -27,7 +27,7 @@ - + diff --git a/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj b/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj index c8bca37..7970933 100644 --- a/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj +++ b/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj @@ -10,9 +10,9 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 8dab8f272bcd0448024658aa4b4180f4c931c7a4 Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Sat, 29 Nov 2025 21:26:25 +0100 Subject: [PATCH 5/6] Fix typos in air pollution method names and types Corrected 'AirPolution' to 'AirPollution' in method names and type references in the README for consistency and accuracy. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dc27b9d..e08d535 100644 --- a/README.md +++ b/README.md @@ -94,21 +94,21 @@ Task>> GetLocationByLatLonAsync( /// /// Retrieves current air pollution data for a specific location. /// -Task> GetAirPolutionAsync( +Task> GetAirPollutionAsync( double latitude, double longitude); /// /// Retrieves forecasted air pollution data for the coming days for a specific location. /// -Task> GetAirPolutionForecastAsync( +Task> GetAirPollutionForecastAsync( double latitude, double longitude); /// /// Retrieves historical air pollution data for a specific location and time range. /// -Task> GetAirPolutionHistoryAsync( +Task> GetAirPollutionHistoryAsync( double latitude, double longitude, DateTime start, From e14b65753ba36c464f8682818f6a9b92eafb5786 Mon Sep 17 00:00:00 2001 From: Sebastian Jensen Date: Sat, 29 Nov 2025 21:28:21 +0100 Subject: [PATCH 6/6] Bump version to 4.2.0 and update release notes Updated the project version to 4.2.0 and revised the release notes to mention typo fixes in the Pollution API. --- 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 f98a614..5ea8fc8 100644 --- a/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj +++ b/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj @@ -4,7 +4,7 @@ netstandard2.0 True OpenWeatherMapSharp - 4.1.0 + 4.2.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 - - Add icon urls to ForecastItem + - Fix typos in Pollution API en README.md