This class allows managing for events.

Hierarchy

Constructors

Methods

Constructors

Methods

  • Creates a new event.

    Returns

    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);
    })();

    Parameters

    • entity: IEvent

      Event object with mandantory fragments.

    Returns Promise<IResult<IEvent>>

  • Removes an event with given id.

    Returns

    Response wrapped in IResult

    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>>

  • Updates event data.

    Returns

    Response wrapped in IResult

    Example


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

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

    Parameters

    • entity: Partial<IEvent>

      Event is partially updatable.

    Returns Promise<IResult<IEvent>>