@itwin/imodels-client-authoring
Version:
iModels API client wrapper for applications that author iModels.
63 lines • 3.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChangesetGroupOperations = 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 ChangesetGroupOperations extends imodels_client_management_1.ChangesetGroupOperations {
/**
* Creates a Changeset Group. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/create-imodel-changeset-group/ Create iModel Changeset Group}
* operation from iModels API.
* @param {CreateChangesetGroupParams} params parameters for this operation. See {@link CreateChangesetGroupParams}.
* @returns {Promise<ChangesetGroup>} newly created Changeset Group. See {@link ChangesetGroup}.
*/
async create(params) {
const createChangesetGroupBody = this.getCreateChangesetGroupRequestBody(params.changesetGroupProperties);
const createChangesetGroupResponse = await this.sendPostRequest({
authorization: params.authorization,
url: this._options.urlFormatter.getChangesetGroupListUrl({
iModelId: params.iModelId,
}),
body: createChangesetGroupBody,
headers: params.headers,
});
const result = this.appendRelatedEntityCallbacks(params.authorization, createChangesetGroupResponse.body.changesetGroup, params.headers);
return result;
}
/**
* Closes an existing Changeset Group. Wraps the
* {@link https://developer.bentley.com/apis/imodels-v2/operations/update-imodel-changeset-group/ Update iModel Changeset Group}
* operation from iModels API.
* @param {UpdateChangesetGroupParams} params parameters for this operation. See {@link UpdateChangesetGroupParams}.
* @returns {Promise<ChangesetGroup>} updated Changeset Group. See {@link ChangesetGroup}.
*/
async update(params) {
const updateChangesetGroupBody = this.getUpdateChangesetGroupRequestBody(params.changesetGroupProperties);
const updateChangesetGroupResponse = await this.sendPatchRequest({
authorization: params.authorization,
url: this._options.urlFormatter.getSingleChangesetGroupUrl({
iModelId: params.iModelId,
changesetGroupId: params.changesetGroupId,
}),
body: updateChangesetGroupBody,
headers: params.headers,
});
const result = this.appendRelatedEntityCallbacks(params.authorization, updateChangesetGroupResponse.body.changesetGroup, params.headers);
return result;
}
getCreateChangesetGroupRequestBody(changesetGroupProperties) {
return {
description: changesetGroupProperties.description,
};
}
getUpdateChangesetGroupRequestBody(changesetGroupProperties) {
return {
state: changesetGroupProperties.state,
};
}
}
exports.ChangesetGroupOperations = ChangesetGroupOperations;
//# sourceMappingURL=ChangesetGroupOperations.js.map