Skip to content

0xc3u/Indiko.OpenWeatherClient

Repository files navigation

Indiko.OpenWeatherClient

The Indiko.OpenWeatherClient is a .NET library for interacting with the OpenWeatherMap APIs. It provides easy access to real-time weather data and map tiles, ensuring seamless integration with .NET applications.

Build Status

ci

Install Controls

NuGet

Available on NuGet.

Install with the dotnet CLI: dotnet add package Indiko.OpenWeatherClient, or through the NuGet Package Manager in Visual Studio.

Features

  • Fetch current weather, hourly forecast, and daily forecast.
  • Access to weather map tiles.
  • Supports Dependency Injection and manual instantiation.
  • Configurable through a fluent API for building request parameters.

Important note: To use this client wrapper for openweathermap.org you need have a valid api-key from https://openweathermap.org.

Platform supported

Platform Version Supported Reference
.NET 8.0

API Coverage

For detailed API usage and more examples, please refer to the official documentation or explore the OpenWeatherClient class definitions within the package.

Dependency Injection

// Add the service to the service collection
services.AddOpenWeatherClient();
// Inject the service
public class MyClass
{
    private readonly IOpenWeatherClient _openWeatherClient;

    public MyClass(IOpenWeatherClient openWeatherClient)
    {
        _openWeatherClient = openWeatherClient;
    }
}

Manual instantiation

// Create a new instance of the client
IOpenWeatherClient _openWeatherClient = new OpenWeatherClient();

Usage

// Get the current weather for a New York

var request = new OpenWeatherRequest
{
    ApiKey = "YOUR_API_KEY_HERE",
    Latitude = 40.712776,
    Longitude = -74.005974,
    Language = Constants.Languages.English,
    Unit = Constants.Units.Metric,
    Excludes = [Constants.Excludes.Minutely, Constants.Excludes.Daily, Constants.Excludes.Hourly]
};

var response = await openWeatherClient.GetWeatherAsync(request);

About

Another C# client for openweathermap.org API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages