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

do-api

v0.0.5

Published

DigitalOcean API v2.0 for Node.js

Downloads

13

Readme

node-do-api

NPM Version NPM Downloads Codacy Badge Gratipay

DigitalOcean API v2.0 for Node.js

Installation

npm install do-api --save

Configuration

Create a api token on digitalocean and save it under config/Default.json

{
  "Token": "y0wCcq9UvKuSHm39q5FQqbT6K8oU7o1D2Fc723658ds1DHyXzkztt0sFQRG8JplK"
}

Code Example

var api = require('do-api');

api.getAccount()
  .then(function(account) {
    ...
  })
  .fail(function (error) {
    ...
  });

Usage

For further details visit the original API Documentation on here

Account

api.getAccount()
  .then(function(account) {
    ...
  });

Actions

Get all actions

api.getActions()
  .then(function(actions) {
    ...
  });

Get action by id

api.getAction(action_id)
  .then(function(action) {
    ...
  });

Domains

Get all domains

api.getDomains()
  .then(function(domains) {
    ...
  });

Get domain by name

api.getDomain(name)
  .then(function(domain) {
    ...
  });

Add domain

api.addDomain(name, ip_address)
  .then(function(domain) {
    ...
  });

Delete domain

api.deleteDomain(name)
  .then(function() {
    ...
  });

Domain Records

Get all records of by domain name

api.getDomainRecords(domain_name)
  .then(function(records) {
    ...
  });

Get domain record by id

api.getDomainRecord(record_id)
  .then(function(record) {
    ...
  });

Add record to a domain

api.addDomainRecord(domain_name, type, name, data, priority, port, weight)
  .then(function(domain) {
    ...
  });

Update an existing domain record

api.updateDomainRecord(domain_name, record_id, type, name, data, priority, port, weight)
  .then(function(domain) {
    ...
  });

Delete domain record

api.deleteDomainRecord(domain_name, record_id)
  .then(function() {
    ...
  });

Droplets

Get your droplets

api.getDroplets()
  .then(function(droplets) {
    ...
  });

Get droplet by id

api.getDroplet(domain_id)
  .then(function(droplet) {
    ...
  });

Create droplet

api.addDroplet(name, region, size, image, ssh_keys, backups, ipv6, user_data, private_networking)
  .then(function(droplet) {
    ...
  });

Delete droplet by id

api.deleteDroplet(droplet_id)
  .then(function() {
    ...
  });

Get available droplet kernels

api.getDropletKernels(droplet_id)
  .then(function(kernels) {
    ...
  });

Get droplet snapshots

api.getDropletSnapshots(droplet_id)
  .then(function(snapshots) {
    ...
  });

Get droplet backups

api.getDropletBackups(droplet_id)
  .then(function(backups) {
    ...
  });

Get droplet actions

api.getDropletActions(droplet_id)
  .then(function(actions) {
    ...
  });

Get droplet neighbors

api.getDropletNeighbors(droplet_id)
  .then(function(droplets) {
    ...
  });

Get neighbors

api.getNeighbors()
  .then(function(neighbors) {
    ...
  });

Droplet Actions

Disable backup on droplet

api.disableBackupOnDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Reboot droplet

api.rebootDroplet(droplet_id)
  .then(function(action) {
    ...
  });

PowerCycle droplet

api.powerCycleDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Shutdown droplet

api.shutdownDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Power Off droplet

api.powerOffDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Power On droplet

api.powerOnDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Restore droplet

api.restoreDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Reset password on droplet

api.passwordResetOnDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Resize droplet

api.resizeDroplet(droplet_id, size)
  .then(function(action) {
    ...
  });

Rebuild droplet

api.rebuildDroplet(droplet_id, image)
  .then(function(action) {
    ...
  });

Rename droplet

api.renameDroplet(droplet_id, name)
  .then(function(action) {
    ...
  });

Change kernel on droplet

api.changeKernelOnDroplet(droplet_id, kernel)
  .then(function(action) {
    ...
  });

Enable ipv6 on droplet

api.enableIpv6OnDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Enable private networking on droplet

api.enablePrivateNetworkingOnDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Snapshot droplet

api.snapshotDroplet(droplet_id, name)
  .then(function(action) {
    ...
  });

Upgrade droplet

api.upgradeDroplet(droplet_id)
  .then(function(action) {
    ...
  });

Get action of droplet

api.getDropletAction(droplet_id, action_id)
  .then(function(action) {
    ...
  });

Images

Get images

api.getImages()
  .then(function(images) {
    ...
  });

Get distribution images

api.getDistributionImages()
  .then(function(images) {
    ...
  });

Get application images

api.getApplicationImages()
  .then(function(images) {
    ...
  });

Get user images

api.getUserImages()
  .then(function(images) {
    ...
  });

Get image

api.getImage(image_id)
  .then(function(image) {
    ...
  });

Image Actions

Get action of image

api.getImageAction(image_id, action_id)
  .then(function(action) {
    ...
  });

Update name of image

api.updateImage(image_id, name)
  .then(function(image) {
    ...
  });

Delete Image by id

api.deleteImage(image_id)
  .then(function() {
    ...
  });

Transfer image

api.transferImage(image_id, region)
  .then(function(action) {
    ...
  });

SSH Keys

Get SSH Keys

api.getSSHKeys()
  .then(function(keys) {
    ...
  });

Add SSH key

api.addSSHKey(name, public_key)
  .then(function(key) {
    ...
  });

Get SSH key by id

api.getSSHKey(key_id)
  .then(function(key) {
    ...
  });

Update name of SSH key

api.updateSSHKey(key_id, name)
  .then(function(key) {
    ...
  });

Delete SSH key

api.deleteSSHKey(key_id)
  .then(function() {
    ...
  });

Regions

Get regions

api.getRegions()
  .then(function(regions) {
    ...
  });

Sizes

Get sizes

api.getSizes()
  .then(function(sizes) {
    ...
  });