24 Editor Runtime API
Nick O'Leary edited this page 2018-04-24 15:53:05 +01:00

Do not treat this as a fully documented public api - it is a working document

This is a snap-shot (March 2018) of the complete HTTP and WebSocket interface between the editor and runtime and how it maps to the internals of the runtime.

This has been done to help rationalise the internal mappings and help stabilise the api.

External API

The Authentication and Runtime API parts are already documented as part of the public API.

All URLs are relative to settings.httpAdminRoot, which defaults to /.

Authentication
GET /auth/login Get the active authentication scheme
POST /auth/token Exchange credentials for access token
POST /auth/revoke Revoke an access token
Runtime API
GET /flows Get the active flow configuration
POST /flows Set the active flow configuration
POST /flow Add a flow to the active configuration
GET /flow/:id Get an individual flow configuration
PUT /flow/:id Update an individual flow configuration
DELETE /flow/:id Delete an individual flow configuration
GET /nodes Get a list of the installed nodes
POST /nodes Install a new node module
GET /nodes/:module Get a node module_s information
PUT /nodes/:module Enable/Disable a node module
DELETE /nodes/:module Remove a node module
GET /nodes/:module/:set Get a node module set information
PUT /nodes/:module/:set Enable/Disable a node set
Editor API
GET / Get the editor html
GET /red/* Get the main editor js/css/images
GET /vendor/* Get 3rd-party libraries used by the editor
GET /settings Get the runtime settings
GET /settings/user Get the user-specific settings
POST /settings/user Set the user-specific settings
GET /settings/user/keys Get the user_s ssh keys
GET /settings/user/keys/:id Get a public key
POST /settings/user/keys Generate a new key pair
DELETE /settings/user/keys/:id Delete a key pair
GET /credentials/:type/:id Get credentials for a given node
GET /locales/nodes Get message catalogs for all known nodes
GET /locales/:module Get message catalog for a specific node module
GET /theme/* Get custom resources for the editorTheme
GET /icons Get the list of all available node icons
GET /icons/:module/:icon Get a module-provided node icon
GET /icons/:icon Get a node icon from the core set
Projects API
GET /projects List all projects
POST /projects Create project
GET /projects/:id Get project metadata
PUT /projects/:id Update a project
DELETE /projects/:id Delete project
GET /projects/:id/status Get project status - files, commit counts, branch info
GET /projects/:id/files Project file listing
GET /projects/:id/files/:treeish/* Get file content in a given tree (index/stage)
DELETE /projects/:id/files/_/* Revert a file (delete from the stage tree)
POST /projects/:id/stage/* Stage a file
POST /projects/:id/stage Stage multiple files
POST /projects/:id/commit Commit changes
DELETE /projects/:id/stage/* Unstage a file
DELETE /projects/:id/stage Unstage multiple files
GET /projects/:id/diff/:type/* Get a file diff
GET /projects/:id/commits Get a list of commits
GET /projects/:id/commits/:sha Get an individual commit details
POST /projects/:id/push/?* Push local commits to remote
POST /projects/:id/pull/?* Pull remote commits
DELETE /projects/:id/merge Abort an ongoing merge
POST /projects/:id/resolve/* Resolve a merge
GET /projects/:id/branches Get a list of local branches
DELETE /projects/:id/branches/:branchName Delete a local branch - ?force=true
GET /projects/:id/branches/remote Get a list of remote branches
GET /projects/:id/branches/remote/*/status Get branch status - commit counts/ahead/behind
POST /projects/:id/branches Set the active local branch
GET /projects/:id/remotes Get a list of remotes
POST /projects/:id/remotes Add a remote
DELETE /projects/:id/remotes/:remoteName Delete a remote
PUT /projects/:id/remotes/:remoteName Update a remote
Comms API
WebSocket /comms Realtime comms between runtime and editor

Internal API

This is a snapshot of how the api is split across source files, and how each of those files reaches into the runtime api. This is a pain to manually generate, so there may be omissions and could likely fall out of sync with reality as things are rationalised.

