UNPKG

@itwin/imodels-client-authoring

Version:

iModels API client wrapper for applications that author iModels.

57 lines 2.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LockOperations = void 0; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ const imodels_client_management_1 = require("@itwin/imodels-client-management"); class LockOperations extends imodels_client_management_1.OperationsBase { /** * Gets Locks for a specific iModel. This method returns Locks in their full representation. The returned iterator * internally queries entities in pages. Wraps the * {@link https://developer.bentley.com/apis/imodels-v2/operations/get-imodel-locks/ Get iModel Locks} operation from * iModels API. * @param {GetLockListParams} params parameters for this operation. See {@link GetLockListParams}. * @returns {EntityListIterator<Lock>} iterator for Lock list. See {@link EntityListIterator}, {@link Lock}. */ getList(params) { return new imodels_client_management_1.EntityListIteratorImpl(async () => this.getEntityCollectionPage({ authorization: params.authorization, url: this._options.urlFormatter.getLockListUrl({ iModelId: params.iModelId, urlParams: params.urlParams, }), entityCollectionAccessor: (response) => response.body.locks, headers: params.headers, })); } /** * Updates Lock for a specific Briefcase. This operation is used to acquire new locks and change the lock level for * already existing ones. Wraps the {@link https://developer.bentley.com/apis/imodels-v2/operations/update-imodel-locks/ * Update iModel Locks} operation from iModels API. * @param {UpdateLockParams} params parameters for this operation. See {@link UpdateLockParams}. * @returns {Promise<Lock>} updated Lock. See {@link Lock}. */ async update(params) { const updateLockBody = this.getUpdateLockBody(params); const updateLockResponse = await this.sendPatchRequest({ authorization: params.authorization, url: this._options.urlFormatter.getLockListUrl({ iModelId: params.iModelId, }), body: updateLockBody, headers: params.headers, }); return updateLockResponse.body.lock; } getUpdateLockBody(params) { return { briefcaseId: params.briefcaseId, changesetId: params.changesetId, lockedObjects: params.lockedObjects, }; } } exports.LockOperations = LockOperations; //# sourceMappingURL=LockOperations.js.map