This commit is contained in:
2023-08-29 20:06:52 +02:00
parent 7c2eec4446
commit 25702c073a
225 changed files with 1071 additions and 808 deletions

View File

@@ -1,4 +1,4 @@
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Getiyo = void 0;
var axios_1 = require("axios");
var Getiyo = /** @class */ (function () {
@@ -10,16 +10,16 @@ var Getiyo = /** @class */ (function () {
this.channelApiKey = settings.channelApiKey;
}
Getiyo.prototype._getBaseURI = function () {
return this.serverProtocol + "://" + this.serverAddress + ":" + this.serverPort + "/" + this.channelName + "/api/v1/" + this
.channelApiKey + "/";
return "".concat(this.serverProtocol, "://").concat(this.serverAddress, ":").concat(this.serverPort, "/").concat(this.channelName, "/api/v1/").concat(this
.channelApiKey, "/");
};
Getiyo.prototype.checkConnection = function (callback) {
axios_1["default"].get(this._getBaseURI()).then(function () { return callback(true); })["catch"](function () { return callback(false); });
axios_1.default.get(this._getBaseURI()).then(function () { return callback(true); }).catch(function () { return callback(false); });
};
Getiyo.prototype.getScenes = function () {
var _this = this;
return new Promise(function (resolve, reject) {
axios_1["default"]
axios_1.default
.get(_this._getBaseURI() + 'scenes')
.then(function (response) {
if (response.data.succeed == true) {
@@ -27,13 +27,14 @@ var Getiyo = /** @class */ (function () {
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.getDisplays = function () {
var _this = this;
return new Promise(function (resolve, reject) {
axios_1["default"]
axios_1.default
.get(_this._getBaseURI() + 'displays')
.then(function (response) {
if (response.data.succeed == true) {
@@ -41,13 +42,14 @@ var Getiyo = /** @class */ (function () {
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.getModules = function () {
var _this = this;
return new Promise(function (resolve, reject) {
axios_1["default"]
axios_1.default
.get(_this._getBaseURI() + 'modules')
.then(function (response) {
if (response.data.succeed == true) {
@@ -55,13 +57,14 @@ var Getiyo = /** @class */ (function () {
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.getTimelineSections = function () {
var _this = this;
return new Promise(function (resolve, reject) {
axios_1["default"]
axios_1.default
.get(_this._getBaseURI() + 'timeline/sections')
.then(function (response) {
if (response.data.succeed == true) {
@@ -69,111 +72,119 @@ var Getiyo = /** @class */ (function () {
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.publishScene = function (sceneID, displayID) {
var _this = this;
return new Promise(function (resolve, reject) {
axios_1["default"]
.get(_this._getBaseURI() + ("scenes/publish/" + sceneID + "/" + displayID))
axios_1.default
.get(_this._getBaseURI() + "scenes/publish/".concat(sceneID, "/").concat(displayID))
.then(function (response) {
if (response.data.succeed == true) {
resolve();
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.startTimeline = function (createNewRunner) {
var _this = this;
if (createNewRunner === void 0) { createNewRunner = false; }
return new Promise(function (resolve, reject) {
axios_1["default"]
.get(_this._getBaseURI() + ("timeline/start/" + createNewRunner))
axios_1.default
.get(_this._getBaseURI() + "timeline/start/".concat(createNewRunner))
.then(function (response) {
if (response.data.succeed == true) {
resolve();
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.stopTimeline = function (runnerID) {
var _this = this;
if (runnerID === void 0) { runnerID = 'main'; }
return new Promise(function (resolve, reject) {
axios_1["default"]
.get(_this._getBaseURI() + ("timeline/stop/" + runnerID))
axios_1.default
.get(_this._getBaseURI() + "timeline/stop/".concat(runnerID))
.then(function (response) {
if (response.data.succeed == true) {
resolve();
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.pauseTimeline = function (runnerID) {
var _this = this;
if (runnerID === void 0) { runnerID = 'main'; }
return new Promise(function (resolve, reject) {
axios_1["default"]
.get(_this._getBaseURI() + ("timeline/pause/" + runnerID))
axios_1.default
.get(_this._getBaseURI() + "timeline/pause/".concat(runnerID))
.then(function (response) {
if (response.data.succeed == true) {
resolve();
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.skipTimelineBlock = function (runnerID) {
var _this = this;
if (runnerID === void 0) { runnerID = 'main'; }
return new Promise(function (resolve, reject) {
axios_1["default"]
.get(_this._getBaseURI() + ("timeline/skip/" + runnerID))
axios_1.default
.get(_this._getBaseURI() + "timeline/skip/".concat(runnerID))
.then(function (response) {
if (response.data.succeed == true) {
resolve();
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.continueTimelineHold = function (runnerID) {
var _this = this;
if (runnerID === void 0) { runnerID = 'main'; }
return new Promise(function (resolve, reject) {
axios_1["default"]
.get(_this._getBaseURI() + ("timeline/hold/" + runnerID))
axios_1.default
.get(_this._getBaseURI() + "timeline/hold/".concat(runnerID))
.then(function (response) {
if (response.data.succeed == true) {
resolve();
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
Getiyo.prototype.jumpToTimelineSections = function (sectionName, runnerID) {
var _this = this;
if (runnerID === void 0) { runnerID = 'main'; }
return new Promise(function (resolve, reject) {
axios_1["default"]
.get(_this._getBaseURI() + ("timeline/sections/jump/" + encodeURI(sectionName) + "/" + runnerID))
axios_1.default
.get(_this._getBaseURI() + "timeline/sections/jump/".concat(encodeURI(sectionName), "/").concat(runnerID))
.then(function (response) {
if (response.data.succeed == true) {
resolve();
}
else
reject(new Error('Unable to connection to Getiyo instance'));
})["catch"](reject);
})
.catch(reject);
});
};
return Getiyo;