@inweb/client
    Preparing search index...

    Class Project

    Provides properties and methods for obtaining information about a project on the Open Cloud Server and managing its roles, members and models.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • data: any

        Raw project data received from the server. For more information, see Open Cloud Projects API.

      • httpClient: IHttpClient

        HTTP client instance used to send requests to the REST API server.

      Returns Project

    Properties

    headers: HeadersInit

    Endpoint-specific HTTP headers for the GET, POST, PUT and DELETE requests. You can add custom headers at any time.

    path: string

    Endpoint API path relative to the REST API server URL.

    Accessors

    • get authorization(): { project_actions: string[] }

      Project features the user has access to.

      Returns { project_actions: string[] }

      • project_actions: string[]

        Actions are allowed to be performed:

        • update - The ability to update the project details.
        • createTopic - The ability to create a new topic.
        • createDocument - The ability to create a new document.
    • get createdAt(): string

      Project creation time (UTC) in the format specified in ISO 8601.

      Returns string

    • get customFields(): any

      Project custom fields object, to store custom data.

      Returns any

    • get data(): any

      Raw project data received from the server. For more information, see Open Cloud Projects API.

      Returns any

    • get description(): string

      Project description.

      Returns string

    • get endDate(): string

      Project end date in the format specified in ISO 8601.

      Returns string

    • get id(): string

      Unique project ID.

      Returns string

    • get memberCount(): number

      The number of members in the project.

      Returns number

    • get modelCount(): number

      The number of models in the project.

      Returns number

    • get name(): string

      Project name.

      Returns string

    • get previewUrl(): string

      Project preview image URL or empty string if the project does not have a preview. Use setPreview() to change preview image.

      This URL does not change when the underlying image content is updated. Because of this, browsers may cache the image, which can prevent the preview from updating visually in web applications (such as React, Angular, etc.).

      To avoid caching issues, append a dynamic query parameter to the URL, such as the project's last modification date. Since this date changes whenever the preview is updated, the browser will correctly reload the new image when required.

      Returns string

      function ProjectPreview({ project }) {
      // 'updatedAt' is a timestamp representing when the project was last modified.
      const cacheBuster = project.updatedAt;

      // Use a default image if the project does not have a preview
      const imageSrc = project.previewUrl
      ? `${project.previewUrl}?t=${cacheBuster}`
      : "/assets/default-preview.png";

      return <img src={imageSrc} alt="Project preview" />;
      }
    • get public(): boolean

      true if project is shared project.

      Returns boolean

    • get startDate(): string

      Project start date in the format specified in ISO 8601.

      Returns string

    • get topicCount(): number

      The number of topics in the project.

      Returns number

    • get updatedAt(): string

      Project last update time (UTC) in the format specified in ISO 8601.

      Returns string

    Methods

    • Adds a user to the project to become a member and have permission to perform actions.

      Parameters

      • userId: string

        User ID.

      • role: string

        Role name from the list of project roles.

      Returns Promise<Member>

    • Adds a file to the project with specified permissions.

      To change file permissions for the project use Permission.actions.

      Parameters

      • fileId: string

        File ID.

      • actions: string | string[]

        Actions are allowed to be performed on a file:

        • read - The ability to read file description, geometry data and properties.
        • readSourceFile - The ability to download source file.
        • write - The ability to modify file name, description and references.
        • readViewpoint - The ability to read file viewpoints.
        • createViewpoint - The ability to create file viewpoints.
        • deleteViewpoint - The ability to delete file viewpoints.

      Returns Promise<File>

      Returns a file instance added to the project.

    • Reloads project data from the server.

      Returns Promise<Project>

    • Creates a clash test for project models.

      This test detects clashes between objects from specified project models by evaluating two types of clashes:

      • Hard clashes - occur when object A intersects with object B by a distance greater than the specified tolerance.
      • Clearance clashes - occur when object A is closer to object B than the specified clearance, but does not intersect it.

      You can disable detection for a specific clash type by explicitly setting its corresponding parameter to null. For example:

      • Hard clashes only test: Set clearance to null and tolerance to a positive value.
      • Clearance clashes only test: Set tolerance to null and clearance to a positive value.
      • Exact contacts only test: Set both tolerance and clearance to 0.

      By default (if neither tolerance nor celarance is provided), the test performs a standard hard clash detection.

      The selected file versions for the test must have extracted geometry in VSFX or glTF format (see File.extractGeometry), otherwise an exception will be thrown.

      Parameters

      • name: string

        Test name.

      • targets: IAdvancedClashTarget | IAdvancedClashTarget[]

        List of project files to include in the test. If a single file is specified, its objects are tested for clashes against each other. If two or more files are specified, the objects of one file are tested against the objects of the other files.

      • Optionalparams: {
            clearance?: number;
            interval?: number;
            onCheckout?: (test: AdvancedClashTest, ready: boolean) => boolean;
            signal?: AbortSignal;
            timeout?: number;
            tolerance?: number;
            waitForDone?: boolean;
        }

        An object containing test parameters.

        • Optionalclearance?: number

          The distance used for detecting clearance clashes, in meters. To disable clearance clash detection, explicitly set this value to null. Defaults to 0.

        • Optionalinterval?: number

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

        • OptionalonCheckout?: (test: AdvancedClashTest, ready: boolean) => boolean

          Waiting progress callback. Return true to cancel waiting.

        • Optionalsignal?: AbortSignal

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

        • Optionaltimeout?: number

          The time, in milliseconds, the function should wait for the test. If the test is not complete during this time, the TimeoutError exception will be thrown.

        • Optionaltolerance?: number

          The distance used for detecting hard clashes, in meters. To disable hard clash detection, explicitly set this value to null. Defaults to 1e-5.

        • OptionalwaitForDone?: boolean

          Wait for test to complete.

      Returns Promise<AdvancedClashTest>

    • Creates a new project role.

      Parameters

      • name: string

        Role name.

      • description: string

        Role description.

      • permissions: IRoleActions

        Actions are allowed to be performed for the role.

      Returns Promise<Role>

    • Deletes a project from the server.

      Returns Promise<any>

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

    • Deletes the specified clash test for project models.

      Parameters

      • testId: string

        Test ID.

      Returns Promise<any>

      Returns the raw data of the deleted test.

    • Removes the project preview.

      Returns Promise<Project>

    • Deletes the specified project role.

      Parameters

      • name: string

        Role name.

      Returns Promise<any>

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

    • Returns information about the specified clash test for project models.

      Parameters

      • testId: string

        Test ID.

      Returns Promise<AdvancedClashTest>

    • Returns a list of clash tests for project models.

      Parameters

      • Optionalstart: number

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

      • Optionallimit: number

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

      • Optionalids: string | string[]

        List of test IDs to return.

      • OptionalfileIds: string | string[]

        Filter tests to those that include at least one of the specified file IDs.

      • OptionalsortByDesc: boolean

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

      • OptionalsortField: string

        Allows to specify sort field.

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

    • Returns a list of project files. For more information, see Open Cloud BCF3 API.

      This list contains all files that the project has access to. To add a file to this list, create a project permission on the file using File.createPermission().

      Returns Promise<any[]>

    • Returns information about the specified project member.

      Parameters

      • memberId: string

        Member ID.

      Returns Promise<Member>

    • Returns a list of project members.

      Returns Promise<Member[]>

    • Returns a list of project files.

      Returns Promise<File[]>

    • Returns information about the specified project role.

      Parameters

      • name: string

        Role name.

      Returns Promise<Role>

    • Returns a list of project roles. Project members have different abilities depending on the role they have in a project.

      Returns Promise<Role[]>

    • Removes the specified member from a project.

      Parameters

      • memberId: string

        Member ID.

      Returns Promise<any>

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

    • Removes the specified file from a project.

      Parameters

      • fileId: string

        File ID.

      Returns Promise<File>

      Returns a file instance removed from the project.

    • Saves project properties changes to the server. Call this method to update project data on the server after any property changes.

      Returns Promise<Project>

    • Sets or removes the project preview.

      Parameters

      Returns Promise<Project>