# megaplanjs

> NodeJS Megaplan API

Latest version **1.0.4** (published 2020-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install megaplanjs
pnpm add megaplanjs
yarn add megaplanjs
bun add megaplanjs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-01-13 |
| First published | 2013-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 62.7 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Alex Yaroshevich |
| Maintainers | atnartur, qfox |
| Keywords | megaplan, api, node |

## Links

- npm: https://www.npmjs.com/package/megaplanjs
- Repository: https://github.com/zxqfox/megaplanjs
- Homepage: https://github.com/zxqfox/megaplanjs#readme
- Issues: https://github.com/zxqfox/megaplanjs/issues
- npm.io page: https://npm.io/package/megaplanjs

## Dependencies (1)

- [qs](https://npm.io/package/qs.md) ~4.0.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2020-01-13
- 1.0.3 — 2018-10-02
- 1.0.2 — 2018-09-29
- 1.0.1 — 2017-08-27
- 1.0.0 — 2016-02-03
- 0.2.0 — 2015-08-10
- 0.1.0 — 2015-06-04
- 0.0.2 — 2013-02-04
- 0.0.1 — 2013-02-01

## 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.html

At 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 <zxqfox@gmail.com> under the MIT License.

Enjoy!

---
_Source: https://npm.io/package/megaplanjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
