@twinfinity/experimental
    Preparing search index...

    Class TwinfinityApiClientWithTwin

    Hierarchy

    • BimTwinfinityApiClient
      • TwinfinityApiClientWithTwin
    Index

    Constructors

    Properties

    baseUrl: URL
    layers: LayerApiClient

    Access to layer operations.

    mapBox: MapBoxApiClient

    Access to MapBox operations.

    messages: MessageApiClient

    Access to message operations.

    settings: SettingsApiClient

    Access to settings operations.

    twins: TwinClient

    Access to twin operations.

    upload: UploadApiClient

    Access to upload operations.

    Accessors

    • get id(): string

      Hostname of baseUrl.

      Returns string

    Methods

    • Parameters

      • __namedParameters: BimChange

      Returns boolean

    • Parameters

      • changesToDelete: BimChange[]

      Returns Promise<TypedResponse<number>[]>

    • Type Parameters

      • T

      Parameters

      • absoluteUrl: string | URL
      • converter: (r: Response) => TypedResponse<T>
      • Optionalinit: RequestInit

      Returns Promise<TypedResponse<T>>

    • Type Parameters

      • T extends BimChange = BimChange

      Parameters

      • parentOrUrl: URL | BimContainer | BimChange
      • options: { id: string } | { query: string } | { query: "all" }

      Returns Promise<TypedResponse<T[]>>

    • Parameters

      • OptionalcontainerOrUrl: URL | BimContainer

      Returns Promise<TypedResponse<BimContainerInfo>>

    • Parameters

      • Optionalid: string

      Returns Promise<BimContainer[]>

    • Parameters

      • parentOrUrl: URL | BimContainer | BimChange

      Returns Promise<BimChangeIfc[]>

    • Returns Promise<TwinfinityInfo>

    • Parameters

      Returns Promise<BimChangeIfc[]>

    • Returns Promise<Twin[]>

    • Creates a new instance of BimTwinfinityApiClient by detecting available root URLs for the current user.

      Parameters

      • hostnameOrUrl: string | URL

        Hostname of the Twinfinity installation. If the hostname does not start with bim. it will be added automatically. Its ok to pass a full URL too, but only the hostname is used. Scheme is always set to https.

      • Optionaloptions: TwinfinityApiOptions

        Optional session used to get authorization header for requests.

      Returns Promise<undefined | BimTwinfinityApiClient>

      A promise that resolves to a new instance of BimTwinfinityApiClient. If no root URLs are detected, the promise resolves to undefined. undefined indicates that the user is not authorized or does not have access to any Twinfinity resources.

      const client = await BimTwinfinityApiClient.create('demo.projektstruktur.se');
      if (client == null) {
      console.log('User does not have access to any root URLs.');
      return;
      }
      const containers = await client.getContainers(); // Fetch containers from all available root URLs.
      console.log(containers);
    • Detects the root URLs available for the current user given a base URL. The result depends on type of Twinfinity installation, how its configured and which resources the user has access to. The method will test the following root URLs:

      • {protocol}://{host}/sites/portal/
      • {protocol}://{host}/sites/archive/
      • {protocol}://{host}/workspaces/ Where {protocol} and {host} is taken from the provided baseUrl.

      Parameters

      • baseUrl: URL

        The base URL to detect root URLs for.

      • Optionaloptions: TwinfinityApiOptions

        Optional session used to get authorization header for requests.

      Returns Promise<URL[]>

      A promise that resolves to an array of detected root URLs.

      const baseUrl = new URL('https://bim.demo.projektstruktur.se');
      const rootUrls = await BimTwinfinityApiClient.detectRootUrls(baseUrl);
      console.log(rootUrls); // [ 'https://bim.demo.projektstruktur.se/sites/portal/', 'https://bim.demo.projektstruktur.se/sites/archive/' ]