node-trafikinfo
npm module for connecting to the swedish trafikinfo API
Last updated 5 years ago by theolll .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-trafikinfo 
SYNC missed versions from official npm registry.

Node Trafikinfo

Utility for connecting to the Swedish transit api in node. Takes any options specified here and a callback.
Module is incomplete and untested please don't use

##Setup

npm install node-trafikinfo
var trafikClient = require('node-trafikinfo'),
	trafikinfo = new trafikClient('yourapikey');

Query departing train times

trafikinfo.get(
	{
		objectType: 'TrainAnnouncement',
		orderBy: 'ScheduledDepartureDateTime',
		filter: [
			{ ActivityType: 'Avgang' },
			{ LocationSignature: queryObj.from },
			{ ToLocation: queryObj.to },
			{ AdvertisedTimeAtLocation: ['-00:15:00','14:00:00'] }
		],
		includes: [
			'AdvertisedTrainIdent',
			'ScheduledDepartureDateTime',
			'ToLocation'
		]
	},
	function(data) {
		console.log(data)
	}
)

An example of querying all Train Station results:

trafikinfo.get(
	{
		objectType: 'TrainStation',
		includes: [
			'Prognosticated',
			'AdvertisedLocationName',
			'LocationSignature'
		],
	},
	function(data) {
		console.log(data)
	}
)

An example of querying railway messages at a location:

trafikinfo.get(
	{
		objectType: 'TrainMessage',
		orderBy: 'AdvertisedTimeAtLocation',
		filter: [
			{ AffectedLocation:'Cst' }
		],
		includes: [
			'StartDateTime',
			'LastUpdateDateTime',
			'ExternalDescription',
			'ReasonCodeText'
		]
	},
	function(data) {
		console.log(data)
	}
)

An example of querying a train's timetable:

trafikinfo.get(
	{
		objectType: 'TrainAnnouncement',
		filter: [
			{ AdvertisedTrainIdent: '535' }
		],
	},
	function(data) {
		console.log(data)
	}
)

Current Tags

  • 0.0.9                                ...           latest (5 years ago)

9 Versions

  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 0
Last Month 10
Dependencies (2)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2017 © taobao.org |