Giter Club home page Giter Club logo

transilien-api's Introduction

Transilien API 1.0.0

An asynchronous client library for the real time Transilien API.

const TransilienApi = require('transilien-api');

const client = new TransilienApi({
  basic_authorization: ''
});

client.nextDepartures(trainStation)
  .then(console.log)
  .catch(console.error);

Installation

npm install transilien-api

You can follow instructions here to get your access authorization.

const TransilienApi = require('transilien-api');

const client = new TransilienApi({
  basic_authorization: '<basic token>'
});

Requests

With endpoints

You now have the ability to make GET requests against the API via the convenience methods.

client.get(path, params);

You simply need to pass the endpoint and parameters to one of convenience methods. Take a look at the documentation site to reference available endpoints.

client.get(`/gare/87758011/depart/87384008/`);

With client methods

You can use the defined client methods to call endpoints.

client.nextDeparturesToDestination(87758011, 87384008);

Promises

The request will return Promise.

client.nextDeparturesToDestination(87758011, 87384008)
  .then(data => console.log(data))
  .catch(function (e) {
    throw e;
  });

transilien-api's People

Contributors

jgobillot avatar

Stargazers

Nicolas avatar

Watchers

James Cloos avatar Julien avatar

transilien-api's Issues

Api fails when not terminus is provided in the result

There are cases when the sncf API doesn't return a terminus for train' it's documented in the api as a case occurring if the terminus is not known in the referencial of stations of transilien.
For instance, it happens regularly when trying to get the results for Paris Saint Lazare.
In that case, there's an un aught exception raised in format module . extractNode tries to call unshift on a undefined value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.