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, diff --git a/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj b/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj index f035b45..b15a419 100644 --- a/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj +++ b/samples/OpenWeatherMapSharp.Console/OpenWeatherMapSharp.Console.csproj @@ -2,13 +2,13 @@ Exe - net9.0 + net10.0 enable enable - + 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/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj b/src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj index 42a432c..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 @@ -27,7 +27,7 @@ - + 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); diff --git a/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj b/tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapSharp.UnitTests.csproj index 2dfe0b0..7970933 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 @@ -10,9 +10,9 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all