nautical
Version:
Wrapper for DigitalOcean's v2 API
55 lines (42 loc) • 1.14 kB
Markdown
# 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
```bash
$ npm install --save nautical
```
## Usage
It's encouraged to put your DigitalOcean API token in a configuration file like:
File: config.json
```javascript
{
"nautical": {
"token": "your_token_here"
}
}
```
Then you can use the wrapper like this:
```javascript
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](https://developers.digitalocean.com/v2)