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

box / box-java-sdk / #5076

07 Oct 2025 12:35PM UTC coverage: 37.132% (+0.007%) from 37.125%
#5076

push

github

web-flow
test: Change `Event.additionalDetails` field assertion in events test (box/box-codegen#858) (#1491)

18454 of 49699 relevant lines covered (37.13%)

0.37 hits per line

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

53.33
/src/main/java/com/box/sdkgen/managers/classifications/ClassificationsManager.java
1
package com.box.sdkgen.managers.classifications;
2

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

7
import com.box.sdkgen.networking.auth.Authentication;
8
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
9
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
10
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
11
import com.box.sdkgen.networking.network.NetworkSession;
12
import com.box.sdkgen.schemas.classificationtemplate.ClassificationTemplate;
13
import com.box.sdkgen.serialization.json.JsonManager;
14
import java.util.List;
15
import java.util.Map;
16

17
public class ClassificationsManager {
18

19
  public Authentication auth;
20

21
  public NetworkSession networkSession;
22

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

27
  protected ClassificationsManager(Builder builder) {
1✔
28
    this.auth = builder.auth;
1✔
29
    this.networkSession = builder.networkSession;
1✔
30
  }
1✔
31

32
  /**
33
   * Retrieves the classification metadata template and lists all the classifications available to
34
   * this enterprise.
35
   *
36
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
37
   * example `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
38
   */
39
  public ClassificationTemplate getClassificationTemplate() {
40
    return getClassificationTemplate(new GetClassificationTemplateHeaders());
1✔
41
  }
42

43
  /**
44
   * Retrieves the classification metadata template and lists all the classifications available to
45
   * this enterprise.
46
   *
47
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
48
   * example `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
49
   *
50
   * @param headers Headers of getClassificationTemplate method
51
   */
52
  public ClassificationTemplate getClassificationTemplate(
53
      GetClassificationTemplateHeaders headers) {
54
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
55
    FetchResponse response =
1✔
56
        this.networkSession
57
            .getNetworkClient()
1✔
58
            .fetch(
1✔
59
                new FetchOptions.Builder(
60
                        String.join(
1✔
61
                            "",
62
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
63
                            "/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema"),
64
                        "GET")
65
                    .headers(headersMap)
1✔
66
                    .responseFormat(ResponseFormat.JSON)
1✔
67
                    .auth(this.auth)
1✔
68
                    .networkSession(this.networkSession)
1✔
69
                    .build());
1✔
70
    return JsonManager.deserialize(response.getData(), ClassificationTemplate.class);
1✔
71
  }
72

73
  /**
74
   * Adds one or more new classifications to the list of classifications available to the
75
   * enterprise.
76
   *
77
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
78
   * example `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
79
   *
80
   * @param requestBody Request body of addClassification method
81
   */
82
  public ClassificationTemplate addClassification(List<AddClassificationRequestBody> requestBody) {
83
    return addClassification(requestBody, new AddClassificationHeaders());
×
84
  }
85

86
  /**
87
   * Adds one or more new classifications to the list of classifications available to the
88
   * enterprise.
89
   *
90
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
91
   * example `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
92
   *
93
   * @param requestBody Request body of addClassification method
94
   * @param headers Headers of addClassification method
95
   */
96
  public ClassificationTemplate addClassification(
97
      List<AddClassificationRequestBody> requestBody, AddClassificationHeaders headers) {
98
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
99
    FetchResponse response =
×
100
        this.networkSession
101
            .getNetworkClient()
×
102
            .fetch(
×
103
                new FetchOptions.Builder(
104
                        String.join(
×
105
                            "",
106
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
107
                            "/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#add"),
108
                        "PUT")
109
                    .headers(headersMap)
×
110
                    .data(JsonManager.serialize(requestBody))
×
111
                    .contentType("application/json")
×
112
                    .responseFormat(ResponseFormat.JSON)
×
113
                    .auth(this.auth)
×
114
                    .networkSession(this.networkSession)
×
115
                    .build());
×
116
    return JsonManager.deserialize(response.getData(), ClassificationTemplate.class);
×
117
  }
118

119
  /**
120
   * Updates the labels and descriptions of one or more classifications available to the enterprise.
121
   *
122
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
123
   * example `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
124
   *
125
   * @param requestBody Request body of updateClassification method
126
   */
127
  public ClassificationTemplate updateClassification(
128
      List<UpdateClassificationRequestBody> requestBody) {
129
    return updateClassification(requestBody, new UpdateClassificationHeaders());
1✔
130
  }
131

132
  /**
133
   * Updates the labels and descriptions of one or more classifications available to the enterprise.
134
   *
135
   * <p>This API can also be called by including the enterprise ID in the URL explicitly, for
136
   * example `/metadata_templates/enterprise_12345/securityClassification-6VMVochwUWo/schema`.
137
   *
138
   * @param requestBody Request body of updateClassification method
139
   * @param headers Headers of updateClassification method
140
   */
141
  public ClassificationTemplate updateClassification(
142
      List<UpdateClassificationRequestBody> requestBody, UpdateClassificationHeaders headers) {
143
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
144
    FetchResponse response =
1✔
145
        this.networkSession
146
            .getNetworkClient()
1✔
147
            .fetch(
1✔
148
                new FetchOptions.Builder(
149
                        String.join(
1✔
150
                            "",
151
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
152
                            "/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema#update"),
153
                        "PUT")
154
                    .headers(headersMap)
1✔
155
                    .data(JsonManager.serialize(requestBody))
1✔
156
                    .contentType("application/json-patch+json")
1✔
157
                    .responseFormat(ResponseFormat.JSON)
1✔
158
                    .auth(this.auth)
1✔
159
                    .networkSession(this.networkSession)
1✔
160
                    .build());
1✔
161
    return JsonManager.deserialize(response.getData(), ClassificationTemplate.class);
1✔
162
  }
163

164
  /**
165
   * When an enterprise does not yet have any classifications, this API call initializes the
166
   * classification template with an initial set of classifications.
167
   *
168
   * <p>If an enterprise already has a classification, the template will already exist and instead
169
   * an API call should be made to add additional classifications.
170
   *
171
   * @param requestBody Request body of createClassificationTemplate method
172
   */
173
  public ClassificationTemplate createClassificationTemplate(
174
      CreateClassificationTemplateRequestBody requestBody) {
175
    return createClassificationTemplate(requestBody, new CreateClassificationTemplateHeaders());
×
176
  }
177

178
  /**
179
   * When an enterprise does not yet have any classifications, this API call initializes the
180
   * classification template with an initial set of classifications.
181
   *
182
   * <p>If an enterprise already has a classification, the template will already exist and instead
183
   * an API call should be made to add additional classifications.
184
   *
185
   * @param requestBody Request body of createClassificationTemplate method
186
   * @param headers Headers of createClassificationTemplate method
187
   */
188
  public ClassificationTemplate createClassificationTemplate(
189
      CreateClassificationTemplateRequestBody requestBody,
190
      CreateClassificationTemplateHeaders headers) {
191
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
192
    FetchResponse response =
×
193
        this.networkSession
194
            .getNetworkClient()
×
195
            .fetch(
×
196
                new FetchOptions.Builder(
197
                        String.join(
×
198
                            "",
199
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
200
                            "/2.0/metadata_templates/schema#classifications"),
201
                        "POST")
202
                    .headers(headersMap)
×
203
                    .data(JsonManager.serialize(requestBody))
×
204
                    .contentType("application/json")
×
205
                    .responseFormat(ResponseFormat.JSON)
×
206
                    .auth(this.auth)
×
207
                    .networkSession(this.networkSession)
×
208
                    .build());
×
209
    return JsonManager.deserialize(response.getData(), ClassificationTemplate.class);
×
210
  }
211

212
  public Authentication getAuth() {
213
    return auth;
×
214
  }
215

216
  public NetworkSession getNetworkSession() {
217
    return networkSession;
×
218
  }
219

220
  public static class Builder {
221

222
    protected Authentication auth;
223

224
    protected NetworkSession networkSession;
225

226
    public Builder() {
1✔
227
      this.networkSession = new NetworkSession();
1✔
228
    }
1✔
229

230
    public Builder auth(Authentication auth) {
231
      this.auth = auth;
1✔
232
      return this;
1✔
233
    }
234

235
    public Builder networkSession(NetworkSession networkSession) {
236
      this.networkSession = networkSession;
1✔
237
      return this;
1✔
238
    }
239

240
    public ClassificationsManager build() {
241
      return new ClassificationsManager(this);
1✔
242
    }
243
  }
244
}
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