Initial commit

This commit is contained in:
2023-08-29 19:55:48 +02:00
commit 7c2eec4446
473 changed files with 40947 additions and 0 deletions

View 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