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

box / box-java-sdk / #5968

19 Dec 2025 11:21AM UTC coverage: 35.692% (+0.2%) from 35.453%
#5968

push

github

web-flow
chore: release version 10.4.0 (#1659)

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

11 existing lines in 6 files now uncovered.

19023 of 53297 relevant lines covered (35.69%)

0.36 hits per line

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

95.67
/src/main/java/com/box/sdkgen/managers/metadatataxonomies/MetadataTaxonomiesManager.java
1
package com.box.sdkgen.managers.metadatataxonomies;
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.metadatataxonomies.MetadataTaxonomies;
15
import com.box.sdkgen.schemas.metadatataxonomy.MetadataTaxonomy;
16
import com.box.sdkgen.schemas.metadatataxonomylevel.MetadataTaxonomyLevel;
17
import com.box.sdkgen.schemas.metadatataxonomylevels.MetadataTaxonomyLevels;
18
import com.box.sdkgen.schemas.metadatataxonomynode.MetadataTaxonomyNode;
19
import com.box.sdkgen.schemas.metadatataxonomynodes.MetadataTaxonomyNodes;
20
import com.box.sdkgen.serialization.json.JsonManager;
21
import java.util.List;
22
import java.util.Map;
23

24
public class MetadataTaxonomiesManager {
25

26
  public Authentication auth;
27

28
  public NetworkSession networkSession;
29

30
  public MetadataTaxonomiesManager() {
×
31
    this.networkSession = new NetworkSession();
×
32
  }
×
33

34
  protected MetadataTaxonomiesManager(Builder builder) {
1✔
35
    this.auth = builder.auth;
1✔
36
    this.networkSession = builder.networkSession;
1✔
37
  }
1✔
38

39
  /**
40
   * Creates a new metadata taxonomy that can be used in metadata templates.
41
   *
42
   * @param requestBody Request body of createMetadataTaxonomy method
43
   */
44
  public MetadataTaxonomy createMetadataTaxonomy(CreateMetadataTaxonomyRequestBody requestBody) {
45
    return createMetadataTaxonomy(requestBody, new CreateMetadataTaxonomyHeaders());
1✔
46
  }
47

48
  /**
49
   * Creates a new metadata taxonomy that can be used in metadata templates.
50
   *
51
   * @param requestBody Request body of createMetadataTaxonomy method
52
   * @param headers Headers of createMetadataTaxonomy method
53
   */
54
  public MetadataTaxonomy createMetadataTaxonomy(
55
      CreateMetadataTaxonomyRequestBody requestBody, CreateMetadataTaxonomyHeaders headers) {
56
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
57
    FetchResponse response =
1✔
58
        this.networkSession
59
            .getNetworkClient()
1✔
60
            .fetch(
1✔
61
                new FetchOptions.Builder(
62
                        String.join(
1✔
63
                            "",
64
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
65
                            "/2.0/metadata_taxonomies"),
66
                        "POST")
67
                    .headers(headersMap)
1✔
68
                    .data(JsonManager.serialize(requestBody))
1✔
69
                    .contentType("application/json")
1✔
70
                    .responseFormat(ResponseFormat.JSON)
1✔
71
                    .auth(this.auth)
1✔
72
                    .networkSession(this.networkSession)
1✔
73
                    .build());
1✔
74
    return JsonManager.deserialize(response.getData(), MetadataTaxonomy.class);
1✔
75
  }
76

77
  /**
78
   * Used to retrieve all metadata taxonomies in a namespace.
79
   *
80
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
81
   */
82
  public MetadataTaxonomies getMetadataTaxonomies(String namespace) {
83
    return getMetadataTaxonomies(
1✔
84
        namespace, new GetMetadataTaxonomiesQueryParams(), new GetMetadataTaxonomiesHeaders());
85
  }
86

87
  /**
88
   * Used to retrieve all metadata taxonomies in a namespace.
89
   *
90
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
91
   * @param queryParams Query parameters of getMetadataTaxonomies method
92
   */
93
  public MetadataTaxonomies getMetadataTaxonomies(
94
      String namespace, GetMetadataTaxonomiesQueryParams queryParams) {
95
    return getMetadataTaxonomies(namespace, queryParams, new GetMetadataTaxonomiesHeaders());
×
96
  }
97

98
  /**
99
   * Used to retrieve all metadata taxonomies in a namespace.
100
   *
101
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
102
   * @param headers Headers of getMetadataTaxonomies method
103
   */
104
  public MetadataTaxonomies getMetadataTaxonomies(
105
      String namespace, GetMetadataTaxonomiesHeaders headers) {
106
    return getMetadataTaxonomies(namespace, new GetMetadataTaxonomiesQueryParams(), headers);
×
107
  }
108

109
  /**
110
   * Used to retrieve all metadata taxonomies in a namespace.
111
   *
112
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
113
   * @param queryParams Query parameters of getMetadataTaxonomies method
114
   * @param headers Headers of getMetadataTaxonomies method
115
   */
116
  public MetadataTaxonomies getMetadataTaxonomies(
117
      String namespace,
118
      GetMetadataTaxonomiesQueryParams queryParams,
119
      GetMetadataTaxonomiesHeaders headers) {
120
    Map<String, String> queryParamsMap =
1✔
121
        prepareParams(
1✔
122
            mapOf(
1✔
123
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
124
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
125
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
126
    FetchResponse response =
1✔
127
        this.networkSession
128
            .getNetworkClient()
1✔
129
            .fetch(
1✔
130
                new FetchOptions.Builder(
131
                        String.join(
1✔
132
                            "",
133
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
134
                            "/2.0/metadata_taxonomies/",
135
                            convertToString(namespace)),
1✔
136
                        "GET")
137
                    .params(queryParamsMap)
1✔
138
                    .headers(headersMap)
1✔
139
                    .responseFormat(ResponseFormat.JSON)
1✔
140
                    .auth(this.auth)
1✔
141
                    .networkSession(this.networkSession)
1✔
142
                    .build());
1✔
143
    return JsonManager.deserialize(response.getData(), MetadataTaxonomies.class);
1✔
144
  }
145

146
  /**
147
   * Used to retrieve a metadata taxonomy by taxonomy key.
148
   *
149
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
150
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
151
   */
152
  public MetadataTaxonomy getMetadataTaxonomyByKey(String namespace, String taxonomyKey) {
153
    return getMetadataTaxonomyByKey(namespace, taxonomyKey, new GetMetadataTaxonomyByKeyHeaders());
1✔
154
  }
155

156
  /**
157
   * Used to retrieve a metadata taxonomy by taxonomy key.
158
   *
159
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
160
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
161
   * @param headers Headers of getMetadataTaxonomyByKey method
162
   */
163
  public MetadataTaxonomy getMetadataTaxonomyByKey(
164
      String namespace, String taxonomyKey, GetMetadataTaxonomyByKeyHeaders headers) {
165
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
166
    FetchResponse response =
1✔
167
        this.networkSession
168
            .getNetworkClient()
1✔
169
            .fetch(
1✔
170
                new FetchOptions.Builder(
171
                        String.join(
1✔
172
                            "",
173
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
174
                            "/2.0/metadata_taxonomies/",
175
                            convertToString(namespace),
1✔
176
                            "/",
177
                            convertToString(taxonomyKey)),
1✔
178
                        "GET")
179
                    .headers(headersMap)
1✔
180
                    .responseFormat(ResponseFormat.JSON)
1✔
181
                    .auth(this.auth)
1✔
182
                    .networkSession(this.networkSession)
1✔
183
                    .build());
1✔
184
    return JsonManager.deserialize(response.getData(), MetadataTaxonomy.class);
1✔
185
  }
186

187
  /**
188
   * Updates an existing metadata taxonomy.
189
   *
190
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
191
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
192
   * @param requestBody Request body of updateMetadataTaxonomy method
193
   */
194
  public MetadataTaxonomy updateMetadataTaxonomy(
195
      String namespace, String taxonomyKey, UpdateMetadataTaxonomyRequestBody requestBody) {
196
    return updateMetadataTaxonomy(
1✔
197
        namespace, taxonomyKey, requestBody, new UpdateMetadataTaxonomyHeaders());
198
  }
199

200
  /**
201
   * Updates an existing metadata taxonomy.
202
   *
203
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
204
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
205
   * @param requestBody Request body of updateMetadataTaxonomy method
206
   * @param headers Headers of updateMetadataTaxonomy method
207
   */
208
  public MetadataTaxonomy updateMetadataTaxonomy(
209
      String namespace,
210
      String taxonomyKey,
211
      UpdateMetadataTaxonomyRequestBody requestBody,
212
      UpdateMetadataTaxonomyHeaders headers) {
213
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
214
    FetchResponse response =
1✔
215
        this.networkSession
216
            .getNetworkClient()
1✔
217
            .fetch(
1✔
218
                new FetchOptions.Builder(
219
                        String.join(
1✔
220
                            "",
221
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
222
                            "/2.0/metadata_taxonomies/",
223
                            convertToString(namespace),
1✔
224
                            "/",
225
                            convertToString(taxonomyKey)),
1✔
226
                        "PATCH")
227
                    .headers(headersMap)
1✔
228
                    .data(JsonManager.serialize(requestBody))
1✔
229
                    .contentType("application/json")
1✔
230
                    .responseFormat(ResponseFormat.JSON)
1✔
231
                    .auth(this.auth)
1✔
232
                    .networkSession(this.networkSession)
1✔
233
                    .build());
1✔
234
    return JsonManager.deserialize(response.getData(), MetadataTaxonomy.class);
1✔
235
  }
236

237
  /**
238
   * Delete a metadata taxonomy. This deletion is permanent and cannot be reverted.
239
   *
240
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
241
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
242
   */
243
  public void deleteMetadataTaxonomy(String namespace, String taxonomyKey) {
244
    deleteMetadataTaxonomy(namespace, taxonomyKey, new DeleteMetadataTaxonomyHeaders());
1✔
245
  }
1✔
246

247
  /**
248
   * Delete a metadata taxonomy. This deletion is permanent and cannot be reverted.
249
   *
250
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
251
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
252
   * @param headers Headers of deleteMetadataTaxonomy method
253
   */
254
  public void deleteMetadataTaxonomy(
255
      String namespace, String taxonomyKey, DeleteMetadataTaxonomyHeaders headers) {
256
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
257
    FetchResponse response =
1✔
258
        this.networkSession
259
            .getNetworkClient()
1✔
260
            .fetch(
1✔
261
                new FetchOptions.Builder(
262
                        String.join(
1✔
263
                            "",
264
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
265
                            "/2.0/metadata_taxonomies/",
266
                            convertToString(namespace),
1✔
267
                            "/",
268
                            convertToString(taxonomyKey)),
1✔
269
                        "DELETE")
270
                    .headers(headersMap)
1✔
271
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
272
                    .auth(this.auth)
1✔
273
                    .networkSession(this.networkSession)
1✔
274
                    .build());
1✔
275
  }
1✔
276

277
  /**
278
   * Creates new metadata taxonomy levels.
279
   *
280
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
281
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
282
   * @param requestBody Request body of createMetadataTaxonomyLevel method
283
   */
284
  public MetadataTaxonomyLevels createMetadataTaxonomyLevel(
285
      String namespace, String taxonomyKey, List<MetadataTaxonomyLevel> requestBody) {
286
    return createMetadataTaxonomyLevel(
1✔
287
        namespace, taxonomyKey, requestBody, new CreateMetadataTaxonomyLevelHeaders());
288
  }
289

290
  /**
291
   * Creates new metadata taxonomy levels.
292
   *
293
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
294
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
295
   * @param requestBody Request body of createMetadataTaxonomyLevel method
296
   * @param headers Headers of createMetadataTaxonomyLevel method
297
   */
298
  public MetadataTaxonomyLevels createMetadataTaxonomyLevel(
299
      String namespace,
300
      String taxonomyKey,
301
      List<MetadataTaxonomyLevel> requestBody,
302
      CreateMetadataTaxonomyLevelHeaders headers) {
303
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
304
    FetchResponse response =
1✔
305
        this.networkSession
306
            .getNetworkClient()
1✔
307
            .fetch(
1✔
308
                new FetchOptions.Builder(
309
                        String.join(
1✔
310
                            "",
311
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
312
                            "/2.0/metadata_taxonomies/",
313
                            convertToString(namespace),
1✔
314
                            "/",
315
                            convertToString(taxonomyKey),
1✔
316
                            "/levels"),
317
                        "POST")
318
                    .headers(headersMap)
1✔
319
                    .data(JsonManager.serialize(requestBody))
1✔
320
                    .contentType("application/json")
1✔
321
                    .responseFormat(ResponseFormat.JSON)
1✔
322
                    .auth(this.auth)
1✔
323
                    .networkSession(this.networkSession)
1✔
324
                    .build());
1✔
325
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevels.class);
1✔
326
  }
327

328
  /**
329
   * Updates an existing metadata taxonomy level.
330
   *
331
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
332
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
333
   * @param levelIndex The index of the metadata taxonomy level. Example: 1
334
   * @param requestBody Request body of updateMetadataTaxonomyLevelById method
335
   */
336
  public MetadataTaxonomyLevel updateMetadataTaxonomyLevelById(
337
      String namespace,
338
      String taxonomyKey,
339
      long levelIndex,
340
      UpdateMetadataTaxonomyLevelByIdRequestBody requestBody) {
341
    return updateMetadataTaxonomyLevelById(
1✔
342
        namespace,
343
        taxonomyKey,
344
        levelIndex,
345
        requestBody,
346
        new UpdateMetadataTaxonomyLevelByIdHeaders());
347
  }
348

349
  /**
350
   * Updates an existing metadata taxonomy level.
351
   *
352
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
353
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
354
   * @param levelIndex The index of the metadata taxonomy level. Example: 1
355
   * @param requestBody Request body of updateMetadataTaxonomyLevelById method
356
   * @param headers Headers of updateMetadataTaxonomyLevelById method
357
   */
358
  public MetadataTaxonomyLevel updateMetadataTaxonomyLevelById(
359
      String namespace,
360
      String taxonomyKey,
361
      long levelIndex,
362
      UpdateMetadataTaxonomyLevelByIdRequestBody requestBody,
363
      UpdateMetadataTaxonomyLevelByIdHeaders headers) {
364
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
365
    FetchResponse response =
1✔
366
        this.networkSession
367
            .getNetworkClient()
1✔
368
            .fetch(
1✔
369
                new FetchOptions.Builder(
370
                        String.join(
1✔
371
                            "",
372
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
373
                            "/2.0/metadata_taxonomies/",
374
                            convertToString(namespace),
1✔
375
                            "/",
376
                            convertToString(taxonomyKey),
1✔
377
                            "/levels/",
378
                            convertToString(levelIndex)),
1✔
379
                        "PATCH")
380
                    .headers(headersMap)
1✔
381
                    .data(JsonManager.serialize(requestBody))
1✔
382
                    .contentType("application/json")
1✔
383
                    .responseFormat(ResponseFormat.JSON)
1✔
384
                    .auth(this.auth)
1✔
385
                    .networkSession(this.networkSession)
1✔
386
                    .build());
1✔
387
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevel.class);
1✔
388
  }
389

390
  /**
391
   * Creates a new metadata taxonomy level and appends it to the existing levels. If there are no
392
   * levels defined yet, this will create the first level.
393
   *
394
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
395
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
396
   * @param requestBody Request body of addMetadataTaxonomyLevel method
397
   */
398
  public MetadataTaxonomyLevels addMetadataTaxonomyLevel(
399
      String namespace, String taxonomyKey, AddMetadataTaxonomyLevelRequestBody requestBody) {
400
    return addMetadataTaxonomyLevel(
1✔
401
        namespace, taxonomyKey, requestBody, new AddMetadataTaxonomyLevelHeaders());
402
  }
403

404
  /**
405
   * Creates a new metadata taxonomy level and appends it to the existing levels. If there are no
406
   * levels defined yet, this will create the first level.
407
   *
408
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
409
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
410
   * @param requestBody Request body of addMetadataTaxonomyLevel method
411
   * @param headers Headers of addMetadataTaxonomyLevel method
412
   */
413
  public MetadataTaxonomyLevels addMetadataTaxonomyLevel(
414
      String namespace,
415
      String taxonomyKey,
416
      AddMetadataTaxonomyLevelRequestBody requestBody,
417
      AddMetadataTaxonomyLevelHeaders headers) {
418
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
419
    FetchResponse response =
1✔
420
        this.networkSession
421
            .getNetworkClient()
1✔
422
            .fetch(
1✔
423
                new FetchOptions.Builder(
424
                        String.join(
1✔
425
                            "",
426
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
427
                            "/2.0/metadata_taxonomies/",
428
                            convertToString(namespace),
1✔
429
                            "/",
430
                            convertToString(taxonomyKey),
1✔
431
                            "/levels:append"),
432
                        "POST")
433
                    .headers(headersMap)
1✔
434
                    .data(JsonManager.serialize(requestBody))
1✔
435
                    .contentType("application/json")
1✔
436
                    .responseFormat(ResponseFormat.JSON)
1✔
437
                    .auth(this.auth)
1✔
438
                    .networkSession(this.networkSession)
1✔
439
                    .build());
1✔
440
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevels.class);
1✔
441
  }
442

443
  /**
444
   * Deletes the last level of the metadata taxonomy.
445
   *
446
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
447
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
448
   */
449
  public MetadataTaxonomyLevels deleteMetadataTaxonomyLevel(String namespace, String taxonomyKey) {
450
    return deleteMetadataTaxonomyLevel(
1✔
451
        namespace, taxonomyKey, new DeleteMetadataTaxonomyLevelHeaders());
452
  }
453

454
  /**
455
   * Deletes the last level of the metadata taxonomy.
456
   *
457
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
458
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
459
   * @param headers Headers of deleteMetadataTaxonomyLevel method
460
   */
461
  public MetadataTaxonomyLevels deleteMetadataTaxonomyLevel(
462
      String namespace, String taxonomyKey, DeleteMetadataTaxonomyLevelHeaders headers) {
463
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
464
    FetchResponse response =
1✔
465
        this.networkSession
466
            .getNetworkClient()
1✔
467
            .fetch(
1✔
468
                new FetchOptions.Builder(
469
                        String.join(
1✔
470
                            "",
471
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
472
                            "/2.0/metadata_taxonomies/",
473
                            convertToString(namespace),
1✔
474
                            "/",
475
                            convertToString(taxonomyKey),
1✔
476
                            "/levels:trim"),
477
                        "POST")
478
                    .headers(headersMap)
1✔
479
                    .responseFormat(ResponseFormat.JSON)
1✔
480
                    .auth(this.auth)
1✔
481
                    .networkSession(this.networkSession)
1✔
482
                    .build());
1✔
483
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevels.class);
1✔
484
  }
