0.4.0 • Published 6 years ago

mango-client v0.4.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
6 years ago

Node.js Mango API Client

Mango Automation REST API client for Node.js written in ES6.

Usage

Run "npm install mango-client" first

const MangoClient = require('mango-client');

const client = new MangoClient({
    protocol: 'https',
    host: 'localhost',
    port: 8443,
    rejectUnauthorized: false
});

const DataPoint = client.DataPoint;
const User = client.User;

User.login('admin', 'admin').then(data => {
    console.log(`Logged in as '${data.username}'.`);
    return DataPoint.getValue('internal_mango_num_data_points');
}).then(data => {
    console.log(`There are ${data.value} data points.`);

    // you can perform any arbitrary rest request like this
    return client.restRequest({
        path: '/rest/v1/data-points/internal_mango_num_data_points',
        method: 'GET',
        //data: {object}
    });
}).then(response => {
    console.log(`The data point's name is '${response.data.name}'`);
});
0.4.0

6 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago