Provides methods for managing Open Cloud Server resources such as users, files, assemblies, jobs, projects, etc.

Hierarchy

Constructors

  • Parameters

    • params: { serverUrl?: string; url?: string } = {}

      An object containing client configuration parameters.

      • OptionalserverUrl?: string

        Open Cloud REST API server URL.

      • Optionalurl?: string

        Deprecated since 25.8. Use serverUrl instead.

    Returns Client

Accessors

  • get httpClient(): IHttpClient
  • HTTP client instance used to send requests to the REST API server.

    Returns IHttpClient

  • get options(): any
  • Deprecated since 25.3. Use Viewer.options() instead to change Viewer parameters.

    Returns any

  • get serverUrl(): string
  • Open Cloud REST API server URL. Use configure() to change server URL.

    Returns string

Methods

  • Registers a new listener for the event type.

    Type Parameters

    • T extends "uploadprogress"

    Parameters

    • type: T

      The type of event to listen to.

    • listener: (event: ClientEventMap[T]) => void

      The function that gets called when the event is fired.

    Returns this

  • Changes the client parameters.

    After changing the parameters, you must re-login.

    Parameters

    • params: { serverUrl?: string }

      An object containing new parameters.

      • OptionalserverUrl?: string

        Open Cloud REST API server URL.

    Returns this

  • Marks the user's email address as confirmed. If the user's email is already confirmed, an exception will be thrown.

    Parameters

    • emailConfirmationId: string

      Confirmation code from the Confirmation Email.

    Returns Promise<any>

  • Creates a new assembly on the server.

    Parameters

    • files: string[]

      List of file IDs.

    • name: string

      Assembly name.

    • Optionalparams: {
          interval?: number;
          onCheckout?: (assembly: Assembly, ready: boolean) => boolean;
          signal?: AbortSignal;
          timeout?: number;
          waitForDone?: boolean;
      }

      Additional assembly creating parameters.

      • Optionalinterval?: number

        The time, in milliseconds, the function should delay in between checking assembly status.

      • OptionalonCheckout?: (assembly: Assembly, ready: boolean) => boolean

        Waiting progress callback. Return true to cancel waiting.

      • Optionalsignal?: AbortSignal

        An AbortController signal, which can be used to abort waiting as desired.

      • Optionaltimeout?: number

        The time, in milliseconds, that the function should wait for the assembly to be created. If the assembly is not created within this time, a TimeoutError exception will be thrown.

      • OptionalwaitForDone?: boolean

        Wait for assembly to be created.

    Returns Promise<Assembly>

  • Runs a new job on the server for the sepecified file.

    Parameters

    • fileId: string

      File ID.

    • outputFormat: string

      The job type. Can be one of:

      • geometry - Convert file geometry data to VSFX format suitable for VisualizeJS viewer.
      • geometryGltf - Convert file geometry data to glTF format suitable for Three.js viewer.
      • properties - Extract file properties.
      • validation - Validate the file. Only for IFC files.
      • dwg, obj, gltf, glb, vsf, pdf, 3dpdf - Export file to the one of the supported format.
      • Other custom job name. Custom job runner must be registered in the job templates table before creating a job.
    • Optionalparameters: string | object

      Parameters for the job runner. Can be given as command line arguments for the File Converter tool in form --arg=value.

    Returns Promise<Job>

  • Creates a new OAuth client on the server.

    Only administrators can create OAuth clients. If the current logged in user is not an administrator, an exception will be thrown.

    Parameters

    • name: string

      Client name.

    • redirectUrl: string

      Endpoint to which the OAuth 2.0 server sends the response.

    • Optionaldescription: string

      Client description.

    Returns Promise<OAuthClient>

  • Creates a new project on the server.

    Parameters

    • name: string

      Project name.

    • Optionaldescription: string

      Project description.

    • OptionalstartDate: string | Date

      Project start date.

    • OptionalendDate: string | Date

      Project end date.

    Returns Promise<Project>

  • Creates a new user on the server.

    Only administrators can create users. If the current logged in user is not an administrator, an exception will be thrown.

    Parameters

    • email: string

      User email. Cannot be empty. Must be unique within the server.

    • password: string

      User password. Cannot be empty. Password can only contain latin letters (a-z, A-Z), numbers (0-9), and special characters (~!@#$%^&*()_-+={}[]<>|/'":;.,?).

    • params: {
          canCreateProject?: boolean;
          firstName?: string;
          isAdmin?: boolean;
          lastName?: string;
          projectsLimit?: number;
          storageLimit?: number;
          userName?: string;
      } = {}

      Additional user data.

      • OptionalcanCreateProject?: boolean

        true if user is allowed to create a project.

      • OptionalfirstName?: string

        First name.

      • OptionalisAdmin?: boolean

        true if user is an administrator.

      • OptionallastName?: string

        Last name.

      • OptionalprojectsLimit?: number

        The maximum number of projects that the user can create.

      • OptionalstorageLimit?: number

        The size of the file storage available to the user in bytes.

      • OptionaluserName?: string

        User name. Cannot be empty or blank if defined. Specify undefined to use username from email.

    Returns Promise<User>

  • Deletes the specified assembly from the server.

    Parameters

    • assemblyId: string

      Assembly ID.

    Returns Promise<any>

    Returns the raw data of a deleted assembly. For more information, see Open Cloud API.

  • Deletes the specified file and all its versions from the server.

    You cannot delete a version file using deleteFile(), only the original file. To delete a version file use File.deleteVersion().

    Parameters

    • fileId: string

      File ID.

    Returns Promise<any>

    Returns the raw data of a deleted file. For more information, see Open Cloud Files API.

  • Deletes the specified job from the server job list. Jobs that are in progress or have already been completed cannot be deleted.

    Parameters

    • jobId: string

      Job ID.

    Returns Promise<any>

    Returns the raw data of a deleted job. For more information, see Open Cloud Jobs API.

  • Deletes the specified OAuth client from the server.

    Only administrators can delete OAuth clients. If the current logged in user is not an administrator, an exception will be thrown.

    Parameters

    • clientId: string

      Client ID.

    Returns Promise<any>

    Returns the raw data of a deleted client. For more information, see Open Cloud OAuth Clients API.

  • Deletes the specified project from the server.

    Parameters

    • projectId: string

      Project ID.

    Returns Promise<any>

    Returns the raw data of a deleted project. For more information, see Open Cloud Projects API.

  • Deletes the specified shared link.

    Only file owner can delete shared link. If the current logged in user is not a file owner, an exception will be thrown.

    Parameters

    • token: string

      Shared link token.

    Returns Promise<any>

    Returns the raw data of a deleted shared link. For more information, see Open Cloud SharedLinks API.

  • Deletes the specified user from the server.

    Only administrators can delete users. If the current logged in user is not an administrator, an exception will be thrown.

    Administrators can delete themselves or other administrators. An administrator can only delete themself if they is not the last administrator.

    You need to re-login after deleting the current logged in user.

    Parameters

    • userId: string

      User ID.

    Returns Promise<any>

    Returns the raw data of a deleted user. For more information, see Open Cloud Users API.

  • Downloads the specified file from the server.

    Parameters

    • fileId: string

      File ID.

    • OptionalonProgress: (progress: number) => void

      Download progress callback.

    • Optionalsignal: AbortSignal

      An AbortController signal. Allows to communicate with a fetch request and abort it if desired.

    Returns Promise<ArrayBuffer>

  • Fires the event. Alias to emitEvent().

    Parameters

    • type: string | object

      The type of event that gets fired.

    • ...args: any[]

      The event properties.

    Returns boolean

  • Fires the event. Calls each of the listeners registered for the event type event.type, in the order they were registered.

    Type Parameters

    • T extends "uploadprogress"

    Parameters

    Returns boolean

  • Returns a list of assemblies created by the current logged in user.

    Parameters

    • Optionalstart: number

      The starting index in the assembly list. Used for paging.

    • Optionallimit: number

      The maximum number of assemblies that should be returned per request. Used for paging.

    • Optionalname: string

      Filter the assemblies by part of the name. Case sensitive.

    • Optionalids: string | string[]

      List of assembly IDs to return.

    • OptionalsortByDesc: boolean

      Allows to specify the descending order of the result. By default assemblies are sorted by name in ascending order.

    • OptionalsortField: string

      Allows to specify sort field.

    Returns Promise<
        {
            allSize: number;
            limit: number;
            result: Assembly[];
            size: number;
            start: number;
        },
    >

  • Returns information about the specified assembly.

    Parameters

    • assemblyId: string

      Assembly ID.

    Returns Promise<Assembly>

  • Returns the current logged in user. Returns null if the user is not logged in or the logged in user has deleted themself.

    Returns User

  • Returns information about the specified file.

    Parameters

    • fileId: string

      File ID.

    Returns Promise<File>

  • Returns a list of files that the current logged in user has uploaded to the server or has access to.

    Parameters

    • Optionalstart: number

      The starting index in the file list. Used for paging.

    • Optionallimit: number

      The maximum number of files that should be returned per request. Used for paging.

    • Optionalname: string

      Filter the files by part of the name. Case sensitive.

    • Optionalext: string | string[]

      Filter the files by extension. Extension can be dgn, dwf, dwg, dxf, ifc, ifczip, nwc, nwd, obj, rcs, rfa, rvt, step, stl, stp, vsf, or any other file type extension.

    • Optionalids: string | string[]

      List of file IDs to return.

    • OptionalsortByDesc: boolean

      Allows to specify the descending order of the result. By default, files are sorted by name in ascending order.

    • OptionalsortField: string

      Allows to specify sort field.

    • Optionalshared: boolean

      Returns shared files only.

    Returns Promise<
        {
            allSize: number;
            limit: number;
            result: File[];
            size: number;
            start: number;
        },
    >

  • Returns the list of server enabled indentity providers.

    Returns Promise<{ name: string; url: string }[]>

  • Returns information about the specified job.

    Parameters

    • jobId: string

      Job ID.

    Returns Promise<Job>

  • Returns a list of jobs started by the current logged in user.

    Parameters

    • Optionalstatus: string | string[]

      Filter the jobs by status. Status can be waiting, inpogress, done or failed.

    • Optionallimit: number

      The maximum number of jobs that should be returned per request. Used for paging.

    • Optionalstart: number

      The starting index in the job list. Used for paging.

    • OptionalsortByDesc: boolean

      Allows to specify the descending order of the result. By default, jobs are sorted by creation time in ascending order.

    • OptionalsortField: string

      Allows to specify sort field.

    Returns Promise<
        {
            allSize: number;
            limit: number;
            result: Job[];
            size: number;
            start: number;
        },
    >

  • Returns information about the specified OAuth client.

    Only administrators can get OAuth clients. If the current logged in user is not an administrator, an exception will be thrown.

    Parameters

    • clientId: string

      Client ID.

    Returns Promise<OAuthClient>

  • Returns a list of OAuth clients of the server.

    Only administrators can get a list of OAuth clients. If the current logged in user is not an administrator, an exception will be thrown.

    Parameters

    • Optionalstart: number

      The starting index in the client list. Used for paging.

    • Optionallimit: number

      The maximum number of clients that should be returned per request. Used for paging.

    Returns Promise<
        {
            allSize: number;
            limit: number;
            result: OAuthClient[];
            size: number;
            start: number;
        },
    >

  • Returns information about the specified project.

    Parameters

    • projectId: string

      Project ID.

    Returns Promise<Project>

  • Returns a list of projects that the currently logged in user has created or has access to.

    Parameters

    • Optionalstart: number

      The starting index in the project list. Used for paging.

    • Optionallimit: number

      The maximum number of projects that should be returned per request. Used for paging.

    • Optionalname: string

      Filter the projects by part of the name. Case sensitive.

    • Optionalids: string | string[]

      List of project IDs to return.

    • OptionalsortByDesc: boolean

      Allows to specify the descending order of the result. By default projects are sorted by name in ascending order.

    Returns Promise<
        {
            allSize: number;
            limit: number;
            result: Project[];
            size: number;
            start: number;
        },
    >

  • Returns the current server settings.

    Returns Promise<any>

    Returns an object with server settings. For more information, see Open Cloud Settings API.

  • Returns information about a file from a shared link.

    Some file features are not available via shared link:

    • Updating file properties, preview, and viewpoints
    • Running file jobs
    • Managing file permissions
    • Managing file versions
    • Deleting file

    Parameters

    • token: string

      Shared link token.

    • Optionalpassword: string

      Password to get access to the file.

    Returns Promise<File>

  • Returns information about the specified file shared link.

    Parameters

    • token: string

      Shared link token.

    Returns Promise<SharedLink>

  • Returns information about the specified user.

    Only administrators can get other users. If the current logged in user is not an administrator, they can only get themselves, otherwise an exception will be thrown.

    Parameters

    • userId: string

      User ID.

    Returns Promise<User>

  • Returns the list of server users.

    Only administrators can get a list of users. If the current logged in user is not an administrator, an exception will be thrown.

    Returns Promise<User[]>

  • Removes the listener from an event type. Alias to removeEventListener().

    Parameters

    • type: string

      The type of the event that gets removed.

    • listener: (event: any) => void

      The listener function that gets removed.

    Returns this

  • Registers a new listener for the event type. Alias to addEventListener()

    Parameters

    • type: string

      The type of event to listen to.

    • listener: (event: any) => void

      The function that gets called when the event is fired.

    Returns this

  • Registers a new user on the server.

    No login is required to register a new user.

    Parameters

    • email: string

      User email. Cannot be empty. Must be unique within the server.

    • password: string

      User password. Cannot be empty. Password can only contain letters (a-z, A-Z), numbers (0-9), and special characters (~!@#$%^&*()_-+={}[]<>|/'":;.,?).

    • OptionaluserName: string

      User name. Cannot be empty or blank if defined. this to undefined to use username from email.

    Returns Promise<any>

  • If type is specified, removes all registered listeners for type, otherwise removes all registered listeners.

    Type Parameters

    • T extends "uploadprogress"

    Parameters

    • Optionaltype: T

      The type of the listener that gets removed.

    Returns this

  • Removes the listener for the event type.

    Type Parameters

    • T extends "uploadprogress"

    Parameters

    • type: T

      The type of the event that gets removed.

    • listener: (event: ClientEventMap[T]) => void

      The listener function that gets removed.

    Returns this

  • Resends a Confirmation Email to the new user. If the user's email is already confirmed, an exception will be thrown.

    Parameters

    • email: string

      User email.

    • password: string

      User password.

    Returns Promise<any>

  • Log in an existing user using email or user name.

    Parameters

    • email: string

      An email or user name for authentication request.

    • password: string

      Password for authentication request.

    Returns Promise<User>

  • Log in an existing user using access token (API Key).

    Parameters

    • token: string

      An access token for authentication request. See User.token for more details.

    Returns Promise<User>

  • Changes the server settings.

    Only administrators can change server settings. If the current logged in user is not an administrator, an exception will be thrown.

    Parameters

    • settings: any

      An object with the new server settings or part of the settings. For more information, see Open Cloud Settings API.

    Returns Promise<any>

    Returns an object with updated server settings.

  • Upload a drawing or reference file to the server.

    Fires:

    Parameters

    • file: File

      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.

    • params: {
          geometry?: string | boolean;
          interval?: number;
          onProgress?: (progress: number, file: File) => void;
          properties?: boolean;
          signal?: AbortSignal;
          timeout?: number;
          waitForDone?: boolean;
      } = ...

      An object containing upload parameters.

      • Optionalgeometry?: string | boolean

        Create job to convert file geometry data. Can be:

        • true - Convert file geometry data to VSFX format to open the file in VisualizeJS viewer.
        • vsfx - Convert file geometry data to VSFX format to open the file in VisualizeJS viewer.
        • gltf - Convert file geometry data to glTF format to open the file in Three.js viewer.
      • Optionalinterval?: number

        The time, in milliseconds, the function should delay in between checking jobs status.

      • OptionalonProgress?: (progress: number, file: File) => void

        Upload progress callback.

      • Optionalproperties?: boolean

        Create job to extract file properties.

      • Optionalsignal?: AbortSignal

        An AbortController signal, which can be used to abort waiting as desired.

      • Optionaltimeout?: number

        The time, in milliseconds that the function should wait jobs. If no one jobs are done during this time, the TimeoutError exception will be thrown.

      • OptionalwaitForDone?: boolean

        Wait for geometry and properties jobs to complete.

    Returns Promise<File>

  • Returns client and server versions.

    No login is required to obtain the version.

    Returns Promise<{ client: string; hash: string; server: string }>