npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

oceanusancora

v0.0.1

Published

DigitalOcean API client wrapper

Downloads

8

Readme

OceanusAncora


A DigitalOcean API client for use with NodeJS.

Example

var oa = require('oceanusancora'),
    fs = require('fs');

var client = oa.createClient({
  client_id:  'id',
  api_key:    'key'
});

client.droplets.list(function (err, statusCode, body, response, res) {
  if (err) {
    console.log(err);
    return;
  }

  console.log(JSON.stringify(res, null, 2, true));
});

Take a look in the examples folder for more examples.

Install

Install using npm:

npm install oceanusancora

Command Line Options for scripts

Below is a list of options you may use when calling any scripts you may have written

-c --client_id X
-a --api_key X
--debug
--no-cookies
--timeout X(ms)
--proxy X
--encoding X

They are fairly self-explanatory no-cookies, timeout, proxy, encoding are all options to request. if using debug its reccomended you use --encoding utf8 or something similar as all you will see is a buffer otherwise in the response.

Because of these command line options you can try a few already from the examples section:

node examples/list_droplets.js -c <client_id> -a <api_key>

Methods

domains

// Listing Domains
list(cb)

// Create New Domain
new(name, ip_address, cb)

// Show A Domain
show(domain_id, cb)

// Destroy a Domain
destroy(domain_id, cb)

// Listing Records for a given Domain
records(domain_id, cb)

// Create a new Record for a given Domain
newRecord(domain_id, record_type, data, options, cb)

// Show a Record for a given Domain
showRecord(domain_id, record_id, cb)

// Destroy a Record for a given Domain
destroyRecord(domain_id, record_id, cb)

// Edit a Record for a given Domain
editRecord(domain_id, record_id, record_type, data, options, cb)

droplets

// Listing Droplets
list(cb)

// Add a new Droplet
new(name, size, image, region, options, cb)// options = {ssh_key_ids : 'string(CSV)', private_networking : boolean, backups_enabled: boolean}

// Show a Droplet
show(droplet_id, cb)

// Reboot a Droplet
reboot(droplet_id, cb)

// Power Cycle a Droplet
powerCycle(droplet_id, cb)

// Shut Down a Droplet
shutDown(droplet_id, cb)

// Power Off a Droplet
powerOff(droplet_id, cb)

// Power On a Droplet
powerOn(droplet_id, cb)

// Reset root password on a Droplet
passwordReset(droplet_id, cb)

// Resize a Droplet
resize(droplet_id, size, cb)

// Make a Snapshot of a Droplet
snapshot(droplet_id, name, cb)

// Restore a Droplet
restore(droplet_id, image_id, cb)

// Rebuild a Droplet
rebuild(droplet_id, image_id, cb)

// Rename a Droplet
rename(droplet_id, name, cb)

// Destroy a Droplet
destroy(droplet_id, scrub_data, cb)

events

// Listing Events
show(event_id, cb)

images

// Listing Images
list(filter, cb)

// Show an Image
show(image, cb)

// Destroy an Image
destroy(image, cb)

// Transfer an Image
transfer(image, region_id, cb)

regions

// Listing Regions
list(cb)

sizes

// Listing Sizes
list(cb)

ssh_keys

// Listing SSH_Keys
list(cb)

// Add a new SSH Key
new(name, ssh_pub_key, cb)

// Show a SSH Key
show(ssh_key_id, cb)

// Edit a SSH Key
edit(ssh_key_id, options, cb) // options = {name: 'string', ssh_pub_key: 'string'}

// Destroy a SSH Key
destroy(ssh_key_id, cb)

Tests

npm test todo: further client testing; nock reply data does not represent what DigitalOcean responds with in all cases, but is currently unused.

License

MIT.