@itwin/property-validation-client
Version:
Property Validation client for the iTwin platform
54 lines • 3.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SchemaOperations = 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 OperationUtils_1 = require("../OperationUtils");
const OperationsBase_1 = require("../../base/OperationsBase");
class SchemaOperations extends OperationsBase_1.OperationsBase {
constructor(options) {
super(options);
}
/**
* Extracts schema/properties info. Required once per iModel before calling getPropertiesInfo().
* 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} 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_1.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 properties info identified by project and iModel id.
* Wraps the {@link https://developer.bentley.com/apis/validation/operations/get-validation-propertyvalue-properties/
* Get properties info} operation from Property Validation API.
* @param {ParamsToGetPropertiesInfo} params parameters for this operation. See {@link ParamsToGetPropertiesInfo}.
* @returns {Promise<ResponseFromGetPropertiesInfo>} status and properties info for the specified iModel and filter string. See {@link ResponseFromGetPropertiesInfo}.
*/
async getPropertiesInfo(params) {
const { accessToken, iModelId } = params;
OperationUtils_1.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.getPropertiesInfoUrl({ iModelId, urlParams: params.urlParams }),
});
return response;
}
}
exports.SchemaOperations = SchemaOperations;
//# sourceMappingURL=SchemaOperations.js.map