485

486
  /**
487
   * Used to retrieve metadata taxonomy nodes based on the parameters specified. Results are sorted
488
   * in lexicographic order unless a `query` parameter is passed. With a `query` parameter
489
   * specified, results are sorted in order of relevance.
490
   *
491
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
492
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
493
   */
494
  public MetadataTaxonomyNodes getMetadataTaxonomyNodes(String namespace, String taxonomyKey) {
495
    return getMetadataTaxonomyNodes(
1✔
496
        namespace,
497
        taxonomyKey,
498
        new GetMetadataTaxonomyNodesQueryParams(),
499
        new GetMetadataTaxonomyNodesHeaders());
500
  }
501

502
  /**
503
   * Used to retrieve metadata taxonomy nodes based on the parameters specified. Results are sorted
504
   * in lexicographic order unless a `query` parameter is passed. With a `query` parameter
505
   * specified, results are sorted in order of relevance.
506
   *
507
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
508
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
509
   * @param queryParams Query parameters of getMetadataTaxonomyNodes method
510
   */
511
  public MetadataTaxonomyNodes getMetadataTaxonomyNodes(
512
      String namespace, String taxonomyKey, GetMetadataTaxonomyNodesQueryParams queryParams) {
513
    return getMetadataTaxonomyNodes(
×
514
        namespace, taxonomyKey, queryParams, new GetMetadataTaxonomyNodesHeaders());
515
  }
