@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
62 lines • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserRoleService = void 0;
const index_js_1 = require("../core/index.js");
/**
* @description
* This service allows for fetch user roles.
*/
class UserRoleService extends index_js_1.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);
* })();
* ```
*/
async detail(entityOrId) {
return super.detail(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);
* })();
* ```
*/
async list(filter = {}) {
return super.list(filter);
}
}
exports.UserRoleService = UserRoleService;
//# sourceMappingURL=UserRoleService.js.map