@itwin/clash-detection-client
Version:
Clash Detection client for the iTwin platform
39 lines • 2.24 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { OperationUtils } from "../OperationUtils";
import { OperationsBase } from "../../base/OperationsBase";
import { EntityListIteratorImpl } from "../../base/iterators/EntityListIteratorImpl";
export class TemplateOperations extends OperationsBase {
constructor(options) {
super(options);
}
/**
* Gets Suppression Rule Templates for a specific project. This method returns Suppression Rule Templates in their full representation. The returned
* iterator internally queries entities in pages. Wraps the
* {@link https://developer.bentley.com/apis/clash-detection/operations/get-suppression-rule-templates/ Get Suppression Rule Template}
* operation from Clash Detection API.
* @param {ParamsToGetTemplateList} params parameters for this operation. See {@link ParamsToGetTemplateList}.
* @returns {EntityListIterator<SuppressionRuleTemplate>} iterator for Template list. See {@link EntityListIterator},
* {@link SuppressionRuleTemplate}.
*/
getList(params) {
const entityCollectionAccessor = (response) => {
const templates = response.suppressionRuleTemplates;
return templates;
};
OperationUtils.ensureAccessTokenProvided(params.accessToken, this._options.accessTokenCallback);
return new EntityListIteratorImpl(async () => {
var _a;
return this.getEntityCollectionPage({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
accessToken: (_a = params.accessToken) !== null && _a !== void 0 ? _a : await this._options.accessTokenCallback(),
url: this._options.urlFormatter.getTemplateListUrl({ urlParams: params.urlParams }),
entityCollectionAccessor,
userMetadata: false,
});
});
}
}
//# sourceMappingURL=TemplateOperations.js.map