516

517
  /**
518
   * Used to retrieve metadata taxonomy nodes based on the parameters specified. Results are sorted
519
   * in lexicographic order unless a `query` parameter is passed. With a `query` parameter
520
   * specified, results are sorted in order of relevance.
521
   *
522
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
523
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
524
   * @param headers Headers of getMetadataTaxonomyNodes method
525
   */
526
  public MetadataTaxonomyNodes getMetadataTaxonomyNodes(
527
      String namespace, String taxonomyKey, GetMetadataTaxonomyNodesHeaders headers) {
528
    return getMetadataTaxonomyNodes(
×
529
        namespace, taxonomyKey, new GetMetadataTaxonomyNodesQueryParams(), headers);
530
  }
531

532
  /**
533
   * Used to retrieve metadata taxonomy nodes based on the parameters specified. Results are sorted
534
   * in lexicographic order unless a `query` parameter is passed. With a `query` parameter
535
   * specified, results are sorted in order of relevance.
536
   *
537
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
538
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
539
   * @param queryParams Query parameters of getMetadataTaxonomyNodes method
540
   * @param headers Headers of getMetadataTaxonomyNodes method
541
   */
542
  public MetadataTaxonomyNodes getMetadataTaxonomyNodes(
543
      String namespace,
544
      String taxonomyKey,
545
      GetMetadataTaxonomyNodesQueryParams queryParams,
546
      GetMetadataTaxonomyNodesHeaders headers) {
547
    Map<String, String> queryParamsMap =
1✔
548
        prepareParams(
1✔
549
            mapOf(
1✔
550
                entryOf("level", convertToString(queryParams.getLevel())),
1✔
551
                entryOf("parent", convertToString(queryParams.getParent())),
1✔
552
                entryOf("ancestor", convertToString(queryParams.getAncestor())),
1✔
553
                entryOf("query", convertToString(queryParams.getQuery())),
1✔
554
                entryOf(
1✔
555
                    "include-total-result-count",
556
                    convertToString(queryParams.getIncludeTotalResultCount())),
1✔
557
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
558
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
559
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
560
    FetchResponse response =
1✔
561
        this.networkSession
562
            .getNetworkClient()
1✔
563
            .fetch(
1✔
564
                new FetchOptions.Builder(
565
                        String.join(
1✔
566
                            "",
567
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
568
                            "/2.0/metadata_taxonomies/",
569
                            convertToString(namespace),
1✔
570
                            "/",
571
                            convertToString(taxonomyKey),
1✔
572
                            "/nodes"),
573
                        "GET")
574
                    .params(queryParamsMap)
1✔
575
                    .headers(headersMap)
1✔
576
                    .responseFormat(ResponseFormat.JSON)
1✔
577
                    .auth(this.auth)
1✔
578
                    .networkSession(this.networkSession)
1✔
579
                    .build());
1✔
580
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNodes.class);
1✔
581
  }
582

583
  /**
584
   * Creates a new metadata taxonomy node.
585
   *
586
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
587
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
588
   * @param requestBody Request body of createMetadataTaxonomyNode method
589
   */
590
  public MetadataTaxonomyNode createMetadataTaxonomyNode(
591
      String namespace, String taxonomyKey, CreateMetadataTaxonomyNodeRequestBody requestBody) {
592
    return createMetadataTaxonomyNode(
1✔
593
        namespace, taxonomyKey, requestBody, new CreateMetadataTaxonomyNodeHeaders());
594
  }
595

596
  /**
597
   * Creates a new metadata taxonomy node.
598
   *
599
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
600
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
601
   * @param requestBody Request body of createMetadataTaxonomyNode method
602
   * @param headers Headers of createMetadataTaxonomyNode method
603
   */
604
  public MetadataTaxonomyNode createMetadataTaxonomyNode(
605
      String namespace,
606
      String taxonomyKey,
607
      CreateMetadataTaxonomyNodeRequestBody requestBody,
608
      CreateMetadataTaxonomyNodeHeaders headers) {
609
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
610
    FetchResponse response =
1✔
611
        this.networkSession
612
            .getNetworkClient()
1✔
613
            .fetch(
1✔
614
                new FetchOptions.Builder(
615
                        String.join(
1✔
616
                            "",
617
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
618
                            "/2.0/metadata_taxonomies/",
619
                            convertToString(namespace),
1✔
620
                            "/",
621
                            convertToString(taxonomyKey),
1✔
622
                            "/nodes"),
623
                        "POST")
624
                    .headers(headersMap)
1✔
625
                    .data(JsonManager.serialize(requestBody))
1✔
626
                    .contentType("application/json")
1✔
627
                    .responseFormat(ResponseFormat.JSON)
1✔
628
                    .auth(this.auth)
1✔
629
                    .networkSession(this.networkSession)
1✔
630
                    .build());
1✔
631
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNode.class);
1✔
632
  }
