UNPKG

@itwin/clash-detection-client

Version:

Clash Detection client for the iTwin platform

89 lines 5.18 kB
/*--------------------------------------------------------------------------------------------- * 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"; export class IModelOperations extends OperationsBase { constructor(options) { super(options); } /** * Gets schema info identified by project and iModel id. * Wraps the {@link https://developer.bentley.com/apis/clash-detection/operations/get-schema-info/ * Get schema info} operation from Clash Detection API. * @param {ParamsToGetSchemaInfo} params parameters for this operation. See {@link ParamsToGetSchemaInfo}. * @returns {Promise<ResponseFromGetSchemaInfo>} schema info for specified iModel and project id. See {@link ResponseFromGetSchemaInfo}. * @deprecated The method should not be used */ async getSchemaInfo(params) { const { accessToken, iModelId } = params; OperationUtils.ensureAccessTokenProvided(accessToken, this._options.accessTokenCallback); const response = await this.sendGetRequest({ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion accessToken: accessToken !== null && accessToken !== void 0 ? accessToken : await this._options.accessTokenCallback(), url: this._options.urlFormatter.getSchemaInfoUrl({ iModelId, urlParams: params.urlParams }), }); return response; } /** * Extracts schema info. Required once per iModel before calling getSchemaInfo(). Extraction is only performed if needed. * Wraps the {@link https://developer.bentley.com/apis/clash-detection/operations/extract-schema-info/ * Extract schema info} operation from Clash Detection API. * @param {ParamsToExtractSchemaInfo} params parameters for this operation. See {@link ParamsToExtractSchemaInfo}. * @returns {Promise<void>}. * @deprecated The method should not be used */ async extractSchemaInfo(params) { const { accessToken, iModelId, projectId } = params; const body = { projectId, }; OperationUtils.ensureAccessTokenProvided(accessToken, this._options.accessTokenCallback); await this.sendPostRequest({ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion accessToken: accessToken !== null && accessToken !== void 0 ? accessToken : await this._options.accessTokenCallback(), url: this._options.urlFormatter.extractSchemaInfoUrl({ iModelId }), body, }); } /** * Gets models and categories identified by project and iModel id. * Wraps the {@link https://developer.bentley.com/apis/clash-detection/operations/get-models-and-categories/ * Get models and categories} operation from Clash Detection API. * @param {ParamsToGetModelsAndCategories} params parameters for this operation. See {@link ParamsToGetModelsAndCategories}. * @returns {Promise<ModelsAndCategories>} models and categories for specified iModel and project id. See {@link ModelsAndCategories}. * @deprecated The method should not be used */ async getModelsAndCategories(params) { const { accessToken, iModelId } = params; OperationUtils.ensureAccessTokenProvided(accessToken, this._options.accessTokenCallback); const response = await this.sendGetRequest({ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion accessToken: accessToken !== null && accessToken !== void 0 ? accessToken : await this._options.accessTokenCallback(), url: this._options.urlFormatter.getModelsAndCategoriesUrl({ iModelId, urlParams: params.urlParams }), }); return response; } /** * Extracts models and categories. Wraps the {@link https://developer.bentley.com/apis/clash-detection/operations/extract-models-and-categories/ * Extract models and categories} operation from Clash Detection API. * @param {ParamsToExtractModelsAndCategories} params parameters for this operation. See {@link ParamsToExtractModelsAndCategories}. * @returns {Promise<void>}. * @deprecated The method should not be used */ async extractModelsAndCategories(params) { const { accessToken, iModelId, projectId } = params; const body = { projectId, }; OperationUtils.ensureAccessTokenProvided(accessToken, this._options.accessTokenCallback); await this.sendPostRequest({ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion accessToken: accessToken !== null && accessToken !== void 0 ? accessToken : await this._options.accessTokenCallback(), url: this._options.urlFormatter.extractModelsAndCategoriesUrl({ iModelId }), body, }); } } //# sourceMappingURL=IModelOperations.js.map