@itwin/imodels-client-management
Version:
iModels API client wrapper for applications that manage iModels.
106 lines • 8.04 kB
TypeScript
import { OperationsBase } from "../../base/internal";
import { AuthorizationCallback, EntityListIterator, HeaderFactories, IModel, MinimalIModel } from "../../base/types";
import { IModelsClient } from "../../IModelsClient";
import { OperationOptions } from "../OperationOptions";
import { CloneIModelParams, CreateEmptyIModelParams, CreateIModelFromTemplateParams, DeleteIModelParams, ForkIModelParams, GetIModelListParams, GetSingleIModelParams, IModelProperties, UpdateIModelParams } from "./IModelOperationParams";
export declare class IModelOperations<TOptions extends OperationOptions> extends OperationsBase<TOptions> {
private _iModelsClient;
constructor(options: TOptions, _iModelsClient: IModelsClient);
/**
* Gets iModels for a specific iTwin. This method returns iModels in their minimal representation. The returned iterator
* internally queries entities in pages. Wraps the {@link https://developer.bentley.com/apis/imodels-v2/operations/get-itwin-imodels/ Get iTwin iModels}
* operation from iModels API.
* @param {GetIModelListParams} params parameters for this operation. See {@link GetIModelListParams}.
* @returns {EntityListIterator<MinimalIModel>} iterator for iModel list. See {@link EntityListIterator}, {@link MinimalIModel}.
*/
getMinimalList(params: GetIModelListParams): EntityListIterator<MinimalIModel>;
/**
* Gets iModels for a specific iTwin. This method returns iModels in their full representation. The returned iterator
* internally queries entities in pages. Wraps the {@link https://developer.bentley.com/apis/imodels-v2/operations/get-itwin-imodels/ Get iTwin iModels}
* operation from iModels API.
* @param {GetIModelListParams} params parameters for this operation. See {@link GetIModelListParams}.
* @returns {EntityListIterator<IModel>} iterator for iModel list. See {@link EntityListIterator}, {@link IModel}.
*/
getRepresentationList(params: GetIModelListParams): EntityListIterator<IModel>;
/**
* Gets a single iModel by its id. This method returns an iModel in its full representation. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/get-imodel-details/ Get iModel} operation from iModels API.
* @param {GetSingleIModelParams} params parameters for this operation. See {@link GetSingleIModelParams}.
* @returns {Promise<iModel>} an iModel with specified id. See {@link IModel}.
*/
getSingle(params: GetSingleIModelParams): Promise<IModel>;
/**
* Creates an empty iModel with specified properties. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/create-imodel/ Create iModel} operation from iModels API.
* @param {CreateEmptyIModelParams} params parameters for this operation. See {@link CreateEmptyIModelParams}.
* @returns {Promise<iModel>} newly created iModel. See {@link IModel}.
*/
createEmpty(params: CreateEmptyIModelParams): Promise<IModel>;
/**
* Creates an iModel from a template. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/create-imodel/ Create iModel} operation from iModels API.
* It uses the `template` request body property to specify the source iModel which will be used as a template. Internally
* this method creates the iModel instance and then repeatedly queries the iModel state until the iModel is initialized.
* The execution of this method can take up to several minutes due to waiting for initialization to complete.
* @param {CreateIModelFromTemplateParams} params parameters for this operation. See {@link CreateIModelFromTemplateParams}.
* @returns {Promise<iModel>} newly created iModel. See {@link IModel}.
* @throws an error that implements `iModelsError` interface with code {@link IModelsErrorCode.IModelFromTemplateInitializationFailed} if
* iModel initialization failed or did not complete in time. See {@link IModelsErrorCode}.
*/
createFromTemplate(params: CreateIModelFromTemplateParams): Promise<IModel>;
/**
* Clones the specified iModel. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/clone-imodel/ Clone iModel} operation from iModels API.
* Internally this method clones the iModel and then repeatedly queries the new iModel's state until it is initialized.
* The execution of this method can take up to several minutes due to waiting for initialization to complete.
* @param {CloneIModelParams} params parameters for this operation. See {@link CloneIModelParams}.
* @returns {Promise<IModel>} newly created iModel. See {@link IModel}.
* @throws an error that implements `iModelsError` interface with code {@link IModelsErrorCode.ClonedIModelInitializationFailed} if
* iModel initialization failed or {@link IModelsErrorCode.ClonedIModelInitializationTimedOut} if operation did not complete in time.
* See {@link IModelsErrorCode}.
*/
clone(params: CloneIModelParams): Promise<IModel>;
/**
* Forks the specified iModel. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/fork-imodel/ Fork iModel} operation from iModels API.
* Internally this method forks the iModel and then repeatedly queries the new iModel's creation state until it is succeeded.
* The execution of this method can take up to several minutes due to waiting for initialization to complete.
* @param {ForkIModelParams} params parameters for this operation. See {@link ForkIModelParams}.
* @returns {Promise<IModel>} newly created iModel. See {@link IModel}.
* @throws an error that implements `iModelsError` interface with code {@link IModelsErrorCode.IModelForkInitializationFailed} if
* iModel initialization failed, {@link IModelsErrorCode.IModelForkInitializationTimedOut} if operation did not complete in time or
* {@link IModelsErrorCode.MainIModelIsMissingFederationGuids} if the iModel from which user is attempting to create a fork does not
* have {@link https://www.itwinjs.org/bis/guide/fundamentals/federationguids/ FederationGuid} property set on all its elements.
* See {@link IModelsErrorCode}.
*/
fork(params: ForkIModelParams): Promise<IModel>;
/**
* Updates iModel properties. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/update-imodel/ Update iModel} operation from iModels API.
* @param {UpdateIModelParams} params parameters for this operation. See {@link UpdateIModelParams}.
* @returns {Promise<IModel>} updated iModel. See {@link IModel}.
*/
update(params: UpdateIModelParams): Promise<IModel>;
/**
* Deletes an iModel with specified id. Wraps the {@link https://developer.bentley.com/apis/imodels-v2/operations/delete-imodel/ Delete iModel}
* operation from iModels API.
* @param {DeleteIModelParams} params parameters for this operation. See {@link DeleteIModelParams}.
* @returns {Promise<void>} a promise that resolves after operation completes.
*/
delete(params: DeleteIModelParams): Promise<void>;
protected appendRelatedEntityCallbacks(authorization: AuthorizationCallback, iModel: IModel, headers?: HeaderFactories): IModel;
protected getCreateEmptyIModelRequestBody(iModelProperties: IModelProperties): IModelProperties;
protected sendIModelPostRequest(authorization: AuthorizationCallback, createIModelBody: object, headers?: HeaderFactories): Promise<IModel>;
private getCreator;
private getCreateIModelFromTemplateRequestBody;
private getCloneIModelRequestBody;
private getForkIModelRequestBody;
private getUpdateIModelRequestBody;
private isIModelInitialized;
private isIModelForkInitialized;
private waitForEmptyIModelInitialization;
private waitForTemplatedIModelInitialization;
private waitForClonedIModelInitialization;
private waitForIModelForkInitialization;
}
//# sourceMappingURL=IModelOperations.d.ts.map