Initial commit
This commit is contained in:
56
Backend/dist/Integrations/buildin/moorentv/MoorenTv.js
vendored
Normal file
56
Backend/dist/Integrations/buildin/moorentv/MoorenTv.js
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
exports.__esModule = true;
|
||||
exports.MoorenTV = void 0;
|
||||
var axios_1 = require("axios");
|
||||
var MoorenTV = /** @class */ (function () {
|
||||
function MoorenTV(settings) {
|
||||
this.serverAddress = settings.serverAddress;
|
||||
this.serverPort = settings.serverPort;
|
||||
this.adminPass = settings.adminPass;
|
||||
}
|
||||
MoorenTV.prototype._getBaseURI = function () {
|
||||
return "http://" + this.serverAddress + ":" + this.serverPort + "/api/v1/" + this.adminPass + "/";
|
||||
};
|
||||
MoorenTV.prototype.ping = function (callback) {
|
||||
axios_1["default"].get(this._getBaseURI() + "ping").then(function () {
|
||||
callback(true);
|
||||
})["catch"](function () {
|
||||
callback(false);
|
||||
});
|
||||
};
|
||||
MoorenTV.prototype.getGames = function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios_1["default"].get(_this._getBaseURI() + 'games').then(function (response) {
|
||||
if (response.data.succeed == true)
|
||||
resolve(response.data.response);
|
||||
else
|
||||
reject('Internal server error');
|
||||
})["catch"](reject);
|
||||
});
|
||||
};
|
||||
MoorenTV.prototype.startGame = function (gameID) {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios_1["default"].get(_this._getBaseURI() + "games/start/" + gameID).then(function (response) {
|
||||
if (response.data.succeed == true)
|
||||
resolve();
|
||||
else
|
||||
reject();
|
||||
})["catch"](reject);
|
||||
});
|
||||
};
|
||||
MoorenTV.prototype.stopGame = function () {
|
||||
var _this = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
axios_1["default"].get(_this._getBaseURI() + "games/stop").then(function (response) {
|
||||
if (response.data.succeed == true)
|
||||
resolve();
|
||||
else
|
||||
reject();
|
||||
})["catch"](reject);
|
||||
});
|
||||
};
|
||||
return MoorenTV;
|
||||
}());
|
||||
exports.MoorenTV = MoorenTV;
|
||||
//# sourceMappingURL=MoorenTv.js.map
|
||||
Reference in New Issue
Block a user