UNPKG

@itwin/imodels-client-management

Version:

iModels API client wrapper for applications that manage iModels.

70 lines 3.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserOperations = 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 internal_1 = require("../../base/internal"); const types_1 = require("../../base/types"); class UserOperations extends internal_1.OperationsBase { /** Gets Users who have ever been connected to the iModel specified by the iModel id. This method returns Users in * their minimal representation. The returned iterator internally queries entities in pages. Wraps the * {@link https://developer.bentley.com/apis/imodels-v2/operations/get-imodel-users/ Get iModel Users} * operation from iModels API. * @param {GetUserListParams} params parameters for this operation. See {@link GetUserListParams}. * @returns {EntityListIterator<MinimalUser>} iterator for User list. See {@link EntityListIterator}, {@link MinimalUser}. */ getMinimalList(params) { return new internal_1.EntityListIteratorImpl(async () => this.getEntityCollectionPage({ authorization: params.authorization, url: this._options.urlFormatter.getUserListUrl({ iModelId: params.iModelId, urlParams: params.urlParams, }), preferReturn: types_1.PreferReturn.Minimal, entityCollectionAccessor: (response) => response.body.users, headers: params.headers, })); } /** * Gets Users who have ever been connected to the iModel specified by the iModel id. This method returns Users in their * full representation. The returned iterator internally queries entities in pages. Wraps the * {@link https://developer.bentley.com/apis/imodels-v2/operations/get-imodel-users/ Get iModel Users} * operation from iModels API. * @param {GetUserListParams} params parameters for this operation. See {@link GetUserListParams}. * @returns {EntityListIterator<User>} iterator for User list. See {@link EntityListIterator}, {@link User}. */ getRepresentationList(params) { return new internal_1.EntityListIteratorImpl(async () => this.getEntityCollectionPage({ authorization: params.authorization, url: this._options.urlFormatter.getUserListUrl({ iModelId: params.iModelId, urlParams: params.urlParams, }), preferReturn: types_1.PreferReturn.Representation, entityCollectionAccessor: (response) => response.body.users, headers: params.headers, })); } /** * Gets a single User by its id. This method returns a User in its full representation. Wraps the * {@link https://developer.bentley.com/apis/imodels-v2/operations/get-imodel-user-details/ Get iModel User} * operation from iModels API. * @param {GetSingleUserParams} params parameters for this operation. See {@link GetSingleUserParams}. * @returns {Promise<User>} a User with specified id. See {@link User}. */ async getSingle(params) { const response = await this.sendGetRequest({ authorization: params.authorization, url: this._options.urlFormatter.getSingleUserUrl({ iModelId: params.iModelId, userId: params.userId, }), headers: params.headers, }); return response.body.user; } } exports.UserOperations = UserOperations; //# sourceMappingURL=UserOperations.js.map