UNPKG

@c8y/client

Version:

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

84 lines 2.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AuditService = void 0; const index_js_1 = require("../core/index.js"); class AuditService extends index_js_1.Service { constructor() { super(...arguments); this.baseUrl = 'audit'; this.listUrl = 'auditRecords'; this.propertyName = 'auditRecords'; } /** * Gets the details of selected audit record. * * @param {string|number|IAuditRecord} entityOrId Entity or Id of the entity. * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const auditId: number = 1; * * (async () => { * const {data, res} = await auditService.detail(auditId); * })(); * ``` */ async detail(entityOrId) { return super.detail(entityOrId); } /** * Creates a new audit record for a given source. * * @param {IAuditRecord} entity Audit record object with mandantory fragments. * IAuditRecord implements the [[IEvent]] interface. * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const mandantoryObject: IAuditRecord = { * type: AuditRecordType.ALARM, * time: '2018-05-02T10:08:00Z', * severity: Severity.MAJOR, * source: {id: 1} * }; * * (async () => { * const {data, res} = await auditService.create(mandantoryObject); * })(); * ``` */ async create(entity) { return super.create(entity); } /** * Gets the list of audit records filtered by parameters. * * @returns Response wrapped in [[IResultList]] * * @param {object} filter Object containing filters for querying audit records. * * **Example** * ```typescript * * const filter: object = { * severity: Severity.MAJOR, * pageSize: 100, * withTotalPages: true * }; * * (async () => { * const {data, res, paging} = await auditService.list(filter); * })(); * ``` */ async list(filter = {}) { return super.list(filter); } } exports.AuditService = AuditService; //# sourceMappingURL=AuditService.js.map