var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var Unibase; (function (Unibase) { let Apps; (function (Apps) { let Collaboration; (function (Collaboration) { class DocumentManager extends Unibase.Platform.Core.BaseManager { getDocumentFileInfo(Id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/getdocumentfile/id/' + Id; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getJsonData(Id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/getjsondata/id/' + Id; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } toJsonData(Id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/tojsondata/id/' + Id; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } spreadSheetDownload(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/downloadspreadsheet'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } saveWord(data) { return __awaiter(this, void 0, void 0, function* () { const url = '/apis/v4/collaboration/unicloud/files/saveword'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } saveSpreadSheet(data) { return __awaiter(this, void 0, void 0, function* () { const url = '/apis/v4/collaboration/unicloud/files/savespreadsheet'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } ConvertDocstoPdfDownload(id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/downloadpdffromword/id/' + id; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getDocumentBase64FileDownload(Id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/files/getebase64documentfile/id/' + Id; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } importCreateSpreadSheet(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/createnewspreadsheet'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } importReplaceSpreadSheet(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/replacespreadsheet'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } insertNewSpreadsheet(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/insertnewspreadsheet'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } copyOfCurrentDocument(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/copyspreadsheet'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } renameFileTitle(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/replacefiletitle'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } spellCheck(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'https://plugins.spellcheck.bizgaze.com/api/documenteditor/SpellCheck'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response !== null) response = JSON.parse(response); return response; }); }); } ssAutoSave(data) { return __awaiter(this, void 0, void 0, function* () { const url = '/apis/v4/collaboration/unicloud/files/spreadsheetautosave'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } CopySheetInToExistingWorkbook(data) { return __awaiter(this, void 0, void 0, function* () { const url = '/apis/v4/collaboration/unicloud/files/copysheetintoexistingworkbook/'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } CopySheetToNewSpreadsheet(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/copysheettonewspreadsheet'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } lastEdit(Id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/getversiondetails/id/' + Id; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } rollBackFileData(Id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/restorejsondatatofiledata/id/' + Id; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } ConvertSpreadsheettoOdsDownload(id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/downloadodsfromExcel/id/' + id; return yield this.dataHelper().postAsync(url, null).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getPermissionLevel(fileId, uid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/getpermissionlevel/id/' + fileId + "/uid/" + uid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getCustomJsonData(Id) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/getcustomjsondata/id/' + Id; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } saveSheetColor(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/savesheetcolor'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(JSON.parse(response.result)); return response; }); }); } updateSheetColorIndex(data) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/updatesheetindex'; return yield this.dataHelper().postAsync(url, data).then(function (response) { if (response.result !== null) response.result = JSON.parse(JSON.parse(response.result)); return response; }); }); } getRecentViews(Id) { return __awaiter(this, void 0, void 0, function* () { const url = '/apis/v4/collaboration/unicloud/files/getrecentviews/id/' + Id; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getLinkInfo(fileid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/collaboration/unicloud/files/linkinfo/id/' + fileid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } static Instance() { if (this.instance === undefined) { this.instance = new DocumentManager(); } return this.instance; } } Collaboration.DocumentManager = DocumentManager; })(Collaboration = Apps.Collaboration || (Apps.Collaboration = {})); })(Apps = Unibase.Apps || (Unibase.Apps = {})); })(Unibase || (Unibase = {}));