Skip to main content

TwinfinityApiClient

This interface extends BimCoreApiClient with methods specifically needed for the Twinfinity backend API.

Hierarchy

Implemented by

Index

Properties

deleteChanges

deleteChanges: (changesToDelete: BimChange[]) => Promise<TypedResponse<number>[]>

Type declaration

    • Deletes changes. Check if it is possible to delete changes using canDelete before. Passing changes where canDelete is ``false`` will generate exceptions.


      Parameters

      Returns Promise<TypedResponse<number>[]>

      A response with TypedResponse.status `` === 200`` and the number of changes that was deleted. In case of error appropriates TypedResponse.status code’s are returned.

getContainerInfo

getContainerInfo: (container?: URL | BimContainer) => Promise<TypedResponse<BimContainerInfo>>

Type declaration

    • Gets info of container and current user. Can also be used to check if a container exists (returns undefined)


      Parameters

      • optionalcontainer: URL | BimContainer

        If given returns info specified container. If not given, the root container is returned.

      Returns Promise<TypedResponse<BimContainerInfo>>

      TypedResponse with container information. If container is undefined, a root container is returned. If there are multiple root containers, only one can be returned using the following priority order: First ProjectNetwork and then Archive. Response will be 404 if no root container does exist. Resonse will be 401 response if user is not logged in.

getInfo

getInfo: () => Promise<TwinfinityInfo>

Type declaration

readonlyid

id: string

Uniquely identifies the backend the client connects to. If the client connects to a REST API its probably the host name of the API.

readonlylayers

API to handle layer functionality. A Layer is a way to enrich an existing change in the database with extra data. This data will be versioned separately from the change the layer is attached to.

readonlymessages

Access to message operations

readonlysettings

Access to settings operations.

readonlyupload

Access to upload operations.

Methods

canDelete

  • Determines whether a change can be deleted by calling deleteChanges.


    Parameters

    Returns boolean

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

get

  • get<T>(absoluteOrRelativeUrl: string | URL, converter: (r: Response) => TypedResponse<T>, init?: RequestInit): Promise<TypedResponse<T>>
  • 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

    • absoluteOrRelativeUrl: 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.

getChanges

  • 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

    type inference by specifying return type.

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

    Predefined queries. Type is included in query so no need to specify on return value.

    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

    Returns Promise<TypedResponse<T[]>>

    Changes in container that matched the filterQuery.

getContainers

  • 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.

getIfcChanges

  • 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.