001package com.box.sdk; 002 003import static com.box.sdk.EventLog.ENTERPRISE_LIMIT; 004 005import com.box.sdk.BoxEvent.EventType; 006import java.util.ArrayList; 007import java.util.Arrays; 008import java.util.Collection; 009 010/** 011 * Class describing request to get Admin Logs Streaming. You can use it's fluent interface to create new request like so: 012 * <pre> 013 * {@code 014 * new EnterpriseEventsStreamRequest().position("stream_position").limit(50); 015 * } 016 * </pre> 017 */ 018public final class EnterpriseEventsStreamRequest { 019 private static final String ADMIN_LOGS_STREAM_TYPE = "admin_logs_streaming"; 020 private String position; 021 private int limit = ENTERPRISE_LIMIT; 022 private Collection<EventType> types = new ArrayList<>(); 023 024 025 /** 026 * The starting position of the event stream. 027 * @param position the starting position of the event stream. 028 * @return request being created. 029 */ 030 public EnterpriseEventsStreamRequest position(String position) { 031 this.position = position; 032 return this; 033 } 034 035 /** 036 * The number of entries to be returned in the response. 037 * @param limit the number of entries to be returned in the response. 038 * @return request being created. 039 */ 040 public EnterpriseEventsStreamRequest limit(int limit) { 041 this.limit = limit; 042 return this; 043 } 044 045 /** 046 * List of event types to filter by. 047 * @param types list of event types to filter by. 048 * @return request being created. 049 */ 050 public EnterpriseEventsStreamRequest types(EventType... types) { 051 this.types = Arrays.asList(types); 052 return this; 053 } 054 055 String getPosition() { 056 return position; 057 } 058 059 int getLimit() { 060 return limit; 061 } 062 063 064 Collection<EventType> getTypes() { 065 return types; 066 } 067 068 String getStreamType() { 069 return ADMIN_LOGS_STREAM_TYPE; 070 } 071}