UNPKG

chiliconnector

Version:

Wrapper for dealing with CHILI publish web services

1,121 lines (890 loc) 91.3 kB
const axios = require('axios'); const parser = require("fast-xml-parser"); const DOMParser = require('xmldom-reborn').DOMParser; class ChiliConnector { /** * * @param url * @param [options=null] */ constructor(url, options = null) { this.options = { url: url, version: 1, rest: true, autoCDATA : false } if (options != null) { for (let key in options) { this.options[key] = options[key]; } } } async makeSoapCall(functionName, data = null, returnXML = false) { let xml = `<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'><soap12:Body>`; xml += `<${functionName} xmlns='http://www.chili-publisher.com/'>`; if (this.options.autoCDATA === true) { ChiliConnector.cleanUpData(data); } if (data != null) { for (let key in data) { if (data.hasOwnProperty(key)) { xml += `<${key}>${data[key]}</${key}>`; } } } xml += `</${functionName}>` + '</soap12:Body></soap12:Envelope>'; let response = await axios({ method: 'post', url: this.options['url'] + "/main.asmx", headers: {'Content-Type': 'text/xml'}, data: xml }); let returnData = ChiliConnector.getResponseValues(response.data, functionName + "Result"); if (returnData != null && !returnXML) { returnData = parser.parse(returnData, { ignoreAttributes: false, attrNodeName: "attr", attributeNamePrefix: "" }); } return returnData; } static getResponseValues(xml, responseTag) { let doc = new DOMParser().parseFromString(xml, "text/xml"); let elements = doc.getElementsByTagName(responseTag); return elements.item(0).textContent; return null; } async makeRestCall(restUrl, method, apiKey, bodyData, queryData = null, returnXML = false) { let currentUrl = `${this.options['url']}/${restUrl}`; if (queryData != null) { let currentTag = "?"; for (let key in queryData) { currentUrl += `${currentTag}${key}=${queryData[key]}`; currentTag = "&"; } } if (this.options.autoCDATA === true) { ChiliConnector.cleanUpData(bodyData); } let response = await axios({ method: method, url: currentUrl, headers: {"API-KEY": apiKey, "ACCEPT": "application/xml"}, data: bodyData }); let returnData = response.data; if (!returnXML) { returnData = parser.parse(returnData, { ignoreAttributes: false, attrNodeName: "attr", attributeNamePrefix: "", }); } return returnData; } static cleanUpData(data) { if (data != null) { for (let key in data) { if (key.toString().toLowerCase().includes("xml")) { data[key] = "<![CDATA[" + data[key] + "]]>"; } } } } /* Below this line is automatically generate from a C# application */ /*58008*/ async documentCreateTempImagesAsync(apiKey, itemID, docXML, settingsXML, imageConversionProfileID, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempImages', {apiKey: apiKey, itemID: itemID, docXML: docXML, settingsXML: settingsXML, imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/images`, 'post', apiKey, {docXML: docXML, settingsXML: settingsXML }, {itemID: itemID, imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority }, returnXML); } } async documentCreateTempImagesAndPDFAsync(apiKey, itemID, docXML, settingsXML, imageConversionProfileID, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempImagesAndPDF', {apiKey: apiKey, itemID: itemID, docXML: docXML, settingsXML: settingsXML, imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/imagesandpdf`, 'post', apiKey, {docXML: docXML, settingsXML: settingsXML }, {itemID: itemID, imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority }, returnXML); } } async documentCreateTempODFAsync(apiKey, itemID, docXML, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempODF', {apiKey: apiKey, itemID: itemID, docXML: docXML, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/odf`, 'post', apiKey, {docXML: docXML, settingsXML: settingsXML }, {itemID: itemID, taskPriority: taskPriority }, returnXML); } } async documentCreateTempPackageAsync(apiKey, itemID, docXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempPackage', {apiKey: apiKey, itemID: itemID, docXML: docXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/package`, 'post', apiKey, {docXML: docXML }, {itemID: itemID, taskPriority: taskPriority }, returnXML); } } async documentCreateTempPDFAsync(apiKey, itemID, docXML, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempPDF', {apiKey: apiKey, itemID: itemID, docXML: docXML, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/pdf`, 'post', apiKey, {docXML: docXML, settingsXML: settingsXML }, {itemID: itemID, taskPriority: taskPriority }, returnXML); } } async documentGetAnnotationsAsync(apiKey, itemID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetAnnotations', {apiKey: apiKey, itemID: itemID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/annotations`, 'get', apiKey, {}, {}, returnXML); } } async documentGetDefaultSettingsAsync(apiKey, itemID, viewType, viewPrefsID, constraintID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetDefaultSettings', {apiKey: apiKey, itemID: itemID, viewType: viewType, viewPrefsID: viewPrefsID, constraintID: constraintID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/defaultsettings`, 'get', apiKey, {}, {itemID: itemID, viewType: viewType, viewPrefsID: viewPrefsID, constraintID: constraintID }, returnXML); } } async documentGetDocumentEventActionsAsync(apiKey, itemID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetDocumentEventActions', {apiKey: apiKey, itemID: itemID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/eventactions`, 'get', apiKey, {}, {}, returnXML); } } async documentGetFoldingViewerURLAsync(apiKey, itemID, foldingSettingsID, modXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetFoldingViewerURL', {apiKey: apiKey, itemID: itemID, foldingSettingsID: foldingSettingsID, modXML: modXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/urls/foldingviewer`, 'post', apiKey, {modXML: modXML }, {foldingSettingsID: foldingSettingsID }, returnXML); } } async documentGetHTMLEditorURLAsync(apiKey, itemID, workSpaceID, viewPrefsID, constraintsID, viewerOnly, forAnonymousUser, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetHTMLEditorURL', {apiKey: apiKey, itemID: itemID, workSpaceID: workSpaceID, viewPrefsID: viewPrefsID, constraintsID: constraintsID, viewerOnly: viewerOnly, forAnonymousUser: forAnonymousUser}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/urls/editor`, 'get', apiKey, {}, {workSpaceID: workSpaceID, viewPrefsID: viewPrefsID, constraintsID: constraintsID, viewerOnly: viewerOnly, forAnonymousUser: forAnonymousUser }, returnXML); } } async documentGetHTMLFoldingViewerURLAsync(apiKey, itemID, foldingSettingsID, modXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetHTMLFoldingViewerURL', {apiKey: apiKey, itemID: itemID, foldingSettingsID: foldingSettingsID, modXML: modXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/urls/htmlfoldingviewer`, 'post', apiKey, {modXML: modXML }, {foldingSettingsID: foldingSettingsID }, returnXML); } } async documentGetHTMLPreloadAsync(apiKey, itemID, workSpaceID, viewPrefsID, constraintsID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetHTMLPreload', {apiKey: apiKey, itemID: itemID, workSpaceID: workSpaceID, viewPrefsID: viewPrefsID, constraintsID: constraintsID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/htmlpreload`, 'get', apiKey, {}, {workSpaceID: workSpaceID, viewPrefsID: viewPrefsID, constraintsID: constraintsID }, returnXML); } } async documentGetHTMLPreloadURLAsync(apiKey, itemID, workSpaceID, viewPrefsID, constraintsID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetHTMLPreloadURL', {apiKey: apiKey, itemID: itemID, workSpaceID: workSpaceID, viewPrefsID: viewPrefsID, constraintsID: constraintsID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/urls/htmlpreload`, 'get', apiKey, {}, {workSpaceID: workSpaceID, viewPrefsID: viewPrefsID, constraintsID: constraintsID }, returnXML); } } async documentGetHTMLThreeDModelViewerURLAsync(apiKey, itemID, threeDModelID, modXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetHTMLThreeDModelViewerURL', {apiKey: apiKey, itemID: itemID, threeDModelID: threeDModelID, modXML: modXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/urls/htmlthreedmodelviewer`, 'post', apiKey, {modXML: modXML }, {threeDModelID: threeDModelID }, returnXML); } } async documentGetInfoAsync(apiKey, itemID, extended, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetInfo', {apiKey: apiKey, itemID: itemID, extended: extended}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/info`, 'get', apiKey, {}, {extended: extended }, returnXML); } } async documentGetPreflightResultsAsync(apiKey, itemID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetPreflightResults', {apiKey: apiKey, itemID: itemID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/preflightresults`, 'get', apiKey, {}, {}, returnXML); } } async documentGetThreeDModelViewerURLAsync(apiKey, itemID, threeDModelID, modXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetThreeDModelViewerURL', {apiKey: apiKey, itemID: itemID, threeDModelID: threeDModelID, modXML: modXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/urls/threedmodelviewer`, 'post', apiKey, {modXML: modXML }, {threeDModelID: threeDModelID }, returnXML); } } async documentGetUsedAssetsAsync(apiKey, itemID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetUsedAssets', {apiKey: apiKey, itemID: itemID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/usedassets`, 'get', apiKey, {}, {}, returnXML); } } async documentGetVariableDefinitionsAsync(apiKey, itemID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetVariableDefinitions', {apiKey: apiKey, itemID: itemID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/variabledefinitions`, 'get', apiKey, {}, {}, returnXML); } } async apiKeyClearHeaderFieldsForServerDownloadsAsync(apiKey, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ApiKeyClearHeaderFieldsForServerDownloads', {apiKey: apiKey}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/headerfields`, 'delete', apiKey, {}, {}, returnXML); } } async apiKeyGetCurrentSettingsAsync(apiKey, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ApiKeyGetCurrentSettings', {apiKey: apiKey}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/withsettings`, 'get', apiKey, {}, {}, returnXML); } } async apiKeyKeepAliveAsync(apiKey, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ApiKeyKeepAlive', {apiKey: apiKey}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/keepalive`, 'put', apiKey, {}, {}, returnXML); } } async apiKeySetHeaderFieldForServerDownloadsAsync(apiKey, headerFieldKey, headerFieldValue, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ApiKeySetHeaderFieldForServerDownloads', {apiKey: apiKey, headerFieldKey: headerFieldKey, headerFieldValue: headerFieldValue}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/headerfields`, 'put', apiKey, {}, {headerFieldKey: headerFieldKey, headerFieldValue: headerFieldValue }, returnXML); } } async apiKeySetRequestHeaderForDomainAsync(apiKey, domain, headerFieldKey, headerFieldValue, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ApiKeySetRequestHeaderForDomain', {apiKey: apiKey, domain: domain, headerFieldKey: headerFieldKey, headerFieldValue: headerFieldValue}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/requestheaders`, 'put', apiKey, {}, {domain: domain, headerFieldKey: headerFieldKey, headerFieldValue: headerFieldValue }, returnXML); } } async apiKeySetRequestWithCredentialsForDomainAsync(apiKey, domain, requestWithCredentials, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ApiKeySetRequestWithCredentialsForDomain', {apiKey: apiKey, domain: domain, requestWithCredentials: requestWithCredentials}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/requestheaderswithcred`, 'put', apiKey, {}, {domain: domain, requestWithCredentials: requestWithCredentials }, returnXML); } } async apiKeyVerifyAsync(apiKey, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ApiKeyVerify', {apiKey: apiKey}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/verify`, 'put', apiKey, {apiKey: apiKey }, {}, returnXML); } } async assetGetImageInfoAsync(apiKey, assetID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('AssetGetImageInfo', {apiKey: apiKey, assetID: assetID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/assets/${assetID}/imageinfo`, 'get', apiKey, {}, {}, returnXML); } } async barcodeCreateAsync(apiKey, barcodeTypeID, barcodeText, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('BarcodeCreate', {apiKey: apiKey, barcodeTypeID: barcodeTypeID, barcodeText: barcodeText}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/barcodes`, 'post', apiKey, {}, {barcodeTypeID: barcodeTypeID, barcodeText: barcodeText }, returnXML); } } async barcodeCreateColoredAsync(apiKey, barcodeTypeID, barcodeText, backColor, barColor, textColor, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('BarcodeCreateColored', {apiKey: apiKey, barcodeTypeID: barcodeTypeID, barcodeText: barcodeText, backColor: backColor, barColor: barColor, textColor: textColor}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/barcodescolored`, 'post', apiKey, {}, {barcodeTypeID: barcodeTypeID, barcodeText: barcodeText, backColor: backColor, barColor: barColor, textColor: textColor }, returnXML); } } async csvFileCreateAsync(apiKey, xmlData, fileName, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('CsvFileCreate', {apiKey: apiKey, xmlData: xmlData, fileName: fileName}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/xmlcsvconverter`, 'post', apiKey, {xmlData: xmlData }, {fileName: fileName }, returnXML); } } async dataSourceAddSampleFileAsync(apiKey, dataSourceID, fileName, fileOrData, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceAddSampleFile', {apiKey: apiKey, dataSourceID: dataSourceID, fileName: fileName, fileOrData: fileOrData}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/files`, 'post', apiKey, {fileOrData: fileOrData }, {fileName: fileName }, returnXML); } } async dataSourceDeleteSampleFileAsync(apiKey, dataSourceID, fileName, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceDeleteSampleFile', {apiKey: apiKey, dataSourceID: dataSourceID, fileName: fileName}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/samplefiles/${fileName}`, 'delete', apiKey, {}, {}, returnXML); } } async dataSourceDownloadSpreadsheetsAsync(apiKey, dataSourceID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceDownloadSpreadsheets', {apiKey: apiKey, dataSourceID: dataSourceID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/spreadsheets`, 'get', apiKey, {}, {}, returnXML); } } async dataSourceDownloadURLAsync(apiKey, dataSourceID, urlType, query, forDocumentID, editorQueryString, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceDownloadURL', {apiKey: apiKey, dataSourceID: dataSourceID, urlType: urlType, query: query, forDocumentID: forDocumentID, editorQueryString: editorQueryString}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/downloadurl`, 'get', apiKey, {}, {urlType: urlType, query: query, forDocumentID: forDocumentID, editorQueryString: editorQueryString }, returnXML); } } async dataSourceFileGetXMLAsync(apiKey, dataSourceID, fileDataOrPath, fileExtension, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceFileGetXML', {apiKey: apiKey, dataSourceID: dataSourceID, fileDataOrPath: fileDataOrPath, fileExtension: fileExtension}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/xmlconverter`, 'put', apiKey, {fileDataOrPath: fileDataOrPath }, {fileExtension: fileExtension }, returnXML); } } async dataSourceListSampleFilesAsync(apiKey, dataSourceID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceListSampleFiles', {apiKey: apiKey, dataSourceID: dataSourceID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/samplefiles`, 'get', apiKey, {}, {}, returnXML); } } async dataSourceSalesForceGetXMLAsync(apiKey, dataSourceID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceSalesForceGetXML', {apiKey: apiKey, dataSourceID: dataSourceID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/salesforce`, 'get', apiKey, {}, {}, returnXML); } } async dataSourceSpreadsheetGetXMLAsync(apiKey, dataSourceID, spreadsheetID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DataSourceSpreadsheetGetXML', {apiKey: apiKey, dataSourceID: dataSourceID, spreadsheetID: spreadsheetID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/datasources/${dataSourceID}/spreadsheets`, 'post', apiKey, {spreadsheetID: spreadsheetID }, {}, returnXML); } } async documentCopyAnnotationsAsync(apiKey, fromItemID, toItemID, replaceExistingAnnotations, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCopyAnnotations', {apiKey: apiKey, fromItemID: fromItemID, toItemID: toItemID, replaceExistingAnnotations: replaceExistingAnnotations}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${toItemID}/annotations/copy`, 'put', apiKey, {}, {fromItemID: fromItemID, replaceExistingAnnotations: replaceExistingAnnotations }, returnXML); } } async documentCopyDocumentEventActionsAsync(apiKey, fromItemID, toItemID, replaceExistingActions, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCopyDocumentEventActions', {apiKey: apiKey, fromItemID: fromItemID, toItemID: toItemID, replaceExistingActions: replaceExistingActions}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${toItemID}/documenteventactions/copy`, 'put', apiKey, {}, {fromItemID: fromItemID, replaceExistingActions: replaceExistingActions }, returnXML); } } async documentCopyVariableDefinitionsAsync(apiKey, fromItemID, toItemID, replaceExistingVariables, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCopyVariableDefinitions', {apiKey: apiKey, fromItemID: fromItemID, toItemID: toItemID, replaceExistingVariables: replaceExistingVariables}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${toItemID}/variabledefinitions/copy`, 'put', apiKey, {}, {fromItemID: fromItemID, replaceExistingVariables: replaceExistingVariables }, returnXML); } } async documentCreateFromBlankDocTemplateAsync(apiKey, documentName, folderPath, blankDocTemplateID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateFromBlankDocTemplate', {apiKey: apiKey, documentName: documentName, folderPath: folderPath, blankDocTemplateID: blankDocTemplateID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/fromtemplate`, 'post', apiKey, {}, {documentName: documentName, folderPath: folderPath, blankDocTemplateID: blankDocTemplateID }, returnXML); } } async documentCreateFromChiliPackageAsync(apiKey, documentName, folderPath, packagePathOrData, newAssetLocation, newFontLocation, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateFromChiliPackage', {apiKey: apiKey, documentName: documentName, folderPath: folderPath, packagePathOrData: packagePathOrData, newAssetLocation: newAssetLocation, newFontLocation: newFontLocation}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/frompackage`, 'post', apiKey, {packagePathOrData: packagePathOrData }, {documentName: documentName, folderPath: folderPath, newAssetLocation: newAssetLocation, newFontLocation: newFontLocation }, returnXML); } } async documentCreateFromODTAsync(apiKey, documentName, folderPath, odtPathOrData, settingsXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateFromODT', {apiKey: apiKey, documentName: documentName, folderPath: folderPath, odtPathOrData: odtPathOrData, settingsXML: settingsXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/fromodt`, 'post', apiKey, {odtPathOrData: odtPathOrData, settingsXML: settingsXML }, {documentName: documentName, folderPath: folderPath }, returnXML); } } async documentCreateFromPDFAsync(apiKey, documentName, folderPath, pdfPathOrData, backgroundAssetLocation, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateFromPDF', {apiKey: apiKey, documentName: documentName, folderPath: folderPath, pdfPathOrData: pdfPathOrData, backgroundAssetLocation: backgroundAssetLocation}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/frompdf`, 'post', apiKey, {pdfPathOrData: pdfPathOrData }, {documentName: documentName, folderPath: folderPath, backgroundAssetLocation: backgroundAssetLocation }, returnXML); } } async documentCreateHTMLAsync(apiKey, itemID, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateHTML', {apiKey: apiKey, itemID: itemID, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/representations/html`, 'post', apiKey, {settingsXML: settingsXML }, {taskPriority: taskPriority }, returnXML); } } async documentCreateIDMLAsync(apiKey, itemID, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateIDML', {apiKey: apiKey, itemID: itemID, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/representations/idml`, 'post', apiKey, {settingsXML: settingsXML }, {taskPriority: taskPriority }, returnXML); } } async documentCreateImagesAsync(apiKey, itemID, settingsXML, imageConversionProfileID, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateImages', {apiKey: apiKey, itemID: itemID, settingsXML: settingsXML, imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/representations/images`, 'post', apiKey, {settingsXML: settingsXML }, {imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority }, returnXML); } } async documentCreateImagesAndPDFAsync(apiKey, itemID, settingsXML, imageConversionProfileID, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateImagesAndPDF', {apiKey: apiKey, itemID: itemID, settingsXML: settingsXML, imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/representations/imagesandpdf`, 'post', apiKey, {settingsXML: settingsXML }, {imageConversionProfileID: imageConversionProfileID, taskPriority: taskPriority }, returnXML); } } async documentCreateODFAsync(apiKey, itemID, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateODF', {apiKey: apiKey, itemID: itemID, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/representations/odf`, 'post', apiKey, {settingsXML: settingsXML }, {taskPriority: taskPriority }, returnXML); } } async documentCreatePackageAsync(apiKey, itemID, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreatePackage', {apiKey: apiKey, itemID: itemID, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/representations/package`, 'post', apiKey, {}, {taskPriority: taskPriority }, returnXML); } } async documentCreatePDFAsync(apiKey, itemID, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreatePDF', {apiKey: apiKey, itemID: itemID, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/representations/pdf`, 'post', apiKey, {settingsXML: settingsXML }, {taskPriority: taskPriority }, returnXML); } } async documentCreateTempFoldingAsync(apiKey, itemID, docXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempFolding', {apiKey: apiKey, itemID: itemID, docXML: docXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/folding`, 'post', apiKey, {docXML: docXML }, {itemID: itemID, taskPriority: taskPriority }, returnXML); } } async documentCreateTempHTMLAsync(apiKey, itemID, docXML, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempHTML', {apiKey: apiKey, itemID: itemID, docXML: docXML, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/html`, 'post', apiKey, {docXML: docXML, settingsXML: settingsXML }, {itemID: itemID, taskPriority: taskPriority }, returnXML); } } async documentCreateTempIDMLAsync(apiKey, itemID, docXML, settingsXML, taskPriority, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentCreateTempIDML', {apiKey: apiKey, itemID: itemID, docXML: docXML, settingsXML: settingsXML, taskPriority: taskPriority}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/tempxml/idml`, 'post', apiKey, {docXML: docXML, settingsXML: settingsXML }, {itemID: itemID, taskPriority: taskPriority }, returnXML); } } async environmentGetLoginSettingsAsync(environmentNameOrURL, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('EnvironmentGetLoginSettings', {environmentNameOrURL: environmentNameOrURL}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/environments/${environmentNameOrURL}/loginsettings`, 'get', null, {}, {}, returnXML); } } async environmentGetReflectionMapsAsync(apiKey, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('EnvironmentGetReflectionMaps', {apiKey: apiKey}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/environments/reflectionmaps`, 'get', apiKey, {}, {}, returnXML); } } async environmentGetSettingsAsync(apiKey, environmentName, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('EnvironmentGetSettings', {apiKey: apiKey, environmentName: environmentName}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/environments/${environmentName}/settings`, 'get', apiKey, {}, {}, returnXML); } } async environmentListAsync(apiKey, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('EnvironmentList', {apiKey: apiKey}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/environments`, 'get', apiKey, {}, {}, returnXML); } } async environmentSaveSettingsAsync(apiKey, environmentName, xml, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('EnvironmentSaveSettings', {apiKey: apiKey, environmentName: environmentName, xml: xml}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/environments/${environmentName}`, 'put', apiKey, {xml: xml }, {}, returnXML); } } async foldingSettingCreatePackageAsync(apiKey, foldingSettingId, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('FoldingSettingCreatePackage', {apiKey: apiKey, foldingSettingId: foldingSettingId}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/foldingsettings/${foldingSettingId}/package`, 'get', apiKey, {}, {}, returnXML); } } async fontGetIncludedGlyphsAsync(apiKey, fontID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('FontGetIncludedGlyphs', {apiKey: apiKey, fontID: fontID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/fonts/${fontID}/includedglyphs`, 'get', apiKey, {}, {}, returnXML); } } async generateApiKeyAsync(environmentNameOrURL, userName, password, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('GenerateApiKey', {environmentNameOrURL: environmentNameOrURL, userName: userName, password: password}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey`, 'post', null, {userName: userName, password: password }, {environmentNameOrURL: environmentNameOrURL }, returnXML); } } async generateApiKeyWithSettingsAsync(environmentNameOrURL, userName, password, settingsXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('GenerateApiKeyWithSettings', {environmentNameOrURL: environmentNameOrURL, userName: userName, password: password, settingsXML: settingsXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/withsetting`, 'post', null, {userName: userName, password: password, settingsXML: settingsXML }, {environmentNameOrURL: environmentNameOrURL }, returnXML); } } async getServerDateAsync(returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('GetServerDate', {}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/server/date`, 'get', null, {}, {}, returnXML); } } async googleCreateAuthorizationUrlAsync(apiKey, clientID, clientSecret, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('GoogleCreateAuthorizationUrl', {apiKey: apiKey, clientID: clientID, clientSecret: clientSecret}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/server/googleauthurl`, 'get', apiKey, {}, {clientID: clientID, clientSecret: clientSecret }, returnXML); } } async interfaceGetInitialSettingsAsync(apiKey, forEditor, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('InterfaceGetInitialSettings', {apiKey: apiKey, forEditor: forEditor}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/environments/interfaceinitialsettings`, 'get', apiKey, {}, {forEditor: forEditor }, returnXML); } } async languageGetCombinedStringsAsync(apiKey, languageID, overrideBasedOn, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LanguageGetCombinedStrings', {apiKey: apiKey, languageID: languageID, overrideBasedOn: overrideBasedOn}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/languages/${languageID}/combinedstrings`, 'get', apiKey, {}, {overrideBasedOn: overrideBasedOn }, returnXML); } } async languageGetCsvURLAsync(apiKey, languageID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LanguageGetCsvURL', {apiKey: apiKey, languageID: languageID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/languages/${languageID}/urls/csv`, 'get', apiKey, {}, {}, returnXML); } } async languageGetUnicodeTextURLAsync(apiKey, languageID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LanguageGetUnicodeTextURL', {apiKey: apiKey, languageID: languageID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/languages/${languageID}/urls/unicodetext`, 'get', apiKey, {}, {}, returnXML); } } async languageImportCsvAsync(apiKey, languageID, filePathOrData, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LanguageImportCsv', {apiKey: apiKey, languageID: languageID, filePathOrData: filePathOrData}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/languages/${languageID}/csv`, 'post', apiKey, {filePathOrData: filePathOrData }, {}, returnXML); } } async languageImportUnicodeTextAsync(apiKey, languageID, filePathOrData, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LanguageImportUnicodeText', {apiKey: apiKey, languageID: languageID, filePathOrData: filePathOrData}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/languages/${languageID}/unicodetext`, 'post', apiKey, {filePathOrData: filePathOrData }, {}, returnXML); } } async languageSaveStringsAsync(apiKey, languageID, stringXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LanguageSaveStrings', {apiKey: apiKey, languageID: languageID, stringXML: stringXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/languages/${languageID}`, 'put', apiKey, {stringXML: stringXML }, {}, returnXML); } } async languagesGetListAsync(apiKey, includeSystemLanguages, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LanguagesGetList', {apiKey: apiKey, includeSystemLanguages: includeSystemLanguages}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/languages`, 'get', apiKey, {}, {includeSystemLanguages: includeSystemLanguages }, returnXML); } } async lockApiKeyAsync(apiKeyToLock, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('LockApiKey', {apiKeyToLock: apiKeyToLock}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/apikey/lock/${apiKeyToLock}`, 'put', apiKey, {}, {}, returnXML); } } async oDTGetStylesAsync(apiKey, fileData, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ODTGetStyles', {apiKey: apiKey, fileData: fileData}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/odt/styles`, 'post', apiKey, {fileData: fileData }, {}, returnXML); } } async oDTGetTextFlowAsync(apiKey, fileData, stylesMapping, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ODTGetTextFlow', {apiKey: apiKey, fileData: fileData, stylesMapping: stylesMapping}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/odt/textflow`, 'post', apiKey, {fileData: fileData, stylesMapping: stylesMapping }, {}, returnXML); } } async resourceFolderAddAsync(apiKey, resourceName, newName, parentPath, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceFolderAdd', {apiKey: apiKey, resourceName: resourceName, newName: newName, parentPath: parentPath}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/folders`, 'post', apiKey, {}, {newName: newName, parentPath: parentPath }, returnXML); } } async resourceFolderCopyAsync(apiKey, resourceName, folderPath, newFolderPath, includeSubFolders, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceFolderCopy', {apiKey: apiKey, resourceName: resourceName, folderPath: folderPath, newFolderPath: newFolderPath, includeSubFolders: includeSubFolders}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/folders/copy`, 'post', apiKey, {}, {folderPath: folderPath, newFolderPath: newFolderPath, includeSubFolders: includeSubFolders }, returnXML); } } async resourceFolderDeleteAsync(apiKey, resourceName, relativePath, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceFolderDelete', {apiKey: apiKey, resourceName: resourceName, relativePath: relativePath}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/folders`, 'delete', apiKey, {}, {relativePath: relativePath }, returnXML); } } async resourceFolderMoveAsync(apiKey, resourceName, folderPath, newFolderPath, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceFolderMove', {apiKey: apiKey, resourceName: resourceName, folderPath: folderPath, newFolderPath: newFolderPath}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/folders/move`, 'put', apiKey, {}, {folderPath: folderPath, newFolderPath: newFolderPath }, returnXML); } } async resourceGetHistoryAsync(apiKey, resourceName, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceGetHistory', {apiKey: apiKey, resourceName: resourceName}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/history`, 'get', apiKey, {}, {}, returnXML); } } async resourceGetTreeAsync(apiKey, resourceName, parentFolder, includeSubDirectories, includeFiles, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceGetTree', {apiKey: apiKey, resourceName: resourceName, parentFolder: parentFolder, includeSubDirectories: includeSubDirectories, includeFiles: includeFiles}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/tree`, 'get', apiKey, {}, {parentFolder: parentFolder, includeSubDirectories: includeSubDirectories, includeFiles: includeFiles }, returnXML); } } async resourceGetTreeLevelAsync(apiKey, resourceName, parentFolder, numLevels, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceGetTreeLevel', {apiKey: apiKey, resourceName: resourceName, parentFolder: parentFolder, numLevels: numLevels}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/treelevel`, 'get', apiKey, {}, {parentFolder: parentFolder, numLevels: numLevels }, returnXML); } } async resourceItemAddAsync(apiKey, resourceName, newName, folderPath, xml, fileData, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceItemAdd', {apiKey: apiKey, resourceName: resourceName, newName: newName, folderPath: folderPath, xml: xml, fileData: fileData}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/items`, 'post', apiKey, {xml: xml, fileData: fileData }, {newName: newName, folderPath: folderPath }, returnXML); } } async resourceItemAddFromURLAsync(apiKey, resourceName, newName, folderPath, url, login, pw, reuseExisting, previewFileURL, previewExtension, isPermanentPreview, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('ResourceItemAddFromURL', {apiKey: apiKey, resourceName: resourceName, newName: newName, folderPath: folderPath, url: url, login: login, pw: pw, reuseExisting: reuseExisting, previewFileURL: previewFileURL, previewExtension: previewExtension, isPermanentPreview: isPermanentPreview}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/${resourceName}/items/fromurl`, 'post', apiKey, {}, {newName: newName, folderPath: folderPath, url: url, login: login, pw: pw, reuseExisting: reuseExisting, previewFileURL: previewFileURL, previewExtension: previewExtension, isPermanentPreview: isPermanentPreview }, returnXML); } } async spellCheckDictionariesGetSystemListAsync(apiKey, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SpellCheckDictionariesGetSystemList', {apiKey: apiKey}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/spellcheckdicts`, 'get', apiKey, {}, {}, returnXML); } } async spellCheckDictionaryAddAsync(apiKey, name, dicFileOrData, affFileOrData, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SpellCheckDictionaryAdd', {apiKey: apiKey, name: name, dicFileOrData: dicFileOrData, affFileOrData: affFileOrData}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/spellcheckdicts`, 'post', apiKey, {dicFileOrData: dicFileOrData, affFileOrData: affFileOrData }, {name: name }, returnXML); } } async spellCheckDictionaryAddFromSystemAsync(apiKey, name, systemDictName, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SpellCheckDictionaryAddFromSystem', {apiKey: apiKey, name: name, systemDictName: systemDictName}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/spellcheckdicts/fromsystem`, 'post', apiKey, {}, {name: name, systemDictName: systemDictName }, returnXML); } } async spellCheckDictionaryReplaceFileAsync(apiKey, itemID, fileType, fileOrData, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SpellCheckDictionaryReplaceFile', {apiKey: apiKey, itemID: itemID, fileType: fileType, fileOrData: fileOrData}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/system/spellcheckdicts/${itemID}`, 'put', apiKey, {fileOrData: fileOrData }, {fileType: fileType }, returnXML); } } async switchServerFlowGetCheckPointsAsync(apiKey, switchServerID, flowID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SwitchServerFlowGetCheckPoints', {apiKey: apiKey, switchServerID: switchServerID, flowID: flowID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/switchservers/${switchServerID}/flows/${flowID}/checkpoints`, 'get', apiKey, {}, {}, returnXML); } } async switchServerFlowGetElementsJobCountAsync(apiKey, switchServerID, flowID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SwitchServerFlowGetElementsJobCount', {apiKey: apiKey, switchServerID: switchServerID, flowID: flowID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/switchservers/${switchServerID}/flows/${flowID}/elementsjobcount`, 'get', apiKey, {}, {}, returnXML); } } async switchServerFlowGetFullConfigAsync(apiKey, switchServerID, flowID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SwitchServerFlowGetFullConfig', {apiKey: apiKey, switchServerID: switchServerID, flowID: flowID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/switchservers/${switchServerID}/flows/${flowID}/fullconfig`, 'get', apiKey, {}, {}, returnXML); } } async switchServerFlowGetJobsAsync(apiKey, switchServerID, flowID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SwitchServerFlowGetJobs', {apiKey: apiKey, switchServerID: switchServerID, flowID: flowID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/switchservers/${switchServerID}/flows/${flowID}/jobs`, 'get', apiKey, {}, {}, returnXML); } } async switchServerFlowGetSubmitPointsAsync(apiKey, switchServerID, flowID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('SwitchServerFlowGetSubmitPoints', {apiKey: apiKey, switchServerID: switchServerID, flowID: flowID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/settings/switchservers/${switchServerID}/flows/${flowID}/submitpoints`, 'get', apiKey, {}, {}, returnXML); } } async documentGetVariableValuesAsync(apiKey, itemID, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentGetVariableValues', {apiKey: apiKey, itemID: itemID}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/variablevalues`, 'get', apiKey, {}, {}, returnXML); } } async documentProcessServerSideAsync(apiKey, itemID, resourceXML, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentProcessServerSide', {apiKey: apiKey, itemID: itemID, resourceXML: resourceXML}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/documentprocessor`, 'put', apiKey, {}, {itemID: itemID, resourceXML: resourceXML }, returnXML); } } async documentSetAnnotationsAsync(apiKey, itemID, annotationXML, replaceExistingAnnotations, returnXML = false) { if (!this.options.rest){ return await this.makeSoapCall('DocumentSetAnnotations', {apiKey: apiKey, itemID: itemID, annotationXML: annotationXML, replaceExistingAnnotations: replaceExistingAnnotations}, returnXML); } else { return await this.makeRestCall(`/rest-api/v1/resources/documents/${itemID}/annotations`, 'post', apiKey, {annotationXML: annotationXML }, {replaceExistingAnnotations: replaceExistingAnnotations }, returnXML); } } async documentSetAssetDirectoriesAsync(apiKey, documentID, userAssetDirectory, userGroupAssetDirectory, documentAs