Event Retrieval

Pre-requisite: The user has to be signed in to perform the following operations.


Get Event Tokens

To get the event token, The following method can be used:

  • spaceId (required): The space id for which the tokens is to be fetched.
Factory.spaceService.getB2AuthToken(spaceId: String) -> IVPublisher<[B2AuthTokenModel]>

Get Events

To get the list of events, The following method can be used:

  • spaceId (required): The space id for which the events are to be fetched.
  • queryItems (required): Filters — .startTime with .lessThen / .greaterThen for the window, .skip and .limit for paging, .deviceId to restrict to a camera, .tags to filter by EventTag.
  • sortItem (optional): Ordering; pair skip/limit with a stable sort such as descending .startTime.
  • queryItems: [ .init(key: .startTime, value: .lessThen(value: startDate.string)), .init(key: .startTime, value: .greaterThen(value: eventsEndDate.string)), .init(key: .skip, value: .equal(value: skip.string)), .init(key: .limit, value: .equal(value: AppConfig.eventPageLimit.string)) ]
  • sortItem: .init(descending: [.startTime])
    Factory.spaceService.events(spaceId: String, queryItems: [QueryItem], sortItem: SortItem?) -> IVPublisher<ListDataModel<EventModel>>
    

Get Event

To get the event, The following method can be used:

  • spaceId (required): The space id for which the event belongs to.
  • eventId (required): The event id for which the event is to be fetched.
Factory.spaceService.event(eventId: String, spaceId: String) -> IVPublisher<EventModel>

Get Space Event Tokens

To get the download tokens scoped to the space, The following method can be used:

  • spaceId (required): The space id for which the tokens is to be fetched.
Factory.spaceService.getSpaceB2AuthToken(spaceId: String) -> IVPublisher<[B2AuthTokenModel]>

Search Events

To search the events of a space, The following method can be used. The call returns the matching event ids, which can then be fetched with the events method filtered on .idKey.

  • spaceId (required): The space id in which the events are to be searched.
  • searchQuery (required): The search text.
Factory.spaceService.searchEvents(spaceId: String, searchQuery: String) -> IVPublisher<SearchEventsIdsModel>

Set Event Feedback

To report whether a detection was accurate, The following method can be used:

  • eventId (required): The event id the feedback is for.
  • spaceId (required): The space id to which the event belongs.
  • request (required): The request object containing whether the detection was accurate.
Factory.spaceService.setEventFeedback(eventId: String, spaceId: String, request: EventFeedbackRequest) -> IVPublisher<Void>