![]() |
Infohub JS API
|
Node Services to get/write objects as tree, etc.
Public Member Functions | |
| constructor (ctx) | |
| async | createChild (parent_node_sid, nodeData) |
| async | getChildren (node_sid, options={}) |
| async | getDocument (node_sid, query, cb) |
| async | getNodeData (node_sid, query, cb) |
| async | getNodePath (node_sid, query, cb) |
| async | getTree (node_sid, params, cb) |
| async | patchTree (parentnode_sid, node_tree, cb) |
| async | postTree (parentnode_sid, node_tree, cb) |
| async | putTree (parentnode_sid, node_tree, cb) |
| async | saveTree (parentnode_sid, node_tree, cb) |
| async | updateTree (parentnode_sid, node_tree, cb) |
| constructor | ( | ctx | ) |
| {Context} | ctx - Context instance |
| async createChild | ( | parent_node_sid, | |
| nodeData ) |
Create a new child node under a parent node.
| {string} | parent_node_sid - Parent node short ID |
| {object} | nodeData - Node data to create |
Example
| async getChildren | ( | node_sid, | |
| options = {} ) |
Get children of a node with optional filters.
| {string} | node_sid - Parent node short ID |
| {object} | options - Query options |
| {string} | [options.filter] - Filter expression (e.g., "$object_type ~eq~ 'cn_federatedmodels'") |
| {string|string[]} | [options.members] - Members to include (e.g., 'info' or ['info', 'properties']) |
| {string|string[]} | [options.properties] - Properties to include |
| {number} | [options.depth] - Tree depth to retrieve (0 = direct children only) |
| {string} | [options.sortby] - Sort expression |
| {number} | [options.limit] - Limit number of results |
| {number} | [options.offset] - Offset for pagination |
Example:
| async getDocument | ( | node_sid, | |
| query, | |||
| cb ) |
| {*} | node_sid |
| {object} | query = { "as_blob" : true download as file, false if the document should be loaded as json } |
| {*} | cb data = { "doc" : json or blob } |
| async getNodeData | ( | node_sid, | |
| query, | |||
| cb ) |
| {*} | node_sid |
| {*} | query { 'members' : [ 'info' , 'properties' ] } |
| {*} | cb |
| async getNodePath | ( | node_sid, | |
| query, | |||
| cb ) |
Get path of node hierarchy from root to node.
| {*} | node_sid Get path from this node to root |
| {*} | query = { 'members' : [ 'info' , 'properties' , ] } |
| {*} | cb |
Example:
| async getTree | ( | node_sid, | |
| params, | |||
| cb ) |
| {string} | node_sid |
| {object} | params = { 'depth' 'members' 'properties' 'geometry' 'filter' 'nodes' 'relations' 'relations_right' 'groupby' 'sortby' 'limit' 'offset' } each parameter has to be encoded as URI component |
Example:
| {function} | cb |
| async patchTree | ( | parentnode_sid, | |
| node_tree, | |||
| cb ) |
Partially updates a node tree below a parent node.
Sends the supplied tree changes to PATCH /{scope}/nodes/{parentnode_sid}/tree and passes the resulting REST response to the callback.
| parentnode_sid | - Short ID of the parent node. |
| node_tree | - Node tree changes to apply below the parent node. |
| cb | - Callback that receives a RestResponse. |
| async postTree | ( | parentnode_sid, | |
| node_tree, | |||
| cb ) |
Creates a node tree below a parent node using the infohub v2 API.
Sends the supplied tree to POST /{scope}/v2/nodes/{parentnode_sid}/tree and passes the resulting REST response to the callback.
| parentnode_sid | - Short ID of the parent node. |
| node_tree | - Node tree to create below the parent node. |
| cb | - Callback that receives a RestResponse. |
| async putTree | ( | parentnode_sid, | |
| node_tree, | |||
| cb ) |
Writes a node tree below a parent node using the infohub v2 API.
Sends the supplied tree to PUT /{scope}/v2/nodes/{parentnode_sid}/tree and passes the resulting REST response to the callback.
| parentnode_sid | - Short ID of the parent node. |
| node_tree | - Node tree to write below the parent node. |
| cb | - Callback that receives a RestResponse. |
| async saveTree | ( | parentnode_sid, | |
| node_tree, | |||
| cb ) |
Update/create node tree.
Replace existing nodes in 'parentnode_sid', if existing nodes are deleted if not in 'node_tree'
POST /{scope}/nodes/{node}/tree
| {*} | parentnode_sid |
| {*} | node_tree |
| {*} | cb |
| async updateTree | ( | parentnode_sid, | |
| node_tree, | |||
| cb ) |
Update node tree.
Keep existing nodes in parentnode_sid
PUT /{scope}/nodes/{node}/tree
| {*} | parentnode_sid |
| {*} | node_tree |
| {*} | cb |