nautical

1.0.0 • Public • Published

It's a wrap(per)

This node module wraps DigitalOcean's v2 API.

Install

Install the module by running the following commands on your command line

$ npm install --save nautical

Usage

It's encouraged to put your DigitalOcean API token in a configuration file like:

File: config.json

{
    "nautical": {
        "token": "your_token_here"
    }
}

Then you can use the wrapper like this:

var config         = require('./config.json').nautical,
    nauticalClient = require('nautical').getClient(config),
    imageList = [];
 
nauticalClient.images.list(callback);
 
function callback(err, reply) {
    if (err) throw err;
    console.log({
        responseBody: reply.body,
        statusCode: reply.res.statusCode,
        headers: reply.res.headers
    });
 
    imageList = imageList.concat(reply.body.images);
 
    // get the next page
    if ('function' === typeof reply.next)
        reply.next(callback);
    else
        console.log(imageList);
}

Participate in development

Pull requests will be greatly appreciated :)

More information

For more information visit the DigitalOcean developers portal

Package Sidebar

Install

npm i nautical

Weekly Downloads

9

Version

1.0.0

License

MIT

Last publish

Collaborators

  • pauldenotter