diff options
author | Valentin Popov <info@valentineus.link> | 2017-05-29 07:02:09 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2017-05-29 07:02:09 +0300 |
commit | c43c75e3d1c4c7a9b2fb71c7cf7e1086ea8fddf4 (patch) | |
tree | 0b1f3313312bdb00ef48f2a4fbfd43939f5140b3 /docs | |
parent | cb354fc09830944839ae4221a0bbe485d2cb64dd (diff) | |
download | iii-client-c43c75e3d1c4c7a9b2fb71c7cf7e1086ea8fddf4.tar.xz iii-client-c43c75e3d1c4c7a9b2fb71c7cf7e1086ea8fddf4.zip |
Release of version 0.0.3.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/_config.yml | 1 | ||||
-rw-r--r-- | docs/global.html | 18 | ||||
-rw-r--r-- | docs/index.html | 2 | ||||
-rw-r--r-- | docs/index.js.html | 54 |
4 files changed, 31 insertions, 44 deletions
diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 2f7efbe..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-minimal
\ No newline at end of file diff --git a/docs/global.html b/docs/global.html index 3d2919f..bcec003 100644 --- a/docs/global.html +++ b/docs/global.html @@ -234,7 +234,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line149">line 149</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line140">line 140</a> </li></ul></dd> @@ -471,7 +471,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line98">line 98</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line92">line 92</a> </li></ul></dd> @@ -631,7 +631,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line113">line 113</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line106">line 106</a> </li></ul></dd> @@ -791,7 +791,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line83">line 83</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line78">line 78</a> </li></ul></dd> @@ -951,7 +951,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line128">line 128</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line120">line 120</a> </li></ul></dd> @@ -1111,7 +1111,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line175">line 175</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line165">line 165</a> </li></ul></dd> @@ -1267,7 +1267,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line14">line 14</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line15">line 15</a> </li></ul></dd> @@ -1428,7 +1428,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line50">line 50</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line48">line 48</a> </li></ul></dd> @@ -1635,7 +1635,7 @@ <br class="clear"> <footer> - Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon May 29 2017 02:00:06 GMT+0300 (MSK) using the Minami theme. + Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon May 29 2017 07:00:49 GMT+0300 (MSK) using the Minami theme. </footer> <script>prettyPrint();</script> diff --git a/docs/index.html b/docs/index.html index 96792a6..f19634a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -57,7 +57,7 @@ <br class="clear"> <footer> - Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon May 29 2017 02:00:06 GMT+0300 (MSK) using the Minami theme. + Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon May 29 2017 07:00:49 GMT+0300 (MSK) using the Minami theme. </footer> <script>prettyPrint();</script> diff --git a/docs/index.js.html b/docs/index.js.html index 3749990..29aeb27 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -47,12 +47,13 @@ var http = require('http'); +exports.connect = connect; /** * Connects to the server and returns the connection data. * @param {String} uuid - The bot UUID. * @param {requestCallback} callback - The callback that handles the response. */ -var connect = function(uuid, callback) { +function connect(uuid, callback) { uuid = uuid || ''; if (!_verification(uuid)) { @@ -64,7 +65,7 @@ var connect = function(uuid, callback) { hostname: 'iii.ru', path: '/api/2.0/json/Chat.init/' + uuid + '/', method: 'GET', - } + }; const request = http.request(query, function(response) { var json = ''; @@ -72,15 +73,12 @@ var connect = function(uuid, callback) { response.on('end', () => callback(json.result)); }); - request.on('error', function(error) { - console.error('Error connecting to the server!\n', error.message); - }); + request.on('error', (error) => Error(error.message)); request.end(); } -exports.connect = connect; - +exports.send = send; /** * Send a message to the server and return a response. * @param {Object} raw - The data to send. @@ -88,7 +86,7 @@ exports.connect = connect; * @param {String} raw.text - Message text. * @param {requestCallback} callback - The callback that handles the response. */ -var send = function(raw, callback) { +function send(raw, callback) { raw = raw || {}; const query = { @@ -96,7 +94,7 @@ var send = function(raw, callback) { hostname: 'iii.ru', path: '/api/2.0/json/Chat.request', method: 'POST', - } + }; const data = _createPackage(raw); @@ -106,22 +104,19 @@ var send = function(raw, callback) { response.on('end', () => callback(json)); }); - request.on('error', function(error) { - console.error('Error sending the package!\n', error.message); - }); + request.on('error', (error) => Error(error)); request.write(data); request.end(); } -exports.send = send; - +exports._encrypt = _encrypt; /** * Encrypts the incoming data. * @param {String} raw - Decrypted data. * @returns {String} - Encrypted string. */ -var _encrypt = function(raw) { +function _encrypt(raw) { raw = raw || ''; var base64 = Buffer.from(raw).toString('base64'); @@ -129,14 +124,13 @@ var _encrypt = function(raw) { return _merger(string).toString('base64'); } -exports._encrypt = _encrypt; - +exports._decrypt = _decrypt; /** * Decrypts the incoming data. * @param {String} raw - Encrypted data. * @returns {String} - Decrypted string. */ -var _decrypt = function(raw) { +function _decrypt(raw) { raw = raw || ''; var string = Buffer.from(raw, 'base64'); @@ -144,14 +138,13 @@ var _decrypt = function(raw) { return Buffer.from(decrypted, 'base64'); } -exports._decrypt = _decrypt; - +exports._decryptJSON = _decryptJSON; /** * Decrypts an encrypted JSON object. * @param {String} raw - Encrypted data. * @returns {Object} - Decrypted JSON. */ -var _decryptJSON = function(raw) { +function _decryptJSON(raw) { raw = raw || ''; var string = raw.toString('ascii'); @@ -159,14 +152,13 @@ var _decryptJSON = function(raw) { return JSON.parse(data); } -exports._decryptJSON = _decryptJSON; - +exports._merger = _merger; /** * Merge and convert a string. * @param {String} raw - The string to convert. * @returns {String} - The converted string. */ -var _merger = function(data) { +function _merger(data) { data = data || ''; const salt = Buffer.from('some very-very long string without any non-latin characters due to different string representations inside of variable programming languages'); @@ -178,8 +170,7 @@ var _merger = function(data) { return data; } -exports._merger = _merger; - +exports._createPackage = _createPackage; /** * Creates an encrypted package to send. * @param {Object} raw - The data to send. @@ -187,7 +178,7 @@ exports._merger = _merger; * @param {String} raw.text - Message text. * @returns {String} - Encrypted string. */ -var _createPackage = function(raw) { +function _createPackage(raw) { raw = raw || {}; if (!raw.text) { @@ -206,20 +197,17 @@ var _createPackage = function(raw) { return _encrypt(json); } -exports._createPackage = _createPackage; - +exports._verification = _verification; /** * Validation UUID format string. * @param {String} data - The string to check. * @returns {Boolean} */ -var _verification = function(data) { +function _verification(data) { data = data || ''; const regexp = new RegExp('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', 'i'); return regexp.test(data); } - -exports._verification = _verification; </code></pre> </article> </section> @@ -232,7 +220,7 @@ exports._verification = _verification; <br class="clear"> <footer> - Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon May 29 2017 02:00:06 GMT+0300 (MSK) using the Minami theme. + Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon May 29 2017 07:00:49 GMT+0300 (MSK) using the Minami theme. </footer> <script>prettyPrint();</script> |