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;
  });

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.