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

box / box-java-sdk / #6244

10 Feb 2026 05:27PM UTC coverage: 40.749% (+22.6%) from 18.192%
#6244

push

github

web-flow
fix(boxsdkgen): Move assigning default values from builder constructor to `build()` method (box/box-codegen#922) (#1712)

0 of 1677 new or added lines in 569 files covered. (0.0%)

2146 existing lines in 544 files now uncovered.

7382 of 18116 relevant lines covered (40.75%)

0.46 hits per line

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

0.0
/src/main/java/com/box/sdkgen/managers/sharedlinksfolders/SharedLinksFoldersManager.java
1
package com.box.sdkgen.managers.sharedlinksfolders;
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.serialization.json.JsonManager;
16
import java.util.Map;
17

18
public class SharedLinksFoldersManager {
19

20
  public Authentication auth;
21

22
  public NetworkSession networkSession;
23

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

28
  protected SharedLinksFoldersManager(Builder builder) {
×
29
    this.auth = builder.auth;
×
30
    this.networkSession = builder.networkSession;
×
31
  }
×
32

33
  /**
34
   * Return the folder represented by a shared link.
35
   *
36
   * <p>A shared folder can be represented by a shared link, which can originate within the current
37
   * enterprise or within another.
38
   *
39
   * <p>This endpoint allows an application to retrieve information about a shared folder when only
40
   * given a shared link.
41
   *
42
   * @param headers Headers of findFolderForSharedLink method
43
   */
44
  public FolderFull findFolderForSharedLink(FindFolderForSharedLinkHeaders headers) {
45
    return findFolderForSharedLink(new FindFolderForSharedLinkQueryParams(), headers);
×
46
  }
47

48
  /**
49
   * Return the folder represented by a shared link.
50
   *
51
   * <p>A shared folder can be represented by a shared link, which can originate within the current
52
   * enterprise or within another.
53
   *
54
   * <p>This endpoint allows an application to retrieve information about a shared folder when only
55
   * given a shared link.
56
   *
57
   * @param queryParams Query parameters of findFolderForSharedLink method
58
   * @param headers Headers of findFolderForSharedLink method
59
   */
60
  public FolderFull findFolderForSharedLink(
61
      FindFolderForSharedLinkQueryParams queryParams, FindFolderForSharedLinkHeaders headers) {
62
    Map<String, String> queryParamsMap =
×
63
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
64
    Map<String, String> headersMap =
×
65
        prepareParams(
×
66
            mergeMaps(
×
67
                mapOf(
×
68
                    entryOf("if-none-match", convertToString(headers.getIfNoneMatch())),
×
69
                    entryOf("boxapi", convertToString(headers.getBoxapi()))),
×
70
                headers.getExtraHeaders()));
×
71
    FetchResponse response =
×
72
        this.networkSession
73
            .getNetworkClient()
×
74
            .fetch(
×
75
                new FetchOptions.Builder(
76
                        String.join(
×
77
                            "",
78
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
79
                            "/2.0/shared_items#folders"),
80
                        "GET")
81
                    .params(queryParamsMap)
×
82
                    .headers(headersMap)
×
83
                    .responseFormat(ResponseFormat.JSON)
×
84
                    .auth(this.auth)
×
85
                    .networkSession(this.networkSession)
×
86
                    .build());
×
87
    return JsonManager.deserialize(response.getData(), FolderFull.class);
×
88
  }
89

90
  /**
91
   * Gets the information for a shared link on a folder.
92
   *
93
   * @param folderId The unique identifier that represent a folder.
94
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
95
   *     and copying the ID from the URL. For example, for the URL
96
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
97
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
98
   * @param queryParams Query parameters of getSharedLinkForFolder method
99
   */
100
  public FolderFull getSharedLinkForFolder(
101
      String folderId, GetSharedLinkForFolderQueryParams queryParams) {
102
    return getSharedLinkForFolder(folderId, queryParams, new GetSharedLinkForFolderHeaders());
×
103
  }
104

105
  /**
106
   * Gets the information for a shared link on a folder.
107
   *
108
   * @param folderId The unique identifier that represent a folder.
109
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
110
   *     and copying the ID from the URL. For example, for the URL
111
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
112
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
113
   * @param queryParams Query parameters of getSharedLinkForFolder method
114
   * @param headers Headers of getSharedLinkForFolder method
115
   */
116
  public FolderFull getSharedLinkForFolder(
117
      String folderId,
118
      GetSharedLinkForFolderQueryParams queryParams,
119
      GetSharedLinkForFolderHeaders headers) {
120
    Map<String, String> queryParamsMap =
×
121
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
122
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
123
    FetchResponse response =
×
124
        this.networkSession
125
            .getNetworkClient()
×
126
            .fetch(
×
127
                new FetchOptions.Builder(
128
                        String.join(
×
129
                            "",
130
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
131
                            "/2.0/folders/",
132
                            convertToString(folderId),
×
133
                            "#get_shared_link"),
134
                        "GET")
135
                    .params(queryParamsMap)
×
136
                    .headers(headersMap)
×
137
                    .responseFormat(ResponseFormat.JSON)
×
138
                    .auth(this.auth)
×
139
                    .networkSession(this.networkSession)
×
140
                    .build());
×
141
    return JsonManager.deserialize(response.getData(), FolderFull.class);
×
142
  }
143

144
  /**
145
   * Adds a shared link to a folder.
146
   *
147
   * @param folderId The unique identifier that represent a folder.
148
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
149
   *     and copying the ID from the URL. For example, for the URL
150
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
151
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
152
   * @param queryParams Query parameters of addShareLinkToFolder method
153
   */
154
  public FolderFull addShareLinkToFolder(
155
      String folderId, AddShareLinkToFolderQueryParams queryParams) {
156
    return addShareLinkToFolder(
×
157
        folderId,
158
        new AddShareLinkToFolderRequestBody(),
159
        queryParams,
160
        new AddShareLinkToFolderHeaders());
161
  }
162

163
  /**
164
   * Adds a shared link to a folder.
165
   *
166
   * @param folderId The unique identifier that represent a folder.
167
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
168
   *     and copying the ID from the URL. For example, for the URL
169
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
170
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
171
   * @param requestBody Request body of addShareLinkToFolder method
172
   * @param queryParams Query parameters of addShareLinkToFolder method
173
   */
174
  public FolderFull addShareLinkToFolder(
175
      String folderId,
176
      AddShareLinkToFolderRequestBody requestBody,
177
      AddShareLinkToFolderQueryParams queryParams) {
178
    return addShareLinkToFolder(
×
179
        folderId, requestBody, queryParams, new AddShareLinkToFolderHeaders());
180
  }
181

182
  /**
183
   * Adds a shared link to a folder.
184
   *
185
   * @param folderId The unique identifier that represent a folder.
186
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
187
   *     and copying the ID from the URL. For example, for the URL
188
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
189
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
190
   * @param queryParams Query parameters of addShareLinkToFolder method
191
   * @param headers Headers of addShareLinkToFolder method
192
   */
193
  public FolderFull addShareLinkToFolder(
194
      String folderId,
195
      AddShareLinkToFolderQueryParams queryParams,
196
      AddShareLinkToFolderHeaders headers) {
197
    return addShareLinkToFolder(
×
198
        folderId, new AddShareLinkToFolderRequestBody(), queryParams, headers);
199
  }
200

201
  /**
202
   * Adds a shared link to a folder.
203
   *
204
   * @param folderId The unique identifier that represent a folder.
205
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
206
   *     and copying the ID from the URL. For example, for the URL
207
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
208
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
209
   * @param requestBody Request body of addShareLinkToFolder method
210
   * @param queryParams Query parameters of addShareLinkToFolder method
211
   * @param headers Headers of addShareLinkToFolder method
212
   */
213
  public FolderFull addShareLinkToFolder(
214
      String folderId,
215
      AddShareLinkToFolderRequestBody requestBody,
216
      AddShareLinkToFolderQueryParams queryParams,
217
      AddShareLinkToFolderHeaders headers) {
218
    Map<String, String> queryParamsMap =
×
219
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
220
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
221
    FetchResponse response =
×
222
        this.networkSession
223
            .getNetworkClient()
×
224
            .fetch(
×
225
                new FetchOptions.Builder(
226
                        String.join(
×
227
                            "",
228
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
229
                            "/2.0/folders/",
230
                            convertToString(folderId),
×
231
                            "#add_shared_link"),
232
                        "PUT")
233
                    .params(queryParamsMap)
×
234
                    .headers(headersMap)
×
235
                    .data(JsonManager.serialize(requestBody))
×
236
                    .contentType("application/json")
×
237
                    .responseFormat(ResponseFormat.JSON)
×
238
                    .auth(this.auth)
×
239
                    .networkSession(this.networkSession)
×
240
                    .build());
×
241
    return JsonManager.deserialize(response.getData(), FolderFull.class);
×
242
  }
243

244
  /**
245
   * Updates a shared link on a folder.
246
   *
247
   * @param folderId The unique identifier that represent a folder.
248
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
249
   *     and copying the ID from the URL. For example, for the URL
250
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
251
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
252
   * @param queryParams Query parameters of updateSharedLinkOnFolder method
253
   */
254
  public FolderFull updateSharedLinkOnFolder(
255
      String folderId, UpdateSharedLinkOnFolderQueryParams queryParams) {
256
    return updateSharedLinkOnFolder(
×
257
        folderId,
258
        new UpdateSharedLinkOnFolderRequestBody(),
259
        queryParams,
260
        new UpdateSharedLinkOnFolderHeaders());
261
  }
262

263
  /**
264
   * Updates a shared link on a folder.
265
   *
266
   * @param folderId The unique identifier that represent a folder.
267
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
268
   *     and copying the ID from the URL. For example, for the URL
269
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
270
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
271
   * @param requestBody Request body of updateSharedLinkOnFolder method
272
   * @param queryParams Query parameters of updateSharedLinkOnFolder method
273
   */
274
  public FolderFull updateSharedLinkOnFolder(
275
      String folderId,
276
      UpdateSharedLinkOnFolderRequestBody requestBody,
277
      UpdateSharedLinkOnFolderQueryParams queryParams) {
278
    return updateSharedLinkOnFolder(
×
279
        folderId, requestBody, queryParams, new UpdateSharedLinkOnFolderHeaders());
280
  }
281

282
  /**
283
   * Updates a shared link on a folder.
284
   *
285
   * @param folderId The unique identifier that represent a folder.
286
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
287
   *     and copying the ID from the URL. For example, for the URL
288
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
289
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
290
   * @param queryParams Query parameters of updateSharedLinkOnFolder method
291
   * @param headers Headers of updateSharedLinkOnFolder method
292
   */
293
  public FolderFull updateSharedLinkOnFolder(
294
      String folderId,
295
      UpdateSharedLinkOnFolderQueryParams queryParams,
296
      UpdateSharedLinkOnFolderHeaders headers) {
297
    return updateSharedLinkOnFolder(
×
298
        folderId, new UpdateSharedLinkOnFolderRequestBody(), queryParams, headers);
299
  }
300

301
  /**
302
   * Updates a shared link on a folder.
303
   *
304
   * @param folderId The unique identifier that represent a folder.
305
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
306
   *     and copying the ID from the URL. For example, for the URL
307
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
308
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
309
   * @param requestBody Request body of updateSharedLinkOnFolder method
310
   * @param queryParams Query parameters of updateSharedLinkOnFolder method
311
   * @param headers Headers of updateSharedLinkOnFolder method
312
   */
313
  public FolderFull updateSharedLinkOnFolder(
314
      String folderId,
315
      UpdateSharedLinkOnFolderRequestBody requestBody,
316
      UpdateSharedLinkOnFolderQueryParams queryParams,
317
      UpdateSharedLinkOnFolderHeaders headers) {
318
    Map<String, String> queryParamsMap =
×
319
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
320
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
321
    FetchResponse response =
×
322
        this.networkSession
323
            .getNetworkClient()
×
324
            .fetch(
×
325
                new FetchOptions.Builder(
326
                        String.join(
×
327
                            "",
328
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
329
                            "/2.0/folders/",
330
                            convertToString(folderId),
×
331
                            "#update_shared_link"),
332
                        "PUT")
333
                    .params(queryParamsMap)
×
334
                    .headers(headersMap)
×
335
                    .data(JsonManager.serialize(requestBody))
×
336
                    .contentType("application/json")
×
337
                    .responseFormat(ResponseFormat.JSON)
×
338
                    .auth(this.auth)
×
339
                    .networkSession(this.networkSession)
×
340
                    .build());
×
341
    return JsonManager.deserialize(response.getData(), FolderFull.class);
×
342
  }
343

344
  /**
345
   * Removes a shared link from a folder.
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 queryParams Query parameters of removeSharedLinkFromFolder method
353
   */
354
  public FolderFull removeSharedLinkFromFolder(
355
      String folderId, RemoveSharedLinkFromFolderQueryParams queryParams) {
356
    return removeSharedLinkFromFolder(
×
357
        folderId,
358
        new RemoveSharedLinkFromFolderRequestBody(),
359
        queryParams,
360
        new RemoveSharedLinkFromFolderHeaders());
361
  }
362

363
  /**
364
   * Removes a shared link from a folder.
365
   *
366
   * @param folderId The unique identifier that represent a folder.
367
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
368
   *     and copying the ID from the URL. For example, for the URL
369
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
370
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
371
   * @param requestBody Request body of removeSharedLinkFromFolder method
372
   * @param queryParams Query parameters of removeSharedLinkFromFolder method
373
   */
374
  public FolderFull removeSharedLinkFromFolder(
375
      String folderId,
376
      RemoveSharedLinkFromFolderRequestBody requestBody,
377
      RemoveSharedLinkFromFolderQueryParams queryParams) {
378
    return removeSharedLinkFromFolder(
×
379
        folderId, requestBody, queryParams, new RemoveSharedLinkFromFolderHeaders());
380
  }
381

382
  /**
383
   * Removes a shared link from a folder.
384
   *
385
   * @param folderId The unique identifier that represent a folder.
386
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
387
   *     and copying the ID from the URL. For example, for the URL
388
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
389
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
390
   * @param queryParams Query parameters of removeSharedLinkFromFolder method
391
   * @param headers Headers of removeSharedLinkFromFolder method
392
   */
393
  public FolderFull removeSharedLinkFromFolder(
394
      String folderId,
395
      RemoveSharedLinkFromFolderQueryParams queryParams,
396
      RemoveSharedLinkFromFolderHeaders headers) {
397
    return removeSharedLinkFromFolder(
×
398
        folderId, new RemoveSharedLinkFromFolderRequestBody(), queryParams, headers);
399
  }
400

401
  /**
402
   * Removes a shared link from a folder.
403
   *
404
   * @param folderId The unique identifier that represent a folder.
405
   *     <p>The ID for any folder can be determined by visiting this folder in the web application
406
   *     and copying the ID from the URL. For example, for the URL
407
   *     `https://*.app.box.com/folder/123` the `folder_id` is `123`.
408
   *     <p>The root folder of a Box account is always represented by the ID `0`. Example: "12345"
409
   * @param requestBody Request body of removeSharedLinkFromFolder method
410
   * @param queryParams Query parameters of removeSharedLinkFromFolder method
411
   * @param headers Headers of removeSharedLinkFromFolder method
412
   */
413
  public FolderFull removeSharedLinkFromFolder(
414
      String folderId,
415
      RemoveSharedLinkFromFolderRequestBody requestBody,
416
      RemoveSharedLinkFromFolderQueryParams queryParams,
417
      RemoveSharedLinkFromFolderHeaders headers) {
418
    Map<String, String> queryParamsMap =
×
419
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
420
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
421
    FetchResponse response =
×
422
        this.networkSession
423
            .getNetworkClient()
×
424
            .fetch(
×
425
                new FetchOptions.Builder(
426
                        String.join(
×
427
                            "",
428
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
429
                            "/2.0/folders/",
430
                            convertToString(folderId),
×
431
                            "#remove_shared_link"),
432
                        "PUT")
433
                    .params(queryParamsMap)
×
434
                    .headers(headersMap)
×
435
                    .data(JsonManager.serialize(requestBody))
×
436
                    .contentType("application/json")
×
437
                    .responseFormat(ResponseFormat.JSON)
×
438
                    .auth(this.auth)
×
439
                    .networkSession(this.networkSession)
×
440
                    .build());
×
441
    return JsonManager.deserialize(response.getData(), FolderFull.class);
×
442
  }
443

444
  public Authentication getAuth() {
445
    return auth;
×
446
  }
447

448
  public NetworkSession getNetworkSession() {
449
    return networkSession;
×
450
  }
451

452
  public static class Builder {
453

454
    protected Authentication auth;
455

456
    protected NetworkSession networkSession;
457

NEW
458
    public Builder() {}
×
459

460
    public Builder auth(Authentication auth) {
UNCOV
461
      this.auth = auth;
×
UNCOV
462
      return this;
×
463
    }
464

465
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
466
      this.networkSession = networkSession;
×
UNCOV
467
      return this;
×
468
    }
469

470
    public SharedLinksFoldersManager build() {
NEW
471
      if (this.networkSession == null) {
×
NEW
472
        this.networkSession = new NetworkSession();
×
473
      }
474
      return new SharedLinksFoldersManager(this);
×
475
    }
476
  }
477
}
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