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

hetzner-api-client

v0.2.1

Published

A NodeJS client for the Hetzner Robot API

Downloads

3

Readme

hetzner-api-client Build status

A nodeJS client for the Hetzner Robot API

Please note: I am in no way affiliated with Hetzner Online GmbH. I am just a developer trying to ease his work with a flexible API client.

Installation

Install using NPM:

npm i --save hetzner-api-client

Usage

First off, create a new API client instance:

var APIClient = require('hetzner-api-client'),
    robot = new APIClient({
      username: '<your Robot username>',
      password: '<your Robot password>'
    });

The client is all ready now and you can start using its methods:

robot.queryReverseDns('123.123.123.123').then(
  response => console.log(response),
  error => console.error(error)
);

Sample response for a valid IP address:

{
  "rdns": {
    "ip": "123.123.123.123",
    "ptr": "sub.domain.tld"
  }
}

Sample response for an invalid IP address:

IP_NOT_FOUND: ip not found

Error messages are structured like so:

<ERROR_CODE>: <error message>

Oh. Did I mention the client is completely promise-based? It will always return a promise to your requests.

Custom server proxies

Say you own one or two servers and want to execute multiple methods on them. Kind of enervating to have to specify the server IP each time, isn't it? Therefore, you can (since 0.0.5) create a proxy:

var thanos = robot.registerServer('123.123.123.123');

// see? no additional IP parameter necessary.
thanos.queryReverseDns().then( /* ... */ )
thanos.updateReverseDns('new.pointer.record.tld').then( /* ... */ )

Current status

I'm still in the process of adding API methods. Currently, around 40% are implemented, some need a final naming scheme and if necessary, some more will be rewritten. So even if the current version works as is, you should not rely on this in production. Though of course you can speed this up by committing :)

A word on tests

To start the tests, simply use npm test.
Obviously many API methods are pretty destructive, so in order to be able to test everything thoroughly, I decided to implement a simple pseudo-Hetzner API webserver based on restify. You can find it in the test folder as apiServer.js. It starts on port 8080 and tries to behave as exactly as possible as the original Hetzner API. That way, I can test the client safely and you can test the scripts you'll use it for. This is a freaking load of additional work though, so I'd appreciate some help here.

API Documentation

Official API docs can be found here.