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

box / box-java-sdk / #5922

17 Dec 2025 05:03PM UTC coverage: 35.498% (-0.4%) from 35.917%
#5922

push

github

web-flow
fix: add taxonomy to Metadata Field (read) definition (box/box-openapi#572) (#1644)

Co-authored-by: box-sdk-build <box-sdk-build@box.com>

2 of 2 new or added lines in 1 file covered. (100.0%)

535 existing lines in 31 files now uncovered.

18926 of 53316 relevant lines covered (35.5%)

0.35 hits per line

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

88.57
/src/main/java/com/box/sdkgen/managers/folders/FoldersManager.java
1
package com.box.sdkgen.managers.folders;
2

3
import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
4
import static com.box.sdkgen.internal.utils.UtilsManager.entryOf;
5
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
6
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
7
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;
8

9
import com.box.sdkgen.networking.auth.Authentication;
10
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
11
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
12
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
13
import com.box.sdkgen.networking.network.NetworkSession;
14
import com.box.sdkgen.schemas.folderfull.FolderFull;
15
import com.box.sdkgen.schemas.items.Items;
16
import com.box.sdkgen.serialization.json.JsonManager;
17
import java.util.Map;
18

19
public class FoldersManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

25
  public FoldersManager() {
×
26
    this.networkSession = new NetworkSession();
×
27
  }
×
28

29
  protected FoldersManager(Builder builder) {
1✔
30
    this.auth = builder.auth;
1✔
31
    this.networkSession = builder.networkSession;
1✔
32
  }
1✔
33

34
  /**
35
   * Retrieves details for a folder, including the first 100 entries in the folder.
36
   *
37
   * <p>Passing `sort`, `direction`, `offset`, and `limit` parameters in query allows you to manage
38
   * the list of returned [folder
39
   * items](https://developer.box.com/reference/resources/folder--full#param-item-collection).
40
   *
41
   * <p>To fetch more items within the folder, use the [Get items in a
42
   * folder](https://developer.box.com/reference/get-folders-id-items) endpoint.
43
   *
44
   * @param folderId The unique identifier that represent a folder.
45
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
46
   *     and copying the ID from the URL. For example, for the URL
47
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
48
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
49
   */
50
  public FolderFull getFolderById(String folderId) {
51
    return getFolderById(folderId, new GetFolderByIdQueryParams(), new GetFolderByIdHeaders());
1✔
52
  }
53

54
  /**
55
   * Retrieves details for a folder, including the first 100 entries in the folder.
56
   *
57
   * <p>Passing `sort`, `direction`, `offset`, and `limit` parameters in query allows you to manage
58
   * the list of returned [folder
59
   * items](https://developer.box.com/reference/resources/folder--full#param-item-collection).
60
   *
61
   * <p>To fetch more items within the folder, use the [Get items in a
62
   * folder](https://developer.box.com/reference/get-folders-id-items) endpoint.
63
   *
64
   * @param folderId The unique identifier that represent a folder.
65
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
66
   *     and copying the ID from the URL. For example, for the URL
67
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
68
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
69
   * @param queryParams Query parameters of getFolderById method
70
   */
71
  public FolderFull getFolderById(String folderId, GetFolderByIdQueryParams queryParams) {
72
    return getFolderById(folderId, queryParams, new GetFolderByIdHeaders());
1✔
73
  }
74

75
  /**
76
   * Retrieves details for a folder, including the first 100 entries in the folder.
77
   *
78
   * <p>Passing `sort`, `direction`, `offset`, and `limit` parameters in query allows you to manage
79
   * the list of returned [folder
80
   * items](https://developer.box.com/reference/resources/folder--full#param-item-collection).
81
   *
82
   * <p>To fetch more items within the folder, use the [Get items in a
83
   * folder](https://developer.box.com/reference/get-folders-id-items) endpoint.
84
   *
85
   * @param folderId The unique identifier that represent a folder.
86
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
87
   *     and copying the ID from the URL. For example, for the URL
88
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
89
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
90
   * @param headers Headers of getFolderById method
91
   */
92
  public FolderFull getFolderById(String folderId, GetFolderByIdHeaders headers) {
UNCOV
93
    return getFolderById(folderId, new GetFolderByIdQueryParams(), headers);
×
94
  }
95

96
  /**
97
   * Retrieves details for a folder, including the first 100 entries in the folder.
98
   *
99
   * <p>Passing `sort`, `direction`, `offset`, and `limit` parameters in query allows you to manage
100
   * the list of returned [folder
101
   * items](https://developer.box.com/reference/resources/folder--full#param-item-collection).
102
   *
103
   * <p>To fetch more items within the folder, use the [Get items in a
104
   * folder](https://developer.box.com/reference/get-folders-id-items) endpoint.
105
   *
106
   * @param folderId The unique identifier that represent a folder.
107
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
108
   *     and copying the ID from the URL. For example, for the URL
109
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
110
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
111
   * @param queryParams Query parameters of getFolderById method
112
   * @param headers Headers of getFolderById method
113
   */
114
  public FolderFull getFolderById(
115
      String folderId, GetFolderByIdQueryParams queryParams, GetFolderByIdHeaders headers) {
116
    Map<String, String> queryParamsMap =
1✔
117
        prepareParams(
1✔
118
            mapOf(
1✔
119
                entryOf("fields", convertToString(queryParams.getFields())),
1✔
120
                entryOf("sort", convertToString(queryParams.getSort())),
1✔
121
                entryOf("direction", convertToString(queryParams.getDirection())),
1✔
122
                entryOf("offset", convertToString(queryParams.getOffset())),
1✔
123
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
124
    Map<String, String> headersMap =
1✔
125
        prepareParams(
1✔
126
            mergeMaps(
1✔
127
                mapOf(
1✔
128
                    entryOf("if-none-match", convertToString(headers.getIfNoneMatch())),
1✔
129
                    entryOf("boxapi", convertToString(headers.getBoxapi()))),
1✔
130
                headers.getExtraHeaders()));
1✔
131
    FetchResponse response =
1✔
132
        this.networkSession
133
            .getNetworkClient()
1✔
134
            .fetch(
1✔
135
                new FetchOptions.Builder(
136
                        String.join(
1✔
137
                            "",
138
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
139
                            "/2.0/folders/",
140
                            convertToString(folderId)),
1✔
141
                        "GET")
142
                    .params(queryParamsMap)
1✔
143
                    .headers(headersMap)
1✔
144
                    .responseFormat(ResponseFormat.JSON)
1✔
145
                    .auth(this.auth)
1✔
146
                    .networkSession(this.networkSession)
1✔
147
                    .build());
1✔
148
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
149
  }
150

151
  /**
152
   * Updates a folder. This can be also be used to move the folder, create shared links, update
153
   * collaborations, and more.
154
   *
155
   * @param folderId The unique identifier that represent a folder.
156
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
157
   *     and copying the ID from the URL. For example, for the URL
158
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
159
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
160
   */
161
  public FolderFull updateFolderById(String folderId) {
UNCOV
162
    return updateFolderById(
×
163
        folderId,
164
        new UpdateFolderByIdRequestBody(),
165
        new UpdateFolderByIdQueryParams(),
166
        new UpdateFolderByIdHeaders());
167
  }
168

169
  /**
170
   * Updates a folder. This can be also be used to move the folder, create shared links, update
171
   * collaborations, and more.
172
   *
173
   * @param folderId The unique identifier that represent a folder.
174
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
175
   *     and copying the ID from the URL. For example, for the URL
176
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
177
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
178
   * @param requestBody Request body of updateFolderById method
179
   */
180
  public FolderFull updateFolderById(String folderId, UpdateFolderByIdRequestBody requestBody) {
181
    return updateFolderById(
1✔
182
        folderId, requestBody, new UpdateFolderByIdQueryParams(), new UpdateFolderByIdHeaders());
183
  }
184

185
  /**
186
   * Updates a folder. This can be also be used to move the folder, create shared links, update
187
   * collaborations, and more.
188
   *
189
   * @param folderId The unique identifier that represent a folder.
190
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
191
   *     and copying the ID from the URL. For example, for the URL
192
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
193
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
194
   * @param queryParams Query parameters of updateFolderById method
195
   */
196
  public FolderFull updateFolderById(String folderId, UpdateFolderByIdQueryParams queryParams) {
UNCOV
197
    return updateFolderById(
×
198
        folderId, new UpdateFolderByIdRequestBody(), queryParams, new UpdateFolderByIdHeaders());
199
  }
200

201
  /**
202
   * Updates a folder. This can be also be used to move the folder, create shared links, update
203
   * collaborations, and more.
204
   *
205
   * @param folderId The unique identifier that represent a folder.
206
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
207
   *     and copying the ID from the URL. For example, for the URL
208
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
209
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
210
   * @param requestBody Request body of updateFolderById method
211
   * @param queryParams Query parameters of updateFolderById method
212
   */
213
  public FolderFull updateFolderById(
214
      String folderId,
215
      UpdateFolderByIdRequestBody requestBody,
216
      UpdateFolderByIdQueryParams queryParams) {
UNCOV
217
    return updateFolderById(folderId, requestBody, queryParams, new UpdateFolderByIdHeaders());
×
218
  }
219

220
  /**
221
   * Updates a folder. This can be also be used to move the folder, create shared links, update
222
   * collaborations, and more.
223
   *
224
   * @param folderId The unique identifier that represent a folder.
225
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
226
   *     and copying the ID from the URL. For example, for the URL
227
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
228
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
229
   * @param headers Headers of updateFolderById method
230
   */
231
  public FolderFull updateFolderById(String folderId, UpdateFolderByIdHeaders headers) {
UNCOV
232
    return updateFolderById(
×
233
        folderId, new UpdateFolderByIdRequestBody(), new UpdateFolderByIdQueryParams(), headers);
234
  }
235

236
  /**
237
   * Updates a folder. This can be also be used to move the folder, create shared links, update
238
   * collaborations, and more.
239
   *
240
   * @param folderId The unique identifier that represent a folder.
241
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
242
   *     and copying the ID from the URL. For example, for the URL
243
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
244
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
245
   * @param requestBody Request body of updateFolderById method
246
   * @param headers Headers of updateFolderById method
247
   */
248
  public FolderFull updateFolderById(
249
      String folderId, UpdateFolderByIdRequestBody requestBody, UpdateFolderByIdHeaders headers) {
UNCOV
250
    return updateFolderById(folderId, requestBody, new UpdateFolderByIdQueryParams(), headers);
×
251
  }
252

253
  /**
254
   * Updates a folder. This can be also be used to move the folder, create shared links, update
255
   * collaborations, and more.
256
   *
257
   * @param folderId The unique identifier that represent a folder.
258
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
259
   *     and copying the ID from the URL. For example, for the URL
260
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
261
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
262
   * @param queryParams Query parameters of updateFolderById method
263
   * @param headers Headers of updateFolderById method
264
   */
265
  public FolderFull updateFolderById(
266
      String folderId, UpdateFolderByIdQueryParams queryParams, UpdateFolderByIdHeaders headers) {
UNCOV
267
    return updateFolderById(folderId, new UpdateFolderByIdRequestBody(), queryParams, headers);
×
268
  }
269

270
  /**
271
   * Updates a folder. This can be also be used to move the folder, create shared links, update
272
   * collaborations, and more.
273
   *
274
   * @param folderId The unique identifier that represent a folder.
275
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
276
   *     and copying the ID from the URL. For example, for the URL
277
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
278
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
279
   * @param requestBody Request body of updateFolderById method
280
   * @param queryParams Query parameters of updateFolderById method
281
   * @param headers Headers of updateFolderById method
282
   */
283
  public FolderFull updateFolderById(
284
      String folderId,
285
      UpdateFolderByIdRequestBody requestBody,
286
      UpdateFolderByIdQueryParams queryParams,
287
      UpdateFolderByIdHeaders headers) {
288
    Map<String, String> queryParamsMap =
1✔
289
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
290
    Map<String, String> headersMap =
1✔
291
        prepareParams(
1✔
292
            mergeMaps(
1✔
293
                mapOf(entryOf("if-match", convertToString(headers.getIfMatch()))),
1✔
294
                headers.getExtraHeaders()));
1✔
295
    FetchResponse response =
1✔
296
        this.networkSession
297
            .getNetworkClient()
1✔
298
            .fetch(
1✔
299
                new FetchOptions.Builder(
300
                        String.join(
1✔
301
                            "",
302
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
303
                            "/2.0/folders/",
304
                            convertToString(folderId)),
1✔
305
                        "PUT")
306
                    .params(queryParamsMap)
1✔
307
                    .headers(headersMap)
1✔
308
                    .data(JsonManager.serialize(requestBody))
1✔
309
                    .contentType("application/json")
1✔
310
                    .responseFormat(ResponseFormat.JSON)
1✔
311
                    .auth(this.auth)
1✔
312
                    .networkSession(this.networkSession)
1✔
313
                    .build());
1✔
314
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
315
  }
316

317
  /**
318
   * Deletes a folder, either permanently or by moving it to the trash.
319
   *
320
   * @param folderId The unique identifier that represent a folder.
321
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
322
   *     and copying the ID from the URL. For example, for the URL
323
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
324
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
325
   */
326
  public void deleteFolderById(String folderId) {
327
    deleteFolderById(folderId, new DeleteFolderByIdQueryParams(), new DeleteFolderByIdHeaders());
1✔
328
  }
1✔
329

330
  /**
331
   * Deletes a folder, either permanently or by moving it to the trash.
332
   *
333
   * @param folderId The unique identifier that represent a folder.
334
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
335
   *     and copying the ID from the URL. For example, for the URL
336
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
337
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
338
   * @param queryParams Query parameters of deleteFolderById method
339
   */
340
  public void deleteFolderById(String folderId, DeleteFolderByIdQueryParams queryParams) {
341
    deleteFolderById(folderId, queryParams, new DeleteFolderByIdHeaders());
1✔
342
  }
1✔
343

344
  /**
345
   * Deletes a folder, either permanently or by moving it to the trash.
346
   *
347
   * @param folderId The unique identifier that represent a folder.
348
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
349
   *     and copying the ID from the URL. For example, for the URL
350
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
351
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
352
   * @param headers Headers of deleteFolderById method
353
   */
354
  public void deleteFolderById(String folderId, DeleteFolderByIdHeaders headers) {
UNCOV
355
    deleteFolderById(folderId, new DeleteFolderByIdQueryParams(), headers);
×
UNCOV
356
  }
×
357

358
  /**
359
   * Deletes a folder, either permanently or by moving it to the trash.
360
   *
361
   * @param folderId The unique identifier that represent a folder.
362
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
363
   *     and copying the ID from the URL. For example, for the URL
364
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
365
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
366
   * @param queryParams Query parameters of deleteFolderById method
367
   * @param headers Headers of deleteFolderById method
368
   */
369
  public void deleteFolderById(
370
      String folderId, DeleteFolderByIdQueryParams queryParams, DeleteFolderByIdHeaders headers) {
371
    Map<String, String> queryParamsMap =
1✔
372
        prepareParams(mapOf(entryOf("recursive", convertToString(queryParams.getRecursive()))));
1✔
373
    Map<String, String> headersMap =
1✔
374
        prepareParams(
1✔
375
            mergeMaps(
1✔
376
                mapOf(entryOf("if-match", convertToString(headers.getIfMatch()))),
1✔
377
                headers.getExtraHeaders()));
1✔
378
    FetchResponse response =
1✔
379
        this.networkSession
380
            .getNetworkClient()
1✔
381
            .fetch(
1✔
382
                new FetchOptions.Builder(
383
                        String.join(
1✔
384
                            "",
385
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
386
                            "/2.0/folders/",
387
                            convertToString(folderId)),
1✔
388
                        "DELETE")
389
                    .params(queryParamsMap)
1✔
390
                    .headers(headersMap)
1✔
391
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
392
                    .auth(this.auth)
1✔
393
                    .networkSession(this.networkSession)
1✔
394
                    .build());
1✔
395
  }
1✔
396

397
  /**
398
   * Retrieves a page of items in a folder. These items can be files, folders, and web links.
399
   *
400
   * <p>To request more information about the folder itself, like its size, use the [Get a
401
   * folder](#get-folders-id) endpoint instead.
402
   *
403
   * @param folderId The unique identifier that represent a folder.
404
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
405
   *     and copying the ID from the URL. For example, for the URL
406
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
407
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
408
   */
409
  public Items getFolderItems(String folderId) {
410
    return getFolderItems(folderId, new GetFolderItemsQueryParams(), new GetFolderItemsHeaders());
1✔
411
  }
412

413
  /**
414
   * Retrieves a page of items in a folder. These items can be files, folders, and web links.
415
   *
416
   * <p>To request more information about the folder itself, like its size, use the [Get a
417
   * folder](#get-folders-id) endpoint instead.
418
   *
419
   * @param folderId The unique identifier that represent a folder.
420
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
421
   *     and copying the ID from the URL. For example, for the URL
422
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
423
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
424
   * @param queryParams Query parameters of getFolderItems method
425
   */
426
  public Items getFolderItems(String folderId, GetFolderItemsQueryParams queryParams) {
UNCOV
427
    return getFolderItems(folderId, queryParams, new GetFolderItemsHeaders());
×
428
  }
429

430
  /**
431
   * Retrieves a page of items in a folder. These items can be files, folders, and web links.
432
   *
433
   * <p>To request more information about the folder itself, like its size, use the [Get a
434
   * folder](#get-folders-id) endpoint instead.
435
   *
436
   * @param folderId The unique identifier that represent a folder.
437
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
438
   *     and copying the ID from the URL. For example, for the URL
439
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
440
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
441
   * @param headers Headers of getFolderItems method
442
   */
443
  public Items getFolderItems(String folderId, GetFolderItemsHeaders headers) {
UNCOV
444
    return getFolderItems(folderId, new GetFolderItemsQueryParams(), headers);
×
445
  }
446

447
  /**
448
   * Retrieves a page of items in a folder. These items can be files, folders, and web links.
449
   *
450
   * <p>To request more information about the folder itself, like its size, use the [Get a
451
   * folder](#get-folders-id) endpoint instead.
452
   *
453
   * @param folderId The unique identifier that represent a folder.
454
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
455
   *     and copying the ID from the URL. For example, for the URL
456
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
457
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
458
   * @param queryParams Query parameters of getFolderItems method
459
   * @param headers Headers of getFolderItems method
460
   */
461
  public Items getFolderItems(
462
      String folderId, GetFolderItemsQueryParams queryParams, GetFolderItemsHeaders headers) {
463
    Map<String, String> queryParamsMap =
1✔
464
        prepareParams(
1✔
465
            mapOf(
1✔
466
                entryOf("fields", convertToString(queryParams.getFields())),
1✔
467
                entryOf("usemarker", convertToString(queryParams.getUsemarker())),
1✔
468
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
469
                entryOf("offset", convertToString(queryParams.getOffset())),
1✔
470
                entryOf("limit", convertToString(queryParams.getLimit())),
1✔
471
                entryOf("sort", convertToString(queryParams.getSort())),
1✔
472
                entryOf("direction", convertToString(queryParams.getDirection()))));
1✔
473
    Map<String, String> headersMap =
1✔
474
        prepareParams(
1✔
475
            mergeMaps(
1✔
476
                mapOf(entryOf("boxapi", convertToString(headers.getBoxapi()))),
1✔
477
                headers.getExtraHeaders()));
1✔
478
    FetchResponse response =
1✔
479
        this.networkSession
480
            .getNetworkClient()
1✔
481
            .fetch(
1✔
482
                new FetchOptions.Builder(
483
                        String.join(
1✔
484
                            "",
485
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
486
                            "/2.0/folders/",
487
                            convertToString(folderId),
1✔
488
                            "/items"),
489
                        "GET")
490
                    .params(queryParamsMap)
1✔
491
                    .headers(headersMap)
1✔
492
                    .responseFormat(ResponseFormat.JSON)
1✔
493
                    .auth(this.auth)
1✔
494
                    .networkSession(this.networkSession)
1✔
495
                    .build());
1✔
496
    return JsonManager.deserialize(response.getData(), Items.class);
1✔
497
  }
498

499
  /**
500
   * Creates a new empty folder within the specified parent folder.
501
   *
502
   * @param requestBody Request body of createFolder method
503
   */
504
  public FolderFull createFolder(CreateFolderRequestBody requestBody) {
505
    return createFolder(requestBody, new CreateFolderQueryParams(), new CreateFolderHeaders());
1✔
506
  }
507

508
  /**
509
   * Creates a new empty folder within the specified parent folder.
510
   *
511
   * @param requestBody Request body of createFolder method
512
   * @param queryParams Query parameters of createFolder method
513
   */
514
  public FolderFull createFolder(
515
      CreateFolderRequestBody requestBody, CreateFolderQueryParams queryParams) {
UNCOV
516
    return createFolder(requestBody, queryParams, new CreateFolderHeaders());
×
517
  }
518

519
  /**
520
   * Creates a new empty folder within the specified parent folder.
521
   *
522
   * @param requestBody Request body of createFolder method
523
   * @param headers Headers of createFolder method
524
   */
525
  public FolderFull createFolder(CreateFolderRequestBody requestBody, CreateFolderHeaders headers) {
UNCOV
526
    return createFolder(requestBody, new CreateFolderQueryParams(), headers);
×
527
  }
528

529
  /**
530
   * Creates a new empty folder within the specified parent folder.
531
   *
532
   * @param requestBody Request body of createFolder method
533
   * @param queryParams Query parameters of createFolder method
534
   * @param headers Headers of createFolder method
535
   */
536
  public FolderFull createFolder(
537
      CreateFolderRequestBody requestBody,
538
      CreateFolderQueryParams queryParams,
539
      CreateFolderHeaders headers) {
540
    Map<String, String> queryParamsMap =
1✔
541
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
542
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
543
    FetchResponse response =
1✔
544
        this.networkSession
545
            .getNetworkClient()
1✔
546
            .fetch(
1✔
547
                new FetchOptions.Builder(
548
                        String.join(
1✔
549
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/folders"),
1✔
550
                        "POST")
551
                    .params(queryParamsMap)
1✔
552
                    .headers(headersMap)
1✔
553
                    .data(JsonManager.serialize(requestBody))
1✔
554
                    .contentType("application/json")
1✔
555
                    .responseFormat(ResponseFormat.JSON)
1✔
556
                    .auth(this.auth)
1✔
557
                    .networkSession(this.networkSession)
1✔
558
                    .build());
1✔
559
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
560
  }
561

562
  /**
563
   * Creates a copy of a folder within a destination folder.
564
   *
565
   * <p>The original folder will not be changed.
566
   *
567
   * @param folderId The unique identifier of the folder to copy.
568
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
569
   *     and copying the ID from the URL. For example, for the URL
570
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
571
   *     <p>The root folder with the ID `0` can not be copied. Example: "0"
572
   * @param requestBody Request body of copyFolder method
573
   */
574
  public FolderFull copyFolder(String folderId, CopyFolderRequestBody requestBody) {
575
    return copyFolder(folderId, requestBody, new CopyFolderQueryParams(), new CopyFolderHeaders());
1✔
576
  }
577

578
  /**
579
   * Creates a copy of a folder within a destination folder.
580
   *
581
   * <p>The original folder will not be changed.
582
   *
583
   * @param folderId The unique identifier of the folder to copy.
584
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
585
   *     and copying the ID from the URL. For example, for the URL
586
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
587
   *     <p>The root folder with the ID `0` can not be copied. Example: "0"
588
   * @param requestBody Request body of copyFolder method
589
   * @param queryParams Query parameters of copyFolder method
590
   */
591
  public FolderFull copyFolder(
592
      String folderId, CopyFolderRequestBody requestBody, CopyFolderQueryParams queryParams) {
UNCOV
593
    return copyFolder(folderId, requestBody, queryParams, new CopyFolderHeaders());
×
594
  }
595

596
  /**
597
   * Creates a copy of a folder within a destination folder.
598
   *
599
   * <p>The original folder will not be changed.
600
   *
601
   * @param folderId The unique identifier of the folder to copy.
602
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
603
   *     and copying the ID from the URL. For example, for the URL
604
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
605
   *     <p>The root folder with the ID `0` can not be copied. Example: "0"
606
   * @param requestBody Request body of copyFolder method
607
   * @param headers Headers of copyFolder method
608
   */
609
  public FolderFull copyFolder(
610
      String folderId, CopyFolderRequestBody requestBody, CopyFolderHeaders headers) {
UNCOV
611
    return copyFolder(folderId, requestBody, new CopyFolderQueryParams(), headers);
×
612
  }
613

614
  /**
615
   * Creates a copy of a folder within a destination folder.
616
   *
617
   * <p>The original folder will not be changed.
618
   *
619
   * @param folderId The unique identifier of the folder to copy.
620
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
621
   *     and copying the ID from the URL. For example, for the URL
622
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
623
   *     <p>The root folder with the ID `0` can not be copied. Example: "0"
624
   * @param requestBody Request body of copyFolder method
625
   * @param queryParams Query parameters of copyFolder method
626
   * @param headers Headers of copyFolder method
627
   */
628
  public FolderFull copyFolder(
629
      String folderId,
630
      CopyFolderRequestBody requestBody,
631
      CopyFolderQueryParams queryParams,
632
      CopyFolderHeaders headers) {
633
    Map<String, String> queryParamsMap =
1✔
634
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
635
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
636
    FetchResponse response =
1✔
637
        this.networkSession
638
            .getNetworkClient()
1✔
639
            .fetch(
1✔
640
                new FetchOptions.Builder(
641
                        String.join(
1✔
642
                            "",
643
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
644
                            "/2.0/folders/",
645
                            convertToString(folderId),
1✔
646
                            "/copy"),
647
                        "POST")
648
                    .params(queryParamsMap)
1✔
649
                    .headers(headersMap)
1✔
650
                    .data(JsonManager.serialize(requestBody))
1✔
651
                    .contentType("application/json")
1✔
652
                    .responseFormat(ResponseFormat.JSON)
1✔
653
                    .auth(this.auth)
1✔
654
                    .networkSession(this.networkSession)
1✔
655
                    .build());
1✔
656
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
657
  }
658

659
  public Authentication getAuth() {
660
    return auth;
×
661
  }
662

663
  public NetworkSession getNetworkSession() {
UNCOV
664
    return networkSession;
×
665
  }
666

667
  public static class Builder {
668

669
    protected Authentication auth;
670

671
    protected NetworkSession networkSession;
672

673
    public Builder() {
1✔
674
      this.networkSession = new NetworkSession();
1✔
675
    }
1✔
676

677
    public Builder auth(Authentication auth) {
678
      this.auth = auth;
1✔
679
      return this;
1✔
680
    }
681

682
    public Builder networkSession(NetworkSession networkSession) {
683
      this.networkSession = networkSession;
1✔
684
      return this;
1✔
685
    }
686

687
    public FoldersManager build() {
688
      return new FoldersManager(this);
1✔
689
    }
690
  }
691
}
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

© 2025 Coveralls, Inc