aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-09-29 00:09:32 +0300
committerValentin Popov <info@valentineus.link>2017-09-29 00:09:32 +0300
commitd27bc8b359d3c52488c5ba5d01d00a8c0dedb5ff (patch)
tree77a74d499e5447ecb2ec8acf5fb6183b416f83d6
parent459ab8bae6525a11e17068bb1652b3ec961b36a4 (diff)
downloadiii-client-d27bc8b359d3c52488c5ba5d01d00a8c0dedb5ff.tar.xz
iii-client-d27bc8b359d3c52488c5ba5d01d00a8c0dedb5ff.zip
Release of version 3.0.0.
-rw-r--r--CHANGELOG.md6
-rw-r--r--README.md115
-rw-r--r--package.json2
3 files changed, 84 insertions, 39 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fad500..8e5783d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,10 @@
# Description of releases
+## 3.0.0 (29-09-2017)
+Features:
+- Full code refactoring.
+- Added testing system.
+- Return to the callbacks and the rejection of Promise in favor of simplicity and lightness.
+
## 2.1.0 (28-09-2017)
Features:
- The assembly system has been reworked, now the package is being assembled for use in browsers.
diff --git a/README.md b/README.md
index c673c29..629aac4 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,41 @@
# III Client
-[![npm](https://img.shields.io/npm/v/iii-client.svg)](https://www.npmjs.com/package/iii-client)
+<p align="justify">
+ <a href="https://www.npmjs.com/package/iii-client">
+ <img alt="NPM" src="https://img.shields.io/npm/v/iii-client.svg">
+ </a>
+ <a href="https://travis-ci.org/valentineus/iii-client">
+ <img alt="Build Status" src="https://travis-ci.org/valentineus/iii-client.svg?branch=master">
+ </a>
+ <a href="https://www.codacy.com/app/valentineus/iii-client">
+ <img alt="Codacy Badge" src="https://api.codacy.com/project/badge/Grade/81b2fdc2f5dd42a6bdc8fdb43640b282">
+ </a>
+ <a href="https://www.codacy.com/app/valentineus/iii-client/files">
+ <img alt="Codacy Coverage Badge" src="https://api.codacy.com/project/badge/Coverage/81b2fdc2f5dd42a6bdc8fdb43640b282">
+ </a>
+ <a href="https://david-dm.org/valentineus/iii-client?type=dev">
+ <img alt="devDependencies Status" src="https://david-dm.org/valentineus/iii-client/dev-status.svg">
+ </a>
+</p>
+<p align="justify">
+ <a href="https://www.libhive.com/providers/npm/packages/iii-client">
+ <img alt="libhive Badge" src="https://www.libhive.com/providers/npm/packages/iii-client/examples/badge.svg">
+ </a>
+ <a href="https://runkit.com/npm/iii-client">
+ <img alt="RunKit Badge" src="https://badge.runkitcdn.com/stripe.svg">
+ </a>
+ <a href="https://gitter.im/iii-client">
+ <img alt="Gitter Badge" src="https://badges.gitter.im/Join%20Chat.svg">
+ </a>
+</p>
Simple API for communicating with the bot of the \"iii.ru\" service.
-**Attention!** At the moment there are difficulties with the `iii.ru` service, there is a possibility that the service will not be restored. All information on the company's
-[forum](http://forum.iii.ru/index.php?showtopic=19886).
-
## Features
- A small and light library.
-- Receiving and sending messages.
-- Installation and processing of sessions.
+- Works, both in NodeJS, and in the browser.
+- Getting session ID.
+- Sending and receiving messages.
+- Does not process incoming errors.
## Installation
NodeJS:
@@ -20,55 +46,68 @@ npm install --save iii-client
Browser:
```html
<script src="https://unpkg.com/iii-client@latest/dist/bundle.js">
- /* client - This is the global name for accessing the package */
+ /* iiiClient - This is the global name for accessing the package */
</script>
```
## Using
An example of a connection, receiving session identification and sending a bot message:
```javascript
-import client from 'iii-client';
-
-const uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
-const text = 'Hello, World!';
-
-// We connect to the system and get a session
-client.connect(uuid).then(session => {
- // Send the message and process the response
- client.send(session.cuid, text).then(answer => {
- console.info(answer);
- });
-}).catch(error => console.error(error.message));
+import { connect, send } from 'iii-client';
+
+var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
+var text = 'Hello, World!';
+
+/* We connect to the system and get a session */
+connect(uuid, (request) => {
+ console.info(`Session: ${request}`);
+ /* Send the message and process the response */
+ if (request.result) {
+ var cuid = request.result.cuid;
+ send(cuid, text, (answer) => {
+ console.info(`Answer: ${answer}`);
+ });
+ }
+});
```
## API
-### Functions
-
-#### connect(uuid)
-Connects to the server and returns the connection data.
-
-**Promise**: <code>Object</code> Answer from the server.
-
-**Rejects**: <code>Error</code> If there are errors in operation.
+## Functions
+<dl>
+ <dt>
+ <a href="#connect">connect(uuid, callback)</a>
+ </dt>
+ <dd>
+ <p>Connection to the service and retrieves the session identifier.</p>
+ </dd>
+ <dt>
+ <a href="#send">send(cuid, text, callback)</a>
+ </dt>
+ <dd>
+ <p>Sends a message to bot and returns a response.</p>
+ </dd>
+</dl>
+
+<a name="connect"></a>
+
+## connect(uuid, callback)
+Connection to the service and retrieves the session identifier.
| Param | Type | Description |
| --- | --- | --- |
-| uuid | <code>String</code> | The bot ID. |
-
-#### send(cuid, text)
-Send a message to the server and return a response.
+| uuid | <code>String</code> | Bot ID |
+| callback | <code>function</code> | Function handler |
-**Promise**: <code>Object</code> Answer from the server.
+<a name="send"></a>
-**Rejects**: <code>Error</code> If there are errors in operation.
+## send(cuid, text, callback)
+Sends a message to bot and returns a response.
| Param | Type | Description |
| --- | --- | --- |
-| cuid | <code>String</code> | Session identifier. |
-| text | <code>String</code> | Message text. |
-
-Found out a mistake or feel a lack of functionality?
-[issues](https://github.com/valentineus/iii-client/issues)
+| cuid | <code>String</code> | Session ID |
+| text | <code>String</code> | Send messages |
+| callback | <code>function</code> | Function handler |
## License
[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/eslint/eslint)
diff --git a/package.json b/package.json
index 3f03670..7165860 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "iii-client",
- "version": "2.1.0",
+ "version": "3.0.0",
"description": "Simple API for communicating with the bot of the \"iii.ru\" service.",
"homepage": "https://github.com/valentineus/iii-client",
"license": "MIT",