From 4219da7350bd4e0f218ef41869978163acfb09c4 Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Wed, 3 Mar 2021 15:41:08 +0100 Subject: [PATCH] added _last_results_raw to gather getFullStatus()/getDeviceNameMappings() functionality. --- unifi.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/unifi.js b/unifi.js index 4f25485..4ad423c 100644 --- a/unifi.js +++ b/unifi.js @@ -1829,7 +1829,12 @@ class Controller { * @return bool|array staus array upon success, false upon failure */ getFullStatus(cb) { - this._request('/status', {}, null, cb); + this._request('/status', {}, null, (error, result) => { + result = this._last_results_raw; + if (typeof (cb) === 'function') { + cb(error, result); + } + }); } /** @@ -1841,7 +1846,12 @@ class Controller { * @return bool|array mappings array upon success, false upon failure */ getDeviceNameMappings(cb) { - this._request('/dl/firmware/bundles.json', {}, null, cb); + this._request('/dl/firmware/bundles.json', {}, null, (error, result) => { + result = this._last_results_raw; + if (typeof (cb) === 'function') { + cb(error, result); + } + }); } /** @@ -3079,6 +3089,7 @@ class Controller { } reqfunc(options, (error, response, body) => { + this._last_results_raw = body; if (error) { callback(error); } else if (body && response.statusCode >= 200 && response.statusCode < 400 &&