api/admin/flow.js GET /flow/:id
POST /flow
DELETE /flow/:id
PUT /flow/:id
runtime.log.audit
runtime.nodes.getFlow(id)
runtime.nodes.addFlow(flow)
runtime.nodes.updateFlow(id,flow)
runtime.nodes.removeFlow(id)
api/admin/flows.js GET /flows
POST /flows
runtime.log.audit
runtime.log.warn
runtime.nodes.loadFlows
runtime.nodes.getFlows
runtime.nodes.setFlows
api/admin/nodes.js GET /nodes
POST /nodes
GET /\/nodes\/((@[^\/]+\/)?[^\/]+)$/
PUT /\/nodes\/((@[^\/]+\/)?[^\/]+)$/
DELETE /\/nodes\/((@[^\/]+\/)?[^\/]+)$/
GET /\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/
PUT /\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/
runtime.nodes.enableNode
runtime.nodes.getModuleInfo
runtime.nodes.getNodeConfig
runtime.nodes.getNodeConfigs
runtime.nodes.getNodeIcons
runtime.log.audit
runtime.nodes.disableNode
runtime.nodes.getNodeInfo
runtime.nodes.getNodeList
runtime.nodes.installModule
runtime.nodes.uninstallModule
api/editor/comms.js WS /comms runtime.log.audit
runtime.log.trace
runtime.log.warn
runtime.settings.adminAuth
runtime.settings.disableEditor
runtime.settings.httpAdminRoot
runtime.settings.webSocketKeepAliveTime
runtime.events.on
runtime.events.removeListener
api/editor/credentials.js GET /credentials/:type/:id runtime.log.audit
runtime.nodes.getCredentials
runtime.nodes.getCredentialDefinition
api/editor/index.js runtime.isStarted
runtime.i18n.registerMessageCatalogs
runtime.log.error
api/editor/library.js POST /library/flows\/.*/
GET /library/flows\/.*/
GET /library/flows
runtime.log.audit
runtime.log.warn
runtime.nodes.getNodeExampleFlows
runtime.nodes.getNodeExampleFlowPath
runtime.storage.getLibraryEntry
runtime.storage.saveLibraryEntry
runtime.storage.getAllFlows
runtime.storage.getFlow
runtime.storage.saveFlow
api/editor/locales.js GET /locales/nodes
GET /locales\/(.+)\/?$/
runtime.nodes.getNodeList
runtime.i18n.i
runtime.i18n.catalog
api/editor/projects/index.js * /projects/* runtime.storage.projects.abortMerge
runtime.storage.projects.addRemote
runtime.storage.projects.commit
runtime.storage.projects.createProject
runtime.storage.projects.deleteBranch
runtime.storage.projects.deleteProject
runtime.storage.projects.getBranchStatus
runtime.storage.projects.getBranches
runtime.storage.projects.getBranches
runtime.storage.projects.getCommit
runtime.storage.projects.getCommits
runtime.storage.projects.getFile
runtime.storage.projects.getFileDiff
runtime.storage.projects.getFiles
runtime.storage.projects.getProject
runtime.storage.projects.getRemotes
runtime.storage.projects.getStatus
runtime.storage.projects.initialiseProject
runtime.storage.projects.listProjects
runtime.storage.projects.pull
runtime.storage.projects.push
runtime.storage.projects.removeRemote
runtime.storage.projects.resolveMerge
runtime.storage.projects.revertFile
runtime.storage.projects.setActiveProject
runtime.storage.projects.setBranch
runtime.storage.projects.stageFile
runtime.storage.projects.stageFile
runtime.storage.projects.unstageFile
runtime.storage.projects.unstageFile
runtime.storage.projects.updateProject
runtime.storage.projects.updateRemote
api/editor/settings.js GET /settings
GET /settings/user
POST /settings/user
runtime.log.audit
runtime.nodes.getCredentialKeyType
runtime.nodes.paletteEditorEnabled
runtime.storage.projects.getActiveProject
runtime.storage.projects.flowFileExists
runtime.storage.projects.getFlowFilename
runtime.storage.projects.getCredentialsFilename
runtime.storage.projects.getGlobalGitUser
runtime.settings.httpNodeRoot
runtime.settings.paletteCategories
runtime.settings.flowFilePretty
runtime.settings.getUserSettings
runtime.settings.setUserSettings
api/editor/sshkeys.js GET /settings/user/keys
POST /settings/user/keys
GET /settings/user/keys/:id
DELETE /settings/user/keys/:id
runtime.storage.projects.ssh.listSSHKeys
runtime.storage.projects.ssh.getSSHKey
runtime.storage.projects.ssh.generateSSHKey
runtime.storage.projects.ssh.deleteSSHKey
api/editor/theme.js GET /theme/* runtime.version
runtime.settings.editorTheme
api/editor/ui.js GET /
GET /[public resources]
GET /icons
GET /icons/:module/:icon
GET /icons/:scope/:module/:icon
runtime.nodes.getNodeIconPath
api/auth/index.js GET /auth/login
POST /auth/token
POST /auth/revoke
api/auth/strategies.js
runtime.settings.adminAuth
runtime.settings.httpAdminRoot
runtime.settings.editorTheme
runtime.log.audit
api/auth/tokens.js runtime.storage.getSessions
runtime.storage.saveSessions

Internal API - v2

The existing API has some issues:

  • as seen in the image above, a lots of overlapping links between the editor api and the runtime api
  • the editor api knows about the user making a request, the runtime api doesn't

In order to provide a clean api between the two, some simplification is needed. The detail is still being worked on, but essentially a new runtime api needs to be defined that provides a higher level of abstraction of the existing internal API.

Guidelines for the new API:

  • Each HTTP request should map to a single call into the runtime api
  • Each function of the runtime api will accept a user object
  • Each function of the runtime api will return a promise that resolves with data to return or rejects with an error to report

The following table shows the simplified runtime api.

NOL: this is a work in progress, still need to figure out projects, comms and auth

Authentication
api/auth/index.js GET /auth/login Get the active authentication scheme tbd
api/auth/index.js POST /auth/token Exchange credentials for access token
api/auth/index.js POST /auth/revoke Revoke an access token
Runtime API
api/admin/flows.js GET /flows Get the active flow configuration runtime.flows.getFlows
api/admin/flows.js POST /flows Set the active flow configuration runtime.flows.setFlows
api/admin/flow.js POST /flow Add a flow to the active configuration runtime.flows.addFlow
api/admin/flow.js GET /flow/:id Get an individual flow configuration runtime.flows.getFlow
api/admin/flow.js PUT /flow/:id Update an individual flow configuration runtime.flows.updateFlow
api/admin/flow.js DELETE /flow/:id Delete an individual flow configuration runtime.flows.deleteFlow
api/admin/nodes.js GET /nodes Get a list of the installed nodes runtime.nodes.getModuleList
api/admin/nodes.js POST /nodes Install a new node module runtime.nodes.addModule
api/admin/nodes.js GET /nodes/:module Get a node module_s information runtime.nodes.getModule
api/admin/nodes.js PUT /nodes/:module Enable/Disable a node module runtime.nodes.enableModule / runtime.nodes.disableModule
api/admin/nodes.js DELETE /nodes/:module Remove a node module runtime.nodes.removeModule
api/admin/nodes.js GET /nodes/:module/:set Get a node module set information runtime.nodes.getNodeSet
api/admin/nodes.js PUT /nodes/:module/:set Enable/Disable a node set runtime.nodes.enableNodeSet / runtime.nodes.disableNodeSet
Editor API
api/editor/ui.js GET / Get the editor html
api/editor/ui.js GET /red/* Get the main editor js/css/images
api/editor/ui.js GET /vendor/* Get 3rd-party libraries used by the editor
api/editor/settings.js GET /settings Get the runtime settings runtime.settings.getRuntimeSettings
api/editor/settings.js GET /settings/user Get the user-specific settings runtime.settings.getUserSettings
api/editor/settings.js POST /settings/user Set the user-specific settings runtime.settings.setUserSettings
api/editor/sshkeys.js GET /settings/user/keys Get the user_s ssh keys runtime.settings.getUserKeys
api/editor/sshkeys.js GET /settings/user/keys/:id Get a public key runtime.setting.getUserKey
api/editor/sshkeys.js POST /settings/user/keys Generate a new key pair runtime.settings.generateUserKey
api/editor/sshkeys.js DELETE /settings/user/keys/:id Delete a key pair runtime.settings.removeUserKey
api/editor/credentials.js GET /credentials/:type/:id Get credentials for a given node runtime.flows.getNodeCredentials
api/editor/locales.js GET /locales/nodes Get message catalogs for all known nodes runtime.nodes.getModuleCatalogs
api/editor/locales.js GET /locales/:module Get message catalog for a specific node module runtime.nodes.getModuleCatalog
api/editor/theme.js GET /theme/* Get custom resources for the editorTheme
api/editor/ui.js GET /icons Get the list of all available node icons runtime.nodes.getIconList
api/editor/ui.js GET /icons/:module/:icon Get a module-provided node icon runtime.nodes.getIcon
api/editor/ui.js GET /icons/:icon Get a node icon from the core set
Library API
api/editor/library.js POST /library/flows/* runtime.library.setEntry
api/editor/library.js GET /library/flows/* runtime.library.getEntry
api/editor/library.js GET /library/flows runtime.library.getEntries
api/editor/library.js GET /library/:type/*
api/editor/library.js POST /library/:type/*
Projects API
api/editor/projects/index.js GET /projects List all projects tbd
api/editor/projects/index.js POST /projects Create project
api/editor/projects/index.js GET /projects/:id Get project metadata
api/editor/projects/index.js PUT /projects/:id Update a project
api/editor/projects/index.js DELETE /projects/:id Delete project
api/editor/projects/index.js GET /projects/:id/status Get project status - files/commit counts/branch info
api/editor/projects/index.js GET /projects/:id/files Project file listing
api/editor/projects/index.js GET /projects/:id/files/:treeish/* Get file content in a given tree (index/stage)
api/editor/projects/index.js DELETE /projects/:id/files/_/* Revert a file (delete from the stage tree)
api/editor/projects/index.js POST /projects/:id/stage/* Stage a file
api/editor/projects/index.js POST /projects/:id/stage Stage multiple files
api/editor/projects/index.js POST /projects/:id/commit Commit changes
api/editor/projects/index.js DELETE /projects/:id/stage/* Unstage a file
api/editor/projects/index.js DELETE /projects/:id/stage Unstage multiple files
api/editor/projects/index.js GET /projects/:id/diff/:type/* Get a file diff
api/editor/projects/index.js GET /projects/:id/commits Get a list of commits
api/editor/projects/index.js GET /projects/:id/commits/:sha Get an individual commit details
api/editor/projects/index.js POST /projects/:id/push/?* Push local commits to remote
api/editor/projects/index.js POST /projects/:id/pull/?* Pull remote commits
api/editor/projects/index.js DELETE /projects/:id/merge Abort an ongoing merge
api/editor/projects/index.js POST /projects/:id/resolve/* Resolve a merge
api/editor/projects/index.js GET /projects/:id/branches Get a list of local branches
api/editor/projects/index.js DELETE /projects/:id/branches/:branchName Delete a local branch - ?force=true
api/editor/projects/index.js GET /projects/:id/branches/remote Get a list of remote branches
api/editor/projects/index.js GET /projects/:id/branches/remote/*/status Get branch status - commit counts/ahead/behind
api/editor/projects/index.js POST /projects/:id/branches Set the active local branch
api/editor/projects/index.js GET /projects/:id/remotes Get a list of remotes
api/editor/projects/index.js POST /projects/:id/remotes Add a remote
api/editor/projects/index.js DELETE /projects/:id/remotes/:remoteName Delete a remote
api/editor/projects/index.js PUT /projects/:id/remotes/:remoteName Update a remote
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.comms : object

