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, completion: @escaping Callback<PagingIterator<Event>> )
Parameters
streamType
Restricts the types of events returned.
streamPosition
The 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.
limit
The maximum number of items to return. If not specified, default API limit is used.
Return Value
Either collection of events or an error.
-
Gets events for all users and content in the enterprise. Enterprise events are accessible for one year via the API, and seven years via exported reports in the Box Admin Console.
Declaration
Swift
public func getEnterpriseEvents( eventTypes: [EventType]? = nil, createdAfter: Date? = nil, createdBefore: Date? = nil, streamPosition: StreamPosition? = nil, limit: Int? = nil, completion: @escaping Callback<PagingIterator<Event>> )
Parameters
evenType
Restricts returned value to listed events.
createdAfter
A lower bound on the timestamp of the events returned.
createdBefore
An upper bound on the timestamp of the events returned.
streamPosition
The location in the event stream from which you want to start receiving events.
limit
The maximum number of items to return.
Return Value
Either collection 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
completion
Returns 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
url
Long polling URL info.
completion
Returns either an event observer response or an error.