Skip to content

zaoblako/megaplanjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Megaplan client module for NodeJS

A NodeJS library to work with megaplan.ru API

Provides a class that implements Megaplan authentication and request signing. Only supports POST requests. The complete API documentation is at: https://help.megaplan.ru/API

At first you need to install library

npm install megaplanjs --save

You can generate documentaion with commands:

npm install
npm run docs

Authorization

To authorize using a password:

var megaplan = require ('megaplanjs');
var client = new megaplan.Client('my.megaplan.ru').auth('me', 'pass');
client.on('auth', function (res, err) {
    // store res.access_id, res.secret_key if you need these (see below)
    console.log('authenticated', res, err);

    client.tasks().send(function (tasks) {
        console.log(tasks); // a lot of results
    }, function (err) {
        console.log(err);
    });
});

To authorize using tokens:

var megaplan = require ('megaplanjs');
var client = new megaplan.Client('xyz.megaplan.ru', access_id, secret_key);
client.tasks().send(function (tasks) {
    console.log(tasks); // still a lot of results
}, function (err) {
    console.log(err);
});

To authorize using one-time-key:

var megaplan = require ('megaplanjs');
var client = new megaplan.Client('xyz.megaplan.ru').auth('', '', '4gih4y4gih4yH77QebicH77Qebic');
client.tasks().send(function (tasks) {
    console.log(tasks); // still a lot of results
}, function (err) {
    console.log(err);
});

Data requests

Look index.js for information. It's pretty simple to use

Copylefts

Code originally written by Alexej Yaroshevich [email protected] under the MIT License.

Enjoy!

About

✈️ NodeJS Megaplan API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%