Skip to main content

BimTwinfinityApiClient

Loads container and IFC data from the Twinfinity backend.

Implements

Index

Constructors

publicconstructor

Properties

publicreadonlybaseUrl

baseUrl: URL

publicreadonlylayers

Access to layer operations.

publicreadonlymapBox

Access to MapBox operations.

publicreadonlymessages

Access to message operations.

publicreadonlysettings

Access to settings operations.

publicreadonlyupload

Access to upload operations.

Accessors

publicid

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


    Returns string

Methods

publiccanDelete

  • canDelete(__namedParameters: BimChange): boolean
  • Determines whether a change can be deleted by calling deleteChanges.


    Parameters

    Returns boolean

    ``true`` if it is possible to delete the change. Otherwise ``false``.

publicdeleteChanges

  • @inheritDoc

    Parameters

    Returns Promise<TypedResponse<number>[]>

publicget

  • Issues an HTTP GET specified url.

    @example
    // Gets a JSON object and convert it to the MyObj interface.
    const myObjResponse = this.get<MyObj>("http://foo.com/jsonendpoint", HttpResponseType.json)
    const myObj = myObjResponse.status === 200 ? (await myObjResponse.value) : undefined;
    // Gets a binary ArrayBuffer.
    const myArrayBufferResponse = this.get("http://foo.com/jsonendpoint", HttpResponseType.arrayBuffer)
    const myArrayBuffer = myArrayBufferResponse.status === 200 ? (await myArrayBufferResponse.value) : undefined;

    Type parameters

    • T

      The type of data the specified converter will convert the HTTP response body to.

    Parameters

    • absoluteUrl: string | URL

      Url to issue HTTP GET to.

    • converter: (r: Response) => TypedResponse<T>

      Converter for response. See HttpResponseType for predefined converters.

      • optionalinit: RequestInit

        Optional settings for to HTTP GET (fetch).

      Returns Promise<TypedResponse<T>>

      a TypedResponse containing the status code and the response value that resulted from using the specified converter.

    publicgetChanges

    • Retrieves all changes in and below a specified parent change and that matches a specific query. Use typescript type inference cast directly to a specific BimChange type if you know exactly which types the query will return

      @example
      const dwgChanges: BimChangeDwg[] = api.getChanges(container, {query: "dwg.status=Processed"});
      @example
      const ifcFailures = api.getChanges(container, PredefinedBimChangeMetadataQuery.ifc(BimChangeStatus.Failed));
      @remarks

      It is expensive to get all changes in a container. Use a query to filter out only the changes you are interested in. Getting everything is discouraged as there can be 100k+ changes in a container. Be specific. As it is expensive DO NOT use this method to get the changes for many/all containers in the system. There can be many containers and many changes (like 100k+) in each container.


      Type parameters

      Parameters

      • parentOrUrl: URL | BimChange | BimContainer

        Parent to get changes from.

      • options: { id: string } | { query: string } | { query: all }

        example: ifc.status=processed, dwg.status=processed or _system.layers.format=sensors

        • id: string
        • query: string
        • query: all

      Returns Promise<TypedResponse<T[]>>

      Changes in container that matched the filterQuery.

    publicgetContainerInfo

    publicgetContainers

    • Gets all containers or just a specific one.


      Parameters

      • optionalid: string

        If given, only container with specific id is returned. Otherwise all containers are returned.

      Returns Promise<BimContainer[]>

      List of containers. May be empty if no containers were found or matched the specified id.

    publicgetIfcChanges

    • Retrieves all (successfully processed) IFC changes located in and below a specified parent.

      @remarks

      As it is expensive DO NOT use this method to get the IFC changes for many/all containers in the system. It is however reasonable to use this method to get the changes for a few specific containers.


      Parameters

      Returns Promise<BimChangeIfc[]>

      All successfully processed IFC changes in the specified container.

    publicgetInfo

    • @inheritDoc

      Returns Promise<TwinfinityInfo>