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

box / box-java-sdk / #5943

18 Dec 2025 07:58PM UTC coverage: 12.907% (+0.01%) from 12.895%
#5943

push

github

web-flow
test(boxsdkgen): Update Metadata Taxonomies tests (box/box-codegen#909) (#1651)

0 of 8 new or added lines in 3 files covered. (0.0%)

17 existing lines in 10 files now uncovered.

8374 of 64880 relevant lines covered (12.91%)

0.13 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/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) {
×
35
    this.auth = builder.auth;
×
36
    this.networkSession = builder.networkSession;
×
37
  }
×
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());
×
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()));
×
57
    FetchResponse response =
×
58
        this.networkSession
59
            .getNetworkClient()
×
60
            .fetch(
×
61
                new FetchOptions.Builder(
62
                        String.join(
×
63
                            "",
64
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
65
                            "/2.0/metadata_taxonomies"),
66
                        "POST")
67
                    .headers(headersMap)
×
68
                    .data(JsonManager.serialize(requestBody))
×
69
                    .contentType("application/json")
×
70
                    .responseFormat(ResponseFormat.JSON)
×
71
                    .auth(this.auth)
×
72
                    .networkSession(this.networkSession)
×
73
                    .build());
×
74
    return JsonManager.deserialize(response.getData(), MetadataTaxonomy.class);
×
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(
×
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 =
×
121
        prepareParams(
×
122
            mapOf(
×
123
                entryOf("marker", convertToString(queryParams.getMarker())),
×
124
                entryOf("limit", convertToString(queryParams.getLimit()))));
×
125
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
126
    FetchResponse response =
×
127
        this.networkSession
128
            .getNetworkClient()
×
129
            .fetch(
×
130
                new FetchOptions.Builder(
131
                        String.join(
×
132
                            "",
133
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
134
                            "/2.0/metadata_taxonomies/",
135
                            convertToString(namespace)),
×
136
                        "GET")
137
                    .params(queryParamsMap)
×
138
                    .headers(headersMap)
×
139
                    .responseFormat(ResponseFormat.JSON)
×
140
                    .auth(this.auth)
×
141
                    .networkSession(this.networkSession)
×
142
                    .build());
×
143
    return JsonManager.deserialize(response.getData(), MetadataTaxonomies.class);
×
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());
×
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()));
×
166
    FetchResponse response =
×
167
        this.networkSession
168
            .getNetworkClient()
×
169
            .fetch(
×
170
                new FetchOptions.Builder(
171
                        String.join(
×
172
                            "",
173
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
174
                            "/2.0/metadata_taxonomies/",
175
                            convertToString(namespace),
×
176
                            "/",
177
                            convertToString(taxonomyKey)),
×
178
                        "GET")
179
                    .headers(headersMap)
×
180
                    .responseFormat(ResponseFormat.JSON)
×
181
                    .auth(this.auth)
×
182
                    .networkSession(this.networkSession)
×
183
                    .build());
×
184
    return JsonManager.deserialize(response.getData(), MetadataTaxonomy.class);
×
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(
×
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()));
×
214
    FetchResponse response =
×
215
        this.networkSession
216
            .getNetworkClient()
×
217
            .fetch(
×
218
                new FetchOptions.Builder(
219
                        String.join(
×
220
                            "",
221
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
222
                            "/2.0/metadata_taxonomies/",
223
                            convertToString(namespace),
×
224
                            "/",
225
                            convertToString(taxonomyKey)),
×
226
                        "PATCH")
227
                    .headers(headersMap)
×
228
                    .data(JsonManager.serialize(requestBody))
×
229
                    .contentType("application/json")
×
230
                    .responseFormat(ResponseFormat.JSON)
×
231
                    .auth(this.auth)
×
232
                    .networkSession(this.networkSession)
×
233
                    .build());
×
234
    return JsonManager.deserialize(response.getData(), MetadataTaxonomy.class);
×
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());
×
245
  }
×
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()));
×
257
    FetchResponse response =
×
258
        this.networkSession
259
            .getNetworkClient()
×
260
            .fetch(
×
261
                new FetchOptions.Builder(
262
                        String.join(
×
263
                            "",
264
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
265
                            "/2.0/metadata_taxonomies/",
266
                            convertToString(namespace),
×
267
                            "/",
268
                            convertToString(taxonomyKey)),
×
269
                        "DELETE")
270
                    .headers(headersMap)
×
271
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
272
                    .auth(this.auth)
×
273
                    .networkSession(this.networkSession)
×
274
                    .build());
×
275
  }
×
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(
×
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()));
×
304
    FetchResponse response =
×
305
        this.networkSession
306
            .getNetworkClient()