Kind: static namespace of RED


comms.addConnection(opts) ⇒ Promise.<Object>

Registers a new comms connection

Kind: static method of comms
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.user User the user calling the api
opts.client CommsConnection the client connection

comms.removeConnection(opts) ⇒ Promise.<Object>

Unregisters a comms connection

Kind: static method of comms
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.user User the user calling the api
opts.client 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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.user User the user calling the api
opts.client 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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.user User the user calling the api
opts.client CommsConnection the client connection
opts.topic String the topic to unsubscribe from

RED.flows : object

Kind: static namespace of RED


flows.getFlows(opts) ⇒ Promise.<Flows>

Gets the current flow configuration

Kind: static method of flows
Returns: Promise.<Flows> - - the active flow configuration

Param Type Description
opts Object
opts.user User the user calling the api

flows.setFlows(opts) ⇒ Promise.<Flows>

Sets the current flow configuration

Kind: static method of flows
Returns: Promise.<Flows> - - the active flow configuration

Param Type Description
opts Object
opts.user User the user calling the api

flows.addFlow(opts) ⇒ Promise.<String>

Adds a flow configuration

Kind: static method of flows
Returns: Promise.<String> - - the id of the added flow

Param Type Description
opts Object
opts.user User the user calling the api
opts.flow Object the flow to add

