![]() |
Infohub JS API
|
Properties on infohub.
Public Member Functions | |
| constructor (ctx) | |
| async | getPropertyFromNode (node_shortid, propertykey) |
| getPropertyListFromTypeIds (typeids) | |
| async | readPropertyList (query) |
| async | readPropertyListByQueryId (queryid) |
| async | readPropertyValuesFromNode (node_shortid) |
| async | writePropertyList (proplist) |
| async | writePropertyValues (proplist) |
| async | writePropertyValuesToNode (node_sid, proplist) |
| constructor | ( | ctx | ) |
| {Context} | ctx - Context instance |
| async getPropertyFromNode | ( | node_shortid, | |
| propertykey ) |
Reads a single property from a node in the current scope.
Sends GET /{scope}/nodes/{nodeShortId}/properties/{propertyKey}. The scope is taken from the current Context. The node short ID and property key are URL-encoded before they are added to the request path.
| {string} | node_shortid - Short ID of the node whose property is read. |
| {string} | propertykey - Full property key, including its value type when applicable, for example ifcType##xs:string. |
Example:
| getPropertyListFromTypeIds | ( | typeids | ) |
Helper function.
Get list of property types in a format that can be used in 'readPropertyList
| {Array<string>} | typeids |
| async readPropertyList | ( | query | ) |
Get property list from infohub.
Use query to specify which objects and properties should be taken into account. For convenience, you can get the member ‘properties’ in the correct format from a list of properties by using the method getPropertyListFromTypeIds( typeids ).
| {*} | query = { "project_ids" : [ '... project shortid... ' , ' ... ' ], "object_ids" : [ '... object id ' , ' ... ' ], "properties" : [ { } ] } |
| async readPropertyListByQueryId | ( | queryid | ) |
| {*} | queryid |
| async readPropertyValuesFromNode | ( | node_shortid | ) |
Reads all property values from a node in the current scope.
Sends GET /{scope}/nodes/{nodeShortId}/properties/values. The scope is taken from the current Context.
| {string} | node_shortid - Short ID of the node whose properties are read. |
Example:
| async writePropertyList | ( | proplist | ) |
Writes object properties to objects given by object ID the current project.
Sends the supplied objects to POST /{scope}/projects/{projectShortId}/properties. The scope and project short ID are taken from the current Context. Property comments can be supplied using the same property names as in properties.
| {Array<{ | parent_id: string, object_id: string, object_name: string, object_type: string, properties: Object<string, *>, properties_comments: (Object<string, string>|undefined) }>} proplist - Objects and their property data to write. |
Example:
| async writePropertyValues | ( | proplist | ) |
Writes property values and comments for one or more objects given by ShortIDs in the current scope.
Sends the supplied list to POST /{scope}/properties. Each entry identifies an object by its short ID and contains property names mapped to their values. Property comments can be supplied using the same property names.
| {Array<{ | shortid: string, properties: Object<string, *>, properties_comments: (Object<string, string>|undefined) }>} proplist - Property updates. properties_comments is optional. |
Example:
| async writePropertyValuesToNode | ( | node_sid, | |
| proplist ) |
Writes property values directly to a node in the current scope.
Sends the property map to POST /{scope}/nodes/{nodeShortId}/properties/values. The scope is taken from the current Context. Property keys may include their value type, for example ifcType##xs:string.
| {string} | node_sid - Short ID of the node whose properties are updated. |
| {Object<string,*>} | proplist - Property names mapped to the values to store on the node. Values may be strings, numbers, booleans, or other JSON-compatible values supported by the property type. |
Example: