@itwin/imodels-client-authoring
Version:
iModels API client wrapper for applications that author iModels.
39 lines • 2.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BriefcaseOperations = 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 imodels_client_management_1 = require("@itwin/imodels-client-management");
class BriefcaseOperations extends imodels_client_management_1.BriefcaseOperations {
/**
* Acquires a new Briefcase with specified properties. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/acquire-imodel-briefcase/ Acquire iModel Briefcase}
* operation from iModels API.
* @param {AcquireBriefcaseParams} params parameters for this operation. See {@link AcquireBriefcaseParams}.
* @returns {Promise<Briefcase>} newly acquired Briefcase. See {@link Briefcase}.
*/
async acquire(params) {
const acquireBriefcaseBody = this.getAcquireBriefcaseRequestBody(params.briefcaseProperties);
const acquireBriefcaseResponse = await this.sendPostRequest({
authorization: params.authorization,
url: this._options.urlFormatter.getBriefcaseListUrl({
iModelId: params.iModelId,
}),
body: acquireBriefcaseBody,
headers: params.headers,
});
const result = this.appendRelatedEntityCallbacks(params.authorization, acquireBriefcaseResponse.body.briefcase, params.headers);
return result;
}
getAcquireBriefcaseRequestBody(briefcaseProperties) {
if (!briefcaseProperties)
return undefined;
return {
deviceName: briefcaseProperties.deviceName,
};
}
}
exports.BriefcaseOperations = BriefcaseOperations;
//# sourceMappingURL=BriefcaseOperations.js.map