Weather.NET
1.3.1-beta.1
1.3.1 doesn't contain any changes, aside from documentation changes, and it is maintained, while this version is no longer maintained.
See the version list below for details.
dotnet add package Weather.NET --version 1.3.1-beta.1
NuGet\Install-Package Weather.NET -Version 1.3.1-beta.1
<PackageReference Include="Weather.NET" Version="1.3.1-beta.1" />
<PackageVersion Include="Weather.NET" Version="1.3.1-beta.1" />
<PackageReference Include="Weather.NET" />
paket add Weather.NET --version 1.3.1-beta.1
#r "nuget: Weather.NET, 1.3.1-beta.1"
#addin nuget:?package=Weather.NET&version=1.3.1-beta.1&prerelease
#tool nuget:?package=Weather.NET&version=1.3.1-beta.1&prerelease
Weather.NET
A simple .NET library that uses OpenWeatherMap API to get the weather of different places and cities. Supports both synchronous and asynchronous methods.
- Nuget Package
- Repository
- How to Contribute
- Code of Conduct
- License
- Official Page
- Documentation
- Tutorial
- Examples
Features
Example
using System;
using Weather.NET;
using Weather.NET.Enums;
using Weather.NET.Models.WeatherModel;
using Weather.NET.Models.PollutionModel;
...
WeatherClient client = new WeatherClient("Your API key");
// Gets a forecast of the London weather asynchronously, using the city name.
List<WeatherModel> forecasts = await client.GetForecastAsync("London", 8, Measurement.Metric, Language.Spanish);
Console.WriteLine(forecasts[7].Weather[0].Description);
// Gets the current temperature of New York synchronously, using the ZIP Code.
WeatherModel currentWeather = client.GetCurrentWeather("10001", "US", measurement: Measurement.Imperial);
Console.WriteLine(currentWeather.Main.Temperature);
// Gets maps of the entire world.
client.DownloadWeatherMap("temperatureMap.png", MapLayer.Temperature, 0, 0, 0);
await client.DownloadWeatherMapAsync("pressureMap.png", MapLayer.Pressure, 0, 0, 0);
// Gets the air pollution of Melbourne synchronously, using geo coordinates.
PollutionModel currentPollution = client.GetCurrentAirPollution(-37.814, 144.9633);
// Gets a forecast of the air pollution of Berlin asynchronously, using geo coordinates.
PollutionModel futurePollution = await client.GetForecastAirPollutionAsync(52.5244, 13.4105);
// Gets the history of the air pollution of Buenos Aires asynchronously, using geo coordinates and unix timestamps.
PollutionModel historicalPollution = await client.GetHistoricalAirPollutionAsync(-34.6132, -58.3772);
// Gets OpenWeather's One Call API response of New Delhi.
OneCallModel currentOneCall = client.GetOneCall(28.6128, 77.2311, new ExcludeOneCall[]{ExcludeOneCall.Alerts}, Measurement.Metric, Language.Hindi);
// Gets a historical One Call API response of Ottawa.
OneCallModel historicalOneCall = await client.GetHistoricalOneCallAsync(45.4112, -75.6981, 1640900049, Measurement.Metric, Language.English);
...
Latest Version: 1.3.0
From 1.2.0: - Added support for the One Call API: - OneCallApi contains extensions for WeatherClient that support calls to the API. - Models.OneCallModel contains the model of the response of all One Call API calls. - Enums.ExcludeOneCall contains parameters in the One Call response that can be excluded. - RestApi now does not have synchronous methods.
From 1.3.0-rc.1: - Fixed a bug where Measurement and Language wouldn't work in historical One Call API calls.
Beta Version: 1.3.1-beta.1
- Changed the dates from unix seconds to DateTime objects, and the old dates are now moved to a separate property. Example: Models.WeatherModel.AnalysisDate is moved to Models.WeatherModel.AnalysisDateUnix and Models.WeatherModel.AnalysisDate now contains a DateTime object.
- Removed dates in unix seconds that accounted for timezones, instead of that, use the new DateTime objects with the timezone offset added. Ex:
Models.WeatherModel.AnalysisDate.AddSeconds(Models.WeatherModel.Timezone)
. - Added missing nullable properties like the wind gust, rain information and snow information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.4.0-beta.1 | 149 | 6/13/2024 | |
1.3.3 | 790 | 11/19/2023 | |
1.3.2 | 2,123 | 8/21/2022 | |
1.3.1 | 488 | 7/20/2022 | |
1.3.1-beta.1 | 170 | 7/15/2022 | |
1.3.0 | 472 | 1/3/2022 | |
1.2.1 | 307 | 12/22/2021 | |
1.2.0 | 317 | 12/20/2021 | |
1.1.1 | 344 | 12/17/2021 | |
1.1.0 | 317 | 12/16/2021 | |
1.0.0 | 305 | 12/10/2021 | |
0.3.0 | 366 | 12/9/2021 | |
0.2.0 | 375 | 12/8/2021 | |
0.1.0 | 478 | 12/5/2021 |
- Changed the dates from unix seconds to DateTime objects, and the old dates are now moved to a separate property. Example: Models.WeatherModel.AnalysisDate is moved to Models.WeatherModel.AnalysisDateUnix and Models.WeatherModel.AnalysisDate now contains a DateTime object.
- Removed dates in unix seconds that accounted for timezones, instead of that, use the new DateTime objects with the timezone offset added. Ex: `Models.WeatherModel.AnalysisDate.AddSeconds(Models.WeatherModel.Timezone)`.
- Added missing nullable properties like the wind gust, rain information and snow information.