633

634
  /**
635
   * Retrieves a metadata taxonomy node by its identifier.
636
   *
637
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
638
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
639
   * @param nodeId The identifier of the metadata taxonomy node. Example:
640
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
641
   */
642
  public MetadataTaxonomyNode getMetadataTaxonomyNodeById(
643
      String namespace, String taxonomyKey, String nodeId) {
644
    return getMetadataTaxonomyNodeById(
1✔
645
        namespace, taxonomyKey, nodeId, new GetMetadataTaxonomyNodeByIdHeaders());
646
  }
647

648
  /**
649
   * Retrieves a metadata taxonomy node by its identifier.
650
   *
651
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
652
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
653
   * @param nodeId The identifier of the metadata taxonomy node. Example:
654
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
655
   * @param headers Headers of getMetadataTaxonomyNodeById method
656
   */
657
  public MetadataTaxonomyNode getMetadataTaxonomyNodeById(
658
      String namespace,
659
      String taxonomyKey,
660
      String nodeId,
661
      GetMetadataTaxonomyNodeByIdHeaders headers) {
662
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
663
    FetchResponse response =
1✔
664
        this.networkSession
665
            .getNetworkClient()
1✔
666
            .fetch(
1✔
667
                new FetchOptions.Builder(
668
                        String.join(
1✔
669
                            "",
670
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
671
                            "/2.0/metadata_taxonomies/",
672
                            convertToString(namespace),
1✔
673
                            "/",
674
                            convertToString(taxonomyKey),
1✔
675
                            "/nodes/",
676
                            convertToString(nodeId)),
1✔
677
                        "GET")
678
                    .headers(headersMap)
1✔
679
                    .responseFormat(ResponseFormat.JSON)
1✔
680
                    .auth(this.auth)
1✔
681
                    .networkSession(this.networkSession)
1✔
682
                    .build());
1✔
683
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNode.class);
1✔
684
  }
