• 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

76.84
/src/main/java/com/box/sdkgen/managers/skills/SkillsManager.java
1
package com.box.sdkgen.managers.skills;
2

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

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

18
public class SkillsManager {
19

20
  public Authentication auth;
21

22
  public NetworkSession networkSession;
23

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

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

33
  /**
34
   * List the Box Skills metadata cards that are attached to a file.
35
   *
36
   * @param fileId The unique identifier that represents a file.
37
   *     <p>The ID for any file can be determined by visiting a file in the web application and
38
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
39
   *     `file_id` is `123`. Example: "12345"
40
   */
41
  public SkillCardsMetadata getBoxSkillCardsOnFile(String fileId) {
42
    return getBoxSkillCardsOnFile(fileId, new GetBoxSkillCardsOnFileHeaders());
1✔
43
  }
44

45
  /**
46
   * List the Box Skills metadata cards that are attached to a file.
47
   *
48
   * @param fileId The unique identifier that represents a file.
49
   *     <p>The ID for any file can be determined by visiting a file in the web application and
50
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
51
   *     `file_id` is `123`. Example: "12345"
52
   * @param headers Headers of getBoxSkillCardsOnFile method
53
   */
54
  public SkillCardsMetadata getBoxSkillCardsOnFile(
55
      String fileId, GetBoxSkillCardsOnFileHeaders 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/files/",
66
                            convertToString(fileId),
1✔
67
                            "/metadata/global/boxSkillsCards"),
68
                        "GET")
69
                    .headers(headersMap)
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(), SkillCardsMetadata.class);
1✔
75
  }
76

77
  /**
78
   * Applies one or more Box Skills metadata cards to a file.
79
   *
80
   * @param fileId The unique identifier that represents a file.
81
   *     <p>The ID for any file can be determined by visiting a file in the web application and
82
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
83
   *     `file_id` is `123`. Example: "12345"
84
   * @param requestBody Request body of createBoxSkillCardsOnFile method
85
   */
86
  public SkillCardsMetadata createBoxSkillCardsOnFile(
87
      String fileId, CreateBoxSkillCardsOnFileRequestBody requestBody) {
88
    return createBoxSkillCardsOnFile(fileId, requestBody, new CreateBoxSkillCardsOnFileHeaders());
1✔
89
  }
90

91
  /**
92
   * Applies one or more Box Skills metadata cards to a file.
93
   *
94
   * @param fileId The unique identifier that represents a file.
95
   *     <p>The ID for any file can be determined by visiting a file in the web application and
96
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
97
   *     `file_id` is `123`. Example: "12345"
98
   * @param requestBody Request body of createBoxSkillCardsOnFile method
99
   * @param headers Headers of createBoxSkillCardsOnFile method
100
   */
101
  public SkillCardsMetadata createBoxSkillCardsOnFile(
102
      String fileId,
103
      CreateBoxSkillCardsOnFileRequestBody requestBody,
104
      CreateBoxSkillCardsOnFileHeaders headers) {
105
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
106
    FetchResponse response =
1✔
107
        this.networkSession
108
            .getNetworkClient()
1✔
109
            .fetch(
1✔
110
                new FetchOptions.Builder(
111
                        String.join(
1✔
112
                            "",
113
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
114
                            "/2.0/files/",
115
                            convertToString(fileId),
1✔
116
                            "/metadata/global/boxSkillsCards"),
117
                        "POST")
118
                    .headers(headersMap)
1✔
119
                    .data(JsonManager.serialize(requestBody))
1✔
120
                    .contentType("application/json")
1✔
121
                    .responseFormat(ResponseFormat.JSON)
1✔
122
                    .auth(this.auth)
1✔
123
                    .networkSession(this.networkSession)
1✔
124
                    .build());
1✔
125
    return JsonManager.deserialize(response.getData(), SkillCardsMetadata.class);
1✔
126
  }
127

128
  /**
129
   * Updates one or more Box Skills metadata cards to a file.
130
   *
131
   * @param fileId The unique identifier that represents a file.
132
   *     <p>The ID for any file can be determined by visiting a file in the web application and
133
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
134
   *     `file_id` is `123`. Example: "12345"
135
   * @param requestBody Request body of updateBoxSkillCardsOnFile method
136
   */
137
  public SkillCardsMetadata updateBoxSkillCardsOnFile(
138
      String fileId, List<UpdateBoxSkillCardsOnFileRequestBody> requestBody) {
139
    return updateBoxSkillCardsOnFile(fileId, requestBody, new UpdateBoxSkillCardsOnFileHeaders());
1✔
140
  }
141

142
  /**
143
   * Updates one or more Box Skills metadata cards to a file.
144
   *
145
   * @param fileId The unique identifier that represents a file.
146
   *     <p>The ID for any file can be determined by visiting a file in the web application and
147
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
148
   *     `file_id` is `123`. Example: "12345"
149
   * @param requestBody Request body of updateBoxSkillCardsOnFile method
150
   * @param headers Headers of updateBoxSkillCardsOnFile method
151
   */
