EventsModule
public class EventsModule
Provides Event management.
-
Gets events for the current user associated with the access token. Due to emphasis on returning complete results quickly, Box may return duplicate or out of order events. Duplicate events can be identified by their event IDs. User events are stored for between two weeks and two months, after which the user events are removed.
Declaration
Swift
public func getUserEvents( streamType: StreamType? = nil, streamPosition: StreamPosition? = nil, limit: Int? = nil ) -> PagingIterator<Event>Parameters
streamTypeRestricts the types of events returned.
streamPositionThe location in the event stream from which you want to start receiving events. If no stream position specified Box API will return all available events beginning with the oldest stream position.
limitThe maximum number of items to return. If not specified, default API limit is used.
Return Value
An iterator of events or an error.
-
Gets events for all users and content in the enterprise from
admin_logsstream type. The emphasis for this stream is on completeness over latency, which means that Box will deliver admin events in chronological order and without duplicates, but with higher latency. Events withadmin_logsstream type are accessible via this API up to one year. This method will only work with an API connection for an enterprise admin account.Declaration
Swift
public func getEnterpriseEvents( eventTypes: [EventType]? = nil, createdAfter: Date? = nil, createdBefore: Date? = nil, streamPosition: StreamPosition? = nil, limit: Int? = nil ) -> PagingIterator<Event>Parameters
eventTypesRestricts returned value to listed events.
createdAfterA lower bound on the timestamp of the events returned.
createdBeforeAn upper bound on the timestamp of the events returned.
streamPositionThe location in the event stream from which you want to start receiving events.
limitThe maximum number of items to return.
Return Value
An iterator of events or an error.
-
Gets events for all users and content in the enterprise from
admin_logs_streamingstream type. The emphasis for this feed is on low latency rather than chronological accuracy, which means that Box may return events more than once and out of chronological order. Events are returned via the API around 12 seconds after they are processed by Box (the 12 seconds buffer ensures that new events are not written after your cursor position). Events withadmin_logs_streamingstream type are accessible via this API up to two weeks only. This method will only work with an API connection for an enterprise admin account.Declaration
Swift
public func getEnterpriseEventsStreaming( eventTypes: [EventType]? = nil, streamPosition: StreamPosition? = nil, limit: Int? = nil ) -> PagingIterator<Event>Parameters
eventTypesRestricts returned value to listed events.
streamPositionThe location in the event stream from which you want to start receiving events.
limitThe maximum number of items to return.
Return Value
An iterator of events or an error.
-
Gets polling URL for checking new changes in an event stream. Works only for user events.
Declaration
Swift
public func getPollingURL(completion: @escaping (Result<PollingURLInfo, BoxSDKError>) -> Void)Parameters
completionReturns either polling url information or an error.
-
Makes long-polling request for new changes. Server does not return response immediatelly. It only returns response when either a new change was detected or a new request for long polling is made. Check the timeout value in the PollingURLInfo object to determine the time that the next long-polling request should be made.
Declaration
Swift
public func observeForNewEvents(with urlInfo: PollingURLInfo, completion: @escaping (Result<PollingResult, BoxSDKError>) -> Void)Parameters
urlLong polling URL info.
completionReturns either an event observer response or an error.
EventsModule Class Reference