index.js
function UnifiAPI(options) {
    if (!(this instanceof UnifiAPI)) return new UnifiAPI(options);
    merge(this, defaultOptions, options);
    this.debugging(this.debug);
    if (typeof this.net === 'undefined') {
        this.net = new UnifiRequest(merge(true, defaultOptions, options));
    }
    debug('UnifiAPI Initialized with options %o', options);
}
function UnifiAPI(options) {
    if (!(this instanceof UnifiAPI)) return new UnifiAPI(options);
    merge(this, defaultOptions, options);
    this.debugging(this.debug);
    if (typeof this.net === 'undefined') {
        this.net = new UnifiRequest(merge(true, defaultOptions, options));
    }
    debug('UnifiAPI Initialized with options %o', options);
}
function UnifiAPI ( options ) { if ( ! ( this instanceof UnifiAPI ) ) return new UnifiAPI ( options ) ; merge ( this , defaultOptions , options ) ; this . debugging ( this . debug ) ; if ( typeof this . net === 'undefined' ) { this . net = new UnifiRequest ( merge ( true , defaultOptions , options ) ) ; } debug ( 'UnifiAPI Initialized with options %o' , options ) ; }
The main class and the initialization of the Unifi Access
@param {object} options the options during initialization
@param {string} options.baseUrl the URL where the Unifi controller is. Default https://127.0.0.1:8443
@param {string} options.username default username
@param {string} options.password default password
@param {string} options.site default site. Default is "default"
@param {boolean} options.debug if the debug log is enabled
@param {boolean} options.debugNet if the debug of the request module is enabled
@returns this
@example let UnifiAPI = require('node-unifiapi');
let unifi = UnifiAPI({
baseUrl: 'https://127.0.0.1:8443', // The URL of the Unifi Controller
username: 'ubnt',
password: 'ubnt',
// debug: true, // More debug of the API (uses the debug module)
// debugNet: true // Debug of the network requests (uses request module)
});
The main class and the initialization of the Unifi Access