Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,21 @@ Task<OpenWeatherMapServiceResponse<List<GeocodeInfo>>> GetLocationByLatLonAsync(
/// <summary>
/// Retrieves current air pollution data for a specific location.
/// </summary>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionAsync(
Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionAsync(
double latitude,
double longitude);

/// <summary>
/// Retrieves forecasted air pollution data for the coming days for a specific location.
/// </summary>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionForecastAsync(
Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionForecastAsync(
double latitude,
double longitude);

/// <summary>
/// Retrieves historical air pollution data for a specific location and time range.
/// </summary>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionHistoryAsync(
Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionHistoryAsync(
double latitude,
double longitude,
DateTime start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Spectre.Console" Version="0.50.0" />
<PackageReference Include="Spectre.Console" Version="0.54.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions samples/OpenWeatherMapSharp.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ OpenWeatherMapServiceResponse<WeatherRoot> weatherResponse
AnsiConsole.Write(weatherPanel);

// == AIR POLLUTION ==
OpenWeatherMapServiceResponse<AirPolutionRoot> airPollutionResponse
= await openWeatherMapService.GetAirPolutionAsync(geolocation.Latitude, geolocation.Longitude);
OpenWeatherMapServiceResponse<AirPollutionRoot> 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
Expand Down
6 changes: 3 additions & 3 deletions src/OpenWeatherMapSharp/IOpenWeatherMapService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Task<OpenWeatherMapServiceResponse<List<GeocodeInfo>>> GetLocationByLatLonAsync(
/// <param name="latitude">Latitude of the location.</param>
/// <param name="longitude">Longitude of the location.</param>
/// <returns>Current air pollution data wrapped in a service response.</returns>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionAsync(
Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionAsync(
double latitude,
double longitude);

Expand All @@ -138,7 +138,7 @@ Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionAsync(
/// <param name="latitude">Latitude of the location.</param>
/// <param name="longitude">Longitude of the location.</param>
/// <returns>Air pollution forecast data wrapped in a service response.</returns>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionForecastAsync(
Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionForecastAsync(
double latitude,
double longitude);

Expand All @@ -150,7 +150,7 @@ Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionForecastAsync
/// <param name="start">Start of the time range (UTC).</param>
/// <param name="end">End of the time range (UTC).</param>
/// <returns>Historical air pollution data wrapped in a service response.</returns>
Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionHistoryAsync(
Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionHistoryAsync(
double latitude,
double longitude,
DateTime start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace OpenWeatherMapSharp.Models
/// Represents the concentration values
/// of various air pollutants (in μg/m³).
/// </summary>
public class AirPolutionComponents
public class AirPollutionComponents
{
/// <summary>
/// Carbon monoxide concentration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ namespace OpenWeatherMapSharp.Models
/// Represents a single entry of air quality data,
/// including AQI, components, and timestamp.
/// </summary>
public class AirPolutionEntry
public class AirPollutionEntry
{
/// <summary>
/// Main air quality index (AQI).
/// </summary>
[JsonPropertyName("main")]
public AirPolutionIndex AQI { get; set; }
public AirPollutionIndex AQI { get; set; }

/// <summary>
/// Concentrations of individual air components.
/// </summary>
[JsonPropertyName("components")]
public AirPolutionComponents Components { get; set; }
public AirPollutionComponents Components { get; set; }

/// <summary>
/// Timestamp of the measurement (Unix time in seconds).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace OpenWeatherMapSharp.Models
/// <summary>
/// Represents the air quality index (AQI) value.
/// </summary>
public class AirPolutionIndex
public class AirPollutionIndex
{
/// <summary>
/// Air Quality Index (1 = Good, 5 = Very Poor).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace OpenWeatherMapSharp.Models
/// <summary>
/// Root object representing the air quality response from the API.
/// </summary>
public class AirPolutionRoot
public class AirPollutionRoot
{
/// <summary>
/// Geographic coordinates of the measurement location.
Expand All @@ -18,6 +18,6 @@ public class AirPolutionRoot
/// List of air polution measurements.
/// </summary>
[JsonPropertyName("list")]
public List<AirPolutionEntry> Entries { get; set; }
public List<AirPollutionEntry> Entries { get; set; }
}
}
12 changes: 6 additions & 6 deletions src/OpenWeatherMapSharp/OpenWeatherMapService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,24 @@ public async Task<OpenWeatherMapServiceResponse<List<GeocodeInfo>>> GetLocationB
}

/// <inheritdoc/>
public async Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionAsync(double latitude, double longitude)
public async Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionAsync(double latitude, double longitude)
{
string url = string.Format(Statics.AirPollutionCoordinatesUri, latitude, longitude, _apiKey);
return await HttpService.GetDataAsync<AirPolutionRoot>(url);
return await HttpService.GetDataAsync<AirPollutionRoot>(url);
}

/// <inheritdoc/>
public async Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionForecastAsync(double latitude, double longitude)
public async Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> GetAirPollutionForecastAsync(double latitude, double longitude)
{
string url = string.Format(Statics.AirPollutionCoordinatesForecastUri, latitude, longitude, _apiKey);
return await HttpService.GetDataAsync<AirPolutionRoot>(url);
return await HttpService.GetDataAsync<AirPollutionRoot>(url);
}

/// <inheritdoc/>
public async Task<OpenWeatherMapServiceResponse<AirPolutionRoot>> GetAirPolutionHistoryAsync(double latitude, double longitude, DateTime start, DateTime end)
public async Task<OpenWeatherMapServiceResponse<AirPollutionRoot>> 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<AirPolutionRoot>(url);
return await HttpService.GetDataAsync<AirPollutionRoot>(url);
}
}
}
6 changes: 3 additions & 3 deletions src/OpenWeatherMapSharp/OpenWeatherMapSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>OpenWeatherMapSharp</Title>
<Version>4.1.0</Version>
<Version>4.2.0</Version>
<Authors>Thomas Sebastian Jensen</Authors>
<Company>tsjdev-apps.de</Company>
<Description>An unofficial .NET API wrapper for OpenWeatherMap.org</Description>
Expand All @@ -15,7 +15,7 @@
<PackageIcon>icon.png</PackageIcon>
<PackageTags>OpenWeatherMap; Api; Mock; Wrapper; free; Weather</PackageTags>
<PackageReleaseNotes>
- Add icon urls to ForecastItem
- Fix typos in Pollution API
</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand All @@ -27,7 +27,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="9.0.7" />
<PackageReference Include="System.Text.Json" Version="10.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

// Act
OpenWeatherMapServiceResponse<WeatherRoot> serviceResponse
= await service.GetWeatherAsync(cityName);

Check warning on line 23 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetWeatherAsync(string, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

Check warning on line 23 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetWeatherAsync(string, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

// Assert
Assert.NotNull(serviceResponse);
Expand Down Expand Up @@ -58,7 +58,7 @@

// Act
OpenWeatherMapServiceResponse<WeatherRoot> serviceResponse
= await service.GetWeatherAsync(cityName);

Check warning on line 61 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetWeatherAsync(string, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

Check warning on line 61 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetWeatherAsync(string, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

// Assert
Assert.NotNull(serviceResponse);
Expand All @@ -78,7 +78,7 @@

// Act
OpenWeatherMapServiceResponse<WeatherRoot> serviceResponse
= await service.GetWeatherAsync(cityId);

Check warning on line 81 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetWeatherAsync(int, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

Check warning on line 81 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetWeatherAsync(int, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

// Assert
Assert.NotNull(serviceResponse);
Expand Down Expand Up @@ -118,7 +118,7 @@

// Act
OpenWeatherMapServiceResponse<ForecastRoot> serviceResponse
= await service.GetForecastAsync(cityName);

Check warning on line 121 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetForecastAsync(string, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

Check warning on line 121 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetForecastAsync(string, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

// Assert
Assert.NotNull(serviceResponse);
Expand All @@ -138,7 +138,7 @@

// Act
OpenWeatherMapServiceResponse<ForecastRoot> serviceResponse
= await service.GetForecastAsync(cityId);

Check warning on line 141 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetForecastAsync(int, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

Check warning on line 141 in tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.cs

View workflow job for this annotation

GitHub Actions / build

'OpenWeatherMapService.GetForecastAsync(int, LanguageCode, Unit)' is obsolete: 'API requests by city name, ZIP code, and city ID are deprecated. They are still supported, but no longer maintained or updated.'

// Assert
Assert.NotNull(serviceResponse);
Expand Down Expand Up @@ -275,8 +275,8 @@
double longitude = 8.69;

// Act
OpenWeatherMapServiceResponse<AirPolutionRoot> response =
await service.GetAirPolutionAsync(latitude, longitude);
OpenWeatherMapServiceResponse<AirPollutionRoot> response =
await service.GetAirPollutionAsync(latitude, longitude);

// Assert
Assert.NotNull(response);
Expand All @@ -298,8 +298,8 @@
double longitude = 8.69;

// Act
OpenWeatherMapServiceResponse<AirPolutionRoot> response =
await service.GetAirPolutionForecastAsync(latitude, longitude);
OpenWeatherMapServiceResponse<AirPollutionRoot> response =
await service.GetAirPollutionForecastAsync(latitude, longitude);

// Assert
Assert.NotNull(response);
Expand All @@ -325,8 +325,8 @@
DateTime start = end.AddHours(-24);

// Act
OpenWeatherMapServiceResponse<AirPolutionRoot> response =
await service.GetAirPolutionHistoryAsync(latitude, longitude, start, end);
OpenWeatherMapServiceResponse<AirPollutionRoot> response =
await service.GetAirPollutionHistoryAsync(latitude, longitude, start, end);

// Assert
Assert.NotNull(response);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down