685

686
  /**
687
   * Updates an existing metadata taxonomy node.
688
   *
689
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
690
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
691
   * @param nodeId The identifier of the metadata taxonomy node. Example:
692
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
693
   */
694
  public MetadataTaxonomyNode updateMetadataTaxonomyNode(
695
      String namespace, String taxonomyKey, String nodeId) {
696
    return updateMetadataTaxonomyNode(
×
697
        namespace,
698
        taxonomyKey,
699
        nodeId,
700
        new UpdateMetadataTaxonomyNodeRequestBody(),
701
        new UpdateMetadataTaxonomyNodeHeaders());
702
  }
703

704
  /**
705
   * Updates an existing metadata taxonomy node.
706
   *
707
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
708
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
709
   * @param nodeId The identifier of the metadata taxonomy node. Example:
710
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
711
   * @param requestBody Request body of updateMetadataTaxonomyNode method
712
   */
713
  public MetadataTaxonomyNode updateMetadataTaxonomyNode(
714
      String namespace,
715
      String taxonomyKey,
716
      String nodeId,
717
      UpdateMetadataTaxonomyNodeRequestBody requestBody) {
718
    return updateMetadataTaxonomyNode(
1✔
719
        namespace, taxonomyKey, nodeId, requestBody, new UpdateMetadataTaxonomyNodeHeaders());
720
  }
