0.2.0 • Published 8 years ago

sncf-api v0.2.0

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

#Sncf-API

Travis Coverage Status

This is a simple wrapper for the SNCF (French National Railways Company) API. -> for more info on the API itself

#Getting started

Terminal : install from npm

npm install sncf-api

JS

// import the wrapper
var SncfApi = require("sncf-api");

// set credentials
SncfApi.withCredentials('username','password');

// create a request with req(), fill it (here with the listNetworks instructions), when your request is good, use build() then execute()
SncfApi.req().listNetworks().build().execute(function(err, resp){
  // err is null if everything went good
});

#Chained instructions

// to list arrivals in a given networks
SncfApi.req().withNetwork('given-network-id').listArrivals().build().execute(function(err, resp){
  // err is null if everything went good
});    

You can chain every type of the following list :

  • Networks
  • Lines
  • Routes
  • StopPoints
  • StopAreas
  • Departures
  • Arrivals
  • CommercialModes
  • PhysicalModes
  • Companies
  • Places
  • PlacesNearby

For every type, you have 2 instructions :

  • list
  • with

eg : for the Lines type, you can use listLines() or withLine()

0.2.0

8 years ago

0.1.0

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago