new Client( [params])
Parameters:
| Name | Type | Argument | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
params |
Object |
<optional> |
An object containing client configuration parameters. Properties
|
Members
-
options :Options
-
VisualizeJSparameters. Changes to these parameters are automatically applied toViewerinstances associated with that client.Type:
-
<readonly> serverUrl :string
-
Open Cloud Server URL. Use configure() to change server URL.
Type:
- string
Methods
-
addEventListener(type, listener)
-
Registers an event listener to a specific event type on the client.
Parameters:
Name Type Description typestring The event type to listen for. Can be one of:
optionschangeuploadprogress
listenerEventListener A listener function that is called whenever an event of the specified type has been fired.
Returns:
Returns a reference to the
Client, so that calls can be chained.- Type
- Client
-
configure(params)
-
Change the client configuration parameters.
Parameters:
Name Type Description paramsObject An object containing new configuration parameters.
Properties
Name Type Description serverUrlstring Open Cloud Server URL.
Returns:
Returns a reference to the
Client.- Type
- Client
-
<async> createAssembly(files, name, params)
-
Create a new assembly.
Parameters:
Name Type Description filesArray.<string> List of file IDs.
namestring Assembly name.
paramsAn object containing upload parameters.
Properties
Name Type Default Description waitForDonefalse Wait until assembly is created.
Returns:
- Type
- Promise.<Assembly>
-
<async> createJob(fileId, outputFormat)
-
Create a new job to retrieve file geometry or property data.
Parameters:
Name Type Description fileIdstring File ID.
outputFormatstring Can be
geometryorproperties.Returns:
- Type
- Promise.<Job>
-
<async> createProject(name, description, startDate, endDate, avatarUrl)
-
Create a new project.
Parameters:
Name Type Description namestring Project name.
descriptionstring | null Project description.
startDateDate | string Project start date.
endDateDate | string Project end date.
avatarUrlstring Project preview image URL. Can be Data URL.
Returns:
- Type
- Promise.<Project>
-
<async> createUser(email, password [, params])
-
Create a new user. Only admins can create users, if the current logged in user does not have administrator rights, an exception will be thrown.
Parameters:
Name Type Argument Description emailstring User email.
passwordstring User password.
paramsObject <optional>
Additionall user data.
Properties
Name Type Argument Description isAdminstring <optional>
trueif user is an administrator.userNamestring <optional>
User name.
firstNamestring <optional>
First name.
lastNamestring <optional>
Last name.
canCreateProjectstring <optional>
trueif user is allowed to create a project.projectsLimitstring <optional>
The maximum number of projects that the user can create.
storageLimitstring <optional>
The size of the file storage available to the user.
Returns:
- Type
- Promise.<User>
-
<async> deleteAssembly(assemblyId)
-
Delete the assembly from the server.
Parameters:
Name Type Description assemblyIdstring Assembly ID.
Returns:
- Returns the raw data of a deleted assembly.
- Type
- Promise.<Object>
-
<async> deleteFile(fileId)
-
Delete the drawing or reference file from the server.
Parameters:
Name Type Description fileIdstring File ID.
Returns:
- Returns the raw data of a deleted file.
- Type
- Promise.<Object>
-
<async> deleteJob(jobId)
-
Remove a job from the server job list. The method does not delete or stop jobs that are already being executed.
Parameters:
Name Type Description jobIdstring Job ID.
Returns:
- Returns the raw data of a deleted job.
- Type
- Promise.<Object>
-
<async> deleteProject(projectId)
-
Delete the project from the server.
Parameters:
Name Type Description projectIdstring Project ID.
Returns:
- Returns the raw data of a deleted project.
- Type
- Promise.<Object>
-
<async> deleteUser(userId)
-
Delete a user from the server. Only admins can delete users, if the current logged in user does not have administrator rights, an exception will be thrown.
Admins can delete themselves or other admins. An admin can only delete himself if he is not the last administrator.
You need to re-login to continue working after deleting the current logged in user.
Parameters:
Name Type Description userIdstring User ID.
Returns:
- Returns the raw data of a deleted user.
- Type
- Promise.<Object>
-
<async> downloadReferenceFile(fileId, onProgress, signal)
-
Download the source of the reference file.
Parameters:
Name Type Description fileIdstring File ID.
onProgressProgressCallback Download progress callback.
signalAbortSignal An AbortSignal object instance. Allows to communicate with a fetch request and abort it if desired.
Returns:
- Type
- Promise.<ArrayBuffer>
-
emitEvent(event)
-
Fires the event. Calls each of the listeners registered with addEventListener() for the event type
event.type, in the order they were registered.Parameters:
Name Type Description eventEvent The event to fire.
Returns:
Returns
trueif the event had listeners.- Type
- boolean
-
<async> getAssemblies(start, limit, name, ids, sortByDesc, sortField)
-
Returns a list of assemblies the user has access to.
Parameters:
Name Type Description startnumber The starting index in the assembly list. Used for paging.
limitnumber The maximum number of assemblies that should be returned per request. Used for paging.
namestring Filter the assemblies by part of the name.
idsArray.<string> | string List of assembly IDs to return. You can specify multiple IDs on one
stringby separating them with a "|".sortByDescboolean Allows to specify the descending order of the result. By default assemblies are sorted by name in ascending order.
sortFieldstring Allows to specify sort field.
Returns:
- Type
- Promise.<AssembliesResult>
-
<async> getAssembly(assemblyId)
-
Get assembly information.
Parameters:
Name Type Description assemblyIdstring Assembly ID.
Returns:
- Type
- Promise.<Assembly>
-
getCurrentUser()
-
Returns the current logged in user information. Returns
nullif the user is not logged in or the logged in user has deleted himself.Returns:
- Type
- User
-
<async> getFile(fileId)
-
Returns the file information.
Parameters:
Name Type Description fileIdstring File ID.
Returns:
- Type
- Promise.<File>
-
<async> getFiles(start, limit, name, ext, ids, sortByDesc, sortField)
-
Returns a list of files the user has access to.
Parameters:
Name Type Description startnumber The starting index in the file list. Used for paging.
limitnumber The maximum number of files that should be returned per request. Used for paging.
namestring Filter the files by part of the name.
extstring | Array.<string> Filter the files by extension. Extension can be
dgn,dwf,dwg,dxf,ifc,nwc,nwd,obj,pdf,rcs,rfa,rvt,stl,vsf, or any other supported file type extension. You can specify multiple extensions on onestringby separating them with a "|".idsArray.<string> | string List of file IDs to return. You can specify multiple IDs on one
stringby separating them with a "|".sortByDescboolean Allows to specify the descending order of the result. By default, files are sorted by name in ascending order.
sortFieldboolean Allows to specify sort field.
Returns:
- Type
- Promise.<FilesResult>
-
<async> getJob(jobId)
-
Returns the job information.
Parameters:
Name Type Description jobIdstring Job ID.
Returns:
- Type
- Promise.<Job>
-
<async> getJobs(status, limit, start, sortByDesc, sortField)
-
Returns a list of jobs created by current user.
Parameters:
Name Type Description statusstring | Array.<string> Filter the jobs by status. Status can be
waiting,inpogress,doneorfailed. You can specify multiple statuses on onestringby separating them with a "|".limitnumber The maximum number of jobs that should be returned per request. Used for paging.
startnumber The starting index in the job list. Used for paging.
sortByDescboolean Allows to specify the descending order of the result. By default, jobs are sorted by creation time in ascending order.
sortFieldboolean Allows to specify sort field
Returns:
- Type
- Promise.<JobsResult>
-
<async> getProject(projectId)
-
Returns the project information.
Parameters:
Name Type Description projectIdstring Project ID.
Returns:
- Type
- Promise.<Project>
-
<async> getProjects(start, limit, name, ids, sortByDesc)
-
Returns a list of projects the user has access to.
Parameters:
Name Type Description startnumber The starting index in the project list. Used for paging.
limitnumber The maximum number of projects that should be returned per request. Used for paging.
namestring Filter the projects by part of the name.
idsArray.<string> | string List of project IDs to return. You can specify multiple IDs on one
stringby separating them with a "|".sortByDescboolean Allows to specify the descending order of the result. By default projects are sorted by name in ascending order.
Returns:
- Type
- Promise.<ProjectsResult>
-
<async> getUser(userId)
-
Returns the user information. Only admins can get other users, if the current logged in user does not have administrator rights, hi can only get himself, otherwise an exception will be thrown.
Parameters:
Name Type Description userIdstring User ID.
Returns:
- Type
- Promise.<User>
-
<async> getUsers()
-
Returns a list of server users. Only admins can get a list of users, if the current logged in user does not have administrator rights, an exception will be thrown.
Returns:
- Type
- Promise.<Array.<User>>
-
removeAllListeners()
-
Removes all listeners previously registered with addEventListener() from the client.
Returns:
Returns a reference to the
Client, so that calls can be chained.- Type
- Client
-
removeEventListener(type, listener)
-
Removes the specified listener previously registered with addEventListener() from the client.
Parameters:
Name Type Description typestring The event type for which to remove the listener.
listenerEventListener The listener function to remove.
Returns:
Returns a reference to the
Client, so that calls can be chained.- Type
- Client
-
<async> signInWithEmail(email, password)
-
Log in an existing user using email and password.
Parameters:
Name Type Description emailstring An email for authentication request.
passwordstring Password for authentication request. Password can only contain letters (a-z, A-Z), numbers (0-9), and special characters (~!@#$%^&*()_-+={}[]:;"'`<>,.?|/\ ), otherwise an exception will be thrown.
Returns:
- Type
- Promise.<User>
-
<async> signInWithToken(token)
-
Log in an existing user using API Key.
Parameters:
Name Type Description tokenstring An access token for authentication request. See User.token for more details.
Returns:
- Type
- Promise.<User>
-
<async> uploadFile(file [, params])
-
Upload a drawing or reference file to the server.
Parameters:
Name Type Argument Description filefile Web API File object are generally retrieved from a FileList object returned as a result of a user selecting files using the HTML
<input>element.paramsObject <optional>
An object containing upload parameters.
Properties
Name Type Argument Default Description geometryboolean true Create job to extract geometry.
propertiesboolean true Create job to extract properties.
waitForDoneboolean false Wait until geometry or properties jobs complete.
onProgressFileProgressCallback <optional>
Upload progress callback.
Fires:
Returns:
- Type
- Promise.<File>
-
<async> version()
-
Returns server version.
Returns:
- Type
- Promise.<VersionResult>
Client.js