×
307
            .fetch(
×
308
                new FetchOptions.Builder(
309
                        String.join(
×
310
                            "",
311
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
312
                            "/2.0/metadata_taxonomies/",
313
                            convertToString(namespace),
×
314
                            "/",
315
                            convertToString(taxonomyKey),
×
316
                            "/levels"),
317
                        "POST")
318
                    .headers(headersMap)
×
319
                    .data(JsonManager.serialize(requestBody))
×
320
                    .contentType("application/json")
×
321
                    .responseFormat(ResponseFormat.JSON)
×
322
                    .auth(this.auth)
×
323
                    .networkSession(this.networkSession)
×
324
                    .build());
×
325
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevels.class);
×
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) {
NEW
341
    return updateMetadataTaxonomyLevelById(
×
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()));
×
365
    FetchResponse response =
×
366
        this.networkSession
367
            .getNetworkClient()
×
368
            .fetch(
×
369
                new FetchOptions.Builder(
370
                        String.join(
×
371
                            "",
372
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
373
                            "/2.0/metadata_taxonomies/",
374
                            convertToString(namespace),
×
375
                            "/",
376
                            convertToString(taxonomyKey),
×
377
                            "/levels/",
378
                            convertToString(levelIndex)),
×
379
                        "PATCH")
380
                    .headers(headersMap)
×
381
                    .data(JsonManager.serialize(requestBody))
×
382
                    .contentType("application/json")
×
383
                    .responseFormat(ResponseFormat.JSON)
×
384
                    .auth(this.auth)
×
385
                    .networkSession(this.networkSession)
×
386
                    .build());
×
387
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevel.class);
×
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(
×
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()));
×
419
    FetchResponse response =
×
420
        this.networkSession
421
            .getNetworkClient()
×
422
            .fetch(
×
423
                new FetchOptions.Builder(
424
                        String.join(
×
425
                            "",
426
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
427
                            "/2.0/metadata_taxonomies/",
428
                            convertToString(namespace),
×
429
                            "/",
430
                            convertToString(taxonomyKey),
×
431
                            "/levels:append"),
432
                        "POST")
433
                    .headers(headersMap)
×
434
                    .data(JsonManager.serialize(requestBody))
×
435
                    .contentType("application/json")
×
436
                    .responseFormat(ResponseFormat.JSON)
×
437
                    .auth(this.auth)
×
438
                    .networkSession(this.networkSession)
×
439
                    .build());
×
440
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevels.class);
×
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(
×
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()));
×
464
    FetchResponse response =
×
465
        this.networkSession
466
            .getNetworkClient()
×
467
            .fetch(
×
468
                new FetchOptions.Builder(
469
                        String.join(
×
470
                            "",
471
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
472
                            "/2.0/metadata_taxonomies/",
473
                            convertToString(namespace),
×
474
                            "/",
475
                            convertToString(taxonomyKey),
×
476
                            "/levels:trim"),
477
                        "POST")
478
                    .headers(headersMap)
×
479
                    .responseFormat(ResponseFormat.JSON)
×
480
                    .auth(this.auth)
×
481
                    .networkSession(this.networkSession)
×
482
                    .build());
×
483
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyLevels.class);
×
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(
×
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 =
×
548
        prepareParams(
×
549
            mapOf(
×
550
                entryOf("level", convertToString(queryParams.getLevel())),
×
551
                entryOf("parent", convertToString(queryParams.getParent())),
×
552
                entryOf("ancestor", convertToString(queryParams.getAncestor())),
×
553
                entryOf("query", convertToString(queryParams.getQuery())),
×
554
                entryOf(
×
555
                    "include-total-result-count",
556
                    convertToString(queryParams.getIncludeTotalResultCount())),
×
557
                entryOf("marker", convertToString(queryParams.getMarker())),
×
558
                entryOf("limit", convertToString(queryParams.getLimit()))));
×
559
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
560
    FetchResponse response =
×
561
        this.networkSession
562
            .getNetworkClient()
×
563
            .fetch(
×
564
                new FetchOptions.Builder(
565
                        String.join(
×
566
                            "",
567
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
568
                            "/2.0/metadata_taxonomies/",
569
                            convertToString(namespace),
×
570
                            "/",
571
                            convertToString(taxonomyKey),
×
572
                            "/nodes"),
573
                        "GET")
574
                    .params(queryParamsMap)
×
575
                    .headers(headersMap)
×
576
                    .responseFormat(ResponseFormat.JSON)
×
577
                    .auth(this.auth)
×
578
                    .networkSession(this.networkSession)
×
579
                    .build());
×
580
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNodes.class);
×
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(
×
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()));
×
610
    FetchResponse response =
×
611
        this.networkSession
612
            .getNetworkClient()
