OpenSky.AspNetCore 1.0.0

dotnet add package OpenSky.AspNetCore --version 1.0.0                
NuGet\Install-Package OpenSky.AspNetCore -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="OpenSky.AspNetCore" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OpenSky.AspNetCore --version 1.0.0                
#r "nuget: OpenSky.AspNetCore, 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 OpenSky.AspNetCore as a Cake Addin
#addin nuget:?package=OpenSky.AspNetCore&version=1.0.0

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

OpenSky.AspNetCore

This package provides an extension method for adding the OpenSkyService to the service collection in an ASP.NET Core project.

Also, you can use OpenSky.Core package for your console applications or other types of projects.

Configuration

Create a configuration file or set environment variables for the API key and other settings.

Usage

Example Usage for Dependency Injection

Here is an example of how to configure and use the OpenSkyService with dependency injection in an ASP.NET Core project:

  1. Configure the service in Startup.cs or Program.cs:
using OpenSky.AspNetCore.Extensions;


var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOssClient(e =>
{
    e.ApiKey = "your-api-key";
});
  1. Inject and use the service in your controllers or services:
    using Microsoft.AspNetCore.Mvc;
    using OpenSky.Core.Service;

    [ApiController]
    [Route("[controller]")]
    public class WeatherController : ControllerBase
    {
        private readonly IOpenSkyService _openSkyService;

        public WeatherController(IOpenSkyService openSkyService)
        {
            _openSkyService = openSkyService;
        }

        [HttpGet("{location}")]
        public async Task<IActionResult> GetWeather(string location)
        {
            var response = await _openSkyService.SearchAsync(location);

            if (response.IsSuccess)
            {
                return Ok(response.Value);
            }

            return BadRequest(response.Error.Message);
        }
    }

This example demonstrates how to configure the OpenSkyService using dependency injection and how to use it in an ASP.NET Core controller to search for weather information.

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.  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. 
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.0 69 12/24/2024