152
  public SkillCardsMetadata updateBoxSkillCardsOnFile(
153
      String fileId,
154
      List<UpdateBoxSkillCardsOnFileRequestBody> requestBody,
155
      UpdateBoxSkillCardsOnFileHeaders headers) {
156
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
157
    FetchResponse response =
1✔
158
        this.networkSession
159
            .getNetworkClient()
1✔
160
            .fetch(
1✔
161
                new FetchOptions.Builder(
162
                        String.join(
1✔
163
                            "",
164
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
165
                            "/2.0/files/",
166
                            convertToString(fileId),
1✔
167
                            "/metadata/global/boxSkillsCards"),
168
                        "PUT")
169
                    .headers(headersMap)
1✔
170
                    .data(JsonManager.serialize(requestBody))
1✔
171
                    .contentType("application/json-patch+json")
1✔
172
                    .responseFormat(ResponseFormat.JSON)
1✔
173
                    .auth(this.auth)
1✔
174
                    .networkSession(this.networkSession)
1✔
175
                    .build());
1✔
176
    return JsonManager.deserialize(response.getData(), SkillCardsMetadata.class);
1✔
177
  }
178

179
  /**
180
   * Removes any Box Skills cards metadata from a file.
181
   *
182
   * @param fileId The unique identifier that represents a file.
183
   *     <p>The ID for any file can be determined by visiting a file in the web application and
184
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
185
   *     `file_id` is `123`. Example: "12345"
186
   */
187
  public void deleteBoxSkillCardsFromFile(String fileId) {
188
    deleteBoxSkillCardsFromFile(fileId, new DeleteBoxSkillCardsFromFileHeaders());
1✔
189
  }
1✔
190

191
  /**
192
   * Removes any Box Skills cards metadata from a file.
193
   *
194
   * @param fileId The unique identifier that represents a file.
195
   *     <p>The ID for any file can be determined by visiting a file in the web application and
196
   *     copying the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the
197
   *     `file_id` is `123`. Example: "12345"
198
   * @param headers Headers of deleteBoxSkillCardsFromFile method
199
   */
200
  public void deleteBoxSkillCardsFromFile(
201
      String fileId, DeleteBoxSkillCardsFromFileHeaders headers) {
202
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
1✔
203
    FetchResponse response =
1✔
204
        this.networkSession
205
            .getNetworkClient()
1✔
206
            .fetch(
1✔
207
                new FetchOptions.Builder(
208
                        String.join(
1✔
209
                            "",
210
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
211
                            "/2.0/files/",
212
                            convertToString(fileId),
1✔
213
                            "/metadata/global/boxSkillsCards"),
214
                        "DELETE")
215
                    .headers(headersMap)
1✔
216
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
217
                    .auth(this.auth)
1✔
218
                    .networkSession(this.networkSession)
1✔
219
                    .build());
1✔
220
  }
1✔
221

222
  /**
223
   * An alternative method that can be used to overwrite and update all Box Skill metadata cards on
224
   * a file.
225
   *
226
   * @param skillId The ID of the skill to apply this metadata for. Example: "33243242"
227
   * @param requestBody Request body of updateAllSkillCardsOnFile method
228
   */
229
  public void updateAllSkillCardsOnFile(
230
      String skillId, UpdateAllSkillCardsOnFileRequestBody requestBody) {
231
    updateAllSkillCardsOnFile(skillId, requestBody, new UpdateAllSkillCardsOnFileHeaders());
×
232
  }
×
233

234
  /**
235
   * An alternative method that can be used to overwrite and update all Box Skill metadata cards on
236
   * a file.
237
   *
238
   * @param skillId The ID of the skill to apply this metadata for. Example: "33243242"
239
   * @param requestBody Request body of updateAllSkillCardsOnFile method
240
   * @param headers Headers of updateAllSkillCardsOnFile method
241
   */
242
  public void updateAllSkillCardsOnFile(
243
      String skillId,
244
      UpdateAllSkillCardsOnFileRequestBody requestBody,
245
      UpdateAllSkillCardsOnFileHeaders headers) {
246
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
247
    FetchResponse response =
×
248
        this.networkSession
249
            .getNetworkClient()
×
250
            .fetch(
×
251
                new FetchOptions.Builder(
252
                        String.join(
×
253
                            "",
254
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
255
                            "/2.0/skill_invocations/",
256
                            convertToString(skillId)),
×
257
                        "PUT")
258
                    .headers(headersMap)
×
259
                    .data(JsonManager.serialize(requestBody))
×
260
                    .contentType("application/json")
×
261
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
262
                    .auth(this.auth)
×
263
                    .networkSession(this.networkSession)
×
264
                    .build());
×
265
  }
×
266

267
  public Authentication getAuth() {
268
    return auth;
×
269
  }
270

271
  public NetworkSession getNetworkSession() {
272
    return networkSession;
×
273
  }
274

275
  public static class Builder {
276

277
    protected Authentication auth;
278

279
    protected NetworkSession networkSession;
280

281
    public Builder() {
1✔
282
      this.networkSession = new NetworkSession();
1✔
283
    }
1✔
284

285
    public Builder auth(Authentication auth) {
286
      this.auth = auth;
1✔
287
      return this;
1✔
288
    }
289

290
    public Builder networkSession(NetworkSession networkSession) {
291
      this.networkSession = networkSession;
1✔
292
      return this;
1✔
293
    }
294

295
    public SkillsManager build() {
296
      return new SkillsManager(this);
1✔
297
    }
298
  }
299
}
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