UNPKG

@itwin/property-validation-client

Version:
86 lines 4.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PropertyValidationClient = void 0; const AxiosRestClient_1 = require("./base/rest/AxiosRestClient"); const Constants_1 = require("./Constants"); const RuleOperations_1 = require("./operations/rule/RuleOperations"); const RunOperations_1 = require("./operations/run/RunOperations"); const ResultOperations_1 = require("./operations/result/ResultOperations"); const TestOperations_1 = require("./operations/test/TestOperations"); const TemplateOperations_1 = require("./operations/template/TemplateOperations"); const SchemaOperations_1 = require("./operations/schema/SchemaOperations"); const PropertyValidationApiUrlFormatter_1 = require("./operations/PropertyValidationApiUrlFormatter"); /** * Property Validation API client for property validation workflows. For more information on the API visit the * {@link https://developer.bentley.com/apis/validation/ Property Validation API documentation page}. */ class PropertyValidationClient { /** * Class constructor. * @param {PropertyValidationClientOptions} options client options. If `options` are `undefined` or if some of the properties * are `undefined` the client uses defaults. See {@link PropertyValidationClientOptions}. */ constructor(options, accessTokenCallback) { const filledPropertyValidationClientOptions = PropertyValidationClient.fillConfiguration(options); this._operationsOptions = { ...filledPropertyValidationClientOptions, urlFormatter: new PropertyValidationApiUrlFormatter_1.PropertyValidationApiUrlFormatter(filledPropertyValidationClientOptions.api.baseUrl), accessTokenCallback, }; this.templateId = ""; this.ruleId = ""; this.testId = ""; this.runId = ""; this.resultId = ""; } /** Template operations. See {@link TemplateOperations}. */ get templates() { return new TemplateOperations_1.TemplateOperations(this._operationsOptions); } /** Rule operations. See {@link RuleOperations}. */ get rules() { return new RuleOperations_1.RuleOperations(this._operationsOptions); } /** Test operations. See {@link TestOperations}. */ get tests() { return new TestOperations_1.TestOperations(this._operationsOptions); } /** Run operations. See {@link RunOperations}. */ get runs() { return new RunOperations_1.RunOperations(this._operationsOptions); } /** Result operations. See {@link ResultOperations}. */ get results() { return new ResultOperations_1.ResultOperations(this._operationsOptions); } /** Schema operations. See {@link SchemaOperations}. */ get schema() { return new SchemaOperations_1.SchemaOperations(this._operationsOptions); } /** * Creates a required configuration instance from user provided options and applying default ones for not specified * options. See {@link PropertyValidationClientOptions}. * @param {PropertyValidationClientOptions} options user-passed client options. * @returns {RecursiveRequired<PropertyValidationClientOptions>} required Property Validation client configuration options. */ static fillConfiguration(options) { var _a, _b, _c, _d, _e; return { api: { baseUrl: (_b = (_a = options === null || options === void 0 ? void 0 : options.api) === null || _a === void 0 ? void 0 : _a.baseUrl) !== null && _b !== void 0 ? _b : Constants_1.Constants.api.baseUrl, version: (_d = (_c = options === null || options === void 0 ? void 0 : options.api) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : Constants_1.Constants.api.version, }, restClient: (_e = options === null || options === void 0 ? void 0 : options.restClient) !== null && _e !== void 0 ? _e : new AxiosRestClient_1.AxiosRestClient(), }; } static toAuthorizationCallback(accessToken) { const splitAccessToken = accessToken.split(" "); const authorization = { scheme: splitAccessToken[0], token: splitAccessToken[1], }; return async () => authorization; } } exports.PropertyValidationClient = PropertyValidationClient; //# sourceMappingURL=PropertyValidationClient.js.map