net.tellerapps.sunrise-sunset-client.dependency-injection 5.0.0

.NET 5.0
dotnet add package net.tellerapps.sunrise-sunset-client.dependency-injection --version 5.0.0
NuGet\Install-Package net.tellerapps.sunrise-sunset-client.dependency-injection -Version 5.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="net.tellerapps.sunrise-sunset-client.dependency-injection" Version="5.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add net.tellerapps.sunrise-sunset-client.dependency-injection --version 5.0.0
#r "nuget: net.tellerapps.sunrise-sunset-client.dependency-injection, 5.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 net.tellerapps.sunrise-sunset-client.dependency-injection as a Cake Addin
#addin nuget:?package=net.tellerapps.sunrise-sunset-client.dependency-injection&version=5.0.0

// Install net.tellerapps.sunrise-sunset-client.dependency-injection as a Cake Tool
#tool nuget:?package=net.tellerapps.sunrise-sunset-client.dependency-injection&version=5.0.0

SunriseSunset

https://sunrise-sunset.org/ API client
GitHub: https://github.com/gilad-teller/SunriseSunset

SunriseSunsetClient Dependency Injection

This extension allows you to easily add SunriseSunsetClient to your .Net 5 application
Add this to the Startup:

services.AddSunriseSunsetClient();

When adding this service, SunriseSunsetService and SunriseSunsetHttpClient are added as scoped services.
Also, an HttpClient is registered and binded to SunriseSunsetService.
This means you don't need to manage the HttpClient.
You can then consume SunriseSunsetService as a dependency.

public class MyService
{
	private readonly SunriseSunsetService _sunriseSunsetService;
	
	public MyService(SunriseSunsetService sunriseSunsetService)
	{
		_sunriseSunsetService = sunriseSunsetService;
	}

	public async Task<Response> Get()
	{
		return await _sunriseSunsetService.Get(51.5010, -0.1406, new DateTime(2021, 1, 1));
	}
}
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
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
5.0.0 174 12/18/2021

Sunset Sunrise client with dependency injection support.
Receiving data from https://sunrise-sunset.org/