eyrolles-api

Unofficial API for Eyrolles.com

EyrollesJS

This is an unofficial JS API for Eyrolles’ website.

[in development]

Usage

The API has some objects (e.g. Book, Publisher, etc), each one has a .fetch method, used to populate its attributes with the informations from the website.

Each API’s function get an object with various attributes:

  • query: the query string
  • limit: the maximum number of results (e.g. for a search), default is 20
  • offset: see limit (default: 0)
  • callback: a function called with the result(s)
  • error: a function called if there’s an error
var api = require( 'eyrolles-api' );
 
api.search({
    query: 'Foo',
    callbackfunction( q ) {
 
        console.log( q.results ); // `Book` objects 
 
    }
 
});
  • with its ISBN code: api.getBookByISBN( opts ), put the code in the query attribute of the opts object. This return a Book object.

If you have an Author object, its books attributes is the list of their books (you have to fetch them with the .fetch methods).