• 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

89.92
/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) {
1✔
29
    this.auth = builder.auth;
1✔
30
    this.networkSession = builder.networkSession;
1✔
31
  }
1✔
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 =
1✔
63
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
64
    Map<String, String> headersMap =
1✔
65
        prepareParams(
1✔
66
            mergeMaps(
1✔
67
                mapOf(
1✔
68
                    entryOf("if-none-match", convertToString(headers.getIfNoneMatch())),
1✔
69
                    entryOf("boxapi", convertToString(headers.getBoxapi()))),
1✔
70
                headers.getExtraHeaders()));
1✔
71
    FetchResponse response =
1✔
72
        this.networkSession
73
            .getNetworkClient()
1✔
74
            .fetch(
1✔
75
                new FetchOptions.Builder(
76
                        String.join(
1✔
77
                            "",
78
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
79
                            "/2.0/shared_items#folders"),
80
                        "GET")
81
                    .params(queryParamsMap)
1✔
82
                    .headers(headersMap)
1✔
83
                    .responseFormat(ResponseFormat.JSON)
1✔
84
                    .auth(this.auth)
1✔
85
                    .networkSession(this.networkSession)
1✔
86
                    .build());
1✔
87
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
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());
1✔
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 =
1✔
121
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
122
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
123
    FetchResponse response =
1✔
124
        this.networkSession
125
            .getNetworkClient()
1✔
126
            .fetch(
1✔
127
                new FetchOptions.Builder(
128
                        String.join(
1✔
129
                            "",
130
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
131
                            "/2.0/folders/",
132
                            convertToString(folderId),
1✔
133
                            "#get_shared_link"),
134
                        "GET")
135
                    .params(queryParamsMap)
1✔
136
                    .headers(headersMap)
1✔
137
                    .responseFormat(ResponseFormat.JSON)
1✔
138
                    .auth(this.auth)
1✔
139
                    .networkSession(this.networkSession)
1✔
140
                    .build());
1✔
141
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
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(
1✔
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 =
1✔
219
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
220
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
221
    FetchResponse response =
1✔
222
        this.networkSession
223
            .getNetworkClient()
1✔
224
            .fetch(
1✔
225
                new FetchOptions.Builder(
226
                        String.join(
1✔
227
                            "",
228
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
229
                            "/2.0/folders/",
230
                            convertToString(folderId),
1✔
231
                            "#add_shared_link"),
232
                        "PUT")
233
                    .params(queryParamsMap)
1✔
234
                    .headers(headersMap)
1✔
235
                    .data(JsonManager.serialize(requestBody))
1✔
236
                    .contentType("application/json")
1✔
237
                    .responseFormat(ResponseFormat.JSON)
1✔
238
                    .auth(this.auth)
1✔
239
                    .networkSession(this.networkSession)
1✔
240
                    .build());
1✔
241
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
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(
1✔
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 =
1✔
319
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
320
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
321
    FetchResponse response =
1✔
322
        this.networkSession
323
            .getNetworkClient()
1✔
324
            .fetch(
1✔
325
                new FetchOptions.Builder(
326
                        String.join(
1✔
327
                            "",
328
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
329
                            "/2.0/folders/",
330
                            convertToString(folderId),
1✔
331
                            "#update_shared_link"),
332
                        "PUT")
333
                    .params(queryParamsMap)
1✔
334
                    .headers(headersMap)
1✔
335
                    .data(JsonManager.serialize(requestBody))
1✔
336
                    .contentType("application/json")
1✔
337
                    .responseFormat(ResponseFormat.JSON)
1✔
338
                    .auth(this.auth)
1✔
339
                    .networkSession(this.networkSession)
1✔
340
                    .build());
1✔
341
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
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(
1✔
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 =
1✔
419
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
1✔
420
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
421
    FetchResponse response =
1✔
422
        this.networkSession
423
            .getNetworkClient()
1✔
424
            .fetch(
1✔
425
                new FetchOptions.Builder(
426
                        String.join(
1✔
427
                            "",
428
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
429
                            "/2.0/folders/",
430
                            convertToString(folderId),
1✔
431
                            "#remove_shared_link"),
432
                        "PUT")
433
                    .params(queryParamsMap)
1✔
434
                    .headers(headersMap)
1✔
435
                    .data(JsonManager.serialize(requestBody))
1✔
436
                    .contentType("application/json")
1✔
437
                    .responseFormat(ResponseFormat.JSON)
1✔
438
                    .auth(this.auth)
1✔
439
                    .networkSession(this.networkSession)
1✔
440
                    .build());
1✔
441
    return JsonManager.deserialize(response.getData(), FolderFull.class);
1✔
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

458
    public Builder() {
1✔
459
      this.networkSession = new NetworkSession();
1✔
460
    }
1✔
461

462
    public Builder auth(Authentication auth) {
463
      this.auth = auth;
1✔
464
      return this;
1✔
465
    }
466

467
    public Builder networkSession(NetworkSession networkSession) {
468
      this.networkSession = networkSession;
1✔
469
      return this;
1✔
470
    }
471

472
    public SharedLinksFoldersManager build() {
473
      return new SharedLinksFoldersManager(this);
1✔
474
    }
475
  }
476
}
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