Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Pegase745/node-gandi
Node.js client for Gandi.net XML-RPC API.
https://github.com/Pegase745/node-gandi
Last synced: 20 days ago
JSON representation
Node.js client for Gandi.net XML-RPC API.
- Host: GitHub
- URL: https://github.com/Pegase745/node-gandi
- Owner: Pegase745
- License: mit
- Created: 2013-01-06T23:45:07.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-07-30T08:17:39.000Z (over 9 years ago)
- Last Synced: 2024-11-23T02:13:06.256Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 198 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-gandi
[![npm version](https://badge.fury.io/js/node-gandi.svg)](http://badge.fury.io/js/node-gandi) [![Build Status](https://travis-ci.org/Pegase745/node-gandi.svg?branch=master)](https://travis-ci.org/Pegase745/node-gandi) [![Dependency Status](https://david-dm.org/pegase745/node-gandi.svg)](https://david-dm.org/pegase745/node-gandi) [![devDependency Status](https://david-dm.org/pegase745/node-gandi/dev-status.svg)](https://david-dm.org/pegase745/node-gandi#info=devDependencies) [![Inline docs](http://inch-ci.org/github/pegase745/node-gandi.svg?branch=master)](http://inch-ci.org/github/pegase745/node-gandi)
[![NPM](https://nodei.co/npm/node-gandi.png?downloads=true&downloadRank=true)](https://nodei.co/npm/node-gandi/)
[Node.js](http://nodejs.org/) client for Gandi.net XML-RPC [API](http://doc.rpc.gandi.net/).
## Installation
``` bash
$ npm install --save node-gandi
```## Usage
Start by instantiating a Gandi client
``` js
var cli = require('node-gandi');
var apikey = 'your-24-char-apikey';var gandi = new cli(apikey); // or new cli(apikey, true); for OT&E
```The client exposes four methods to use in your code.
### gandi.call (method, params, callback)
Returns the result(s) of the API call to the method given in parameter.``` js
var gandi = new cli(apikey, true);
var domain = 'pegase745.org';var cb = function(err, data) {
if (data[domain] == 'pending') {
console.log('result is not yet ready')
setTimeout(function() {
gandi.call('domain.available', [[domain]], cb);
}, 700)
}
else {
console.dir(data);
}
}gandi.call('domain.available', [[domain]], cb);
```### gandi.list (callback)
Returns the list of available methods in the API.``` js
var gandi = new cli(apikey, true);gandi.list(function(err, data) {
if (err) throw err;
console.log(data);
});```
### gandi.signature (method, callback)
Returns the signature of the API method given in parameter.``` js
var gandi = new cli(apikey, true);gandi.signature('domain.list', function(err, data) {
if (err) throw err;
console.log(data);
});```
### gandi.help (method, callback)
Returns a help for the API method given in parameter.``` js
var gandi = new cli(apikey, true);gandi.help('domain.list', function(err, data) {
if (err) throw err;
console.log(data);
});```
## Run tests
``` bash
$ sudo ote_apikey=your-24-char-apikey npm test
```## License
MIT