×
613
            .fetch(
×
614
                new FetchOptions.Builder(
615
                        String.join(
×
616
                            "",
617
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
618
                            "/2.0/metadata_taxonomies/",
619
                            convertToString(namespace),
×
620
                            "/",
621
                            convertToString(taxonomyKey),
×
622
                            "/nodes"),
623
                        "POST")
624
                    .headers(headersMap)
×
625
                    .data(JsonManager.serialize(requestBody))
×
626
                    .contentType("application/json")
×
627
                    .responseFormat(ResponseFormat.JSON)
×
628
                    .auth(this.auth)
×
629
                    .networkSession(this.networkSession)
×
630
                    .build());
×
631
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNode.class);
×
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(
×
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()));
×
663
    FetchResponse response =
×
664
        this.networkSession
665
            .getNetworkClient()
×
666
            .fetch(
×
667
                new FetchOptions.Builder(
668
                        String.join(
×
669
                            "",
670
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
671
                            "/2.0/metadata_taxonomies/",
672
                            convertToString(namespace),
×
673
                            "/",
674
                            convertToString(taxonomyKey),
×
675
                            "/nodes/",
676
                            convertToString(nodeId)),
×
677
                        "GET")
678
                    .headers(headersMap)
×
679
                    .responseFormat(ResponseFormat.JSON)
×
680
                    .auth(this.auth)
×
681
                    .networkSession(this.networkSession)
×
682
                    .build());
×
683
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNode.class);
×
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(
×
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()));
×
757
    FetchResponse response =
×
758
        this.networkSession
759
            .getNetworkClient()
×
760
            .fetch(
×
761
                new FetchOptions.Builder(
762
                        String.join(
×
763
                            "",
764
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
765
                            "/2.0/metadata_taxonomies/",
766
                            convertToString(namespace),
×
767
                            "/",
768
                            convertToString(taxonomyKey),
×
769
                            "/nodes/",
770
                            convertToString(nodeId)),
×
771
                        "PATCH")
772
                    .headers(headersMap)
×
773
                    .data(JsonManager.serialize(requestBody))
×
774
                    .contentType("application/json")
×
775
                    .responseFormat(ResponseFormat.JSON)
×
776
                    .auth(this.auth)
×
777
                    .networkSession(this.networkSession)
×
778
                    .build());
×
779
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNode.class);
×
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(
×
793
        namespace, taxonomyKey, nodeId, new DeleteMetadataTaxonomyNodeHeaders());
794
  }
×
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()));
×
812
    FetchResponse response =
×
813
        this.networkSession
814
            .getNetworkClient()
×
815
            .fetch(
×
816
                new FetchOptions.Builder(
817
                        String.join(
×
818
                            "",
819
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
820
                            "/2.0/metadata_taxonomies/",
821
                            convertToString(namespace),
×
822
                            "/",
823
                            convertToString(taxonomyKey),
×
824
                            "/nodes/",
825
                            convertToString(nodeId)),
×
826
                        "DELETE")
827
                    .headers(headersMap)
×
828
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
829
                    .auth(this.auth)
×
830
                    .networkSession(this.networkSession)
×
831
                    .build());
×
832
  }
×
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(
×
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) {
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 =
×
921
        prepareParams(
×
922
            mapOf(
×
923
                entryOf("level", convertToString(queryParams.getLevel())),
×
924
                entryOf("parent", convertToString(queryParams.getParent())),
×
925
                entryOf("ancestor", convertToString(queryParams.getAncestor())),
×
926
                entryOf("query", convertToString(queryParams.getQuery())),
×
927
                entryOf(
×
928
                    "include-total-result-count",
929
                    convertToString(queryParams.getIncludeTotalResultCount())),
×
930
                entryOf(
×
931
                    "only-selectable-options",
932
                    convertToString(queryParams.getOnlySelectableOptions())),
×
933
                entryOf("marker", convertToString(queryParams.getMarker())),
×
934
                entryOf("limit", convertToString(queryParams.getLimit()))));
×
935
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
936
    FetchResponse response =
×
937
        this.networkSession
938
            .getNetworkClient()
×
939
            .fetch(
×
940
                new FetchOptions.Builder(
941
                        String.join(
×
942
                            "",
943
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
944
                            "/2.0/metadata_templates/",
NEW
945
                            convertToString(namespace),
×
946
                            "/",
947
                            convertToString(templateKey),
×
948
                            "/fields/",
949
                            convertToString(fieldKey),
×
950
                            "/options"),
951
                        "GET")
952
                    .params(queryParamsMap)
×
953
                    .headers(headersMap)
×
954
                    .responseFormat(ResponseFormat.JSON)
×
955
                    .auth(this.auth)
×
956
                    .networkSession(this.networkSession)
×
957
                    .build());
×
958
    return JsonManager.deserialize(response.getData(), MetadataTaxonomyNodes.class);
×
959
  }
960

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

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

969
  public static class Builder {
970

971
    protected Authentication auth;
972

973
    protected NetworkSession networkSession;
974

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

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

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

989
    public MetadataTaxonomiesManager build() {
990
      return new MetadataTaxonomiesManager(this);
×
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