721

722
  /**
723
   * Updates an existing metadata taxonomy node.
724
   *
725
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
726
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
727
   * @param nodeId The identifier of the metadata taxonomy node. Example:
728
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
729
   * @param headers Headers of updateMetadataTaxonomyNode method
730
   */
731
  public MetadataTaxonomyNode updateMetadataTaxonomyNode(
732
      String namespace,
733
      String taxonomyKey,
734
      String nodeId,
735
      UpdateMetadataTaxonomyNodeHeaders headers) {
736
    return updateMetadataTaxonomyNode(
×
737
        namespace, taxonomyKey, nodeId, new UpdateMetadataTaxonomyNodeRequestBody(), headers);
738
  }
739

740
  /**
741
   * Updates an existing metadata taxonomy node.
742
   *
743
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
744
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
745
   * @param nodeId The identifier of the metadata taxonomy node. Example:
746
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
747
   * @param requestBody Request body of updateMetadataTaxonomyNode method
748
   * @param headers Headers of updateMetadataTaxonomyNode method
749
   */
750
  public MetadataTaxonomyNode updateMetadataTaxonomyNode(
751
      String namespace,
752
      String taxonomyKey,
753
      String nodeId,
754
      UpdateMetadataTaxonomyNodeRequestBody requestBody,
755
      UpdateMetadataTaxonomyNodeHeaders headers) {
756
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
757
    FetchResponse response =
1✔
758
        this.networkSession
759
            .getNetworkClient()
1✔
760
            .fetch(
1✔
761
                new FetchOptions.Builder(
762
                        String.join(
1✔
763
                            "",
764
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
765
                            "/2.0/metadata_taxonomies/",
766
                            convertToString(namespace),
1✔
767
                            "/",
768
                            convertToString(taxonomyKey),
1✔
769
                            "/nodes/",
770
                            convertToString(nodeId)),
1✔
771
                        "PATCH")
772
                    .headers(headersMap)
1✔
773
                    .data(JsonManager.serialize(requestBody))
1✔
774
                    .contentType("application/json")
1✔
775
                    .responseFormat(ResponseFormat.JSON)
1✔
776
                    .auth(this.auth)
1✔
777
                    .networkSession(this.networkSession)
1✔
778
                    .build());
1✔
779
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNode.class);
1✔
780
  }
