WeerLive 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package WeerLive --version 1.0.0                
NuGet\Install-Package WeerLive -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WeerLive" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WeerLive --version 1.0.0                
#r "nuget: WeerLive, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WeerLive as a Cake Addin
#addin nuget:?package=WeerLive&version=1.0.0

// Install WeerLive as a Cake Tool
#tool nuget:?package=WeerLive&version=1.0.0                

WeerLive.Net

WeerLive.Net is a library for the Dutch weather service WeerLive. This library provides the following features:

  • Get the live weather for a location
  • Get the weather forecast for the coming 24 hours for a location
  • Get the weather forecast for the coming 5 days for a location

The location can be either a city name or latitude and longitude coordinates.

Usage

Here you can see a simple example of how to use the library combined with the Microsoft.Extensions.DependencyInjection library. This example can also be found in the example project.

var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureServices((ctx, services) =>
    services.AddWeerLive(conf => ctx.Configuration.GetSection("WeerLive").Bind(conf)));
var host = builder.Build();

var serviceScope = host.Services.CreateScope();
var client = serviceScope.ServiceProvider.GetRequiredService<IWeerLiveClient>();
var logger = serviceScope.ServiceProvider.GetRequiredService<ILogger<Program>>();

var forecast = await client.GetAsync("Amsterdam");
if (forecast?.LiveWeather is null)
{
    logger.LogError("Failed to get weather forecast.");
    return;
}

logger.LogInformation("Today in Amsterdam: {Temperature}°C with a RH of {Humidity}%.",
    forecast.LiveWeather.Temperature,
    forecast.LiveWeather.Humidity);

And without dependency injection:

var httpClient = new HttpClient();
var options = new WeerLiveOptions
{
    ApiKey = "demo"
};

var client = new WeerLiveClient(httpClient, Options.Create(options));
var forecast = await client.GetAsync("Amsterdam");
if (forecast?.LiveWeather is null)
{
    Console.WriteLine("Failed to get weather forecast.");
    return;
}

Console.WriteLine($"Today in Amsterdam: {forecast.LiveWeather.Temperature}°C with a RH of {forecast.LiveWeather.Humidity}%.");

API key

To use the WeerLive API, you need an API key. You can get a free API key by registering on the WeerLive website. With an API key you can make up to 300 requests per day. In the responses you can find how many requests you have left for the day.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.1 114 9/1/2024
1.0.0 105 8/31/2024