skynode

a node.js client for the sky behavioral database

npm install skynode
1 downloads in the last week
13 downloads in the last month

Skynode

A low level client for the Sky database. Operates using the HTTP protocol.

Currently very alpha and lacking tests and docs. Doesn't maintain any form of state and currently really have understanding of the data it's returned by the sky server. Designed largely for higher level clients to be built on top of it

The api/naming/style is by no means fixed at this stage and is open to suggested changes or pull requests.

Stability Index

Based up on node.js stability index

Stability: 1 - Experimental

Installation

npm install skynode

Depenendecies

The request module us currently used to make all HTTP requests. Nor particularly tied to it though.

Usage

Instantiate a client. Only supported option is host which is non-optional.

var skynode = require('skynode');

var opts = {host:localhost:8585}

var client = skynode.createClient(opts);

Currently all methods expect a callback as their last argument and that callback will be passed 2 args, err and response. e.g

var callback = function(err, response) {
    if(err) {
        console.error(err);
    } else {
        console.log(response);
    }
}

Tables API

List tables

client.listTables(function(err, res){
    console.log(res);
    //[
    //{name: 'users-table'}
    //{name: 'anotherTable'}
    //]
})

Get a table

client.getTable('users-table', function(err, res){
    console.log(res);
    //{name: 'users-table'}
})

Get a table's stats

client.getTableStats('users-table', function(err, res){
    console.log(res);
    //{count: 2}
})

Create a table

client.createTable('users-table', function(err, res){
    console.log(res);
    //{name: 'users-table'}
})

Delete a table

client.deleteTable('users-table', function(err, res){
    console.log(res);
    //`null`
})

Properties API

List properties for a table

client.listProperties('users-table', function(err, res){
    console.log(res);
    //[
    //{"id":1,"name":"uname","transient":false,"dataType":"string"}
    //{"id":2,"name":"type","transient":false,"dataType":"string"}
    //]
})

Create a property

var property = {
    name: "check",
    transient: false,
    dataType: "string"
}
client.addProperty(property, 'users-table', function(err, res){
    console.log(res);
    //{"id":2,"name":"check","transient":false,"dataType":"string"}
})

Get a property

```
__Rename a property__

```javascript

Delete a property

```
---------

### Events API


__List events for an object__

```javascript

Delete all events for an object

```

__Get an event__

```javascript

Replace an event

```

__Merge an event__

```javascript

Delete an event

```
---------

### Query API

```javascript

Misc APIs

Ping

client.ping(function(err, res){
    console.log(res.message); //Should return 'ok'
})
npm loves you