781

782
  /**
783
   * Delete a metadata taxonomy node. This deletion is permanent and cannot be reverted. Only
784
   * metadata taxonomy nodes without any children can be deleted.
785
   *
786
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
787
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
788
   * @param nodeId The identifier of the metadata taxonomy node. Example:
789
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
790
   */
791
  public void deleteMetadataTaxonomyNode(String namespace, String taxonomyKey, String nodeId) {
792
    deleteMetadataTaxonomyNode(
1✔
793
        namespace, taxonomyKey, nodeId, new DeleteMetadataTaxonomyNodeHeaders());
794
  }
1✔
795

796
  /**
797
   * Delete a metadata taxonomy node. This deletion is permanent and cannot be reverted. Only
798
   * metadata taxonomy nodes without any children can be deleted.
799
   *
800
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
801
   * @param taxonomyKey The key of the metadata taxonomy. Example: "geography"
802
   * @param nodeId The identifier of the metadata taxonomy node. Example:
803
   *     "14d3d433-c77f-49c5-b146-9dea370f6e32"
804
   * @param headers Headers of deleteMetadataTaxonomyNode method
805
   */
806
  public void deleteMetadataTaxonomyNode(
807
      String namespace,
808
      String taxonomyKey,
809
      String nodeId,
810
      DeleteMetadataTaxonomyNodeHeaders headers) {
811
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
812
    FetchResponse response =
1✔
813
        this.networkSession
814
            .getNetworkClient()
1✔
815
            .fetch(
1✔
816
                new FetchOptions.Builder(
817
                        String.join(
1✔
818
                            "",
819
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
820
                            "/2.0/metadata_taxonomies/",
821
                            convertToString(namespace),
1✔
822
                            "/",
823
                            convertToString(taxonomyKey),
1✔
824
                            "/nodes/",
825
                            convertToString(nodeId)),
1✔
826
                        "DELETE")
827
                    .headers(headersMap)
1✔
828
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
829
                    .auth(this.auth)
1✔
830
                    .networkSession(this.networkSession)
1✔
831
                    .build());
1✔
832
  }
1✔
833

834
  /**
835
   * Used to retrieve metadata taxonomy nodes which are available for the taxonomy field based on
836
   * its configuration and the parameters specified. Results are sorted in lexicographic order
837
   * unless a `query` parameter is passed. With a `query` parameter specified, results are sorted in
838
   * order of relevance.
839
   *
840
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
841
   * @param templateKey The name of the metadata template. Example: "properties"
842
   * @param fieldKey The key of the metadata taxonomy field in the template. Example: "geography"
843
   */
844
  public MetadataTaxonomyNodes getMetadataTemplateFieldOptions(
845
      String namespace, String templateKey, String fieldKey) {
846
    return getMetadataTemplateFieldOptions(
1✔
847
        namespace,
848
        templateKey,
849
        fieldKey,
850
        new GetMetadataTemplateFieldOptionsQueryParams(),
851
        new GetMetadataTemplateFieldOptionsHeaders());
852
  }
853

854
  /**
855
   * Used to retrieve metadata taxonomy nodes which are available for the taxonomy field based on
856
   * its configuration and the parameters specified. Results are sorted in lexicographic order
857
   * unless a `query` parameter is passed. With a `query` parameter specified, results are sorted in
858
   * order of relevance.
859
   *
860
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
861
   * @param templateKey The name of the metadata template. Example: "properties"
862
   * @param fieldKey The key of the metadata taxonomy field in the template. Example: "geography"
863
   * @param queryParams Query parameters of getMetadataTemplateFieldOptions method
864
   */
