Compare commits

...

7 commits

Author SHA1 Message Date
Todd Treece
8c117eebf6 4.4.0 2016-06-09 17:12:06 -04:00
Todd Treece
bb13a5d36a 4.3.0 2016-06-09 17:06:36 -04:00
Todd Treece
a92d2171c8 add user agent to client headers 2016-06-09 17:06:01 -04:00
Todd Treece
424530699f 4.2.7 2016-05-09 12:27:48 -04:00
Todd Treece
c329b09ba0 add latest docs 2016-05-09 12:26:42 -04:00
Todd Treece
505d08d6d0 4.2.6 2016-04-28 12:15:03 -04:00
Todd Treece
872d95619d update api docs path 2016-04-28 12:14:27 -04:00
3 changed files with 21 additions and 5 deletions

View file

@ -1,7 +1,22 @@
'use strict';
const Swagger = require('swagger-client-promises'),
Stream = require('./lib/stream');
Stream = require('./lib/stream'),
pkg = require('../package.json');
class HeaderKey {
constructor(key) {
this.key = key;
}
apply(obj, authorizations) {
obj.headers['X-AIO-Key'] = this.key;
obj.headers['User-Agent'] = `AdafruitIO-Node/${pkg.version} (${process.platform} ${process.arch} ${process.version})`;
return true;
}
}
class Client {
@ -11,7 +26,7 @@ class Client {
this.port = 80;
this.username = username || false;
this.key = key || false;
this.swagger_path = '/api/docs/api.json';
this.swagger_path = '/api/docs/v1.json';
this.success = function() {};
this.failure = function(err) { throw err; };
@ -25,10 +40,11 @@ class Client {
this.swagger = new Swagger({
url: `http://${this.host}:${this.port}${this.swagger_path}`,
debug: true,
success: this._defineGetters.bind(this),
failure: this.failure,
authorizations: {
HeaderKey: new Swagger.ApiKeyAuthorization('X-AIO-Key', this.key, 'header')
HeaderKey: new HeaderKey(this.key)
}
});

View file

@ -1,6 +1,6 @@
{
"name": "adafruit-io",
"version": "4.2.5",
"version": "4.4.0",
"description": "Adafruit IO Client, Local Server, & io.adafruit.com TLS Tunnel",
"bin": "./cli.js",
"main": "index.js",

@ -1 +1 @@
Subproject commit 39cd5ef820d8c0b830018c27a7a78d7c32cc5aeb
Subproject commit 0981108294f7a37d85443deccf3650bbdd200d43