• 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

46.67
/src/main/java/com/box/sdkgen/managers/search/SearchForContentQueryParams.java
1
package com.box.sdkgen.managers.search;
2

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

17
public class SearchForContentQueryParams {
18

19
  /**
20
   * The string to search for. This query is matched against item names, descriptions, text content
21
   * of files, and various other fields of the different item types.
22
   *
23
   * <p>This parameter supports a variety of operators to further refine the results returns.
24
   *
25
   * <p>* `""` - by wrapping a query in double quotes only exact matches are returned by the API.
26
   * Exact searches do not return search matches based on specific character sequences. Instead,
27
   * they return matches based on phrases, that is, word sequences. For example: A search for
28
   * `"Blue-Box"` may return search results including the sequence `"blue.box"`, `"Blue Box"`, and
29
   * `"Blue-Box"`; any item containing the words `Blue` and `Box` consecutively, in the order
30
   * specified. * `AND` - returns items that contain both the search terms. For example, a search
31
   * for `marketing AND BoxWorks` returns items that have both `marketing` and `BoxWorks` within its
32
   * text in any order. It does not return a result that only has `BoxWorks` in its text. * `OR` -
33
   * returns items that contain either of the search terms. For example, a search for `marketing OR
34
   * BoxWorks` returns a result that has either `marketing` or `BoxWorks` within its text. Using
35
   * this operator is not necessary as we implicitly interpret multi-word queries as `OR` unless
36
   * another supported boolean term is used. * `NOT` - returns items that do not contain the search
37
   * term provided. For example, a search for `marketing AND NOT BoxWorks` returns a result that has
38
   * only `marketing` within its text. Results containing `BoxWorks` are omitted.
39
   *
40
   * <p>We do not support lower case (that is, `and`, `or`, and `not`) or mixed case (that is,
41
   * `And`, `Or`, and `Not`) operators.
42
   *
43
   * <p>This field is required unless the `mdfilters` parameter is defined.
44
   */
45
  public String query;
46

47
  /**
48
   * Limits the search results to either the files that the user has access to, or to files
49
   * available to the entire enterprise.
50
   *
51
   * <p>The scope defaults to `user_content`, which limits the search results to content that is
52
   * available to the currently authenticated user.
53
   *
54
   * <p>The `enterprise_content` can be requested by an admin through our support channels. Once
55
   * this scope has been enabled for a user, it will allow that use to query for content across the
56
   * entire enterprise and not only the content that they have access to.
57
   */
58
  public EnumWrapper<SearchForContentQueryParamsScopeField> scope;
59

60
  /**
61
   * Limits the search results to any files that match any of the provided file extensions. This
62
   * list is a comma-separated list of file extensions without the dots.
63
   */
64
  public List<String> fileExtensions;
65

66
  /**
67
   * Limits the search results to any items created within a given date range.
68
   *
69
   * <p>Date ranges are defined as comma separated RFC3339 timestamps.
70
   *
71
   * <p>If the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything created before the end
72
   * date will be returned.
73
   *
74
   * <p>If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as
75
   * the end date instead.
76
   */
77
  public List<String> createdAtRange;
78

79
  /**
80
   * Limits the search results to any items updated within a given date range.
81
   *
82
   * <p>Date ranges are defined as comma separated RFC3339 timestamps.
83
   *
84
   * <p>If the start date is omitted (`,2014-05-17T13:35:01-07:00`) anything updated before the end
85
   * date will be returned.
86
   *
87
   * <p>If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the current date will be used as
88
   * the end date instead.
89
   */
90
  public List<String> updatedAtRange;
91

92
  /**
93
   * Limits the search results to any items with a size within a given file size range. This applied
94
   * to files and folders.
95
   *
96
   * <p>Size ranges are defined as comma separated list of a lower and upper byte size limit
97
   * (inclusive).
98
   *
99
   * <p>The upper and lower bound can be omitted to create open ranges.
100
   */
101
  public List<Long> sizeRange;
102

103
  /**
104
   * Limits the search results to any items that are owned by the given list of owners, defined as a
105
   * list of comma separated user IDs.
106
   *
107
   * <p>The items still need to be owned or shared with the currently authenticated user for them to
108
   * show up in the search results. If the user does not have access to any files owned by any of
109
   * the users an empty result set will be returned.
110
   *
111
   * <p>To search across an entire enterprise, we recommend using the `enterprise_content` scope
112
   * parameter which can be requested with our support team.
113
   */
114
  public List<String> ownerUserIds;
115

116
  /**
117
   * Limits the search results to any items that have been updated by the given list of users,
118
   * defined as a list of comma separated user IDs.
119
   *
120
   * <p>The items still need to be owned or shared with the currently authenticated user for them to
121
   * show up in the search results. If the user does not have access to any files owned by any of
122
   * the users an empty result set will be returned.
123
   *
124
   * <p>This feature only searches back to the last 10 versions of an item.
125
   */
126
  public List<String> recentUpdaterUserIds;
127

128
  /**
129
   * Limits the search results to items within the given list of folders, defined as a comma
130
   * separated lists of folder IDs.
131
   *
132
   * <p>Search results will also include items within any subfolders of those ancestor folders.
133
   *
134
   * <p>The folders still need to be owned or shared with the currently authenticated user. If the
135
   * folder is not accessible by this user, or it does not exist, a `HTTP 404` error code will be
136
   * returned instead.
137
   *
138
   * <p>To search across an entire enterprise, we recommend using the `enterprise_content` scope
139
   * parameter which can be requested with our support team.
140
   */
141
  public List<String> ancestorFolderIds;
142

143
  /**
144
   * Limits the search results to any items that match the search query for a specific part of the
145
   * file, for example the file description.
146
   *
147
   * <p>Content types are defined as a comma separated lists of Box recognized content types. The
148
   * allowed content types are as follows.
149
   *
150
   * <p>* `name` - The name of the item, as defined by its `name` field. * `description` - The
151
   * description of the item, as defined by its `description` field. * `file_content` - The actual
152
   * content of the file. * `comments` - The content of any of the comments on a file or folder. *
153
   * `tags` - Any tags that are applied to an item, as defined by its `tags` field.
154
   */
155
  public List<EnumWrapper<SearchForContentQueryParamsContentTypesField>> contentTypes;
156

157
  /**
158
   * Limits the search results to any items of this type. This parameter only takes one value. By
159
   * default the API returns items that match any of these types.
160
   *
161
   * <p>* `file` - Limits the search results to files, * `folder` - Limits the search results to
162
   * folders, * `web_link` - Limits the search results to web links, also known as bookmarks.
163
   */
164
  public EnumWrapper<SearchForContentQueryParamsTypeField> type;
165

166
  /**
167
   * Determines if the search should look in the trash for items.
168
   *
169
   * <p>By default, this API only returns search results for items not currently in the trash
170
   * (`non_trashed_only`).
171
   *
172
   * <p>* `trashed_only` - Only searches for items currently in the trash * `non_trashed_only` -
173
   * Only searches for items currently not in the trash * `all_items` - Searches for both trashed
174
   * and non-trashed items.
175
   */
176
  public EnumWrapper<SearchForContentQueryParamsTrashContentField> trashContent;
177

178
  /**
179
   * Limits the search results to any items for which the metadata matches the provided filter. This
180
   * parameter is a list that specifies exactly **one** metadata template used to filter the search
181
   * results. The parameter is required unless the `query` parameter is provided.
182
   */
183
  public List<MetadataFilter> mdfilters;
184

185
  /**
186
   * Defines the order in which search results are returned. This API defaults to returning items by
187
   * relevance unless this parameter is explicitly specified.
188
   *
189
   * <p>* `relevance` (default) returns the results sorted by relevance to the query search term.
190
   * The relevance is based on the occurrence of the search term in the items name, description,
191
   * content, and additional properties. * `modified_at` returns the results ordered in descending
192
   * order by date at which the item was last modified.
193
   */
194
  public EnumWrapper<SearchForContentQueryParamsSortField> sort;
195

196
  /**
197
   * Defines the direction in which search results are ordered. This API defaults to returning items
198
   * in descending (`DESC`) order unless this parameter is explicitly specified.
199
   *
200
   * <p>When results are sorted by `relevance` the ordering is locked to returning items in
201
   * descending order of relevance, and this parameter is ignored.
202
   */
203
  public EnumWrapper<SearchForContentQueryParamsDirectionField> direction;
204

205
  /** Defines the maximum number of items to return as part of a page of results. */
206
  public Long limit;
207

208
  /**
209
   * Defines whether the search results should include any items that the user recently accessed
210
   * through a shared link.
211
   *
212
   * <p>When this parameter has been set to true, the format of the response of this API changes to
213
   * return a list of [Search Results with Shared Links](r://search_results_with_shared_links).
214
   */
215
  public Boolean includeRecentSharedLinks;
216

217
  /**
218
   * A comma-separated list of attributes to include in the response. This can be used to request
219
   * fields that are not normally returned in a standard response.
220
   *
221
   * <p>Be aware that specifying this parameter will have the effect that none of the standard
222
   * fields are returned in the response unless explicitly specified, instead only fields for the
223
   * mini representation are returned, additional to the fields requested.
224
   */
225
  public List<String> fields;
226

227
  /**
228
   * The offset of the item at which to begin the response.
229
   *
230
   * <p>Queries with offset parameter value exceeding 10000 will be rejected with a 400 response.
231
   */
232
  public Long offset;
233

234
  /**
235
   * Limits the search results to items that were deleted by the given list of users, defined as a
236
   * list of comma separated user IDs.
237
   *
238
   * <p>The `trash_content` parameter needs to be set to `trashed_only`.
239
   *
240
   * <p>If searching in trash is not performed, an empty result set is returned. The items need to
241
   * be owned or shared with the currently authenticated user for them to show up in the search
242
   * results.
243
   *
244
   * <p>If the user does not have access to any files owned by any of the users, an empty result set
245
   * is returned.
246
   *
247
   * <p>Data available from 2023-02-01 onwards.
248
   */
249
  public List<String> deletedUserIds;
250

251
  /**
252
   * Limits the search results to any items deleted within a given date range.
253
   *
254
   * <p>Date ranges are defined as comma separated RFC3339 timestamps.
255
   *
256
   * <p>If the start date is omitted (`2014-05-17T13:35:01-07:00`), anything deleted before the end
257
   * date will be returned.
258
   *
259
   * <p>If the end date is omitted (`2014-05-15T13:35:01-07:00`), the current date will be used as
260
   * the end date instead.
261
   *
262
   * <p>The `trash_content` parameter needs to be set to `trashed_only`.
263
   *
264
   * <p>If searching in trash is not performed, then an empty result is returned.
265
   *
266
   * <p>Data available from 2023-02-01 onwards.
267
   */
268
  public List<String> deletedAtRange;
269

270
  public SearchForContentQueryParams() {}
×
271

272
  protected SearchForContentQueryParams(Builder builder) {
1✔
273
    this.query = builder.query;
1✔
274
    this.scope = builder.scope;
1✔
275
    this.fileExtensions = builder.fileExtensions;
1✔
276
    this.createdAtRange = builder.createdAtRange;
1✔
277
    this.updatedAtRange = builder.updatedAtRange;
1✔
278
    this.sizeRange = builder.sizeRange;
1✔
279
    this.ownerUserIds = builder.ownerUserIds;
1✔
280
    this.recentUpdaterUserIds = builder.recentUpdaterUserIds;
1✔
281
    this.ancestorFolderIds = builder.ancestorFolderIds;
1✔
282
    this.contentTypes = builder.contentTypes;
1✔
283
    this.type = builder.type;
1✔
284
    this.trashContent = builder.trashContent;
1✔
285
    this.mdfilters = builder.mdfilters;
1✔
286
    this.sort = builder.sort;
1✔
287
    this.direction = builder.direction;
1✔
288
    this.limit = builder.limit;
1✔
289
    this.includeRecentSharedLinks = builder.includeRecentSharedLinks;
1✔
290
    this.fields = builder.fields;
1✔
291
    this.offset = builder.offset;
1✔
292
    this.deletedUserIds = builder.deletedUserIds;
1✔
293
    this.deletedAtRange = builder.deletedAtRange;
1✔
294
  }
1✔
295

296
  public String getQuery() {
297
    return query;
1✔
298
  }
299

300
  public EnumWrapper<SearchForContentQueryParamsScopeField> getScope() {
301
    return scope;
1✔
302
  }
303

304
  public List<String> getFileExtensions() {
305
    return fileExtensions;
1✔
306
  }
307

308
  public List<String> getCreatedAtRange() {
309
    return createdAtRange;
1✔
310
  }
311

312
  public List<String> getUpdatedAtRange() {
313
    return updatedAtRange;
1✔
314
  }
315

316
  public List<Long> getSizeRange() {
317
    return sizeRange;
1✔
318
  }
319

320
  public List<String> getOwnerUserIds() {
321
    return ownerUserIds;
1✔
322
  }
323

324
  public List<String> getRecentUpdaterUserIds() {
325
    return recentUpdaterUserIds;
1✔
326
  }
327

328
  public List<String> getAncestorFolderIds() {
329
    return ancestorFolderIds;
1✔
330
  }
331

332
  public List<EnumWrapper<SearchForContentQueryParamsContentTypesField>> getContentTypes() {
333
    return contentTypes;
1✔
334
  }
335

336
  public EnumWrapper<SearchForContentQueryParamsTypeField> getType() {
337
    return type;
1✔
338
  }
339

340
  public EnumWrapper<SearchForContentQueryParamsTrashContentField> getTrashContent() {
341
    return trashContent;
1✔
342
  }
343

344
  public List<MetadataFilter> getMdfilters() {
345
    return mdfilters;
1✔
346
  }
347

348
  public EnumWrapper<SearchForContentQueryParamsSortField> getSort() {
349
    return sort;
1✔
350
  }
351

352
  public EnumWrapper<SearchForContentQueryParamsDirectionField> getDirection() {
353
    return direction;
1✔
354
  }
355

356
  public Long getLimit() {
357
    return limit;
1✔
358
  }
359

360
  public Boolean getIncludeRecentSharedLinks() {
361
    return includeRecentSharedLinks;
1✔
362
  }
363

364
  public List<String> getFields() {
365
    return fields;
1✔
366
  }
367

368
  public Long getOffset() {
369
    return offset;
1✔
370
  }
371

372
  public List<String> getDeletedUserIds() {
373
    return deletedUserIds;
1✔
374
  }
375

376
  public List<String> getDeletedAtRange() {
377
    return deletedAtRange;
1✔
378
  }
379

380
  public static class Builder {
1✔
381

382
    protected String query;
383

384
    protected EnumWrapper<SearchForContentQueryParamsScopeField> scope;
385

386
    protected List<String> fileExtensions;
387

388
    protected List<String> createdAtRange;
389

390
    protected List<String> updatedAtRange;
391

392
    protected List<Long> sizeRange;
393

394
    protected List<String> ownerUserIds;
395

396
    protected List<String> recentUpdaterUserIds;
397

398
    protected List<String> ancestorFolderIds;
399

400
    protected List<EnumWrapper<SearchForContentQueryParamsContentTypesField>> contentTypes;
401

402
    protected EnumWrapper<SearchForContentQueryParamsTypeField> type;
403

404
    protected EnumWrapper<SearchForContentQueryParamsTrashContentField> trashContent;
405

406
    protected List<MetadataFilter> mdfilters;
407

408
    protected EnumWrapper<SearchForContentQueryParamsSortField> sort;
409

410
    protected EnumWrapper<SearchForContentQueryParamsDirectionField> direction;
411

412
    protected Long limit;
413

414
    protected Boolean includeRecentSharedLinks;
415

416
    protected List<String> fields;
417

418
    protected Long offset;
419

420
    protected List<String> deletedUserIds;
421

422
    protected List<String> deletedAtRange;
423

424
    public Builder query(String query) {
425
      this.query = query;
1✔
426
      return this;
1✔
427
    }
428

429
    public Builder scope(SearchForContentQueryParamsScopeField scope) {
430
      this.scope = new EnumWrapper<SearchForContentQueryParamsScopeField>(scope);
×
431
      return this;
×
432
    }
433

434
    public Builder scope(EnumWrapper<SearchForContentQueryParamsScopeField> scope) {
435
      this.scope = scope;
×
436
      return this;
×
437
    }
438

439
    public Builder fileExtensions(List<String> fileExtensions) {
440
      this.fileExtensions = fileExtensions;
×
441
      return this;
×
442
    }
443

444
    public Builder createdAtRange(List<String> createdAtRange) {
445
      this.createdAtRange = createdAtRange;
×
446
      return this;
×
447
    }
448

449
    public Builder updatedAtRange(List<String> updatedAtRange) {
450
      this.updatedAtRange = updatedAtRange;
×
451
      return this;
×
452
    }
453

454
    public Builder sizeRange(List<Long> sizeRange) {
455
      this.sizeRange = sizeRange;
×
456
      return this;
×
457
    }
458

459
    public Builder ownerUserIds(List<String> ownerUserIds) {
460
      this.ownerUserIds = ownerUserIds;
×
461
      return this;
×
462
    }
463

464
    public Builder recentUpdaterUserIds(List<String> recentUpdaterUserIds) {
465
      this.recentUpdaterUserIds = recentUpdaterUserIds;
×
466
      return this;
×
467
    }
468

469
    public Builder ancestorFolderIds(List<String> ancestorFolderIds) {
470
      this.ancestorFolderIds = ancestorFolderIds;
1✔
471
      return this;
1✔
472
    }
473

474
    public Builder contentTypes(List<? extends Valuable> contentTypes) {
475
      this.contentTypes =
×
476
          EnumWrapper.wrapValuableEnumList(
×
477
              contentTypes, SearchForContentQueryParamsContentTypesField.class);
478
      return this;
×
479
    }
480

481
    public Builder type(SearchForContentQueryParamsTypeField type) {
482
      this.type = new EnumWrapper<SearchForContentQueryParamsTypeField>(type);
×
483
      return this;
×
484
    }
485

486
    public Builder type(EnumWrapper<SearchForContentQueryParamsTypeField> type) {
487
      this.type = type;
×
488
      return this;
×
489
    }
490

491
    public Builder trashContent(SearchForContentQueryParamsTrashContentField trashContent) {
492
      this.trashContent =
1✔
493
          new EnumWrapper<SearchForContentQueryParamsTrashContentField>(trashContent);
494
      return this;
1✔
495
    }
496

497
    public Builder trashContent(
498
        EnumWrapper<SearchForContentQueryParamsTrashContentField> trashContent) {
499
      this.trashContent = trashContent;
×
500
      return this;
×
501
    }
502

503
    public Builder mdfilters(List<MetadataFilter> mdfilters) {
504
      this.mdfilters = mdfilters;
1✔
505
      return this;
1✔
506
    }
507

508
    public Builder sort(SearchForContentQueryParamsSortField sort) {
509
      this.sort = new EnumWrapper<SearchForContentQueryParamsSortField>(sort);
×
510
      return this;
×
511
    }
512

513
    public Builder sort(EnumWrapper<SearchForContentQueryParamsSortField> sort) {
514
      this.sort = sort;
×
515
      return this;
×
516
    }
517

518
    public Builder direction(SearchForContentQueryParamsDirectionField direction) {
519
      this.direction = new EnumWrapper<SearchForContentQueryParamsDirectionField>(direction);
×
520
      return this;
×
521
    }
522

523
    public Builder direction(EnumWrapper<SearchForContentQueryParamsDirectionField> direction) {
524
      this.direction = direction;
×
525
      return this;
×
526
    }
527

528
    public Builder limit(Long limit) {
529
      this.limit = limit;
×
530
      return this;
×
531
    }
532

533
    public Builder includeRecentSharedLinks(Boolean includeRecentSharedLinks) {
534
      this.includeRecentSharedLinks = includeRecentSharedLinks;
1✔
535
      return this;
1✔
536
    }
537

538
    public Builder fields(List<String> fields) {
539
      this.fields = fields;
×
540
      return this;
×
541
    }
542

543
    public Builder offset(Long offset) {
544
      this.offset = offset;
×
545
      return this;
×
546
    }
547

548
    public Builder deletedUserIds(List<String> deletedUserIds) {
549
      this.deletedUserIds = deletedUserIds;
×
550
      return this;
×
551
    }
552

553
    public Builder deletedAtRange(List<String> deletedAtRange) {
554
      this.deletedAtRange = deletedAtRange;
×
555
      return this;
×
556
    }
557

558
    public SearchForContentQueryParams build() {
559
      return new SearchForContentQueryParams(this);
1✔
560
    }
561
  }
562

563
  public static class ContentTypesDeserializer
564
      extends JsonDeserializer<List<EnumWrapper<SearchForContentQueryParamsContentTypesField>>> {
565

566
    public final JsonDeserializer<EnumWrapper<SearchForContentQueryParamsContentTypesField>>
567
        elementDeserializer;
568

569
    public ContentTypesDeserializer() {
570
      super();
×
571
      this.elementDeserializer =
×
572
          new SearchForContentQueryParamsContentTypesField
573
              .SearchForContentQueryParamsContentTypesFieldDeserializer();
574
    }
×
575

576
    @Override
577
    public List<EnumWrapper<SearchForContentQueryParamsContentTypesField>> deserialize(
578
        JsonParser p, DeserializationContext ctxt) throws IOException {
579
      JsonNode node = p.getCodec().readTree(p);
×
580
      List<EnumWrapper<SearchForContentQueryParamsContentTypesField>> elements = new ArrayList<>();
×
581
      for (JsonNode item : node) {
×
582
        JsonParser pa = item.traverse(p.getCodec());
×
583
        pa.nextToken();
×
584
        elements.add(elementDeserializer.deserialize(pa, ctxt));
×
585
      }
×
586
      return elements;
×
587
    }
588
  }
589

590
  public static class ContentTypesSerializer
591
      extends JsonSerializer<List<EnumWrapper<SearchForContentQueryParamsContentTypesField>>> {
592

593
    public final JsonSerializer<EnumWrapper<SearchForContentQueryParamsContentTypesField>>
594
        elementSerializer;
595

596
    public ContentTypesSerializer() {
597
      super();
×
598
      this.elementSerializer =
×
599
          new SearchForContentQueryParamsContentTypesField
600
              .SearchForContentQueryParamsContentTypesFieldSerializer();
601
    }
×
602

603
    @Override
604
    public void serialize(
605
        List<EnumWrapper<SearchForContentQueryParamsContentTypesField>> value,
606
        JsonGenerator gen,
607
        SerializerProvider serializers)
608
        throws IOException {
609
      gen.writeStartArray();
×
610
      for (EnumWrapper<SearchForContentQueryParamsContentTypesField> item : value) {
×
611
        elementSerializer.serialize(item, gen, serializers);
×
612
      }
×
613
      gen.writeEndArray();
×
614
    }
×
615
  }
616
}
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