Conversation
Introduces AirPolutionComponents, AirPolutionEntry, AirPolutionIndex, and AirPolutionRoot classes to represent air quality data, pollutant concentrations, AQI, and API response structure. These models enable structured deserialization and handling of air pollution data from the OpenWeatherMap API.
Changed the ToDateTime method to return universal time (UTC) instead of local time when converting a Unix timestamp. This ensures consistent time representation across different environments.
Introduces DateTimeExtensions with a ToUnixTimestamp method for converting DateTime objects to Unix timestamps in seconds. Ensures conversion to UTC before calculation.
Introduces static URI strings for air pollution data, forecast, and history endpoints in the Statics utility class. This enables easier access to OpenWeatherMap air pollution APIs by geographic coordinates.
Introduces methods to retrieve current, forecast, and historical air pollution data in IOpenWeatherMapService and implements them in OpenWeatherMapService. This extends the API coverage to include air pollution endpoints.
Added unit tests for GetAirPollutionAsync, GetAirPollutionForecastAsync, and GetAirPollutionHistoryAsync methods in OpenWeatherMapService. These tests verify valid responses, future forecast entries, and historical data within a specified time range.
Fetches air pollution data using OpenWeatherMap API and displays AQI and pollutant levels in a new panel. Includes AQI meaning mapping and error handling for data retrieval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces AirPolutionComponents, AirPolutionEntry, AirPolutionIndex, and AirPolutionRoot classes to represent air quality data, pollutant concentrations, AQI, and API response structure. These models enable structured deserialization and handling of air pollution data from the OpenWeatherMap API.
This pull request introduces support for retrieving and displaying air pollution data from the OpenWeatherMap API. The changes include new API methods, data models, utility extensions, and unit tests to ensure functionality. The most important changes are grouped into functionality additions, data modeling, utility updates, and testing enhancements.
Functionality Additions:
IOpenWeatherMapServiceandOpenWeatherMapServiceto retrieve current, forecasted, and historical air pollution data using geographic coordinates. ([[1]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-440e3d00a7ca4edf88d6fd6474e5df8b229872460600e623022ce46ab7bef452R124-R157),[[2]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-f268d1876ec5d13f379dd36ef5b70b6f47e8f8f310e57c3cb28f764c516fb30aR151-R171))[samples/OpenWeatherMapSharp.Console/Program.csR90-R134](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-b33f3f44842b0cd27151536e7a0fc369618dfde39d2774a476c09ee6b490b8e9R90-R134))Data Modeling:
AirPolutionRoot,AirPolutionEntry,AirPolutionComponents, andAirPolutionIndexclasses to represent air pollution data retrieved from the API. ([[1]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-c99198f91e1935b67de9f1a0559d6f692ab9091666717c87c2a2e3a659d72534R1-R23),[[2]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-010961e333b3e14e0fbdc047babe8be7cd87afb7c24a6dac16b4c54586405a86R1-R39),[[3]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-2a19f3d847c7d58047a72cb1cbc7692d6d56321638efdedbee265537f87cb555R1-R59),[[4]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-f742bd8331b13cb597f05190d55c403af7e2d623be7570257d0deb5a87b65900R1-R16))Utility Updates:
DateTimeExtensionsfor convertingDateTimeto Unix timestamps and updatedLongExtensionsto ensure timestamps are handled in UTC. ([[1]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-28a2eb861d9240db8529ef6049628a97f7d5e37e21ea0edd964beaf1d24c9892R1-R27),[[2]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-dcf54a12972a0b5007eeb66f2d0e88d96b6d3ced0d8c0d4fb89d42cd0873d00cL20-R25))Staticsfor air pollution API endpoints, including current, forecast, and historical data URIs. ([[1]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-424c8fbf4e4d4849fb754ae75ee7f0e30374a15916c7d9757fdf34f114c51eecR20-R22),[[2]](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-424c8fbf4e4d4849fb754ae75ee7f0e30374a15916c7d9757fdf34f114c51eecR86-R106))Testing Enhancements:
[tests/OpenWeatherMapSharp.UnitTests/OpenWeatherMapServiceTests.csR268-R343](https://github.com/tsjdev-apps/openweathermap-sharp/pull/10/files#diff-b7661d50f7227a93f6bf7077d7f406e5e88178f35b32cb935ab43f55b2b90d15R268-R343))