UNPKG

@c8y/client

Version:

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

122 lines 3.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InventoryRoleService = void 0; const index_js_1 = require("../core/index.js"); class InventoryRoleService extends index_js_1.Service { constructor() { super(...arguments); this.baseUrl = 'user'; this.listUrl = 'inventoryroles'; this.propertyName = 'roles'; } /** * Gets the details of inventory role. * * @param {string|number|IIdentified} entityOrId Entity or Id of the entity. * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const inventoryRoleId: number = 1; * * (async () => { * const {data, res} = await inventoryRoleService.detail(inventoryRoleId); * })(); * ``` */ async detail(entityOrId) { return super.detail(entityOrId); } /** * Creates a new inventory role. * * @param {IIdentified} entity * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const newRole: IIdentified = { * name: 'Custom role' * }; * * (async () => { * const {data, res} = await inventoryRoleService.create(newRole); * })(); * ``` */ async create(entity) { return super.create(entity); } /** * Updates inventory role data. * * @param {IIdentified} entity * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const updateObject: IIdentified = { * id: 1, * name: 'changed role' * }; * * (async () => { * const {data, res} = await inventoryRoleService.update(updateObject); * })(); * ``` */ async update(entity) { return super.update(entity); } /** * Gets the list of inventory roles filtered by parameters. * * @returns Response wrapped in [[IResultList]] * * @param {object} filter Object containing filters for querying alarms. * * **Example** * ```typescript * * const filter: object = { * pageSize: 100, * withTotalPages: true * }; * * (async () => { * const {data, res, paging} = await inventoryRoleService.list(filter); * })(); * ``` */ async list(filter = {}) { return super.list(filter); } /** * Removes an inventory role with given id. * * @returns Response wrapped in [[IResult]] * * @param {IExternalIdentity} identity Identity object with mandantory fragments. * * **Example** * ```typescript * * const id: number = 1; * * (async () => { * const {data, res} = await identityService.delete(id); * })(); * ``` */ async delete(entityOrId) { return super.delete(entityOrId); } } exports.InventoryRoleService = InventoryRoleService; //# sourceMappingURL=InventoryRoleService.js.map