A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/f0xy/forecast.io-csharp below:

cillierscharl/forecast.io-csharp: C# Wrapper Library For Forecast.io

C# Wrapper Library For Forecast.io

Install-Package Forecast.io
using ForecastIO;
// API key, Lat, Long, Unit

var request = new ForecastIORequest(key, 37.8267f, -122.423f, Unit.si);
var response = request.Get();

var request = new ForecastIORequest(key, 43.4499376f, -79.7880999f, Unit.si);
var response = await request.GetAsync();

Returns the complete object :

using ForecastIO;

var request = new ForecastIORequest("YOUR API KEY", 37.8267f, -122.423f, DateTime.Now, Unit.si);
var response = request.Get();
Using date/time extensions
using ForecastIO;
using ForecastIO.Extensions;

var request = new ForecastIORequest("YOUR API KEY", 37.8267f, -122.423f, DateTime.Now, Unit.si);
var response = request.Get();

// Date/Time is represented by a Unix Timestamp
var currentTime = response.currently.time;

// Return a .NET DateTime object (UTC) using an extension (Notice the additional 'using' statement)
var _currentTime = currentTime.ToDateTime();

// Return a local .NET DateTime object
var _localCurrentTime = currentTime.ToDateTime().ToLocalTime();
Include extra data - (Currently only hourly is supported by the API) Returns hourly data for the next seven days, rather than the next two. Please note that you cannot specify a date (TimeMachine request) as the extend parameter will be ignored.
using ForecastIO;

var extendBlocks = new Extend[]
{
    Extend.hourly
};

var request = new ForecastIORequest("YOUR API KEY", 37.8267f, -122.423f, Unit.si, extendBlocks);
var response = request.Get();
Exclude certain objects (returned as null)
using ForecastIO;

var excludeBlocks = new Exclude[]
{
    Exclude.alerts,
    Exclude.currently
};

var request = new ForecastIORequest("YOUR API KEY", 37.8267f, -122.423f, DateTime.Now, Unit.si, null, excludeBlocks);
var response = request.Get();

Once a request has been made with Get() two properties namely ApiResponseTime and ApiCallsMade will be accesible on the request object. Please note that if a request has not yet been made an exception will be thrown.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4