UNPKG

@itwin/imodels-client-authoring

Version:

iModels API client wrapper for applications that author iModels.

59 lines 3.21 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import { ChangesetGroupOperations as ManagementChangesetGroupOperations, } from "@itwin/imodels-client-management"; export class ChangesetGroupOperations extends ManagementChangesetGroupOperations { /** * 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, }; } } //# sourceMappingURL=ChangesetGroupOperations.js.map