33 * See LICENSE.md in the project root for license terms and full copyright notice.
44 *--------------------------------------------------------------------------------------------*/
55import {
6- EntityListIterator ,
7- EntityListIteratorImpl ,
8- OperationsBase ,
6+ Lock ,
7+ LockResponse ,
8+ LockOperations as ManagementLockOperations ,
99} from "@itwin/imodels-client-management" ;
1010
11- import {
12- LockResponse ,
13- LocksResponse ,
14- ReleaseLocksChunkResponse ,
15- } from "../../base/internal" ;
16- import { Lock , ReleaseLocksChunkResult } from "../../base/types" ;
1711import { OperationOptions } from "../OperationOptions" ;
1812
19- import {
20- GetLockListParams ,
21- UpdateLockParams ,
22- ReleaseLocksChunkParams ,
23- } from "./LockOperationParams" ;
13+ import { UpdateLockParams } from "./LockOperationParams" ;
2414
2515export class LockOperations <
2616 TOptions extends OperationOptions
27- > extends OperationsBase < TOptions > {
28- /**
29- * Gets Locks for a specific iModel. This method returns Locks in their full representation. The returned iterator
30- * internally queries entities in pages. Wraps the
31- * {@link https://developer.bentley.com/apis/imodels-v2/operations/get-imodel-locks/ Get iModel Locks} operation from
32- * iModels API.
33- * @param {GetLockListParams } params parameters for this operation. See {@link GetLockListParams}.
34- * @returns {EntityListIterator<Lock> } iterator for Lock list. See {@link EntityListIterator}, {@link Lock}.
35- */
36- public getList ( params : GetLockListParams ) : EntityListIterator < Lock > {
37- return new EntityListIteratorImpl ( async ( ) =>
38- this . getEntityCollectionPage < Lock , LocksResponse > ( {
39- authorization : params . authorization ,
40- url : this . _options . urlFormatter . getLockListUrl ( {
41- iModelId : params . iModelId ,
42- urlParams : params . urlParams ,
43- } ) ,
44- entityCollectionAccessor : ( response ) => response . body . locks ,
45- headers : params . headers ,
46- } )
47- ) ;
48- }
49-
17+ > extends ManagementLockOperations < TOptions > {
5018 /**
5119 * Updates Lock for a specific Briefcase. This operation is used to acquire new locks and change the lock level for
5220 * already existing ones. Wraps the {@link https://developer.bentley.com/apis/imodels-v2/operations/update-imodel-locks/
@@ -67,41 +35,11 @@ export class LockOperations<
6735 return updateLockResponse . body . lock ;
6836 }
6937
70- /**
71- * Releases Locks chunk for a specific Briefcase. This operation is used to release or abandon existing Locks.
72- * Wraps the {@link https://developer.bentley.com/apis/imodels-v2/operations/release-imodel-locks-chunk/
73- * Release iModel Locks Chunk} operation from iModels API.
74- * @param {ReleaseLocksChunkParams } params parameters for this operation. See {@link ReleaseLocksChunkParams}.
75- * @returns {Promise<ReleaseLocksChunkResult> } result indicating if this was the last chunk. See {@link ReleaseLocksChunkResult}.
76- */
77- public async releaseLocksChunk (
78- params : ReleaseLocksChunkParams
79- ) : Promise < ReleaseLocksChunkResult > {
80- const releaseLocksChunkBody = this . getReleaseLocksChunkBody ( params ) ;
81- const releaseLocksChunkResponse =
82- await this . sendPostRequest < ReleaseLocksChunkResponse > ( {
83- authorization : params . authorization ,
84- url : this . _options . urlFormatter . getReleaseLocksChunkUrl ( {
85- iModelId : params . iModelId ,
86- } ) ,
87- body : releaseLocksChunkBody ,
88- headers : params . headers ,
89- } ) ;
90- return releaseLocksChunkResponse . body ;
91- }
92-
9338 private getUpdateLockBody ( params : UpdateLockParams ) : object {
9439 return {
9540 briefcaseId : params . briefcaseId ,
9641 changesetId : params . changesetId ,
9742 lockedObjects : params . lockedObjects ,
9843 } ;
9944 }
100-
101- private getReleaseLocksChunkBody ( params : ReleaseLocksChunkParams ) : object {
102- return {
103- briefcaseId : params . briefcaseId ,
104- changesetId : params . changesetId ,
105- } ;
106- }
10745}
0 commit comments