UNPKG

@c8y/client

Version:

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

144 lines 3.89 kB
import { __awaiter } from "tslib"; import { Service } from '../core/index.js'; export class InventoryRoleService extends 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); * })(); * ``` */ 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); }); } /** * 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); * })(); * ``` */ create(entity) { const _super = Object.create(null, { create: { get: () => super.create } }); return __awaiter(this, void 0, void 0, function* () { return _super.create.call(this, 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); * })(); * ``` */ update(entity) { const _super = Object.create(null, { update: { get: () => super.update } }); return __awaiter(this, void 0, void 0, function* () { return _super.update.call(this, 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); * })(); * ``` */ list() { const _super = Object.create(null, { list: { get: () => super.list } }); return __awaiter(this, arguments, void 0, function* (filter = {}) { return _super.list.call(this, 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); * })(); * ``` */ delete(entityOrId) { const _super = Object.create(null, { delete: { get: () => super.delete } }); return __awaiter(this, void 0, void 0, function* () { return _super.delete.call(this, entityOrId); }); } } //# sourceMappingURL=InventoryRoleService.js.map