node-red-contrib-pac
Version:
Node-RED nodes for PAC Control.
1,319 lines (1,318 loc) • 251 kB
JavaScript
"use strict";
/**
* SNAP PAC REST API
*
* OpenAPI spec version: R1.0a
* Contact: developer@opto22.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var request = require("request");
var Promise = require("bluebird");
var defaultBasePath = 'http://restpac.groov.com/api/v1';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
/* tslint:disable:no-unused-variable */
var ControllerResponse = /** @class */ (function () {
function ControllerResponse() {
}
return ControllerResponse;
}());
exports.ControllerResponse = ControllerResponse;
var DigitalPointStateObject = /** @class */ (function () {
function DigitalPointStateObject() {
}
return DigitalPointStateObject;
}());
exports.DigitalPointStateObject = DigitalPointStateObject;
var DigitalPointStateVar = /** @class */ (function () {
function DigitalPointStateVar() {
}
return DigitalPointStateVar;
}());
exports.DigitalPointStateVar = DigitalPointStateVar;
var ErrorResponse200OKish = /** @class */ (function () {
function ErrorResponse200OKish() {
}
return ErrorResponse200OKish;
}());
exports.ErrorResponse200OKish = ErrorResponse200OKish;
var ErrorResponse400BadAdminOrValue = /** @class */ (function () {
function ErrorResponse400BadAdminOrValue() {
}
return ErrorResponse400BadAdminOrValue;
}());
exports.ErrorResponse400BadAdminOrValue = ErrorResponse400BadAdminOrValue;
var ErrorResponse401BadKeyForBasicAuth = /** @class */ (function () {
function ErrorResponse401BadKeyForBasicAuth() {
}
return ErrorResponse401BadKeyForBasicAuth;
}());
exports.ErrorResponse401BadKeyForBasicAuth = ErrorResponse401BadKeyForBasicAuth;
var ErrorResponse404NotFound = /** @class */ (function () {
function ErrorResponse404NotFound() {
}
return ErrorResponse404NotFound;
}());
exports.ErrorResponse404NotFound = ErrorResponse404NotFound;
var FloatValueObject = /** @class */ (function () {
function FloatValueObject() {
}
return FloatValueObject;
}());
exports.FloatValueObject = FloatValueObject;
var FloatVar = /** @class */ (function () {
function FloatVar() {
}
return FloatVar;
}());
exports.FloatVar = FloatVar;
var Int32ValueObject = /** @class */ (function () {
function Int32ValueObject() {
}
return Int32ValueObject;
}());
exports.Int32ValueObject = Int32ValueObject;
var Int32Var = /** @class */ (function () {
function Int32Var() {
}
return Int32Var;
}());
exports.Int32Var = Int32Var;
var Int64StringValueObject = /** @class */ (function () {
function Int64StringValueObject() {
}
return Int64StringValueObject;
}());
exports.Int64StringValueObject = Int64StringValueObject;
var Int64ValueObject = /** @class */ (function () {
function Int64ValueObject() {
}
return Int64ValueObject;
}());
exports.Int64ValueObject = Int64ValueObject;
var Int64Var = /** @class */ (function () {
function Int64Var() {
}
return Int64Var;
}());
exports.Int64Var = Int64Var;
var Int64VarAsString = /** @class */ (function () {
function Int64VarAsString() {
}
return Int64VarAsString;
}());
exports.Int64VarAsString = Int64VarAsString;
var StrategyResponse = /** @class */ (function () {
function StrategyResponse() {
}
return StrategyResponse;
}());
exports.StrategyResponse = StrategyResponse;
var StringValueObject = /** @class */ (function () {
function StringValueObject() {
}
return StringValueObject;
}());
exports.StringValueObject = StringValueObject;
var StringVar = /** @class */ (function () {
function StringVar() {
}
return StringVar;
}());
exports.StringVar = StringVar;
var TableDef = /** @class */ (function () {
function TableDef() {
}
return TableDef;
}());
exports.TableDef = TableDef;
var HttpBasicAuth = /** @class */ (function () {
function HttpBasicAuth() {
}
HttpBasicAuth.prototype.applyToRequest = function (requestOptions) {
// Only SNAP PAC needs "requestOptions.auth" to be set.
// If we're talking to Groov EPIC, then the username will have been set to a special
// value in "api-ex.ts".
if (this.username != 'groov-epic-pac-skip-reqoptions-auth') {
requestOptions.auth = {
username: this.username, password: this.password
};
}
};
return HttpBasicAuth;
}());
exports.HttpBasicAuth = HttpBasicAuth;
var ApiKeyAuth = /** @class */ (function () {
function ApiKeyAuth(location, paramName) {
this.location = location;
this.paramName = paramName;
}
ApiKeyAuth.prototype.applyToRequest = function (requestOptions) {
if (this.location == "query") {
requestOptions.qs[this.paramName] = this.apiKey;
}
else if (this.location == "header") {
requestOptions.headers[this.paramName] = this.apiKey;
}
};
return ApiKeyAuth;
}());
exports.ApiKeyAuth = ApiKeyAuth;
var OAuth = /** @class */ (function () {
function OAuth() {
}
OAuth.prototype.applyToRequest = function (requestOptions) {
requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
};
return OAuth;
}());
exports.OAuth = OAuth;
var VoidAuth = /** @class */ (function () {
function VoidAuth() {
}
VoidAuth.prototype.applyToRequest = function (requestOptions) {
// Do nothing
};
return VoidAuth;
}());
exports.VoidAuth = VoidAuth;
var AllApiApiKeys;
(function (AllApiApiKeys) {
})(AllApiApiKeys = exports.AllApiApiKeys || (exports.AllApiApiKeys = {}));
var AllApi = /** @class */ (function () {
function AllApi(basePathOrUsername, password, basePath) {
this.basePath = defaultBasePath;
this.defaultHeaders = {};
this._useQuerystring = false;
this.authentications = {
'default': new VoidAuth(),
'basicAuth': new HttpBasicAuth(),
};
if (password) {
this.username = basePathOrUsername;
this.password = password;
if (basePath) {
this.basePath = basePath;
}
}
else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername;
}
}
}
Object.defineProperty(AllApi.prototype, "useQuerystring", {
set: function (value) {
this._useQuerystring = value;
},
enumerable: true,
configurable: true
});
AllApi.prototype.setApiKey = function (key, value) {
this.authentications[AllApiApiKeys[key]].apiKey = value;
};
Object.defineProperty(AllApi.prototype, "username", {
set: function (username) {
this.authentications.basicAuth.username = username;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AllApi.prototype, "password", {
set: function (password) {
this.authentications.basicAuth.password = password;
},
enumerable: true,
configurable: true
});
AllApi.prototype.extendObj = function (objA, objB) {
for (var key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
}
}
return objA;
};
/**
*
* Reads the value in engineering units (EU) of the specified analog input
* @param ioName Name of the analog input point to read
*/
AllApi.prototype.readAnalogInputEu = function (ioName) {
var localVarPath = this.basePath + '/device/strategy/ios/analogInputs/{ioName}/eu'
.replace('{' + 'ioName' + '}', String(ioName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'ioName' is not null or undefined
if (ioName === null || ioName === undefined) {
throw new Error('Required parameter ioName was null or undefined when calling readAnalogInputEu.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the name and engineering units (EU) for all analog input points in the strategy
*/
AllApi.prototype.readAnalogInputs = function () {
var localVarPath = this.basePath + '/device/strategy/ios/analogInputs';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Reads the value in engineering units (EU) of the specified analog output
* @param ioName Name of analog output point to read
*/
AllApi.prototype.readAnalogOutputEu = function (ioName) {
var localVarPath = this.basePath + '/device/strategy/ios/analogOutputs/{ioName}/eu'
.replace('{' + 'ioName' + '}', String(ioName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'ioName' is not null or undefined
if (ioName === null || ioName === undefined) {
throw new Error('Required parameter ioName was null or undefined when calling readAnalogOutputEu.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the name and engineering units (EU) for all analog output points in the strategy
*/
AllApi.prototype.readAnalogOutputs = function () {
var localVarPath = this.basePath + '/device/strategy/ios/analogOutputs';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns controller's type, e.g. \"SNAP-PAC-R1\"; firmware version; both mac addresses; and uptime in seconds
*/
AllApi.prototype.readDeviceDetails = function () {
var localVarPath = this.basePath + '/device';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the specified digital input point's state (true = on, false = off)
* @param ioName Name of the digital input point to read
*/
AllApi.prototype.readDigitalInputState = function (ioName) {
var localVarPath = this.basePath + '/device/strategy/ios/digitalInputs/{ioName}/state'
.replace('{' + 'ioName' + '}', String(ioName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'ioName' is not null or undefined
if (ioName === null || ioName === undefined) {
throw new Error('Required parameter ioName was null or undefined when calling readDigitalInputState.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the name and state (true = on, false = off) of all digital input points in the strategy. If there is no strategy in the controller, or the strategy includes no digital inputs, the returned array will be empty.
*/
AllApi.prototype.readDigitalInputs = function () {
var localVarPath = this.basePath + '/device/strategy/ios/digitalInputs';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the specified digital output point's state (true = on, false = off)
* @param ioName Name of the digit output point to read
*/
AllApi.prototype.readDigitalOutputState = function (ioName) {
var localVarPath = this.basePath + '/device/strategy/ios/digitalOutputs/{ioName}/state'
.replace('{' + 'ioName' + '}', String(ioName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'ioName' is not null or undefined
if (ioName === null || ioName === undefined) {
throw new Error('Required parameter ioName was null or undefined when calling readDigitalOutputState.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the name and state (true = on, false = off) of all digital output points in the strategy
*/
AllApi.prototype.readDigitalOutputs = function () {
var localVarPath = this.basePath + '/device/strategy/ios/digitalOutputs';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns current value of the specified down timer
* @param downTimerName Name of the down timer variable to read
*/
AllApi.prototype.readDownTimerValue = function (downTimerName) {
var localVarPath = this.basePath + '/device/strategy/vars/downTimers/{downTimerName}/value'
.replace('{' + 'downTimerName' + '}', String(downTimerName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'downTimerName' is not null or undefined
if (downTimerName === null || downTimerName === undefined) {
throw new Error('Required parameter downTimerName was null or undefined when calling readDownTimerValue.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the name and current value of all down timers in the strategy
*/
AllApi.prototype.readDownTimerVars = function () {
var localVarPath = this.basePath + '/device/strategy/vars/downTimers';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Read table elements
* @param tableName Name of float table to read; starting index and number of elements may be specified (defaults to all elements)
* @param startIndex Index of first element to read (default is 0)
* @param numElements Number of elements to read (default is number of elements in the table minus startIndex)
*/
AllApi.prototype.readFloatTable = function (tableName, startIndex, numElements) {
var localVarPath = this.basePath + '/device/strategy/tables/floats/{tableName}'
.replace('{' + 'tableName' + '}', String(tableName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'tableName' is not null or undefined
if (tableName === null || tableName === undefined) {
throw new Error('Required parameter tableName was null or undefined when calling readFloatTable.');
}
if (startIndex !== undefined) {
queryParameters['startIndex'] = startIndex;
}
if (numElements !== undefined) {
queryParameters['numElements'] = numElements;
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Read specified table element
* @param tableName Name of float table to read
* @param index Index of element to read
*/
AllApi.prototype.readFloatTableElement = function (tableName, index) {
var localVarPath = this.basePath + '/device/strategy/tables/floats/{tableName}/{index}'
.replace('{' + 'tableName' + '}', String(tableName))
.replace('{' + 'index' + '}', String(index));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'tableName' is not null or undefined
if (tableName === null || tableName === undefined) {
throw new Error('Required parameter tableName was null or undefined when calling readFloatTableElement.');
}
// verify required parameter 'index' is not null or undefined
if (index === null || index === undefined) {
throw new Error('Required parameter index was null or undefined when calling readFloatTableElement.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns an array of the name and length of all the float tables in the strategy
*/
AllApi.prototype.readFloatTables = function () {
var localVarPath = this.basePath + '/device/strategy/tables/floats';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns value of the specified float variable
* @param floatName Name of float variable to read
*/
AllApi.prototype.readFloatVar = function (floatName) {
var localVarPath = this.basePath + '/device/strategy/vars/floats/{floatName}'
.replace('{' + 'floatName' + '}', String(floatName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'floatName' is not null or undefined
if (floatName === null || floatName === undefined) {
throw new Error('Required parameter floatName was null or undefined when calling readFloatVar.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the name and value of all (single-precision) float variables in the strategy
*/
AllApi.prototype.readFloatVars = function () {
var localVarPath = this.basePath + '/device/strategy/vars/floats';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Read a range of table elements from the specified integer32 table
* @param tableName Name of integer32 table to read; starting index and number of elements may be specified (defaults to all elements)
* @param startIndex Index of first element to read (default is 0)
* @param numElements Number of elements to read (default is number of elements in the table minus startIndex)
*/
AllApi.prototype.readInt32Table = function (tableName, startIndex, numElements) {
var localVarPath = this.basePath + '/device/strategy/tables/int32s/{tableName}'
.replace('{' + 'tableName' + '}', String(tableName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'tableName' is not null or undefined
if (tableName === null || tableName === undefined) {
throw new Error('Required parameter tableName was null or undefined when calling readInt32Table.');
}
if (startIndex !== undefined) {
queryParameters['startIndex'] = startIndex;
}
if (numElements !== undefined) {
queryParameters['numElements'] = numElements;
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Read specified integer32 table element
* @param tableName Name of the integer32 table to read
* @param index Index of element to read
*/
AllApi.prototype.readInt32TableElement = function (tableName, index) {
var localVarPath = this.basePath + '/device/strategy/tables/int32s/{tableName}/{index}'
.replace('{' + 'tableName' + '}', String(tableName))
.replace('{' + 'index' + '}', String(index));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'tableName' is not null or undefined
if (tableName === null || tableName === undefined) {
throw new Error('Required parameter tableName was null or undefined when calling readInt32TableElement.');
}
// verify required parameter 'index' is not null or undefined
if (index === null || index === undefined) {
throw new Error('Required parameter index was null or undefined when calling readInt32TableElement.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns an array of the name and length of all the integer32 tables in the strategy
*/
AllApi.prototype.readInt32Tables = function () {
var localVarPath = this.basePath + '/device/strategy/tables/int32s';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns value of the specified integer32 variable
* @param int32Name Name of integer32 variable to read
*/
AllApi.prototype.readInt32Var = function (int32Name) {
var localVarPath = this.basePath + '/device/strategy/vars/int32s/{int32Name}'
.replace('{' + 'int32Name' + '}', String(int32Name));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'int32Name' is not null or undefined
if (int32Name === null || int32Name === undefined) {
throw new Error('Required parameter int32Name was null or undefined when calling readInt32Var.');
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Returns the name and value of all integer32 variables in the strategy
*/
AllApi.prototype.readInt32Vars = function () {
var localVarPath = this.basePath + '/device/strategy/vars/int32s';
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject({ response: response, body: body });
}
}
});
});
};
/**
*
* Read table elements
* @param tableName Name of the integer64 table to read; starting index and number of elements may be specified (defaults to all elements)
* @param startIndex Index of first element to read (default is 0)
* @param numElements Number of elements to read (default is number of elements in the table minus startIndex)
*/
AllApi.prototype.readInt64Table = function (tableName, startIndex, numElements) {
var localVarPath = this.basePath + '/device/strategy/tables/int64s/{tableName}'
.replace('{' + 'tableName' + '}', String(tableName));
var queryParameters = {};
var headerParams = this.extendObj({}, this.defaultHeaders);
var formParams = {};
// verify required parameter 'tableName' is not null or undefined
if (tableName === null || tableName === undefined) {
throw new Error('Required parameter tableName was null or undefined when calling readInt64Table.');
}
if (startIndex !== undefined) {
queryParameters['startIndex'] = startIndex;
}
if (numElements !== undefined) {
queryParameters['numElements'] = numElements;
}
var useFormData = false;
var requestOptions = {
method: 'GET',
qs: queryParameters,
headers: headerParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.basicAuth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
requestOptions.formData = formParams;
}
else {
requestOptions.form = formParams;
}
}
return new Promise(function (resolve, reject) {
request(requestOptions, function (error, response, body) {
if (error) {
reject(error);
}
else {