Node.js client for the Lelylan API

Lelylan API for Node.js

Node.js client library for Lelylan API

Node client library is tested against Node ~0.8.x

Install the client library using npm:

$ npm install lelylan-node

Install the client library using git:

$ git clone git://github.com/lelylan/lelylan-node.git
$ cd lelylan-node
$ npm install

Before calling Lelylan APIs you need to set the access token using Simple OAuth2.

// Set the OAuth2 client credentials 
var credentials = { client: { id: '<client-id>', secret: '<client-secret>', site: 'https://example.org' }};
// Initialize the OAuth2 Library 
var OAuth2 = require('simple-oauth2')(credentials);
// Authorization OAuth2 URI 
var authorization_uri = OAuth2.AuthCode.authorizeURL({ redirect_uri: 'http://localhost:3000/callback' });
// Redirect example using Express (see http://expressjs.com/api.html#res.redirect) 
// Get the access token object (the authorization code is given from the previous step). 
var token;
OAuth2.AuthCode.getToken({ code: 'authorization-code', redirectURI: 'http://localhost:3000/callback' },
  function(errorresult) { token = OAuth2.AccessToken.create(result); }
// Initialize Lelylan Node library 
Lelylan = require('lelylan-node')({ token: token });
// Get all devices 
Lelylan.Devices.all(function(errorresponse) {

Using Simple OAuth2 the access token is automatically refreshed when expired.

Configuration block.

options = { 'endpoint' : 'http://localhost:8000' }
Lelylan = require('lelylan')(options);

Fork the repo on github and send a pull requests with topic branches. Do not forget to provide specs to your contribution.

  • Fork and clone the repository.
  • Run npm install for dependencies.
  • Run npm test to execute all specs.
  • Run make test-watch to auto execute all specs when a file change.

Follow github guidelines.

Use the issue tracker for bugs. Mail or Tweet us for any idea that can improve the project.

Andrea Reginato

Special thanks to the following people for submitting patches.


Copyright (c) 2013 Lelylan. See LICENSE for details.