From f8fa500c981bf27a6fd741eb6399a684ad590435 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 24 Apr 2018 15:53:05 +0100 Subject: [PATCH] Updated Editor Runtime API (markdown) --- Editor-Runtime-API.md | 225 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 1 deletion(-) diff --git a/Editor-Runtime-API.md b/Editor-Runtime-API.md index 4c91595..a8bbbe6 100644 --- a/Editor-Runtime-API.md +++ b/Editor-Runtime-API.md @@ -234,7 +234,7 @@ The following table shows the simplified runtime api. |api/editor/comms.js|WebSocket /comms|Realtime comms between runtime and editor|*tbd*| -### Work in progress API +# Work in progress API ## Objects @@ -334,6 +334,9 @@ The following table shows the simplified runtime api. * [.isStarted(opts)](#RED.isStarted) ⇒ Promise.<Boolean> * [.version(opts)](#RED.version) ⇒ Promise.<String> + +* * * + ### RED.comms : object @@ -345,6 +348,9 @@ The following table shows the simplified runtime api. * [.subscribe(opts)](#RED.comms.subscribe) ⇒ Promise.<Object> * [.unsubscribe(opts)](#RED.comms.unsubscribe) ⇒ Promise.<Object> + +* * * + #### comms.addConnection(opts) ⇒ Promise.<Object> @@ -359,6 +365,9 @@ Registers a new comms connection | opts.user | [User](#User) | the user calling the api | | opts.client | [CommsConnection](#CommsConnection) | the client connection | + +* * * + #### comms.removeConnection(opts) ⇒ Promise.<Object> @@ -373,6 +382,9 @@ Unregisters a comms connection | opts.user | [User](#User) | the user calling the api | | opts.client | [CommsConnection](#CommsConnection) | the client connection | + +* * * + #### comms.subscribe(opts) ⇒ Promise.<Object> @@ -390,6 +402,9 @@ request will trigger retained messages to be sent. | opts.client | [CommsConnection](#CommsConnection) | the client connection | | opts.topic | String | the topic to subscribe to | + +* * * + #### comms.unsubscribe(opts) ⇒ Promise.<Object> @@ -405,6 +420,9 @@ TODO: Unsubscribes a comms connection from a given topic | opts.client | [CommsConnection](#CommsConnection) | the client connection | | opts.topic | String | the topic to unsubscribe from | + +* * * + ### RED.flows : object @@ -419,6 +437,9 @@ TODO: Unsubscribes a comms connection from a given topic * [.deleteFlow(opts)](#RED.flows.deleteFlow) ⇒ Promise * [.getNodeCredentials(opts)](#RED.flows.getNodeCredentials) ⇒ Promise.<Object> + +* * * + #### flows.getFlows(opts) ⇒ [Promise.<Flows>](#Flows) @@ -432,6 +453,9 @@ Gets the current flow configuration | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### flows.setFlows(opts) ⇒ [Promise.<Flows>](#Flows) @@ -445,6 +469,9 @@ Sets the current flow configuration | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### flows.addFlow(opts) ⇒ Promise.<String> @@ -459,6 +486,9 @@ Adds a flow configuration | opts.user | [User](#User) | the user calling the api | | opts.flow | Object | the flow to add | + +* * * + #### flows.getFlow(opts) ⇒ [Promise.<Flow>](#Flow) @@ -473,6 +503,9 @@ Gets an individual flow configuration | opts.user | [User](#User) | the user calling the api | | opts.id | Object | the id of the flow to retrieve | + +* * * + #### flows.updateFlow(opts) ⇒ Promise.<String> @@ -488,6 +521,9 @@ Updates an existing flow configuration | opts.id | Object | the id of the flow to update | | opts.flow | Object | the flow configuration | + +* * * + #### flows.deleteFlow(opts) ⇒ Promise @@ -502,6 +538,9 @@ Deletes a flow | opts.user | [User](#User) | the user calling the api | | opts.id | Object | the id of the flow to delete | + +* * * + #### flows.getNodeCredentials(opts) ⇒ Promise.<Object> @@ -517,6 +556,9 @@ Gets the safe credentials for a node | opts.type | String | the node type to return the credential information for | | opts.id | String | the node id | + +* * * + ### RED.library : object @@ -527,6 +569,9 @@ Gets the safe credentials for a node * [.saveEntry(opts)](#RED.library.saveEntry) ⇒ Promise * [.getEntries(opts)](#RED.library.getEntries) ⇒ Promise.<Object> + +* * * + #### library.getEntry(opts) ⇒ Promise.<(String\|Object)> @@ -542,6 +587,9 @@ Gets an entry from the library. | opts.type | String | the type of entry | | opts.path | String | the path of the entry | + +* * * + #### library.saveEntry(opts) ⇒ Promise @@ -559,6 +607,9 @@ Saves an entry to the library | opts.meta | Object | any meta data associated with the entry | | opts.body | String | the body of the entry | + +* * * + #### library.getEntries(opts) ⇒ Promise.<Object> @@ -573,6 +624,9 @@ Returns a complete listing of all entries of a given type in the library. | opts.user | [User](#User) | the user calling the api | | opts.type | String | the type of entry | + +* * * + ### RED.nodes : object @@ -591,6 +645,9 @@ Returns a complete listing of all entries of a given type in the library. * [.getIconList(opts)](#RED.nodes.getIconList) ⇒ Promise.<IconList> * [.getIcon(opts)](#RED.nodes.getIcon) ⇒ Promise.<Buffer> + +* * * + #### nodes.getNodeInfo(opts) ⇒ Promise.<NodeInfo> @@ -605,6 +662,9 @@ Gets the info of an individual node set | 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> @@ -618,6 +678,9 @@ Gets the list of node modules installed in the runtime | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### nodes.getNodeConfig(opts) ⇒ Promise.<String> @@ -633,6 +696,9 @@ Gets an individual node's html content | opts.id | String | the id of the node set to return | | opts.lang | String | the locale language to return | + +* * * + #### nodes.getNodeConfigs(opts) ⇒ Promise.<String> @@ -647,6 +713,9 @@ Gets all node html content | opts.user | [User](#User) | the user calling the api | | opts.lang | String | the locale language to return | + +* * * + #### nodes.getModuleInfo(opts) ⇒ Promise.<ModuleInfo> @@ -661,6 +730,9 @@ Gets the info of a node module | opts.user | [User](#User) | the user calling the api | | opts.module | String | the id of the module to return | + +* * * + #### nodes.addModule(opts) ⇒ Promise.<ModuleInfo> @@ -676,6 +748,9 @@ Install a new module into the runtime | 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 @@ -690,6 +765,9 @@ Removes a module from the runtime | opts.user | [User](#User) | the user calling the api | | opts.module | String | the id of the module to remove | + +* * * + #### nodes.setModuleState(opts) ⇒ Promise.<ModuleInfo> @@ -705,6 +783,9 @@ Enables or disables a module in the runtime | 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> @@ -720,6 +801,9 @@ Enables or disables a n individual node-set in the runtime | 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> @@ -733,6 +817,9 @@ Gets the list of all icons available in the modules installed within the runtime | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### nodes.getIcon(opts) ⇒ Promise.<Buffer> @@ -748,6 +835,9 @@ Gets a node icon | opts.module | String | the id of the module requesting the icon | | opts.icon | String | the name of the icon | + +* * * + ### RED.projects : object @@ -785,6 +875,9 @@ Gets a node icon * [.pull(opts)](#RED.projects.pull) ⇒ Promise.<Object> * [.push(opts)](#RED.projects.push) ⇒ Promise.<Object> + +* * * + #### projects.listProjects(opts) ⇒ Promise.<Object> @@ -798,6 +891,9 @@ List projects known to the runtime | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### projects.createProject(opts) ⇒ Promise.<Object> @@ -812,6 +908,9 @@ Create a new project | opts.user | [User](#User) | the user calling the api | | opts.project | Object | the project information | + +* * * + #### projects.initialiseProject(opts) ⇒ Promise.<Object> @@ -827,6 +926,9 @@ Initialises an empty project | opts.id | String | the id of the project to initialise | | opts.project | Object | the project information | + +* * * + #### projects.getActiveProject(opts) ⇒ Promise.<Object> @@ -840,6 +942,9 @@ Gets the active project | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### projects.setActiveProject(opts) ⇒ Promise.<Object> @@ -852,6 +957,9 @@ Gets the active project | opts.user | [User](#User) | the user calling the api | | opts.id | String | the id of the project to activate | + +* * * + #### projects.getProject(opts) ⇒ Promise.<Object> @@ -866,6 +974,9 @@ Gets a projects metadata | opts.user | [User](#User) | the user calling the api | | opts.id | String | the id of the project to get | + +* * * + #### projects.updateProject(opts) ⇒ Promise.<Object> @@ -881,6 +992,9 @@ Updates the metadata of an existing project | opts.id | String | the id of the project to update | | opts.project | Object | the project information | + +* * * + #### projects.deleteProject(opts) ⇒ Promise.<Object> @@ -895,6 +1009,9 @@ Deletes a project | opts.user | [User](#User) | the user calling the api | | opts.id | String | the id of the project to update | + +* * * + #### projects.getStatus(opts) ⇒ Promise.<Object> @@ -910,6 +1027,9 @@ Gets current git status of a project | opts.id | String | the id of the project | | opts.remote | Boolean | whether to include status of remote repos | + +* * * + #### projects.getBranches(opts) ⇒ Promise.<Object> @@ -925,6 +1045,9 @@ Get a list of local branches | 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> @@ -940,6 +1063,9 @@ Gets the status of a branch | opts.id | String | the id of the project | | opts.branch | String | the name of the branch | + +* * * + #### projects.setBranch(opts) ⇒ Promise.<Object> @@ -956,6 +1082,9 @@ Sets the current local branch | 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> @@ -972,6 +1101,9 @@ Deletes a branch | opts.branch | String | the name of the branch | | opts.force | Boolean | whether to force delete | + +* * * + #### projects.commit(opts) ⇒ Promise.<Object> @@ -987,6 +1119,9 @@ Commits the current staged files | opts.id | String | the id of the project | | opts.message | String | the message to associate with the commit | + +* * * + #### projects.getCommit(opts) ⇒ Promise.<Object> @@ -1002,6 +1137,9 @@ Gets the details of a single commit | opts.id | String | the id of the project | | opts.sha | String | the sha of the commit to return | + +* * * + #### projects.getCommits(opts) ⇒ Promise.<Array> @@ -1018,6 +1156,9 @@ Gets the commit history 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> @@ -1032,6 +1173,9 @@ Abort an in-progress merge | opts.user | [User](#User) | the user calling the api | | opts.id | String | the id of the project | + +* * * + #### projects.resolveMerge(opts) ⇒ Promise.<Object> @@ -1048,6 +1192,9 @@ Resolves a merge conflict | opts.path | String | the path of the file being merged | | opts.resolutions | String | how to resolve the merge conflict | + +* * * + #### projects.getFiles(opts) ⇒ Promise.<Object> @@ -1062,6 +1209,9 @@ Gets a listing of the files in the project | opts.user | [User](#User) | the user calling the api | | opts.id | String | the id of the project | + +* * * + #### projects.getFile(opts) ⇒ Promise.<String> @@ -1078,6 +1228,9 @@ Gets the contents of a file | opts.path | String | the path of the file | | opts.tree | String | the version control tree to use | + +* * * + #### projects.stageFile(opts) ⇒ Promise.<Object> @@ -1091,6 +1244,9 @@ Gets the contents of a file | 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> @@ -1104,6 +1260,9 @@ Gets the contents of a file | 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> @@ -1119,6 +1278,9 @@ Reverts changes to a file back to its commited version | opts.id | String | the id of the project | | opts.path | String | the path of the file | + +* * * + #### projects.getFileDiff(opts) ⇒ Promise.<Object> @@ -1135,6 +1297,9 @@ Get the diff of a file | opts.path | String | the path of the file | | opts.type | String | the type of diff | + +* * * + #### projects.getRemotes(opts) ⇒ Promise.<Object> @@ -1149,6 +1314,9 @@ Gets a list of the project remotes | opts.user | [User](#User) | the user calling the api | | opts.id | String | the id of the project | + +* * * + #### projects.addRemote(opts) ⇒ Promise.<Object> @@ -1164,6 +1332,9 @@ Gets a list of the project remotes | opts.remote.name | String | the name of the remote | | opts.remote.url | String | the url of the remote | + +* * * + #### projects.removeRemote(opts) ⇒ Promise.<Object> @@ -1179,6 +1350,9 @@ Remove a project remote | opts.id | String | the id of the project | | opts.remote | String | the name of the remote | + +* * * + #### projects.updateRemote(opts) ⇒ Promise.<Object> @@ -1193,6 +1367,9 @@ Remove a project remote | opts.remote | Object | the remote metadata | | opts.remote.name | String | the name of the remote | + +* * * + #### projects.pull(opts) ⇒ Promise.<Object> @@ -1206,6 +1383,9 @@ Pull changes from the remote | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### projects.push(opts) ⇒ Promise.<Object> @@ -1222,6 +1402,9 @@ Push changes to a remote | opts.remote | String | the name of the remote | | opts.track | String | whether to set the remote as the upstream | + +* * * + ### RED.settings : object @@ -1236,6 +1419,9 @@ Push changes to a remote * [.generateUserKey(opts)](#RED.settings.generateUserKey) ⇒ Promise.<String> * [.removeUserKey(opts)](#RED.settings.removeUserKey) ⇒ Promise + +* * * + #### settings.getRuntimeSettings(opts) ⇒ Promise.<Object> @@ -1249,6 +1435,9 @@ Gets the runtime settings object | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### settings.getUserSettings(opts) ⇒ Promise.<Object> @@ -1262,6 +1451,9 @@ Gets an individual user's settings object | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### settings.updateUserSettings(opts) ⇒ Promise.<Object> @@ -1276,6 +1468,9 @@ Updates an individual user's settings object. | opts.user | [User](#User) | the user calling the api | | opts.settings | Object | the updates to the user settings | + +* * * + #### settings.getUserKeys(opts) ⇒ Promise.<Object> @@ -1289,6 +1484,9 @@ Gets a list of a user's ssh keys | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + #### settings.getUserKey(opts) ⇒ Promise.<String> @@ -1303,6 +1501,9 @@ Gets a user's ssh public key | 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> @@ -1320,6 +1521,9 @@ Generates a new ssh 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 @@ -1334,6 +1538,9 @@ Deletes a user's ssh key pair | 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> @@ -1347,6 +1554,9 @@ Returns whether the runtime is started | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + ### RED.version(opts) ⇒ Promise.<String> @@ -1360,6 +1570,9 @@ Returns version number of the runtime | opts | Object | | | opts.user | [User](#User) | the user calling the api | + +* * * + ## CommsConnection : object @@ -1372,6 +1585,9 @@ Returns version number of the runtime | user | Object | the user associated with the connection | | send | function | publish a message to the connection | + +* * * + ## Flows : object @@ -1383,6 +1599,9 @@ Returns version number of the runtime | rev | string | the flow revision identifier | | flows | Array | the flow configuration, an array of node configuration objects | + +* * * + ## Flow : object @@ -1395,6 +1614,9 @@ Returns version number of the runtime | label | string | a label for the flow | | nodes | Array | an array of node configuration objects | + +* * * + ## User : object @@ -1402,4 +1624,5 @@ A user accessing the API **Kind**: global typedef +* * *