Reference·JavaScript · @bimworks/jssdkJavaScript

Fs

Class in @bimworks/jssdk.

API catalogue · @bimworks/jssdk · Class

TypeScript#
class Fs

API Namespace Fs is used for BIM.works FileSystem related API calls.

A note about "paths" in BIM.works: Paths are relative to your credentials. For example an API Token that has been created on "/My Organization/Sub Folder" will resolve "/" to "/My Organization/Sub Folder"

Members#

Member Kind Description
constructor Method
createNode Method Create a new Node
createNodeIfNotExists Method Create a new Node, but only if it did not already exist
deleteNode Method Delete a Node by it's Nid. Will throw an exception if the Node does not exist or was already deleted.
deleteNodeError Method Delete a NodeError by it's id
deleteNodeIfExists Method Will delete the designated Node if is has not already been deleted. Will not throw an exception when there is no such Node.
deleteNodeVersion Method Delete a Version. In a future version, the requirement to specify the nodeUuid in this method will be dropped
getNodeByPath Method Get a Node by it's path.
getNodeByUuid Method Get a Node by it Nid.
getNodeByVersionUuid Method Get a Node by a given Vid. This can be useful if you want to quickly go from a known Vid o Node without first resolving the Version object.
getNodeVersion Method Resolve the given Vid to a Version
getNodeVersions Method Resolve the given Vids to an array of Version
getRootNode Method Get the Root node of the current authorization context
getRootNodeUuid Method Get the Nid of the root Node of the current authorization context
listNodeErrors Method List all the known Error on the given Node
listNodes Method List all the direct child Nodes of the given Nid.
listNodesByPath Method List all the child nodes of the Node on the given path
listNodesRecursive Method Recursively list all the child Nodes of the given Nid. The Promise will resolve to a flat array of all the nodes.
listNodeVersions Method List all the known Version on the given Node
moveNode Method Moves a Node to another parent Node
nodeExists Method
previousVersion Method The Version before this one on its Node: the highest version number below it among the Node's live, processed Versions; null for a first Version.
renameNode Method Rename an existing Node
undeleteNode Method Undelete a given Node. Undeleting Nodes is currently only allowed for users with SUPER_ADMIN rights
updateNode Method Update an existing Node

constructor#

TypeScript#
constructor()

createNode#

TypeScript#
public createNode(parentNodeUuid: string, name: string, isFolder: boolean, inputFileType: InputFileType): Promise<string>

Create a new Node

Parameters#

Name Type Description
parentNodeUuid string The Nid of the parent Node under which to create the new Node
name string The name of the new Node
isFolder boolean Whether this new Node should be a folder or not
inputFileType InputFileType The type of files that will be stored in this Node, for a folder node use FOLDER

Returns#

The Nid of the newly created Node

createNodeIfNotExists#

TypeScript#
public createNodeIfNotExists(parentNodeUuid: string, name: string, isFolder: boolean, inputFileType: InputFileType): Promise<string>

Create a new Node, but only if it did not already exist

Parameters#

Name Type Description
parentNodeUuid string The Nid of the parent Node under which to create the new Node
name string The name of the new Node
isFolder boolean Whether this new Node should be a folder or not
inputFileType InputFileType The type of files that will be stored in this Node, for a folder node use FOLDER

Returns#

The Nid of the newly created Node, of if the Node already existed the Nid of the existing Node

deleteNode#

TypeScript#
public deleteNode(nodeUuid: string): Promise<unknown>

Delete a Node by it's Nid. Will throw an exception if the Node does not exist or was already deleted.

Parameters#

Name Type Description
nodeUuid string The UUID of the Node to delete

deleteNodeError#

TypeScript#
public deleteNodeError(nodeUuid: string, errorUuid: string): Promise<unknown>

Delete a NodeError by it's id

Parameters#

Name Type Description
nodeUuid string The UUID of the Node
errorUuid string The UUID of the Error

deleteNodeIfExists#

TypeScript#
public deleteNodeIfExists(nodeUuid: string): Promise<void>

Will delete the designated Node if is has not already been deleted. Will not throw an exception when there is no such Node.

Parameters#

Name Type Description
nodeUuid string The UUID of the Node to delete

deleteNodeVersion#