flows.getFlow(opts) ⇒ Promise.<Flow>

Gets an individual flow configuration

Kind: static method of flows
Returns: Promise.<Flow> - - the active flow configuration

Param Type Description
opts Object
opts.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
Returns: Promise.<String> - - the id of the updated flow

Param Type Description
opts Object
opts.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
Returns: Promise - - resolves if successful

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the safe credentials

Param Type Description
opts Object
opts.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


library.getEntry(opts) ⇒ Promise.<(String|Object)>

Gets an entry from the library.

Kind: static method of library
Returns: Promise.<(String|Object)> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the entry listing

Param Type Description
opts Object
opts.user User the user calling the api
opts.type String the type of entry

RED.nodes : object

Kind: static namespace of RED


nodes.getNodeInfo(opts) ⇒ Promise.<NodeInfo>

Gets the info of an individual node set

Kind: static method of nodes
Returns: Promise.<NodeInfo> - - the node information

Param Type Description
opts Object
opts.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
Returns: Promise.<NodeList> - - the list of node modules

Param Type Description
opts Object
opts.user User the user calling the api

nodes.getNodeConfig(opts) ⇒ Promise.<String>

Gets an individual node's html content

Kind: static method of nodes
Returns: Promise.<String> - - the node html content

Param Type Description
opts Object
opts.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
Returns: Promise.<String> - - the node html content

Param Type Description
opts Object
opts.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
Returns: Promise.<ModuleInfo> - - the node module info

Param Type Description
opts Object
opts.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
Returns: Promise.<ModuleInfo> - - the node module info

Param Type Description
opts Object
opts.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
Returns: Promise - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<ModuleInfo> - - the module info object

Param Type Description
opts Object
opts.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
Returns: Promise.<ModuleInfo> - - the module info object

Param Type Description
opts Object
opts.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
Returns: Promise.<IconList> - - the list of all icons

Param Type Description
opts Object
opts.user User the user calling the api

nodes.getIcon(opts) ⇒ Promise.<Buffer>

Gets a node icon

Kind: static method of nodes
Returns: Promise.<Buffer> - - the icon file as a Buffer

Param Type Description
opts Object
opts.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


projects.listProjects(opts) ⇒ Promise.<Object>

List projects known to the runtime

Kind: static method of projects
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.user User the user calling the api

projects.createProject(opts) ⇒ Promise.<Object>

Create a new project

Kind: static method of projects
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the active project

Param Type Description
opts Object
opts.user User the user calling the api

projects.setActiveProject(opts) ⇒ Promise.<Object>

Kind: static method of projects
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the project metadata

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the project status

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - a list of the local branches

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the status of the branch

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the commit details

Param Type Description
opts Object
opts.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
Returns: Promise.<Array> - - an array of commits

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the file listing

Param Type Description
opts Object
opts.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
Returns: Promise.<String> - - the content of the file

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the requested diff

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - a list of project remotes

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.user User the user calling the api

projects.push(opts) ⇒ Promise.<Object>

Push changes to a remote

Kind: static method of projects
Returns: Promise.<Object> - - resolves when complete

Param Type Description
opts Object
opts.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


settings.getRuntimeSettings(opts) ⇒ Promise.<Object>

Gets the runtime settings object

Kind: static method of settings
Returns: Promise.<Object> - - the runtime settings

Param Type Description
opts Object
opts.user User the user calling the api

settings.getUserSettings(opts) ⇒ Promise.<Object>

Gets an individual user's settings object

Kind: static method of settings
Returns: Promise.<Object> - - the user settings

Param Type Description
opts Object
opts.user User the user calling the api

settings.updateUserSettings(opts) ⇒ Promise.<Object>

Updates an individual user's settings object.

Kind: static method of settings
Returns: Promise.<Object> - - the user settings

Param Type Description
opts Object
opts.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
Returns: Promise.<Object> - - the user's ssh keys

Param Type Description
opts Object
opts.user User the user calling the api

settings.getUserKey(opts) ⇒ Promise.<String>

Gets a user's ssh public key

Kind: static method of settings
Returns: Promise.<String> - - the user's ssh public key

Param Type Description
opts Object
opts.user User the user calling the api
opts.id User the id of the key to return

settings.generateUserKey(opts) ⇒ Promise.<String>

Generates a new ssh key pair

Kind: static method of settings
Returns: Promise.<String> - - the id of the generated key

Param Type Description
opts Object
opts.user User the user calling the api
opts.name User the id of the key to return
opts.password User (optional) the password for the key pair
opts.comment User (option) a comment to associate with the key pair
opts.size 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
Returns: Promise - - resolves when deleted

Param Type Description
opts Object
opts.user User the user calling the api
opts.id User the id of the key to delete

RED.isStarted(opts) ⇒ Promise.<Boolean>

Returns whether the runtime is started

Kind: static method of RED
Returns: Promise.<Boolean> - - whether the runtime is started

Param Type Description
opts Object
opts.user User the user calling the api

RED.version(opts) ⇒ Promise.<String>

Returns version number of the runtime

Kind: static method of RED
Returns: Promise.<String> - - the runtime version number

Param Type Description
opts Object
opts.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