npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

irail-node

v0.0.2

Published

wrapper api for irail.be API

Downloads

4

Readme

iRail Api Node.js Wrapper

Synopsis

This projects helps you to make HTTP requests to the irail API.

Installation

npm install irail-node
var iralclient = require('irail-node');
// Public API

var client = new irailclient();

iRail API

The iRail api allows anyone to query trains, stations, liveboards and connections.

iRail api datasets are accessible by developers through an HTTP REST API.

API Index

The API is available at https://api.irail.be.

Methods

stations

Response

{ 
  id: '0',
  departure:
   { delay: '0',
     station: 'Liège-Guillemins',
     stationinfo: [Object],
     time: '1521085920',
     vehicle: 'BE.NMBS.IC2426',
     platform: '6',
     platforminfo: [Object],
     canceled: '0',
     departureConnection: 'http://irail.be/connections/8841004/20180315/IC2426',
     direction: [Object],
     left: '0',
     walking: '0',
     occupancy: [Object] 
   },
  arrival:
   { delay: '0',
     station: 'Namur',
     stationinfo: [Object],
     time: '1521088980',
     vehicle: 'BE.NMBS.IC2426',
     platform: '9',
     platforminfo: [Object],
     canceled: '0',
     direction: [Object],
     arrived: '0',
     walking: '0' 
   },
  duration: '3060',
  occupancy: 
    { 
      '@id': 'http://api.irail.be/terms/unknown', name: 'unknown' 
    } 
}

Examples Request: /api/stations param: lang: en,fr,nl

 client.stations(function (error, data) {
  if(error) console.log("E!",error)
  console.dir(data);
 });

disturbances

Response

{ 
  version: '1.1',
  timestamp: '1521241196',
  disturbance:
   [ 
      { 
         id: '0',
         title: 'Ath - Leuze: Collision with a road vehicle.',
         description: 'Train traffic interrupted between Ath and Leuze.Some IC trains from Kortrijk  to Sint-Niklaas  are diverted via Mons. IC trains from Brussels Airport - Zaventem  to Tournai  have Ath as their terminal station. Shuttle bus service between Ath and Tournai. Delays and cancellations are possible. Listen to the announcements in the train station. ',
         link: 'http://www.belgianrail.be/jp/sncb-nmbs-routeplanner/help.exe/en?tpl=showmap_external&tplParamHimMsgInfoGroup=trouble&messageID=26800&channelFilter=custom2,livemap,rss_line_10,twitter,custom1,timetable&',
         timestamp: '1521230603' 
      }
    ] 
}

Examples Request: /api/disturbances param: lang: en,fr,nl

 client.disturbances(function (error, data) {
  if(error) console.log("E!",error)
  console.dir(data);
 });

liveboard

Response

{ 
  version: '1.1',
  timestamp: '1521241528',
  station: 'Brussels-Central',
  stationinfo:
   { id: 'BE.NMBS.008813003',
     locationX: '4.356801',
     locationY: '50.845658',
     '@id': 'http://irail.be/stations/NMBS/008813003',
     name: 'Brussels-Central',
     standardname: 'Brussel-Centraal/Bruxelles-Central' },
  departures:
   { number: '50',
     departure:
      [ [Object]]
    }
}

Examples

Request: /api/liveboard

param: 
id: string (optional) Example: BE.NMBS.008892007     
lang: string (optional) Avaible: en,fr,de,nl
arrdep: departure, arrival 
station :string (required) The name of the station to query. Example: Gent-Sint-Pieters 
 client.liveboard(id,lang,station,arrdep,function (error, data) {
  if(error) console.log("E!",error)
  console.dir(data);
 });

connections

Response

{ 
  version: '1.1',
  timestamp: '1521241863',
  connection:
   [ 
    {  
       id: '0',
       departure: [Object],
       arrival: [Object],
       duration: '9060',
       vias: [Object],
       occupancy: [Object] 
     }
    ] 
}

Examples Request: /api/connections

param:  
lang: string (optional) Avaible: en,fr,de,nl
from:string (required) The name or id of the station of departure string (required) Example: Gent-Sint-Pieters
to :string (required) The name or id of the destination. Example: Gent-Sint-Pieters   
date:string (optional) Default: current date in Belgium Example: 300917 The date to query.
timesel:string (optional)  Whether the results should show arrivals departures in the station.Default: departure Example: departure.
typeOfTransport: string (optional)  The types of transport to include in the search Default: trains Example: trains .
 client.connections(from,to,lang,date,timesel,typeOfTransport,function (data) {
  console.dir(data);
 });

vehicle

Response

{ 
  version: '1.1',
  timestamp: '1521242220',
  vehicle: 'BE.NMBS.IC1832',
  vehicleinfo:
   { locationX: '4.421101',
     locationY: '51.2172',
     name: 'BE.NMBS.IC1832',
     shortname: 'IC1832',
     '@id': 'http://irail.be/vehicle/IC1832' },
  stops:
   { number: '8',
     stop:
      [ [Object]
      ] 
    } 
}

Examples

Request: /api/vehicle

params: 
id: string (optional) Example: BE.NMBS.008892007  
date:string (optional) Default: current date in Belgium Example: 300917 The date to query.
lang: string (optional) Avaible: en,fr,de,nl     
 client.vehicle(id,lang,date,function (data) {
  console.dir(data);
 });

API Reference

https://docs.irail.be/

https://github.com/iRail/hyperRail

Contributors

Anis Haboubi

License

See LICENSE.txt for more info.