iModelHub Client

To work with iModelHub API directly, you have to create an instance of IModelHubClient. Once you have instance of the client, you can access various iModelHub class handlers through it. IModelDb covers most of the common functionality of iModelHub and it should be used instead of IModelHubClient when possible.

You should try to reuse IModelHubClient instances, as performance sending multiple requests to iModelHub will be better on the same client instance. It's not necessary to reuse handler instances.

iModelHub Client on backend

If you're working on a backend and require downloading and uploading files, you have to specify an implementation of FileHandler. For iModelHub that should be AzureFileHandler

Example:

import { IModelHubClient } from "@bentley/imodeljs-clients";
import { AzureFileHandler, IOSAzureFileHandler } from "@bentley/imodeljs-clients-backend";
import { MobileRpcConfiguration } from "@bentley/imodeljs-common";

const imodelHubClient = new IModelHubClient(MobileRpcConfiguration.isMobileBackend ? new IOSAzureFileHandler() : new AzureFileHandler());

Last Updated: 08 January, 2020