1.0.2 • Published 6 years ago

node-blablacar v1.0.2

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

NodeJS wrapper around Blablacar API

This NPM module allows you easily to retrieve data from Blablacar through their API.

Todo

  • Update as the Blablacar API changes
  • Use ES6 promises instead of callbacks

Installation

Install with npm:

    $ npm install node-blablacar

Install via Git clone:

    $ git clone https://github.com/ojathelonius/node-blablacar.git
    $ cd node-blablacar
    $ npm install

Documentation

Please use the Blablacar API documentation for all the details. Usage examples are shown below.

Examples

Set-up the client

import BlablacarClient from "node-blablacar";

var client = new BlablacarClient("your_api_key");

Run a trip search with given parameters (see full list of parameters here

client
  .searchTrip({
    fn: "Paris",
    tn: "Berlin",
    format: "json",
    locale: "fr_FR",
    cur: "EUR",
    db: "2017-10-22",
    de: "2017-10-25",
    hb: 7,
    he: 14,
    seats: 1
  })
  .then(function(result) {
    // Do something with the result
  })
  .catch(function(err) {
    // Handle the error
  });

Retrieve details from a given trip

client
  .getTripDetails({
    Trip_ID: "906288359-massy-angers",
    locale: "fr_FR",
    format: "json"
  })
  .then(function(result) {
    // Do something with the result
  })
  .catch(function(err) {
    // Handle the error
  });