Skip to content

OpenSky.Core is a .NET library for interacting with the OpenSky API. It simplifies communication with the API and provides a comprehensive set of features.

License

Notifications You must be signed in to change notification settings

selcukgural/opensky.core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSky.Core

OpenSky.Core is a comprehensive .NET library designed for seamless interaction with the WeatherAPI.com APIs. This library wraps the WeatherAPI functionalities in C#, providing developers with an intuitive and efficient way to integrate weather data into their applications.

Key Features

  • WeatherAPI Integration: Leverages the powerful APIs provided by WeatherAPI.com for accessing a wide range of weather data.
  • Strong Typing: Ensures robust type safety, minimizing runtime errors and enhancing code reliability.
  • Flexible Response Formats: Supports both XML and JSON response formats, allowing developers to choose the most suitable format for their needs.
  • Error Handling: Implements comprehensive error handling mechanisms, ensuring that developers can effectively manage and respond to any issues that arise during API interactions.

This project is an excellent tool for developers looking to integrate weather data into their applications with ease and reliability.

Installation

Nuget Package

.NET CLI:

  dotnet add package OpenSky.Core --version 1.0.1

Package Manager

  Install-Package OpenSky.Core -Version 1.0.1

Also, you can use OpenSky.AspNetCore package for your web projects.

Example Usage

Here is an example of how to use the OpenSkyService to search for a location. This example demonstrates how to configure the service and make a request to search for a location.

using OpenSky.Core.Configuration;
using OpenSky.Core.Service;

// Create the configuration settings with the API key
var ossConfig = new OssConfiguration { ApiKey = "your-api-key" };

// Create the HttpClient instance
var httpClient = new HttpClient();

// Create the OpenSkyService instance with the HttpClient and configuration settings
var ossService = new OpenSkyService(httpClient, ossConfig);

// Make a request to search for a location
// You can get the return value as strong type, json or xml if you wish.
var result = await ossService.SearchAsync("Ista");
//var jsonResult = await ossService.SearchJsonAsync("Ista");
//var xmlResult = await ossService.SearchXmlAsync("Ista");

// Handle the response (example)
if (result.IsSuccess)
{
    var searchResults = result.Response;
    // Process search results
}
else
{
    Console.WriteLine($"Error: {result.Error!.Message}");
}

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

Contributions

Contributions are welcome! Please fork this repository and submit a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.

About

OpenSky.Core is a .NET library for interacting with the OpenSky API. It simplifies communication with the API and provides a comprehensive set of features.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages