Box.V2.Managers.BoxEventsManager.EnterpriseEventsAsync C# (CSharp) Method

EnterpriseEventsAsync() public method

Retrieve a chunk of Enterprise Events. You must be using a token that is scoped to admin level in order to use this endpoint.
public EnterpriseEventsAsync ( int limit = 500, string streamPosition = null, List eventTypes = null, System.DateTime createdAfter = null, System.DateTime createdBefore = null ) : Task>
limit int Limits the number of events returned (defaults to 500).
streamPosition string The starting position for fetching the events. This is used in combination with the limit to determine which events to return to the caller. Use the results from the next_stream_position of your last call to get the next set of events.
eventTypes List Events to filter by.
createdAfter System.DateTime A lower bound on the timestamp of the events returned.
createdBefore System.DateTime An upper bound on the timestamp of the events returned.
return Task>
        public async Task<BoxEventCollection<BoxEnterpriseEvent>> EnterpriseEventsAsync(int limit = 500,
                                                                        string streamPosition = null,
                                                                        List<string> eventTypes = null,
                                                                        DateTime? createdAfter = null,
                                                                        DateTime? createdBefore = null)
        {
            var createdAfterString = createdAfter.HasValue ? createdAfter.Value.ToString(Constants.RFC3339DateFormat) : null;
            var createdBeforeString = createdBefore.HasValue ? createdBefore.Value.ToString(Constants.RFC3339DateFormat) : null;

            BoxRequest request = new BoxRequest(_config.EventsUri)
                .Param("stream_type", ENTERPRISE_EVENTS_STREAM_TYPE)
                .Param("limit", limit.ToString())
                .Param("stream_position", streamPosition)
                .Param("event_type", eventTypes)
                .Param("created_after", createdAfterString)
                .Param("created_before", createdBeforeString);

            IBoxResponse<BoxEventCollection<BoxEnterpriseEvent>> response = await ToResponseAsync<BoxEventCollection<BoxEnterpriseEvent>>(request).ConfigureAwait(false);

            return response.ResponseObject;
        }