3.2.2 • Published 6 years ago

iii-client v3.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

III Client

GitHub Release NPM Build Status Codacy Badge Codacy Coverage Badge Gitter Badge

Simple API for communicating with the bot of the \"iii.ru\" service.

Features

  • Multiplatform library.
  • A small and light library.
  • Getting session ID.
  • Sending and receiving messages.

Installation

NodeJS:

npm install --save iii-client

Browser:

<script src="https://unpkg.com/iii-client@latest/dist/bundle.js">
    /* 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:

import { connect, send } from 'iii-client';

var uuid = '109cd867-0ef3-4473-af71-7543a9b2fccd';
var cuid = '0340feab-b09e-4960-96e9-c9518b1fb157';
var text = 'Hello, World!';

/* We connect to the system and get a session */
connect(uuid, (request) => {
    console.info(`Session: ${request.result.cuid}`);
});

/* Send the message and process the response */
send(cuid, text, (answer) => {
    console.info(`Answer: ${answer.result.text.value}`);
});

API

Functions

connect(uuid, callback)

Connection to the service and retrieves the session identifier.

ParamTypeDescription
uuidStringBot ID
callbackfunctionFunction handler

send(uuid, text, callback)

Sends a message to bot and returns a response.

ParamTypeDescription
uuidStringSession ID
textStringThe message you are sending
callbackfunctionFunction handler

License

JavaScript Style Guide

MIT. Copyright (c) Valentin Popov.

3.2.2

6 years ago

3.2.1

7 years ago

3.2.0

7 years ago

3.0.1

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago