EventsModule
public class EventsModule
Provides Event management.
-
Initializer.
Declaration
Swift
public init(boxClient: BoxClient)Parameters
boxClientRequired for communicating with Box APIs.
-
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) -> PaginationIterator<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
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 ) -> PaginationIterator<Event>Parameters
evenTypeRestricts 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
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
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