Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qfox/megaplanjs
:airplane: NodeJS Megaplan API
https://github.com/qfox/megaplanjs
Last synced: 23 days ago
JSON representation
:airplane: NodeJS Megaplan API
- Host: GitHub
- URL: https://github.com/qfox/megaplanjs
- Owner: qfox
- Created: 2013-02-01T02:43:58.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T09:15:24.000Z (over 1 year ago)
- Last Synced: 2024-09-23T08:18:50.772Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 16
- Watchers: 2
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Megaplan client module for NodeJS
---------------------------------A NodeJS library to work with megaplan.ru API ver. 1
Provides a class that implements Megaplan authentication and request signing.
Only supports POST requests. The complete API documentation is at:
https://dev.megaplan.ru/api/index.htmlAt first you need to install library
```sh
npm install megaplanjs --save
```You can generate documentaion with commands:
```sh
npm install
npm run docs
```Authorization
=============To authorize using a password:
```js
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:
```js
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:
```js
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);
});
```Usage
=====```js
var megaplan = require("megaplanjs");
// SET here your megaplan URL, login and password
var client = new megaplan.Client("my.megaplan.ru").auth("me", "pass");client.on("auth", function(res, err) {
// show user's tasks
client.tasks({ folder: "owner" }).send(
function(tasks) {
console.log(tasks);
},
function(err) {
console.log(err);
}
);
});
```Look `index.js` for more examples. It's pretty simple to use
Copylefts
=========Code originally written by Alexej Yaroshevich under the MIT License.
Enjoy!