Skip to main content

TwinfinityApiClientWithTwin

Hierarchy

  • BimTwinfinityApiClient
    • TwinfinityApiClientWithTwin

Index

Constructors

constructor

Properties

readonlybaseUrl

baseUrl: URL

readonlylayers

layers: LayerApiClient

Access to layer operations.

readonlymapBox

mapBox: MapBoxApiClient

Access to MapBox operations.

readonlymessages

messages: MessageApiClient

Access to message operations.

readonlysettings

settings: SettingsApiClient

Access to settings operations.

readonlyupload

upload: UploadApiClient

Access to upload operations.

Accessors

id

  • get id(): string
  • Hostname of baseUrl.


    Returns string

Methods

canDelete

  • canDelete(__namedParameters: BimChange): boolean
  • @inheritDoc

    Parameters

    • __namedParameters: BimChange

    Returns boolean

deleteChanges

  • deleteChanges(changesToDelete: BimChange[]): Promise<TypedResponse<number>[]>
  • @inheritDoc

    Parameters

    • changesToDelete: BimChange[]

    Returns Promise<TypedResponse<number>[]>

get

  • get<T>(absoluteUrl: string | URL, converter: (r: Response) => TypedResponse<T>, init?: RequestInit): Promise<TypedResponse<T>>
  • @inheritDoc

    Type parameters

    • T

    Parameters

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

      Returns Promise<TypedResponse<T>>

    getChanges

    • getChanges<T>(parentOrUrl: URL | BimChange | BimContainer, options: { id: string } | { query: string } | { query: all }): Promise<TypedResponse<T[]>>
    • @inheritDoc

      Type parameters

      • T: BimChange = BimChange

      Parameters

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

      Returns Promise<TypedResponse<T[]>>

    getContainerInfo

    • getContainerInfo(containerOrUrl?: URL | BimContainer): Promise<TypedResponse<BimContainerInfo>>
    • @inheritDoc

      Parameters

      • optionalcontainerOrUrl: URL | BimContainer

      Returns Promise<TypedResponse<BimContainerInfo>>

    getContainers

    • getContainers(id?: string): Promise<BimContainer[]>
    • @inheritDoc

      Parameters

      • optionalid: string

      Returns Promise<BimContainer[]>

    getIfcChanges

    • getIfcChanges(parentOrUrl: URL | BimChange | BimContainer): Promise<BimChangeIfc[]>
    • @inheritDoc

      Parameters

      • parentOrUrl: URL | BimChange | BimContainer

      Returns Promise<BimChangeIfc[]>

    getInfo

    • getInfo(): Promise<TwinfinityInfo>
    • @inheritDoc

      Returns Promise<TwinfinityInfo>

    publicgetTwinIfcChanges

    • getTwinIfcChanges(twin: Twin): Promise<BimChangeIfc[]>
    • Parameters

      Returns Promise<BimChangeIfc[]>

    publicgetTwins

    • getTwins(): Promise<Twin[]>
    • Returns Promise<Twin[]>

    staticcreate

    • create(hostnameOrUrl: string | URL, options?: TwinfinityApiSession): Promise<undefined | BimTwinfinityApiClient>
    • Creates a new instance of BimTwinfinityApiClient by detecting available root URLs for the current user.

      @example
      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);

      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: TwinfinityApiSession

        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.

    staticdetectRootUrls

    • detectRootUrls(baseUrl: URL, options?: TwinfinityApiSession): Promise<URL[]>
    • 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.
      @example
      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/' ]

      Parameters

      • baseUrl: URL

        The base URL to detect root URLs for.

      • optionaloptions: TwinfinityApiSession

        Optional session used to get authorization header for requests.

      Returns Promise<URL[]>

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