UNPKG

@itwin/clash-detection-client

Version:

Clash Detection client for the iTwin platform

87 lines 5.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RunOperations = 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"); const CommonInterfaces_1 = require("../../base/interfaces/CommonInterfaces"); class RunOperations extends OperationsBase_1.OperationsBase { constructor(options) { super(options); } /** * Gets Runs for a specific project. This method returns Runs in their minimal representation. The * returned iterator internally queries entities in pages. Wraps the * {@link https://developer.bentley.com/apis/clash-detection/operations/get-clashdetection-runs/ Get Runs} * operation from Clash Detection API. * @param {ParamsToGetRunList} params parameters for this operation. See {@link ParamsToGetRunList}. * @returns {Promise<MinimalRun[]>} minimal Run list. See {@link MinimalRun}. */ async getMinimalList(params) { var _a; OperationUtils_1.OperationUtils.ensureAccessTokenProvided(params.accessToken, this._options.accessTokenCallback); const response = await this.sendGetRequest({ // 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.getRunListUrl({ urlParams: params.urlParams }), preferReturn: CommonInterfaces_1.PreferReturn.Representation, }); return response.runs; } /** * Gets Runs for a specific project. This method returns Runs in their full representation. The returned * iterator internally queries entities in pages. Wraps the * {@link https://developer.bentley.com/apis/clash-detection/operations/get-clashdetection-runs/ Get Runs} * operation from Clash Detection API. * @param {ParamsToGetRunList} params parameters for this operation. See {@link ParamsToGetRunList}. * @returns {Promise<RunDetails[]>} array of Run details. See {@link RunDetails}. */ async getRepresentationList(params) { var _a; OperationUtils_1.OperationUtils.ensureAccessTokenProvided(params.accessToken, this._options.accessTokenCallback); const response = await this.sendGetRequest({ // 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.getRunListUrl({ urlParams: params.urlParams }), preferReturn: CommonInterfaces_1.PreferReturn.Representation, }); return response.runs; } /** * Gets a single Run identified by id. This method returns a Run in its full representation. * Wraps the {@link https://developer.bentley.com/apis/clash-detection/operations/get-clashdetection-run/ * Get Run} operation from Clash Detection API. * @param {ParamsToGetRun} params parameters for this operation. See {@link ParamsToGetRun}. * @returns {Promise<RunDetails>} a Run with specified id. See {@link RunDetails}. */ async getSingle(params) { const { accessToken, runId } = 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.getSingleRunUrl({ runId }), }); return response.run; } /** * Deletes a Run. Wraps the {@link https://developer.bentley.com/apis/clash-detection/operations/delete-clashdetection-run/ * Delete Run} operation from Clash Detection API. * @param {ParamsToDeleteRun} params parameters for this operation. See {@link ParamsToDeleteRun}. * @returns {Promise<void>}. */ async delete(params) { var _a; OperationUtils_1.OperationUtils.ensureAccessTokenProvided(params.accessToken, this._options.accessTokenCallback); await this.sendDeleteRequest({ // 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.deleteRunUrl(params), }); } } exports.RunOperations = RunOperations; //# sourceMappingURL=RunOperations.js.map