Skip to content

novagen/trafikinfo

Repository files navigation

Trafikinfo

License Build Status NuGet CodeFactor

C# library to fetch data from Trafikverket Trafikinfo API.

This is not an official library from Trafikverket.

You can find more information about the API here

Installation

PM> Install-Package Trafikinfo

Example

Fetch information about Stockholm Central station.

using(var api = new Trafikinfo(new Configuration { Key = "yoursecretkey", Referer = "https://www.yourdomain.com" }))
{
    var request = new Request();
    request.AddQuery(new Query(ObjectType.TrainStation));
    request.Queries[0].Filter.AddOperator(new FilterOperator(OperatorType.Equals, "LocationSignature", "cst"));

    var response = api.Request(request);
}

Dependencies

The following dependencies are used.

Tests

Tests are using NUnit

There is an example .runsettings included. Copy it to .runsettings and add your API-key in it. You can get a key at Trafikverket.

About

C# library to fetch data from Trafikverket Trafikinfo API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published