TypeScript#
public deleteNodeVersion(nodeUuid: string, versionUuid: string): Promise<unknown>

Delete a Version. In a future version, the requirement to specify the nodeUuid in this method will be dropped

Parameters#

Name Type Description
nodeUuid string The UUID of the Node
versionUuid string The UUID of the Version

getNodeByPath#

TypeScript#
public getNodeByPath(path: string): Promise<Node>

Get a Node by it's path.

Parameters#

Name Type Description
path string

getNodeByUuid#

TypeScript#
public getNodeByUuid(nodeUuid: string): Promise<Node>

Get a Node by it Nid.

Parameters#

Name Type Description
nodeUuid string

getNodeByVersionUuid#

TypeScript#
public getNodeByVersionUuid(versionUuid: string): Promise<Node>

Get a Node by a given Vid. This can be useful if you want to quickly go from a known Vid o Node without first resolving the Version object.

Parameters#

Name Type Description
versionUuid string

getNodeVersion#

TypeScript#
public getNodeVersion(versionUuid: string): Promise<Version>

Resolve the given Vid to a Version

Parameters#

Name Type Description
versionUuid string The UUID of the Version to fetch

getNodeVersions#

TypeScript#
public getNodeVersions(versionUuids: (string)[]): Promise<(Version)[]>

Resolve the given Vids to an array of Version

Parameters#

Name Type Description
versionUuids (string)[]

getRootNode#

TypeScript#
public getRootNode(): Promise<Node>

Get the Root node of the current authorization context

getRootNodeUuid#

TypeScript#
public getRootNodeUuid(): Promise<string>

Get the Nid of the root Node of the current authorization context

listNodeErrors#

TypeScript#
public listNodeErrors(nodeUuid: string): Promise<unknown>

List all the known Error on the given Node

Parameters#

Name Type Description
nodeUuid string

listNodes#

TypeScript#
public listNodes(uuid: string): Promise<{ nodes: (Node)[] }>

List all the direct child Nodes of the given Nid.

Parameters#

Name Type Description
uuid string

listNodesByPath#

TypeScript#
public listNodesByPath(path: string): Promise<{ nodes: (Node)[] }>

List all the child nodes of the Node on the given path

Parameters#

Name Type Description
path string

listNodesRecursive#

TypeScript#
public listNodesRecursive(nodeUuid: string): Promise<{ nodes: (Node)[] }>

Recursively list all the child Nodes of the given Nid. The Promise will resolve to a flat array of all the nodes.

Parameters#

Name Type Description
nodeUuid string

listNodeVersions#

TypeScript#
public listNodeVersions(nodeUuid: string): Promise<unknown>

List all the known Version on the given Node

Parameters#

Name Type Description
nodeUuid string

moveNode#

TypeScript#
public moveNode(nodeUuid: string, targetNodeUuid: string): Promise<unknown>

Moves a Node to another parent Node

Parameters#

Name Type Description
nodeUuid string
targetNodeUuid string

nodeExists#

TypeScript#
public nodeExists(path: string): Promise<unknown>

Parameters#

Name Type Description
path string The path to the Node

Returns#

Whether a Node already exists on the given path

previousVersion#

TypeScript#
public previousVersion(version: string | Version): Promise<Version | null>

The Version before this one on its Node: the highest version number below it among the Node's live, processed Versions; null for a first Version.

Parameters#

Name Type Description
version string | Version

renameNode#

TypeScript#
public renameNode(nodeUuid: string, newName: string): Promise<void>

Rename an existing Node

Parameters#

Name Type Description
nodeUuid string The UUID of the Node
newName string The new name of the Node

undeleteNode#

TypeScript#
public undeleteNode(nodeUuid: string): Promise<void>

Undelete a given Node. Undeleting Nodes is currently only allowed for users with SUPER_ADMIN rights

Parameters#

Name Type Description
nodeUuid string The UUID of the Node to undelete

updateNode#

TypeScript#
public updateNode(nodeUuid: string, newName: string, userData?: unknown): Promise<void>

Update an existing Node

Parameters#

Name Type Description
nodeUuid string The UUID of the Node
newName string The new name of the Node, passing null will keep the existing name
userData unknown Optional user data that can be stored. This needs to be a value that can be converted to JSON (object, array, json primitive)