diff --git a/demo/example.js b/demo/example.js new file mode 100644 index 0000000..51cfe12 --- /dev/null +++ b/demo/example.js @@ -0,0 +1,19 @@ +const ewelink = require('../main'); + +(async () => { + const conn = new ewelink({ + email: '', + password: '', + }); + + /* get all devices */ + const devices = await conn.getDevices(); + console.log(devices); + + /* get specific devide info */ + const device = await conn.getDevice(''); + console.log(device); + + /* toggle device */ + await conn.toggleDevice(''); +})(); diff --git a/package.json b/package.json index 74827c5..8981ef7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "eWeLink API for Node.js", "main": "main.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "demo": "node ./demo/example.js" }, "author": "Martín M.", "license": "MIT",