new SmartOrg(endpoint, path_)
Any interaction with the SmartOrg API starts by creating a SmartOrg object.
Parameters:
| Name | Type | Description |
|---|---|---|
endpoint |
string | The SmartOrg server endpoint |
path_ |
string | The path where the API is accessible |
- Source:
Example
// If your API is at https://localhost/kirk var endpoint = "https://localhost"; var path = "kirk"; var smartorg = new SmartOrg(endpoint, path);
Methods
-
acceptWelcomeMessage(messageType)
-
Accept license or security warnings.
Parameters:
Name Type Description messageTypestring Can be LICENSE and SECURITY_WARNING.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
actionFor(actionID, nodeID, packedReportOptions)
-
Executes action command and fetches the results. This is a general way to access any template menu command.
Parameters:
Name Type Description actionIDstring The ID for the action specified in the template menu JSON (portfolio or application structure).
nodeIDstring The node for which the action is to be applied
packedReportOptionsobject Report options for this action.
- Source:
Returns:
A promise to the result of running the action
- Type
- PromiseActionResults
Example
smartorg.actionFor(actionID, nodeID) .then(function (data) { console.log(data); // The data object is structured differently for each command }) .catch(function (err) { console.error(err); }) -
actionMenuFor(nodeID)
-
Fetches the menu (from the appropriate template) that is associated with a node.
Parameters:
Name Type Description nodeIDstring The ID of the node for which a menu is to be fetched
- Source:
Returns:
A promise to return the action menu for the specified node
- Type
- PromiseActionMenu
Example
smartorg.actionMenuFor(nodeID) .then(function (menu) { console.log(menu); }) .catch(function (err) { handleError(err); }); -
adminSetPassword(username, password)
-
Admin users call this function to set other user's password.
Server will check if the user calling this function is admin.Parameters:
Name Type Description usernamestring This function use username instead of
user id. Username should also be unique.passwordstring Plain text new user password
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
authenticate(credentials)
-
Authenticate the user using the credentials provided.
This is the first thing that needs to happen after the SmartOrg object
has been created.Parameters:
Name Type Description credentialsObject The credentials with which the user is to be authenticated.
Properties
Name Type Description usernamestring The username
passwordstring The password
- Source:
Returns:
A promise to authenticate
- Type
- PromiseAuthenticate
Example
// Let's assume the SmartOrg API is accessible at https://localhost/kirk var smartorg = new SmartOrg("https://localhost","kirk"); var username = ...; // get the username from somewhere var password = ...; // get the password from somewhere smartorg.authenticate({'username': username, 'password': password}) .then(function (userInfo) { console.info("user ID " + userInfo.uid + " logged in"); }) .catch(function (err) { console.error("Error occurred "+err); }); -
categoriesConfigFor(rootNodeID)
-
Parameters:
Name Type Description rootNodeID- Source:
Returns:
Example
smartorg.categoriesConfigFor(rootNodeID) .then(function(categoryConfigs) { // categoryConfigs is an array of categoryConfig categoryConfigs.forEach(function(categoryConfig) { console.log(categoryConfig.AppliesTo); console.log(categoryConfig.IsMultiSelect); console.log(categoryConfig.CategoryName); //e.g. Region console.log(categoryConfig.AutoPropagateUp); categoryConfig.CategoryEntries.forEach(function(entry) { console.log("category entry "+ entry); // e.g. US, Asia, Europe }); }); }) .catch(function(err) { handleError(err); }); -
changeLog(nodeID)
-
Fetch change log at or under current node.
Parameters:
Name Type Description nodeIDstring The ID of the node at or under which change log is to be fetched
- Source:
Returns:
- Type
- Array.<changes>
-
changePasswordWithoutOld(newpassword)
-
Call this api to change password to current logged in user.
Special version for first time login and reset password.TODO: Fix this security glitch!
Parameters:
Name Type Description newpasswordstring Clear text new user password
- Source:
Returns:
A promise.
then: dict of result, status 0 as success, message as
array of strings of messages.
catch: error status, text and message.- Type
- * | Promise.<T> | Promise | axios.Promise
-
checkResetPasswordKey(username, key)
-
Check if the username and key matches and not expired.
Parameters:
Name Type Description usernamestring keystring - Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
confirmUserEmail(username, key)
-
Confirm email address by username and key. At this point user
should not be logged in, so this call will bypass authentication
and use username.Parameters:
Name Type Description usernamestring Username, should be unique.
keystring System generated one time key.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
createNewGroup(groupName, description)
-
Create a new group.
Parameters:
Name Type Description groupNamestring Group name, should be unique.
descriptionstring Description of the group.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
createNode(parentNodeID, newNodeName, templateName, platformOrLeaf)
-
Create a new Node under an existing portfolio
Parameters:
Name Type Description parentNodeIDstring parent node ID
newNodeNamestring new Node name
templateNamestring template name
platformOrLeafstring 'platform' or 'leaf'
- Source:
Returns:
msg - create Node status message
- Type
- string
Example
smartorg.createNode(parentNodeID, newNodeName, templateName, platformOrLeaf) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
createPortfolio(newPortfolioName)
-
Create new Portfolio
Parameters:
Name Type Description newPortfolioNamestring Name of the new portfolio
- Source:
Returns:
msg - create Portfolio status message
- Type
- string
Example
smartorg.createPortfolio(newPortfolioName) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
createPortfolioFromExisting(newPortfolioName, categoriesConfig, acl, chosenTemplates, chosenGroups)
-
Create new Portfolio from existing portfolio
Parameters:
Name Type Description newPortfolioNamestring Name of the new portfolio
categoriesConfigaclchosenTemplateschosenGroups- Source:
Returns:
msg - create Portfolio status message
- Type
- string
Example
smartorg.createPortfolioFromExisting(newPortfolioName, categoriesConfig, acl) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
createShortURL(urlToShorten, byPassLogin, urlLinkName)
-
Parameters:
Name Type Description urlToShortenstring long url to shorten
byPassLoginboolean true or false flag to bypass login
urlLinkNamestring optional link or report name
- Source:
Returns:
ShortUrlPromise
-
deleteCategoryConfig(rootNodeID, categoryName)
-
Delete a category from config.
Parameters:
Name Type Description rootNodeIDcategoryNamestring Category name, should be an existing one.
- Source:
Returns:
- Type
- *
Example
smartorg.deleteCategoryConfig(rootNodeID, categoryName) .then(function(statusMessage) { console.log(statusMessage); }) .catch(function(err) { handleError(err); }); -
deleteGroup(groupId)
-
Delete a group from database.
Parameters:
Name Type Description groupIdstring Unique database id for group.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
deleteNode(nodeID)
-
Delete Node
Parameters:
Name Type Description nodeIDstring The ID of the node to delete
- Source:
Returns:
msg - delete status message
- Type
- string
Example
smartorg.deleteNode(nodeToDeleteID) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
deleteUnivSchemaFromRoot(nodeID, schemaName)
-
delete specific schema from rootNode
Parameters:
Name Type Description nodeIDstring schemaNamestring - Source:
-
deleteUser(userId)
-
Delete a user from database by his id.
Parameters:
Name Type Description userIdstring User unique id.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
downloadSpreadsheet(nodeID)
-
Downloads spreadsheet model applicable at node with given nodeID.
Data is a json object with the following structure:Parameters:
Name Type Description nodeID- Source:
Returns:
- Type
- * | Promise | axios.Promise
Example
smartorg.downloadSpreadsheet(myNodeID).then(function(answer) { console.log(answer.templateName); // e.g. simpleLaunch console.log(answer.extension); // e.g. xls console.log(answer.modelData); // Base-64 encoded binary data }).catch(function(err) { console.log(err); }); -
editGroup(groupId, groupName, description)
-
Edit a group info. Only group description can be change.
Parameters:
Name Type Description groupIdstring Unique database id for group.
groupNamestring Unique group name.
descriptionstring - Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
editNode(nodeID, newNodeName, templateName, children)
-
Edit Node
Parameters:
Name Type Description nodeIDstring The ID of the node to edit
newNodeNamestring The new node name
templateNamestring The template name
childrenArray.<string> List of children ids.
- Source:
Returns:
- Type
- axios.Promise
Example
smartorg.editNode(nodeID, newNodeName, templateName) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
exportPortfolio(nodeID)
-
Export portfolio
Parameters:
Name Type Description nodeID- Source:
Returns:
msg - entire portfolio is exported
- Type
- string
Example
smartorg.exportPortfolio(treeID) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
fetchAllExportedPortfolioPaths()
-
Fetch all exported portfolio paths
- Source:
Returns:
exported portfolio path list
- Type
- string
Example
smartorg.fetchAllExportedPortfolioPaths(treeID) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
fetchCalculationEngineLog(linesFromBottom)
-
Fetch lines from bottom of calculation engine log
Parameters:
Name Type Description linesFromBottom- Source:
Returns:
msg - fetched lines from bottom of calculation engine log
- Type
- string
Example
smartorg.fetchCalculationEngineLog(treeID) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
fetchInputData(treeID, nodeID)
-
Fetch input data in a excel format string.
Parameters:
Name Type Description treeIDstring Tree id, ie. root node name.
nodeIDstring Node id, can be any node. Will download
input of a subtree from this node.- Source:
Returns:
Download input promise.
then:
catch:- Type
- * | Promise.<T> | Promise | axios.Promise
-
fixOrphanNodesCount(treeID)
-
Fix (delete) all orphan nodes in tree.
Parameters:
Name Type Description treeIDstring Tree id aka root node name.
- Source:
Returns:
then: number of deleted nodes.
- Type
- * | Promise.<T> | Promise | axios.Promise
-
getAcl(treeId)
-
Get access control list through tree id.
Parameters:
Name Type Description treeIdstring Root node name as tree id.
- Source:
Returns:
Resolved will
get a acl object with owner and acl groups.- Type
- * | Promise.<T> | Promise | axios.Promise
-
getAllTemplates()
-
Get all templates. Maybe duplicated to templatesFor when node
id is empty.- Source:
Returns:
- Type
- *
-
getApiVersionNumber()
-
Get current api version number.
- Source:
Returns:
Api version number promise.
//to do: Fan this is not complete needs @example then: string of version number. catchL {status: err code, statusText: status text, message: err message}- Type
- *
-
getAssignCategory(treeID)
-
Parameters:
Name Type Description treeIDstring The treeID for which category
assignment is sought- Source:
Returns:
- Category assignment object
- Type
- object
-
getCalculationEngineInfo()
-
Get calculation engine version number and log level.
- Source:
Returns:
Promise.
then: {logLevel: "something", versionNumber: "something"}
catch: Error.- Type
- Object
-
getDisplayNameList(templateName, leafOrPlatform, nodeID)
-
lookup inputs from astro_data and gives the specific fields
Parameters:
Name Type Description templateNameleafOrPlatformnodeIDstring Tree node Id.
- Source:
Returns:
list for fields to be displayed in universal output
-
getFieldList(nodeID, schema, packedReportOptions)
-
Lookup inputs and outputs that need to go into the universal table
by key. We need to supply nodeID, and at least one of
input or output keys (or both).Parameters:
Name Type Description nodeIDstring Tree node Id.
schemaobject contains selectedInputKeys {Array},
selectedOutputKeys {Array} and selectedTableInputKeys {object}packedReportOptionscontains encoded reportOptions
- Source:
Returns:
list for fields to be displayed in universal output
-
getGroupRestrictions(treeId)
-
Get group restrictions. Same thing as templates.
Parameters:
Name Type Description treeIdstring Root node name as tree id.
- Source:
Returns:
Two arrays of
chosen and unchosen.- Type
- * | Promise.<T> | Promise | axios.Promise
-
getInfoForShortURL(shortCode)
-
lookup host specific short code to return url
Parameters:
Name Type Description shortCodestring the short code to lookup url
- Source:
Returns:
ShortUrl or 404 Not Found
-
getListOfGroups()
-
Get a list of all groups with name, id, and list of users of
groups.- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
getListOfUsers()
-
Get list of all user with all info except password.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
getOrphanNodesCount(treeID)
-
Get the total number of orphan nodes in tree.
Parameters:
Name Type Description treeIDstring Tree id aka root node name.
- Source:
Returns:
then: number of nodes.
- Type
- * | Promise.<T> | Promise | axios.Promise
-
getSimpleOutputs()
-
Get simple outputs from node data
- Source:
Returns:
simple outputs
- Type
- *
-
getTemplateRestrictions(treeId)
-
Get template restriction by tree id.
Parameters:
Name Type Description treeIdstring Root node name as tree id.
- Source:
Returns:
Resolved will
be a list of chosen template names and a list of unchosen.- Type
- * | Promise.<T> | Promise | axios.Promise
-
getUserProfile()
-
Get current logged in user profile.
- Source:
Returns:
Get user profile promise.
then: dict of user profile info.
catch: error status, text and message.- Type
- *
Example
smartorg.getUserProfile().then( function (result) { console.log(result); }) .catch(function (err) { console.err(err); }); -
getUserProfileByID(userId)
-
Read user profile by his id.
Parameters:
Name Type Description userIdstring Unique user database id.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
getWelcomeMessage(messageType)
-
Get welcome message, including license and security warning.
Parameters:
Name Type Description messageTypestring Can be LICENSE and SECURITY_WARNING.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
groupAddUser(groupId, userId)
-
Add a user to a group.
Parameters:
Name Type Description groupIdstring Group to add a user to.
userIdstring Add this user to group.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
groupRemoveUser(groupId, userId)
-
Remove a user from a group.
Parameters:
Name Type Description groupIdstring Group to remove user.
userIdstring This user will be removed from given
group.- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
importPortfolio(includeData, pathToImportFiles64, newTreeName64)
-
Import portfolio
Parameters:
Name Type Description includeDatapathToImportFiles64newTreeName64- Source:
Returns:
msg - portfolio is imported
- Type
- string
Example
smartorg.exportPortfolio(treeID) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
inputsFor(nodeID, inputKeys)
-
Given the keys for inputs and a node ID, all the input data
at that node matching the keys are fetched.Parameters:
Name Type Description nodeIDstring The ID of the node at which the inputs are to be fetched
inputKeysstring A pipe-delimited list of input keys that are to be fetched at the node
- Source:
Returns:
A promise to the inputs
- Type
- PromiseInputs
Example
nodeID = "012345"; inputKeys = "marketSize|marketShare|discountRate"; smartorg.inputsFor(nodeID, inputKeys) .then(function (inputs) { inputs.menuItems.map(function (input) { console.log(input); }) }) .catch(function (err) { console.error(err); }) -
makeEditable(nodeID, includeAllChildren)
-
Set a node (and its children) editable
Parameters:
Name Type Description nodeIDincludeAllChildren- Source:
Returns:
msg - Made node (and its descendants) editable
- Type
- string
Example
smartorg.makeEditable(nodeID, includeAllChildren) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
makeReadOnly(nodeID, includeAllChildren)
-
Set a node (and its children) readonly
Parameters:
Name Type Description nodeIDincludeAllChildren- Source:
Returns:
msg - Made node (and its descendants) readonly
- Type
- string
Example
smartorg.makeReadOnly(nodeID, includeAllChildren) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
modifyExistingUser(userID, username, name, email, phone1, organisation, defaultGroupName)
-
Similar to save user profile. This one is for address book use.
Parameters:
Name Type Description userIDstring Unique user database id.
usernamestring Unique username. Server will double
check if it is unique.namestring Full name of user in format "Last, First".
emailstring phone1string In format +14081231234.
organisationstring defaultGroupNamestring Group name instead of id.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
newUser(username, name, password, email, phone1, organisation, defaultGroupName)
-
Creates a new user
Parameters:
Name Type Description usernamestring Unique username. Server will double
check if it is unique.namestring Full name of user in format "Last, First".
passwordstring Password in plain text. x_x
emailstring phone1string In format +14081231234.
organisationstring defaultGroupNamestring Group name instead of id.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
nodeBy(nodeID)
-
Retrieves a node by its ID
Parameters:
Name Type Description nodeIDstring The ID of the node to get
- Source:
Returns:
A promise to return the node
- Type
- PromiseNodeResults
Example
smartorg.nodeBy(nodeID) .then(function (node) { console.log(node); }) .catch(function (err) { handleError(err); }) -
pasteNode(targetParentNodeID, nodeToPaste)
-
Paste Node
Parameters:
Name Type Description targetParentNodeIDstring parent Node ID
nodeToPastestring Node ID to paste
- Source:
Returns:
A promise to provide status message of the Paste Node operation.
- Type
- PromisePasteStatus
Example
// to paste a node under a target parent node smartorg.pasteNode(targetParentNodeID, nodeToPaste) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
portfolios()
-
Fetches all the portfolios available to user, based on access control rules
setup by the administrator. If no rules are set for the user, all
portfolios will be returned.- Source:
Returns:
A promise to the portfolios
- Type
- PromisePortfolios
Example
smartorg.portfolios() .then(function (portfolios) { portfolios.map(function (portfolio) { console.log(portfolio); }) }) .catch(function (err) { console.error(err); }) -
recalculatePortfolio(treeID, recalType, startNodeId)
-
Recalculate entire portfolio
Parameters:
Name Type Description treeIDrecalTypestartNodeId- Source:
Returns:
msg - tree is recalculated
- Type
- string
Example
smartorg.recalculatePortfolio(treeID) .then(function (ret) { console.warn(ret); }) .catch(function (err) { handleError(err); }) -
replaceUnivSchemaInRoot(nodeID, schemaName, oldSchemaName, univSchema)
-
replace univSchema in rootNode
Parameters:
Name Type Description nodeIDstring schemaNamestring oldSchemaNamestring univSchemaschema has templateName, inputKeys, outputKeys & access
- Source:
-
requestResetPassword(username, email)
-
Request reset password.
Parameters:
Name Type Description usernamestring emailstring - Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
resetPassword(oldpassword, newpassword)
-
Call this api to change the password for user.
Parameters:
Name Type Description oldpasswordstring users: pass in clear text old
password. admin use: pass in clear text string optional
for admin reset ( must be called by user in administrators
group )newpasswordstring clear text new user password
- Source:
Returns:
- status message of modifying password
A promise.
then: dict of result, status 0 as success, message as
catch: error status, text and message.array of strings of messages.
- Type
- string
-
resetPasswordThroughEmail(username, key, newPassword)
-
Reset password to new password. Will check the username and
key again to make sure everything is correct.Parameters:
Name Type Description usernamestring keystring newPasswordstring - Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
saveCategoryConfig(rootNodeID, categoryConfig)
-
Parameters:
Name Type Description rootNodeIDcategoryConfigCategoryConfig new or existing category config object ( not string )
- Source:
Returns:
Example
smartorg.saveCategoryConfig(rootNodeID, categoryConfig) .then(function(statusMessage) { console.log(statusMessage); }) .catch(function(err) { handleError(err); }); -
saveDescripton(nodeID, description)
-
Save a node's description.
Both two parameters need to encode in base 64.Parameters:
Name Type Description nodeIDstring Tree node Id.
descriptionstring Html format description.
- Source:
-
saveInputs(nodeID, inputs)
-
Saves inputs
Parameters:
Name Type Description nodeIDstring The ID of the node that's inputs are to be saved
inputsArray.<InputKeyValPair> array of inputs to be saved
- Source:
Returns:
msg - save status message
- Type
- string
Examples
saved dataset for node 'leafNodeExample' by calling template 'exampleTemplateName'
//to save inputs for a given node smartorg.saveInputs(nodeID, inputs) .then(function (ret) { console.log(ret); // Need documentation on ret }) .catch(function (err) { handleError(err); }); -
saveSmartText(nodeID, smartText)
-
Save a node's smartText.
Both two parameters need to encode in base 64.Parameters:
Name Type Description nodeIDstring Tree node Id.
smartTextstring Html format smartText.
- Source:
-
saveTags(nodeID, newTagString)
-
Saves array of tags for a node
Parameters:
Name Type Description nodeIDnewTagStringArray.<TagSet> - Source:
Returns:
- Type
- SaveTagsPromise
Example
smartorg.saveTags(nodeId, newTagString) .then(function(msg) { console.log(msg); }) .catch(function(err) { console.error(err); }); -
saveUnivSchemaToRoot(nodeID, schema, oldName)
-
saving univSchema to rootNode
Parameters:
Name Type Description nodeIDstring schemahas templateName, IOKeys & access
oldNameto check and replace it with new schema name
- Source:
-
saveUserProfile(username, name, email, phone1, organisation)
-
Save (update) user profile information. This one is for user
to change their own profiles.Parameters:
Name Type Description usernamestring Username as login name.
namestring User full name in "Lastname, Firstname"
emailstring phone1string Phone number, only + and numbers.
organisationstring - Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
setAcl(treeId, acl)
-
Set acl info.
Parameters:
Name Type Description treeIdstring Root node name as tree id.
aclobject Though we request acl object here, we only
save group info into database.- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
setGroupRestrictions(treeId, chosenGroups)
-
Set group restrictions.
Parameters:
Name Type Description treeIdstring Root node name as tree id.
chosenGroupsArray.<string> Array of chosen group
names. We do not save unchosen ones.- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
setGroupsAndTemplatesRestrictions(treeId, groups, templates)
-
Set group restrictions and template restrictions at the same
time.Parameters:
Name Type Description treeIdstring Root node name as tree id.
groupsArray.<string> Array of chosen group names.
templatesArray.<string> Array of chosen template
names.- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
setTemplateRestrictions(treeId, chosenTemplates)
-
Set template restriction.
Parameters:
Name Type Description treeIdstring Root node name as tree id.
chosenTemplatesArray.<string> Array of chosen template
names. We do not save unchosen ones.- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
setWelcomeMessage(messageType, message, state)
-
Set welcome message. This function will push whatever string
passed in without doing any encoding. So encode the message
before calling this.Parameters:
Name Type Description messageTypestring Can be LICENSE and SECURITY_WARNING.
messagestring Message to be save into database.
stateboolean True for always display.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
sharedDataFor(nodeID)
-
Get share data (Input screen) structure.
Parameters:
Name Type Description nodeIDstring Tree node ID.
- Source:
Returns:
A promise to return shared data for the
specified node.- Type
- Promise
Example
smartorg.sharedDataFor(nodeID) .then(function (menu) { console.log(menu); }) .catch(function (err) { handleError(err); }); -
tagsFor(nodeID)
-
Get array of tags for a node.
Parameters:
Name Type Description nodeIDstring - Source:
Returns:
Tags promise.
then: array of tags
catch: {status: err code, statusText: status text,
message: err message}- Type
- *
Example
smartorg.tagsFor(nodeId).then( function (result) { console.log(result); }).catch(function (err) { console.log(err); }); -
templatesFor(nodeID)
-
Obtain all the templates applicable to a node.
Parameters:
Name Type Description nodeIDstring The ID of the node for which templates are to be fetched.
Normally, this would result in all the templates in the system, unless the administrator has restricted
the templates that are visible in the portfolio of which this node is a part. In that case,
only the restricted templates will be returned.- Source:
Returns:
A promise to provide the list of templates
- Type
- PromiseTemplates
Example
smartorg.templatesFor(templatesNodeID) .then(function (ret) { console.warn(ret); // ret[0] --> First Template // ret[0].name --> Name of first template // ret[0].hasPlatform --> Does this have a platform? // ret[0].info.Creator --> Optional name of creator of template // ret[0].info.CreatorLink --> Optional link to creator website // ret[0].info.Description --> Optional description of template // ret[0].info.Email --> Optional email id of creator of template }) .catch(function (err) { console.error(err); }) -
tornado(nodeID)
-
Tornado Report
Parameters:
Name Type Description nodeIDstring The ID of the node for the Tornado
- Source:
Returns:
tornadoData in JSON
- Type
- *
Example
smartorg.tornado(nodeID) .then(function (tornado) { console.log(tornado); }) .catch(function (err) { handleError(err); }) -
treeFor(portfolioName)
-
Gets the Tree for a Portfolio
Parameters:
Name Type Description portfolioNamestring Portfolio Name
- Source:
Returns:
A promise representing the Portfolio Tree structure
- Type
- PromiseTree
Example
smartorg.treeFor(treeID) .then(function (tree) { console.log(tree); }) .catch(function (err) { handleError(err); }) -
universalSaveInputs(inputs)
-
save inputs to corresponding nodes
Parameters:
Name Type Description inputsObject - Source:
-
updateUserAdminSettings(userId, adminSettings)
-
Update user admin settings, including force user to change
password on login and reset user to first login status.Parameters:
Name Type Description userIdstring Unique user id (couch db doc id).
adminSettingsobject A dict contains everything needs
to be set. For now it has passwordChange and
resetToFirstLogin. Anything come in later just add to the
dict object.- Source:
Returns:
Result status promise.
then: status 0, no data.
catch: status not 0, exception object or message array.- Type
- * | Promise.<T> | Promise | axios.Promise
-
updateUserEmail(email)
-
Update user email address. Will be obselete soon.
Parameters:
Name Type Description emailstring Email address.
- Source:
Returns:
- Type
- * | Promise.<T> | Promise | axios.Promise
-
zendeskAuthUrl()
-
Generate zendesk authentication url (token) for one login.
- Source:
Returns:
Get url promise.
then: url string.
catch: error status, text and message.- Type
- *
Example
smartorg.zendeskAuthUrl().then( function (result) { console.log(result); }) .catch(function (err) { console.err(err); }); -
zendeskRedirect()
-
Generate zendesk authentication url (token) for one login.
Return to page specified by front end.If url is not start with "https://smartorg.zendesk.com",
it will redirect you to that page.- Source:
Returns:
Get url promise.
then: url string.
catch: error status, text and message.- Type
- *
Example
smartorg.zendeskRedirect(returnTo).then( function (result) { console.log(result); }) .catch(function (err) { console.err(err); });