@gradecam/restler-q
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

restler-q Build Status

(C) Andrew Newdigate (@suprememoocow), Licensed under the MIT-LICENSE

An extremely simple Q promises wrapper for Don Wrong's Restler library.

Installing

npm install restler-q

Using

The interface is similar to Restler's interface:

var rest = require('restler-q');

rest.get('https://api.github.com/orgs/Troupe/repos')
  .then(function(repos) {
    assert(Array.isArray(repos));
  })
  .nodeify(done);

If you would like to gain access to the response object, do it like this

var rest = require('restler-q').spread; // Note the .spread on the end!
rest.get('https://api.github.com/orgs/Troupe/repos')
  .spread(function(repos, response) {
    // Use Q's `spread`, not `then` 
    assert(Array.isArray(repos));
  })
  .fail(function(err) {
    // err.response contains the HTTP Response
  })
  .nodeify(done);

Running the tests

npm install
make test

TODO

  • Provide ability to call abort and retry methods.

Package Sidebar

Install

npm i @gradecam/restler-q

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

14.4 kB

Total Files

9

Last publish

Collaborators

  • bloveridge
  • jaroml
  • rgigger
  • rumbcam
  • taxilian