Named Versions

Every ChangeSet pushed to iModelHub creates a new Version of iModel. To distinguish a specific ChangeSet in iModel's timeline, that represents an important milestone or significant event for that iModel, its Version can be given a unique human-readable name, creating a Named Version. It will allow Version to be easier to recognize and access. Named Versions can be queried separately from ChangeSets and they get Thumbnails rendered.

Creating Named Versions

Named Version can be created by calling VersionHandler.create. To create a Named Version a ChangeSet id has to be specified. You can get ChangeSet ids by querying ChangeSets through ChangeSetHandler.get.

To create a Named Version from a ChangeSet query:

// Query all ChangeSets
const changeSets: ChangeSet[] = await imodelHubClient.changeSets.get(authorizedRequestContext, imodelId);
// Select one of the resulting ChangeSets
const changeSetId: string = changeSets[0].id!;
// Create a Named Version for that ChangeSet
const createdVersion: Version = await imodelHubClient.versions.create(authorizedRequestContext, imodelId, changeSetId, "Version name", "Version description");

Querying Named Versions

After creating Named Version, its possible to query them by calling VersionHandler.get. Results of this query can be modified by using VersionQuery. Named Versions by default are ordered from the newest ChangeSet to the oldest.

// Query all Named Versions
const allVersions: Version[] = await imodelHubClient.versions.get(authorizedRequestContext, imodelId);
// Query a single Named Version by its name
const queryByName: VersionQuery = new VersionQuery().byName("Version name");
const versionByName: Version[] = await imodelHubClient.versions.get(authorizedRequestContext, imodelId, queryByName);

detachChangeCache() deprecated

The only way to detach change cache is to close the connection. The api will be remove in future.

Last Updated: 29 November, 2022