UNPKG

@c8y/client

Version:

Client application programming interface to access the Cumulocity IoT-Platform REST services.

69 lines 1.96 kB
import { __awaiter } from "tslib"; import { Service } from '../core/index.js'; /** * @description * This service allows for fetch user roles. */ export class UserRoleService extends Service { constructor() { super(...arguments); this.baseUrl = 'user'; this.listUrl = 'roles'; this.propertyName = 'roles'; } /** * Gets the details of given role. * * @param {string|number|IRole} entityOrId Roles's id or role object. * * @returns Returns promise object that is resolved with the IRole wrapped by IResult. * * **Example** * ```typescript * * const roleId: number = 1; * * (async () => { * const {data, res} = await userRoleService.detail(roleId); * })(); * ``` */ detail(entityOrId) { const _super = Object.create(null, { detail: { get: () => super.detail } }); return __awaiter(this, void 0, void 0, function* () { return _super.detail.call(this, entityOrId); }); } /** * Gets the list of user roles filtered by parameters. * * @param {object} filter Object containing filters for querying roles. * * @returns Returns promise object that is resolved with the IRole wrapped by IResultList. * * **Example** * ```typescript * * const filter: object = { * severity: Severity.MAJOR, * pageSize: 100, * withTotalPages: true * }; * * (async () => { * const {data, res, paging} = await userRoleService.list(filter); * })(); * ``` */ list() { const _super = Object.create(null, { list: { get: () => super.list } }); return __awaiter(this, arguments, void 0, function* (filter = {}) { return _super.list.call(this, filter); }); } } //# sourceMappingURL=UserRoleService.js.map