From d91bbd50d36c853b371d362dcb695dc39eb7f409 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 24 Apr 2018 15:47:41 +0100 Subject: [PATCH] Updated Editor Runtime API (markdown) --- Editor-Runtime-API.md | 1170 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1169 insertions(+), 1 deletion(-) diff --git a/Editor-Runtime-API.md b/Editor-Runtime-API.md index 05f1430..4c91595 100644 --- a/Editor-Runtime-API.md +++ b/Editor-Runtime-API.md @@ -232,6 +232,1174 @@ The following table shows the simplified runtime api. ||||| |**Comms API**|||| |api/editor/comms.js|WebSocket /comms|Realtime comms between runtime and editor|*tbd*| + + +### Work in progress API + +## Objects + +
+
RED : object
+
+
+ +## Typedefs + +
+
CommsConnection : object
+
+
Flows : object
+
+
Flow : object
+
+
User : object
+

A user accessing the API

+
+
+ + + +## RED : object +**Kind**: global namespace + +* [RED](#RED) : object + * [.comms](#RED.comms) : object + * [.addConnection(opts)](#RED.comms.addConnection) ⇒ Promise.<Object> + * [.removeConnection(opts)](#RED.comms.removeConnection) ⇒ Promise.<Object> + * [.subscribe(opts)](#RED.comms.subscribe) ⇒ Promise.<Object> + * [.unsubscribe(opts)](#RED.comms.unsubscribe) ⇒ Promise.<Object> + * [.flows](#RED.flows) : object + * [.getFlows(opts)](#RED.flows.getFlows) ⇒ [Promise.<Flows>](#Flows) + * [.setFlows(opts)](#RED.flows.setFlows) ⇒ [Promise.<Flows>](#Flows) + * [.addFlow(opts)](#RED.flows.addFlow) ⇒ Promise.<String> + * [.getFlow(opts)](#RED.flows.getFlow) ⇒ [Promise.<Flow>](#Flow) + * [.updateFlow(opts)](#RED.flows.updateFlow) ⇒ Promise.<String> + * [.deleteFlow(opts)](#RED.flows.deleteFlow) ⇒ Promise + * [.getNodeCredentials(opts)](#RED.flows.getNodeCredentials) ⇒ Promise.<Object> + * [.library](#RED.library) : object + * [.getEntry(opts)](#RED.library.getEntry) ⇒ Promise.<(String\|Object)> + * [.saveEntry(opts)](#RED.library.saveEntry) ⇒ Promise + * [.getEntries(opts)](#RED.library.getEntries) ⇒ Promise.<Object> + * [.nodes](#RED.nodes) : object + * [.getNodeInfo(opts)](#RED.nodes.getNodeInfo) ⇒ Promise.<NodeInfo> + * [.getNodeList(opts)](#RED.nodes.getNodeList) ⇒ Promise.<NodeList> + * [.getNodeConfig(opts)](#RED.nodes.getNodeConfig) ⇒ Promise.<String> + * [.getNodeConfigs(opts)](#RED.nodes.getNodeConfigs) ⇒ Promise.<String> + * [.getModuleInfo(opts)](#RED.nodes.getModuleInfo) ⇒ Promise.<ModuleInfo> + * [.addModule(opts)](#RED.nodes.addModule) ⇒ Promise.<ModuleInfo> + * [.removeModule(opts)](#RED.nodes.removeModule) ⇒ Promise + * [.setModuleState(opts)](#RED.nodes.setModuleState) ⇒ Promise.<ModuleInfo> + * [.setNodeSetState(opts)](#RED.nodes.setNodeSetState) ⇒ Promise.<ModuleInfo> + * [.getIconList(opts)](#RED.nodes.getIconList) ⇒ Promise.<IconList> + * [.getIcon(opts)](#RED.nodes.getIcon) ⇒ Promise.<Buffer> + * [.projects](#RED.projects) : object + * [.listProjects(opts)](#RED.projects.listProjects) ⇒ Promise.<Object> + * [.createProject(opts)](#RED.projects.createProject) ⇒ Promise.<Object> + * [.initialiseProject(opts)](#RED.projects.initialiseProject) ⇒ Promise.<Object> + * [.getActiveProject(opts)](#RED.projects.getActiveProject) ⇒ Promise.<Object> + * [.setActiveProject(opts)](#RED.projects.setActiveProject) ⇒ Promise.<Object> + * [.getProject(opts)](#RED.projects.getProject) ⇒ Promise.<Object> + * [.updateProject(opts)](#RED.projects.updateProject) ⇒ Promise.<Object> + * [.deleteProject(opts)](#RED.projects.deleteProject) ⇒ Promise.<Object> + * [.getStatus(opts)](#RED.projects.getStatus) ⇒ Promise.<Object> + * [.getBranches(opts)](#RED.projects.getBranches) ⇒ Promise.<Object> + * [.getBranchStatus(opts)](#RED.projects.getBranchStatus) ⇒ Promise.<Object> + * [.setBranch(opts)](#RED.projects.setBranch) ⇒ Promise.<Object> + * [.deleteBranch(opts)](#RED.projects.deleteBranch) ⇒ Promise.<Object> + * [.commit(opts)](#RED.projects.commit) ⇒ Promise.<Object> + * [.getCommit(opts)](#RED.projects.getCommit) ⇒ Promise.<Object> + * [.getCommits(opts)](#RED.projects.getCommits) ⇒ Promise.<Array> + * [.abortMerge(opts)](#RED.projects.abortMerge) ⇒ Promise.<Object> + * [.resolveMerge(opts)](#RED.projects.resolveMerge) ⇒ Promise.<Object> + * [.getFiles(opts)](#RED.projects.getFiles) ⇒ Promise.<Object> + * [.getFile(opts)](#RED.projects.getFile) ⇒ Promise.<String> + * [.stageFile(opts)](#RED.projects.stageFile) ⇒ Promise.<Object> + * [.unstageFile(opts)](#RED.projects.unstageFile) ⇒ Promise.<Object> + * [.revertFile(opts)](#RED.projects.revertFile) ⇒ Promise.<Object> + * [.getFileDiff(opts)](#RED.projects.getFileDiff) ⇒ Promise.<Object> + * [.getRemotes(opts)](#RED.projects.getRemotes) ⇒ Promise.<Object> + * [.addRemote(opts)](#RED.projects.addRemote) ⇒ Promise.<Object> + * [.removeRemote(opts)](#RED.projects.removeRemote) ⇒ Promise.<Object> + * [.updateRemote(opts)](#RED.projects.updateRemote) ⇒ Promise.<Object> + * [.pull(opts)](#RED.projects.pull) ⇒ Promise.<Object> + * [.push(opts)](#RED.projects.push) ⇒ Promise.<Object> + * [.settings](#RED.settings) : object + * [.getRuntimeSettings(opts)](#RED.settings.getRuntimeSettings) ⇒ Promise.<Object> + * [.getUserSettings(opts)](#RED.settings.getUserSettings) ⇒ Promise.<Object> + * [.updateUserSettings(opts)](#RED.settings.updateUserSettings) ⇒ Promise.<Object> + * [.getUserKeys(opts)](#RED.settings.getUserKeys) ⇒ Promise.<Object> + * [.getUserKey(opts)](#RED.settings.getUserKey) ⇒ Promise.<String> + * [.generateUserKey(opts)](#RED.settings.generateUserKey) ⇒ Promise.<String> + * [.removeUserKey(opts)](#RED.settings.removeUserKey) ⇒ Promise + * [.isStarted(opts)](#RED.isStarted) ⇒ Promise.<Boolean> + * [.version(opts)](#RED.version) ⇒ Promise.<String> + + + +### RED.comms : object +**Kind**: static namespace of [RED](#RED) + +* [.comms](#RED.comms) : object + * [.addConnection(opts)](#RED.comms.addConnection) ⇒ Promise.<Object> + * [.removeConnection(opts)](#RED.comms.removeConnection) ⇒ Promise.<Object> + * [.subscribe(opts)](#RED.comms.subscribe) ⇒ Promise.<Object> + * [.unsubscribe(opts)](#RED.comms.unsubscribe) ⇒ Promise.<Object> + + + +#### comms.addConnection(opts) ⇒ Promise.<Object> +Registers a new comms connection + +**Kind**: static method of [comms](#RED.comms) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.client | [CommsConnection](#CommsConnection) | the client connection | + + + +#### comms.removeConnection(opts) ⇒ Promise.<Object> +Unregisters a comms connection + +**Kind**: static method of [comms](#RED.comms) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.client | [CommsConnection](#CommsConnection) | the client connection | + + + +#### comms.subscribe(opts) ⇒ Promise.<Object> +Subscribes a comms connection to a given topic. Currently, all clients get +automatically subscribed to everything and cannot unsubscribe. Sending a subscribe +request will trigger retained messages to be sent. + +**Kind**: static method of [comms](#RED.comms) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.client | [CommsConnection](#CommsConnection) | the client connection | +| opts.topic | String | the topic to subscribe to | + + + +#### comms.unsubscribe(opts) ⇒ Promise.<Object> +TODO: Unsubscribes a comms connection from a given topic + +**Kind**: static method of [comms](#RED.comms) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.client | [CommsConnection](#CommsConnection) | the client connection | +| opts.topic | String | the topic to unsubscribe from | + + + +### RED.flows : object +**Kind**: static namespace of [RED](#RED) + +* [.flows](#RED.flows) : object + * [.getFlows(opts)](#RED.flows.getFlows) ⇒ [Promise.<Flows>](#Flows) + * [.setFlows(opts)](#RED.flows.setFlows) ⇒ [Promise.<Flows>](#Flows) + * [.addFlow(opts)](#RED.flows.addFlow) ⇒ Promise.<String> + * [.getFlow(opts)](#RED.flows.getFlow) ⇒ [Promise.<Flow>](#Flow) + * [.updateFlow(opts)](#RED.flows.updateFlow) ⇒ Promise.<String> + * [.deleteFlow(opts)](#RED.flows.deleteFlow) ⇒ Promise + * [.getNodeCredentials(opts)](#RED.flows.getNodeCredentials) ⇒ Promise.<Object> + + + +#### flows.getFlows(opts) ⇒ [Promise.<Flows>](#Flows) +Gets the current flow configuration + +**Kind**: static method of [flows](#RED.flows) +**Returns**: [Promise.<Flows>](#Flows) - - the active flow configuration + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### flows.setFlows(opts) ⇒ [Promise.<Flows>](#Flows) +Sets the current flow configuration + +**Kind**: static method of [flows](#RED.flows) +**Returns**: [Promise.<Flows>](#Flows) - - the active flow configuration + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### flows.addFlow(opts) ⇒ Promise.<String> +Adds a flow configuration + +**Kind**: static method of [flows](#RED.flows) +**Returns**: Promise.<String> - - the id of the added flow + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.flow | Object | the flow to add | + + + +#### flows.getFlow(opts) ⇒ [Promise.<Flow>](#Flow) +Gets an individual flow configuration + +**Kind**: static method of [flows](#RED.flows) +**Returns**: [Promise.<Flow>](#Flow) - - the active flow configuration + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | Object | the id of the flow to retrieve | + + + +#### flows.updateFlow(opts) ⇒ Promise.<String> +Updates an existing flow configuration + +**Kind**: static method of [flows](#RED.flows) +**Returns**: Promise.<String> - - the id of the updated flow + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | Object | the id of the flow to update | +| opts.flow | Object | the flow configuration | + + + +#### flows.deleteFlow(opts) ⇒ Promise +Deletes a flow + +**Kind**: static method of [flows](#RED.flows) +**Returns**: Promise - - resolves if successful + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | Object | the id of the flow to delete | + + + +#### flows.getNodeCredentials(opts) ⇒ Promise.<Object> +Gets the safe credentials for a node + +**Kind**: static method of [flows](#RED.flows) +**Returns**: Promise.<Object> - - the safe credentials + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.type | String | the node type to return the credential information for | +| opts.id | String | the node id | + + + +### RED.library : object +**Kind**: static namespace of [RED](#RED) + +* [.library](#RED.library) : object + * [.getEntry(opts)](#RED.library.getEntry) ⇒ Promise.<(String\|Object)> + * [.saveEntry(opts)](#RED.library.saveEntry) ⇒ Promise + * [.getEntries(opts)](#RED.library.getEntries) ⇒ Promise.<Object> + + + +#### library.getEntry(opts) ⇒ Promise.<(String\|Object)> +Gets an entry from the library. + +**Kind**: static method of [library](#RED.library) +**Returns**: Promise.<(String\|Object)> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.type | String | the type of entry | +| opts.path | String | the path of the entry | + + + +#### library.saveEntry(opts) ⇒ Promise +Saves an entry to the library + +**Kind**: static method of [library](#RED.library) +**Returns**: Promise - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.type | String | the type of entry | +| opts.path | String | the path of the entry | +| opts.meta | Object | any meta data associated with the entry | +| opts.body | String | the body of the entry | + + + +#### library.getEntries(opts) ⇒ Promise.<Object> +Returns a complete listing of all entries of a given type in the library. + +**Kind**: static method of [library](#RED.library) +**Returns**: Promise.<Object> - - the entry listing + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.type | String | the type of entry | + + + +### RED.nodes : object +**Kind**: static namespace of [RED](#RED) + +* [.nodes](#RED.nodes) : object + * [.getNodeInfo(opts)](#RED.nodes.getNodeInfo) ⇒ Promise.<NodeInfo> + * [.getNodeList(opts)](#RED.nodes.getNodeList) ⇒ Promise.<NodeList> + * [.getNodeConfig(opts)](#RED.nodes.getNodeConfig) ⇒ Promise.<String> + * [.getNodeConfigs(opts)](#RED.nodes.getNodeConfigs) ⇒ Promise.<String> + * [.getModuleInfo(opts)](#RED.nodes.getModuleInfo) ⇒ Promise.<ModuleInfo> + * [.addModule(opts)](#RED.nodes.addModule) ⇒ Promise.<ModuleInfo> + * [.removeModule(opts)](#RED.nodes.removeModule) ⇒ Promise + * [.setModuleState(opts)](#RED.nodes.setModuleState) ⇒ Promise.<ModuleInfo> + * [.setNodeSetState(opts)](#RED.nodes.setNodeSetState) ⇒ Promise.<ModuleInfo> + * [.getIconList(opts)](#RED.nodes.getIconList) ⇒ Promise.<IconList> + * [.getIcon(opts)](#RED.nodes.getIcon) ⇒ Promise.<Buffer> + + + +#### nodes.getNodeInfo(opts) ⇒ Promise.<NodeInfo> +Gets the info of an individual node set + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<NodeInfo> - - the node information + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the node set to return | + + + +#### nodes.getNodeList(opts) ⇒ Promise.<NodeList> +Gets the list of node modules installed in the runtime + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<NodeList> - - the list of node modules + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### nodes.getNodeConfig(opts) ⇒ Promise.<String> +Gets an individual node's html content + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<String> - - the node html content + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the node set to return | +| opts.lang | String | the locale language to return | + + + +#### nodes.getNodeConfigs(opts) ⇒ Promise.<String> +Gets all node html content + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<String> - - the node html content + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.lang | String | the locale language to return | + + + +#### nodes.getModuleInfo(opts) ⇒ Promise.<ModuleInfo> +Gets the info of a node module + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<ModuleInfo> - - the node module info + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.module | String | the id of the module to return | + + + +#### nodes.addModule(opts) ⇒ Promise.<ModuleInfo> +Install a new module into the runtime + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<ModuleInfo> - - the node module info + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.module | String | the id of the module to install | +| opts.version | String | (optional) the version of the module to install | + + + +#### nodes.removeModule(opts) ⇒ Promise +Removes a module from the runtime + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.module | String | the id of the module to remove | + + + +#### nodes.setModuleState(opts) ⇒ Promise.<ModuleInfo> +Enables or disables a module in the runtime + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<ModuleInfo> - - the module info object + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.module | String | the id of the module to enable or disable | +| opts.enabled | String | whether the module should be enabled or disabled | + + + +#### nodes.setNodeSetState(opts) ⇒ Promise.<ModuleInfo> +Enables or disables a n individual node-set in the runtime + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<ModuleInfo> - - the module info object + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the node-set to enable or disable | +| opts.enabled | String | whether the module should be enabled or disabled | + + + +#### nodes.getIconList(opts) ⇒ Promise.<IconList> +Gets the list of all icons available in the modules installed within the runtime + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<IconList> - - the list of all icons + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### nodes.getIcon(opts) ⇒ Promise.<Buffer> +Gets a node icon + +**Kind**: static method of [nodes](#RED.nodes) +**Returns**: Promise.<Buffer> - - the icon file as a Buffer + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.module | String | the id of the module requesting the icon | +| opts.icon | String | the name of the icon | + + + +### RED.projects : object +**Kind**: static namespace of [RED](#RED) + +* [.projects](#RED.projects) : object + * [.listProjects(opts)](#RED.projects.listProjects) ⇒ Promise.<Object> + * [.createProject(opts)](#RED.projects.createProject) ⇒ Promise.<Object> + * [.initialiseProject(opts)](#RED.projects.initialiseProject) ⇒ Promise.<Object> + * [.getActiveProject(opts)](#RED.projects.getActiveProject) ⇒ Promise.<Object> + * [.setActiveProject(opts)](#RED.projects.setActiveProject) ⇒ Promise.<Object> + * [.getProject(opts)](#RED.projects.getProject) ⇒ Promise.<Object> + * [.updateProject(opts)](#RED.projects.updateProject) ⇒ Promise.<Object> + * [.deleteProject(opts)](#RED.projects.deleteProject) ⇒ Promise.<Object> + * [.getStatus(opts)](#RED.projects.getStatus) ⇒ Promise.<Object> + * [.getBranches(opts)](#RED.projects.getBranches) ⇒ Promise.<Object> + * [.getBranchStatus(opts)](#RED.projects.getBranchStatus) ⇒ Promise.<Object> + * [.setBranch(opts)](#RED.projects.setBranch) ⇒ Promise.<Object> + * [.deleteBranch(opts)](#RED.projects.deleteBranch) ⇒ Promise.<Object> + * [.commit(opts)](#RED.projects.commit) ⇒ Promise.<Object> + * [.getCommit(opts)](#RED.projects.getCommit) ⇒ Promise.<Object> + * [.getCommits(opts)](#RED.projects.getCommits) ⇒ Promise.<Array> + * [.abortMerge(opts)](#RED.projects.abortMerge) ⇒ Promise.<Object> + * [.resolveMerge(opts)](#RED.projects.resolveMerge) ⇒ Promise.<Object> + * [.getFiles(opts)](#RED.projects.getFiles) ⇒ Promise.<Object> + * [.getFile(opts)](#RED.projects.getFile) ⇒ Promise.<String> + * [.stageFile(opts)](#RED.projects.stageFile) ⇒ Promise.<Object> + * [.unstageFile(opts)](#RED.projects.unstageFile) ⇒ Promise.<Object> + * [.revertFile(opts)](#RED.projects.revertFile) ⇒ Promise.<Object> + * [.getFileDiff(opts)](#RED.projects.getFileDiff) ⇒ Promise.<Object> + * [.getRemotes(opts)](#RED.projects.getRemotes) ⇒ Promise.<Object> + * [.addRemote(opts)](#RED.projects.addRemote) ⇒ Promise.<Object> + * [.removeRemote(opts)](#RED.projects.removeRemote) ⇒ Promise.<Object> + * [.updateRemote(opts)](#RED.projects.updateRemote) ⇒ Promise.<Object> + * [.pull(opts)](#RED.projects.pull) ⇒ Promise.<Object> + * [.push(opts)](#RED.projects.push) ⇒ Promise.<Object> + + + +#### projects.listProjects(opts) ⇒ Promise.<Object> +List projects known to the runtime + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### projects.createProject(opts) ⇒ Promise.<Object> +Create a new project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.project | Object | the project information | + + + +#### projects.initialiseProject(opts) ⇒ Promise.<Object> +Initialises an empty project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project to initialise | +| opts.project | Object | the project information | + + + +#### projects.getActiveProject(opts) ⇒ Promise.<Object> +Gets the active project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - the active project + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### projects.setActiveProject(opts) ⇒ Promise.<Object> +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project to activate | + + + +#### projects.getProject(opts) ⇒ Promise.<Object> +Gets a projects metadata + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - the project metadata + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project to get | + + + +#### projects.updateProject(opts) ⇒ Promise.<Object> +Updates the metadata of an existing project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project to update | +| opts.project | Object | the project information | + + + +#### projects.deleteProject(opts) ⇒ Promise.<Object> +Deletes a project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project to update | + + + +#### projects.getStatus(opts) ⇒ Promise.<Object> +Gets current git status of a project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - the project status + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.remote | Boolean | whether to include status of remote repos | + + + +#### projects.getBranches(opts) ⇒ Promise.<Object> +Get a list of local branches + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - a list of the local branches + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.remote | Boolean | whether to return remote branches (true) or local (false) | + + + +#### projects.getBranchStatus(opts) ⇒ Promise.<Object> +Gets the status of a branch + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - the status of the branch + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.branch | String | the name of the branch | + + + +#### projects.setBranch(opts) ⇒ Promise.<Object> +Sets the current local branch + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.branch | String | the name of the branch | +| opts.create | Boolean | whether to create the branch if it doesn't exist | + + + +#### projects.deleteBranch(opts) ⇒ Promise.<Object> +Deletes a branch + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.branch | String | the name of the branch | +| opts.force | Boolean | whether to force delete | + + + +#### projects.commit(opts) ⇒ Promise.<Object> +Commits the current staged files + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.message | String | the message to associate with the commit | + + + +#### projects.getCommit(opts) ⇒ Promise.<Object> +Gets the details of a single commit + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - the commit details + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.sha | String | the sha of the commit to return | + + + +#### projects.getCommits(opts) ⇒ Promise.<Array> +Gets the commit history of the project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Array> - - an array of commits + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.limit | String | limit how many to return | +| opts.before | String | id of the commit to work back from | + + + +#### projects.abortMerge(opts) ⇒ Promise.<Object> +Abort an in-progress merge + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | + + + +#### projects.resolveMerge(opts) ⇒ Promise.<Object> +Resolves a merge conflict + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.path | String | the path of the file being merged | +| opts.resolutions | String | how to resolve the merge conflict | + + + +#### projects.getFiles(opts) ⇒ Promise.<Object> +Gets a listing of the files in the project + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - the file listing + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | + + + +#### projects.getFile(opts) ⇒ Promise.<String> +Gets the contents of a file + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<String> - - the content of the file + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.path | String | the path of the file | +| opts.tree | String | the version control tree to use | + + + +#### projects.stageFile(opts) ⇒ Promise.<Object> +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.path | String \| Array | the path of the file, or an array of paths | + + + +#### projects.unstageFile(opts) ⇒ Promise.<Object> +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.path | String | the path of the file. If not set, all staged files are unstaged | + + + +#### projects.revertFile(opts) ⇒ Promise.<Object> +Reverts changes to a file back to its commited version + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.path | String | the path of the file | + + + +#### projects.getFileDiff(opts) ⇒ Promise.<Object> +Get the diff of a file + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - the requested diff + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.path | String | the path of the file | +| opts.type | String | the type of diff | + + + +#### projects.getRemotes(opts) ⇒ Promise.<Object> +Gets a list of the project remotes + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - a list of project remotes + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | + + + +#### projects.addRemote(opts) ⇒ Promise.<Object> +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.remote | Object | the remote metadata | +| opts.remote.name | String | the name of the remote | +| opts.remote.url | String | the url of the remote | + + + +#### projects.removeRemote(opts) ⇒ Promise.<Object> +Remove a project remote + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.remote | String | the name of the remote | + + + +#### projects.updateRemote(opts) ⇒ Promise.<Object> +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.remote | Object | the remote metadata | +| opts.remote.name | String | the name of the remote | + + + +#### projects.pull(opts) ⇒ Promise.<Object> +Pull changes from the remote + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### projects.push(opts) ⇒ Promise.<Object> +Push changes to a remote + +**Kind**: static method of [projects](#RED.projects) +**Returns**: Promise.<Object> - - resolves when complete + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | String | the id of the project | +| opts.remote | String | the name of the remote | +| opts.track | String | whether to set the remote as the upstream | + + + +### RED.settings : object +**Kind**: static namespace of [RED](#RED) + +* [.settings](#RED.settings) : object + * [.getRuntimeSettings(opts)](#RED.settings.getRuntimeSettings) ⇒ Promise.<Object> + * [.getUserSettings(opts)](#RED.settings.getUserSettings) ⇒ Promise.<Object> + * [.updateUserSettings(opts)](#RED.settings.updateUserSettings) ⇒ Promise.<Object> + * [.getUserKeys(opts)](#RED.settings.getUserKeys) ⇒ Promise.<Object> + * [.getUserKey(opts)](#RED.settings.getUserKey) ⇒ Promise.<String> + * [.generateUserKey(opts)](#RED.settings.generateUserKey) ⇒ Promise.<String> + * [.removeUserKey(opts)](#RED.settings.removeUserKey) ⇒ Promise + + + +#### settings.getRuntimeSettings(opts) ⇒ Promise.<Object> +Gets the runtime settings object + +**Kind**: static method of [settings](#RED.settings) +**Returns**: Promise.<Object> - - the runtime settings + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### settings.getUserSettings(opts) ⇒ Promise.<Object> +Gets an individual user's settings object + +**Kind**: static method of [settings](#RED.settings) +**Returns**: Promise.<Object> - - the user settings + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### settings.updateUserSettings(opts) ⇒ Promise.<Object> +Updates an individual user's settings object. + +**Kind**: static method of [settings](#RED.settings) +**Returns**: Promise.<Object> - - the user settings + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.settings | Object | the updates to the user settings | + + + +#### settings.getUserKeys(opts) ⇒ Promise.<Object> +Gets a list of a user's ssh keys + +**Kind**: static method of [settings](#RED.settings) +**Returns**: Promise.<Object> - - the user's ssh keys + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +#### settings.getUserKey(opts) ⇒ Promise.<String> +Gets a user's ssh public key + +**Kind**: static method of [settings](#RED.settings) +**Returns**: Promise.<String> - - the user's ssh public key + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | [User](#User) | the id of the key to return | + + + +#### settings.generateUserKey(opts) ⇒ Promise.<String> +Generates a new ssh key pair + +**Kind**: static method of [settings](#RED.settings) +**Returns**: Promise.<String> - - the id of the generated key + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.name | [User](#User) | the id of the key to return | +| opts.password | [User](#User) | (optional) the password for the key pair | +| opts.comment | [User](#User) | (option) a comment to associate with the key pair | +| opts.size | [User](#User) | (optional) the size of the key. Default: 2048 | + + + +#### settings.removeUserKey(opts) ⇒ Promise +Deletes a user's ssh key pair + +**Kind**: static method of [settings](#RED.settings) +**Returns**: Promise - - resolves when deleted + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | +| opts.id | [User](#User) | the id of the key to delete | + + + +### RED.isStarted(opts) ⇒ Promise.<Boolean> +Returns whether the runtime is started + +**Kind**: static method of [RED](#RED) +**Returns**: Promise.<Boolean> - - whether the runtime is started + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +### RED.version(opts) ⇒ Promise.<String> +Returns version number of the runtime + +**Kind**: static method of [RED](#RED) +**Returns**: Promise.<String> - - the runtime version number + +| Param | Type | Description | +| --- | --- | --- | +| opts | Object | | +| opts.user | [User](#User) | the user calling the api | + + + +## CommsConnection : object +**Kind**: global typedef +**Properties** + +| Name | Type | Description | +| --- | --- | --- | +| session | string | a unique session identifier | +| user | Object | the user associated with the connection | +| send | function | publish a message to the connection | + + + +## Flows : object +**Kind**: global typedef +**Properties** + +| Name | Type | Description | +| --- | --- | --- | +| rev | string | the flow revision identifier | +| flows | Array | the flow configuration, an array of node configuration objects | + + + +## Flow : object +**Kind**: global typedef +**Properties** + +| Name | Type | Description | +| --- | --- | --- | +| id | string | the flow identifier | +| label | string | a label for the flow | +| nodes | Array | an array of node configuration objects | + + + +## User : object +A user accessing the API + +**Kind**: global typedef - \ No newline at end of file