This class allows managing for events.

Hierarchy (view full)

Constructors

Methods

  • Creates a new event.

    Parameters

    • entity: IEvent

      Event object with mandantory fragments.

    Returns Promise<IResult<IEvent>>

    Response wrapped in [[IResult]]

    Example


    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);
    })();
  • Removes an event with given id.

    Parameters

    • entityOrId: string | number | IIdentified

      entity or id of the event.

      Example


      const eventId: number = 1;

      (async () => {
      const {data, res} = await eventService.delete(eventId);
      // data will be null
      })();

    Returns Promise<IResult<null>>

    Response wrapped in [[IResult]]

  • Gets the details of a specific event.

    Parameters

    • entityOrId: string | number | IIdentified

      Entity or Id of the entity.

    Returns Promise<IResult<IEvent>>

    Response wrapped in [[IResult]]

    Example


    const eventId: number = 1;

    (async () => {
    const {data, res} = await eventService.detail(eventId);
    })();
  • Gets the list of events filtered by parameters.

    Parameters

    • filter: object = {}

      Object containing filters for querying events.

      Example


      const filter: object = {
      pageSize: 100,
      withTotalPages: true
      };

      (async () => {
      const {data, res, paging} = await eventService.list(filter);
      })();

    Returns Promise<IResultList<IEvent>>

    Response wrapped in [[IResultList]]

  • Updates event data.

    Parameters

    • entity: Partial<IEvent>

      Event is partially updatable.

    Returns Promise<IResult<IEvent>>

    Response wrapped in [[IResult]]

    Example


    const partialUpdateObject: Partial<IEvent> = {
    source: device,
    text: 'Changed Event!'
    };

    (async () => {
    const {data, res} = await eventService.update(partialUpdateObject);
    })();