Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventService

This class allows managing for events.

Hierarchy

Index

Constructors

constructor

Methods

create

  • Creates a new event.

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

    Response wrapped in IResult

delete

  • Removes an event with given id.

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

    Parameters

    • entityOrId: string | number | IIdentified

      entity or id of the event.

    Returns Promise<IResult<null>>

    Response wrapped in IResult

detail

  • Gets the details of a specific event.

    example
    
       const eventId: number = 1;
    
       (async () => {
         const {data, res} = await eventService.detail(eventId);
      })();
    

    Parameters

    • entityOrId: string | number | IIdentified

      Entity or Id of the entity.

    Returns Promise<IResult<IEvent>>

    Response wrapped in IResult

list

  • Gets the list of events filtered by parameters.

    example
    
     const filter: object = {
        pageSize: 100,
        withTotalPages: true
      };
    
      (async () => {
        const {data, res, paging} = await eventService.list(filter);
      })();
    

    Parameters

    • Default value filter: object = {}

      Object containing filters for querying events.

    Returns Promise<IResultList<IEvent>>

    Response wrapped in IResultList

list$

  • Gets a list as observable.

    example
    
      const list$ = eventService.list$();
      list$.subscribe((data) => console.log(data));
    

    Parameters

    • Default value filter: object = {}

      Object containing filters for querying

    • Default value options: IObservableOptions = {}

      To configure the observable

    Returns ObservableList<IEvent>

    Data wrapped as ObservableList

listBySource$

  • List all events by a given source.

    example
    
      const listBySource$ = eventService.listBySource$(11);
      listBySource$.subscribe((data) => console.log(data));
    

    Parameters

    • sourceOrId: string | number | IIdentified

      The source of the event.

    • Default value filter: object = {}

      Object containing filters for querying.

    • Default value options: IObservableOptions = {}

      To configure the observable.

    Returns ObservableList<IEvent>

    Data wrapped as ObservableList

update

  • Updates event data.

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

    Response wrapped in IResult

Generated using TypeDoc