@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
114 lines • 3.14 kB
TypeScript
import { IIdentified, Service, IResult, IResultList } from '../core/index.js';
import { IEvent } from './IEvent.js';
/**
* This class allows managing for events.
*/
export declare class EventService extends Service<IEvent> {
protected baseUrl: string;
protected listUrl: string;
protected propertyName: string;
protected channel: string;
/**
* Gets the details of a specific event.
*
* @param {string|number|IIdentified} entityOrId Entity or Id of the entity.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const eventId: number = 1;
*
* (async () => {
* const {data, res} = await eventService.detail(eventId);
* })();
* ```
*/
detail(entityOrId: string | number | IIdentified): Promise<IResult<IEvent>>;
/**
* Creates a new event.
*
* @param {IEvent} entity Event object with mandantory fragments.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const mandantoryObject: IEvent = {
* source: device,
* text: 'I am an Event!',
* time: '2018-05-02T10:08:00Z',
* type: 'device-type-here',
* };
*
* (async () => {
* const {data, res} = await eventService.create(mandantoryObject);
* })();
* ```
*/
create(entity: IEvent): Promise<IResult<IEvent>>;
/**
* Updates event data.
*
* @param {Partial<IEvent>} entity Event is partially updatable.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const partialUpdateObject: Partial<IEvent> = {
* source: device,
* text: 'Changed Event!'
* };
*
* (async () => {
* const {data, res} = await eventService.update(partialUpdateObject);
* })();
* ```
*/
update(entity: Partial<IEvent>): Promise<IResult<IEvent>>;
/**
* Gets the list of events filtered by parameters.
*
* @returns Response wrapped in [[IResultList]]
*
* @param {object} filter Object containing filters for querying events.
*
* **Example**
* ```typescript
*
* const filter: object = {
* pageSize: 100,
* withTotalPages: true
* };
*
* (async () => {
* const {data, res, paging} = await eventService.list(filter);
* })();
* ```
*/
list(filter?: object): Promise<IResultList<IEvent>>;
/**
* Removes an event with given id.
*
* @returns Response wrapped in [[IResult]]
*
* @param {string | number | IIdentified} entityOrId entity or id of the event.
*
* **Example**
* ```typescript
*
* const eventId: number = 1;
*
* (async () => {
* const {data, res} = await eventService.delete(eventId);
* // data will be null
* })();
* ```
*/
delete(entityOrId: string | number | IIdentified): Promise<IResult<null>>;
}
//# sourceMappingURL=EventService.d.ts.map