865
  public MetadataTaxonomyNodes getMetadataTemplateFieldOptions(
866
      String namespace,
867
      String templateKey,
868
      String fieldKey,
869
      GetMetadataTemplateFieldOptionsQueryParams queryParams) {
870
    return getMetadataTemplateFieldOptions(
×
871
        namespace,
872
        templateKey,
873
        fieldKey,
874
        queryParams,
875
        new GetMetadataTemplateFieldOptionsHeaders());
876
  }
877

878
  /**
879
   * Used to retrieve metadata taxonomy nodes which are available for the taxonomy field based on
880
   * its configuration and the parameters specified. Results are sorted in lexicographic order
881
   * unless a `query` parameter is passed. With a `query` parameter specified, results are sorted in
882
   * order of relevance.
883
   *
884
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
885
   * @param templateKey The name of the metadata template. Example: "properties"
886
   * @param fieldKey The key of the metadata taxonomy field in the template. Example: "geography"
887
   * @param headers Headers of getMetadataTemplateFieldOptions method
888
   */
889
  public MetadataTaxonomyNodes getMetadataTemplateFieldOptions(
890
      String namespace,
891
      String templateKey,
892
      String fieldKey,
893
      GetMetadataTemplateFieldOptionsHeaders headers) {
UNCOV
894
    return getMetadataTemplateFieldOptions(
×
895
        namespace,
896
        templateKey,
897
        fieldKey,
898
        new GetMetadataTemplateFieldOptionsQueryParams(),
899
        headers);
900
  }
901

902
  /**
903
   * Used to retrieve metadata taxonomy nodes which are available for the taxonomy field based on
904
   * its configuration and the parameters specified. Results are sorted in lexicographic order
905
   * unless a `query` parameter is passed. With a `query` parameter specified, results are sorted in
906
   * order of relevance.
907
   *
908
   * @param namespace The namespace of the metadata taxonomy. Example: "enterprise_123456"
909
   * @param templateKey The name of the metadata template. Example: "properties"
910
   * @param fieldKey The key of the metadata taxonomy field in the template. Example: "geography"
911
   * @param queryParams Query parameters of getMetadataTemplateFieldOptions method
912
   * @param headers Headers of getMetadataTemplateFieldOptions method
913
   */
914
  public MetadataTaxonomyNodes getMetadataTemplateFieldOptions(
915
      String namespace,
916
      String templateKey,
917
      String fieldKey,
918
      GetMetadataTemplateFieldOptionsQueryParams queryParams,
919
      GetMetadataTemplateFieldOptionsHeaders headers) {
920
    Map<String, String> queryParamsMap =
1✔
921
        prepareParams(
1✔
922
            mapOf(
1✔
923
                entryOf("level", convertToString(queryParams.getLevel())),
1✔
924
                entryOf("parent", convertToString(queryParams.getParent())),
1✔
925
                entryOf("ancestor", convertToString(queryParams.getAncestor())),
1✔
926
                entryOf("query", convertToString(queryParams.getQuery())),
1✔
927
                entryOf(
1✔
928
                    "include-total-result-count",
929
                    convertToString(queryParams.getIncludeTotalResultCount())),
1✔
930
                entryOf(
1✔
931
                    "only-selectable-options",
932
                    convertToString(queryParams.getOnlySelectableOptions())),
1✔
933
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
934
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
935
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
936
    FetchResponse response =
1✔
937
        this.networkSession
938
            .getNetworkClient()
1✔
939
            .fetch(
1✔
940
                new FetchOptions.Builder(
941
                        String.join(
1✔
942
                            "",
943
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
944
                            "/2.0/metadata_templates/",
945
                            convertToString(namespace),
1✔
946
                            "/",
947
                            convertToString(templateKey),
1✔
948
                            "/fields/",
949
                            convertToString(fieldKey),
1✔
950
                            "/options"),
951
                        "GET")
952
                    .params(queryParamsMap)
1✔
953
                    .headers(headersMap)
1✔
954
                    .responseFormat(ResponseFormat.JSON)
1✔
955
                    .auth(this.auth)
1✔
956
                    .networkSession(this.networkSession)
1✔
957
                    .build());
1✔
958
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNodes.class);
1✔
959
  }
960

961
  public Authentication getAuth() {
UNCOV
962
    return auth;
×
963
  }
964

965
  public NetworkSession getNetworkSession() {
UNCOV
966
    return networkSession;
×
967
  }
968

969
  public static class Builder {
970

971
    protected Authentication auth;
972

973
    protected NetworkSession networkSession;
974

975
    public Builder() {
1✔
976
      this.networkSession = new NetworkSession();
1✔
977
    }
1✔
978

979
    public Builder auth(Authentication auth) {
980
      this.auth = auth;
1✔
981
      return this;
1✔
982
    }
983

984
    public Builder networkSession(NetworkSession networkSession) {
985
      this.networkSession = networkSession;
1✔
986
      return this;
1✔
987
    }
988

989
    public MetadataTaxonomiesManager build() {
990
      return new MetadataTaxonomiesManager(this);
1✔
991
    }
992
  }
993
}
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