• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #5076

07 Oct 2025 12:35PM UTC coverage: 37.132% (+0.007%) from 37.125%
#5076

push

github

web-flow
test: Change `Event.additionalDetails` field assertion in events test (box/box-codegen#858) (#1491)

18454 of 49699 relevant lines covered (37.13%)

0.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.85
/src/main/java/com/box/sdkgen/managers/events/GetEventsQueryParams.java
1
package com.box.sdkgen.managers.events;
2

3
import com.box.sdkgen.serialization.json.EnumWrapper;
4
import com.box.sdkgen.serialization.json.Valuable;
5
import com.fasterxml.jackson.core.JsonGenerator;
6
import com.fasterxml.jackson.core.JsonParser;
7
import com.fasterxml.jackson.databind.DeserializationContext;
8
import com.fasterxml.jackson.databind.JsonDeserializer;
9
import com.fasterxml.jackson.databind.JsonNode;
10
import com.fasterxml.jackson.databind.JsonSerializer;
11
import com.fasterxml.jackson.databind.SerializerProvider;
12
import java.io.IOException;
13
import java.time.OffsetDateTime;
14
import java.util.ArrayList;
15
import java.util.List;
16

17
public class GetEventsQueryParams {
18

19
  /**
20
   * Defines the type of events that are returned
21
   *
22
   * <p>* `all` returns everything for a user and is the default * `changes` returns events that may
23
   * cause file tree changes such as file updates or collaborations. * `sync` is similar to
24
   * `changes` but only applies to synced folders * `admin_logs` returns all events for an entire
25
   * enterprise and requires the user making the API call to have admin permissions. This stream
26
   * type is for programmatically pulling from a 1 year history of events across all users within
27
   * the enterprise and within a `created_after` and `created_before` time frame. The complete
28
   * history of events will be returned in chronological order based on the event time, but latency
29
   * will be much higher than `admin_logs_streaming`. * `admin_logs_streaming` returns all events
30
   * for an entire enterprise and requires the user making the API call to have admin permissions.
31
   * This stream type is for polling for recent events across all users within the enterprise.
32
   * Latency will be much lower than `admin_logs`, but events will not be returned in chronological
33
   * order and may contain duplicates.
34
   */
35
  public EnumWrapper<GetEventsQueryParamsStreamTypeField> streamType;
36

37
  /**
38
   * The location in the event stream to start receiving events from.
39
   *
40
   * <p>* `now` will return an empty list events and the latest stream position for initialization.
41
   * * `0` or `null` will return all events.
42
   */
43
  public String streamPosition;
44

45
  /**
46
   * Limits the number of events returned.
47
   *
48
   * <p>Note: Sometimes, the events less than the limit requested can be returned even when there
49
   * may be more events remaining. This is primarily done in the case where a number of events have
50
   * already been retrieved and these retrieved events are returned rather than delaying for an
51
   * unknown amount of time to see if there are any more results.
52
   */
53
  public Long limit;
54

55
  /**
56
   * A comma-separated list of events to filter by. This can only be used when requesting the events
57
   * with a `stream_type` of `admin_logs` or `adming_logs_streaming`. For any other `stream_type`
58
   * this value will be ignored.
59
   */
60
  public List<EnumWrapper<GetEventsQueryParamsEventTypeField>> eventType;
61

62
  /**
63
   * The lower bound date and time to return events for. This can only be used when requesting the
64
   * events with a `stream_type` of `admin_logs`. For any other `stream_type` this value will be
65
   * ignored.
66
   */
67
  public OffsetDateTime createdAfter;
68

69
  /**
70
   * The upper bound date and time to return events for. This can only be used when requesting the
71
   * events with a `stream_type` of `admin_logs`. For any other `stream_type` this value will be
72
   * ignored.
73
   */
74
  public OffsetDateTime createdBefore;
75

76
  public GetEventsQueryParams() {}
1✔
77

78
  protected GetEventsQueryParams(Builder builder) {
1✔
79
    this.streamType = builder.streamType;
1✔
80
    this.streamPosition = builder.streamPosition;
1✔
81
    this.limit = builder.limit;
1✔
82
    this.eventType = builder.eventType;
1✔
83
    this.createdAfter = builder.createdAfter;
1✔
84
    this.createdBefore = builder.createdBefore;
1✔
85
  }
1✔
86

87
  public EnumWrapper<GetEventsQueryParamsStreamTypeField> getStreamType() {
88
    return streamType;
1✔
89
  }
90

91
  public String getStreamPosition() {
92
    return streamPosition;
1✔
93
  }
94

95
  public Long getLimit() {
96
    return limit;
1✔
97
  }
98

99
  public List<EnumWrapper<GetEventsQueryParamsEventTypeField>> getEventType() {
100
    return eventType;
1✔
101
  }
102

103
  public OffsetDateTime getCreatedAfter() {
104
    return createdAfter;
1✔
105
  }
106

107
  public OffsetDateTime getCreatedBefore() {
108
    return createdBefore;
1✔
109
  }
110

111
  public static class Builder {
1✔
112

113
    protected EnumWrapper<GetEventsQueryParamsStreamTypeField> streamType;
114

115
    protected String streamPosition;
116

117
    protected Long limit;
118

119
    protected List<EnumWrapper<GetEventsQueryParamsEventTypeField>> eventType;
120

121
    protected OffsetDateTime createdAfter;
122

123
    protected OffsetDateTime createdBefore;
124

125
    public Builder streamType(GetEventsQueryParamsStreamTypeField streamType) {
126
      this.streamType = new EnumWrapper<GetEventsQueryParamsStreamTypeField>(streamType);
1✔
127
      return this;
1✔
128
    }
129

130
    public Builder streamType(EnumWrapper<GetEventsQueryParamsStreamTypeField> streamType) {
131
      this.streamType = streamType;
×
132
      return this;
×
133
    }
134

135
    public Builder streamPosition(String streamPosition) {
136
      this.streamPosition = streamPosition;
×
137
      return this;
×
138
    }
139

140
    public Builder limit(Long limit) {
141
      this.limit = limit;
1✔
142
      return this;
1✔
143
    }
144

145
    public Builder eventType(List<? extends Valuable> eventType) {
146
      this.eventType =
1✔
147
          EnumWrapper.wrapValuableEnumList(eventType, GetEventsQueryParamsEventTypeField.class);
1✔
148
      return this;
1✔
149
    }
150

151
    public Builder createdAfter(OffsetDateTime createdAfter) {
152
      this.createdAfter = createdAfter;
1✔
153
      return this;
1✔
154
    }
155

156
    public Builder createdBefore(OffsetDateTime createdBefore) {
157
      this.createdBefore = createdBefore;
1✔
158
      return this;
1✔
159
    }
160

161
    public GetEventsQueryParams build() {
162
      return new GetEventsQueryParams(this);
1✔
163
    }
164
  }
165

166
  public static class EventTypeDeserializer
167
      extends JsonDeserializer<List<EnumWrapper<GetEventsQueryParamsEventTypeField>>> {
168

169
    public final JsonDeserializer<EnumWrapper<GetEventsQueryParamsEventTypeField>>
170
        elementDeserializer;
171

172
    public EventTypeDeserializer() {
173
      super();
×
174
      this.elementDeserializer =
×
175
          new GetEventsQueryParamsEventTypeField.GetEventsQueryParamsEventTypeFieldDeserializer();
176
    }
×
177

178
    @Override
179
    public List<EnumWrapper<GetEventsQueryParamsEventTypeField>> deserialize(
180
        JsonParser p, DeserializationContext ctxt) throws IOException {
181
      JsonNode node = p.getCodec().readTree(p);
×
182
      List<EnumWrapper<GetEventsQueryParamsEventTypeField>> elements = new ArrayList<>();
×
183
      for (JsonNode item : node) {
×
184
        JsonParser pa = item.traverse(p.getCodec());
×
185
        pa.nextToken();
×
186
        elements.add(elementDeserializer.deserialize(pa, ctxt));
×
187
      }
×
188
      return elements;
×
189
    }
190
  }
191

192
  public static class EventTypeSerializer
193
      extends JsonSerializer<List<EnumWrapper<GetEventsQueryParamsEventTypeField>>> {
194

195
    public final JsonSerializer<EnumWrapper<GetEventsQueryParamsEventTypeField>> elementSerializer;
196

197
    public EventTypeSerializer() {
198
      super();
×
199
      this.elementSerializer =
×
200
          new GetEventsQueryParamsEventTypeField.GetEventsQueryParamsEventTypeFieldSerializer();
201
    }
×
202

203
    @Override
204
    public void serialize(
205
        List<EnumWrapper<GetEventsQueryParamsEventTypeField>> value,
206
        JsonGenerator gen,
207
        SerializerProvider serializers)
208
        throws IOException {
209
      gen.writeStartArray();
×
210
      for (EnumWrapper<GetEventsQueryParamsEventTypeField> item : value) {
×
211
        elementSerializer.serialize(item, gen, serializers);
×
212
      }
×
213
      gen.writeEndArray();
×
214
    }
×
215
  }
216
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc