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

box / box-java-sdk-gen / #541

05 Sep 2025 02:31PM UTC coverage: 7.451% (-29.2%) from 36.66%
#541

push

other

web-flow
chore: release version 0.8.1 (#437)

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

14652 existing lines in 1191 files now uncovered.

3737 of 50151 relevant lines covered (7.45%)

0.07 hits per line

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

12.0
/src/main/java/com/box/sdkgen/managers/foldermetadata/FolderMetadataManager.java
1
package com.box.sdkgen.managers.filemetadata;
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.metadatafull.MetadataFull;
14
import com.box.sdkgen.schemas.metadatas.Metadatas;
15
import com.box.sdkgen.serialization.json.JsonManager;
16
import java.util.List;
17
import java.util.Map;
18

19
public class FileMetadataManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

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

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

34
  public Metadatas getFileMetadata(String fileId) {
UNCOV
35
    return getFileMetadata(fileId, new GetFileMetadataHeaders());
×
36
  }
37

38
  public Metadatas getFileMetadata(String fileId, GetFileMetadataHeaders headers) {
UNCOV
39
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
40
    FetchResponse response =
×
41
        this.networkSession
UNCOV
42
            .getNetworkClient()
×
UNCOV
43
            .fetch(
×
44
                new FetchOptions.Builder(
UNCOV
45
                        String.join(
×
46
                            "",
UNCOV
47
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
48
                            "/2.0/files/",
UNCOV
49
                            convertToString(fileId),
×
50
                            "/metadata"),
51
                        "GET")
UNCOV
52
                    .headers(headersMap)
×
UNCOV
53
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
54
                    .auth(this.auth)
×
UNCOV
55
                    .networkSession(this.networkSession)
×
UNCOV
56
                    .build());
×
UNCOV
57
    return JsonManager.deserialize(response.getData(), Metadatas.class);
×
58
  }
59

60
  public MetadataFull getFileMetadataById(
61
      String fileId, GetFileMetadataByIdScope scope, String templateKey) {
UNCOV
62
    return getFileMetadataById(fileId, scope, templateKey, new GetFileMetadataByIdHeaders());
×
63
  }
64

65
  public MetadataFull getFileMetadataById(
66
      String fileId,
67
      GetFileMetadataByIdScope scope,
68
      String templateKey,
69
      GetFileMetadataByIdHeaders headers) {
UNCOV
70
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
71
    FetchResponse response =
×
72
        this.networkSession
UNCOV
73
            .getNetworkClient()
×
UNCOV
74
            .fetch(
×
75
                new FetchOptions.Builder(
UNCOV
76
                        String.join(
×
77
                            "",
UNCOV
78
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
79
                            "/2.0/files/",
UNCOV
80
                            convertToString(fileId),
×
81
                            "/metadata/",
UNCOV
82
                            convertToString(scope),
×
83
                            "/",
UNCOV
84
                            convertToString(templateKey)),
×
85
                        "GET")
UNCOV
86
                    .headers(headersMap)
×
UNCOV
87
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
88
                    .auth(this.auth)
×
UNCOV
89
                    .networkSession(this.networkSession)
×
UNCOV
90
                    .build());
×
UNCOV
91
    return JsonManager.deserialize(response.getData(), MetadataFull.class);
×
92
  }
93

94
  public MetadataFull createFileMetadataById(
95
      String fileId,
96
      CreateFileMetadataByIdScope scope,
97
      String templateKey,
98
      Map<String, Object> requestBody) {
UNCOV
99
    return createFileMetadataById(
×
100
        fileId, scope, templateKey, requestBody, new CreateFileMetadataByIdHeaders());
101
  }
102

103
  public MetadataFull createFileMetadataById(
104
      String fileId,
105
      CreateFileMetadataByIdScope scope,
106
      String templateKey,
107
      Map<String, Object> requestBody,
108
      CreateFileMetadataByIdHeaders headers) {
UNCOV
109
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
110
    FetchResponse response =
×
111
        this.networkSession
UNCOV
112
            .getNetworkClient()
×
UNCOV
113
            .fetch(
×
114
                new FetchOptions.Builder(
UNCOV
115
                        String.join(
×
116
                            "",
UNCOV
117
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
118
                            "/2.0/files/",
UNCOV
119
                            convertToString(fileId),
×
120
                            "/metadata/",
UNCOV
121
                            convertToString(scope),
×
122
                            "/",
UNCOV
123
                            convertToString(templateKey)),
×
124
                        "POST")
UNCOV
125
                    .headers(headersMap)
×
UNCOV
126
                    .data(JsonManager.serialize(requestBody))
×
UNCOV
127
                    .contentType("application/json")
×
UNCOV
128
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
129
                    .auth(this.auth)
×
UNCOV
130
                    .networkSession(this.networkSession)
×
UNCOV
131
                    .build());
×
UNCOV
132
    return JsonManager.deserialize(response.getData(), MetadataFull.class);
×
133
  }
134

135
  public MetadataFull updateFileMetadataById(
136
      String fileId,
137
      UpdateFileMetadataByIdScope scope,
138
      String templateKey,
139
      List<UpdateFileMetadataByIdRequestBody> requestBody) {
UNCOV
140
    return updateFileMetadataById(
×
141
        fileId, scope, templateKey, requestBody, new UpdateFileMetadataByIdHeaders());
142
  }
143

144
  public MetadataFull updateFileMetadataById(
145
      String fileId,
146
      UpdateFileMetadataByIdScope scope,
147
      String templateKey,
148
      List<UpdateFileMetadataByIdRequestBody> requestBody,
149
      UpdateFileMetadataByIdHeaders headers) {
UNCOV
150
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
151
    FetchResponse response =
×
152
        this.networkSession
UNCOV
153
            .getNetworkClient()
×
UNCOV
154
            .fetch(
×
155
                new FetchOptions.Builder(
UNCOV
156
                        String.join(
×
157
                            "",
UNCOV
158
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
159
                            "/2.0/files/",
UNCOV
160
                            convertToString(fileId),
×
161
                            "/metadata/",
UNCOV
162
                            convertToString(scope),
×
163
                            "/",
UNCOV
164
                            convertToString(templateKey)),
×
165
                        "PUT")
UNCOV
166
                    .headers(headersMap)
×
UNCOV
167
                    .data(JsonManager.serialize(requestBody))
×
UNCOV
168
                    .contentType("application/json-patch+json")
×
UNCOV
169
                    .responseFormat(ResponseFormat.JSON)
×
UNCOV
170
                    .auth(this.auth)
×
UNCOV
171
                    .networkSession(this.networkSession)
×
UNCOV
172
                    .build());
×
UNCOV
173
    return JsonManager.deserialize(response.getData(), MetadataFull.class);
×
174
  }
175

176
  public void deleteFileMetadataById(
177
      String fileId, DeleteFileMetadataByIdScope scope, String templateKey) {
UNCOV
178
    deleteFileMetadataById(fileId, scope, templateKey, new DeleteFileMetadataByIdHeaders());
×
UNCOV
179
  }
×
180

181
  public void deleteFileMetadataById(
182
      String fileId,
183
      DeleteFileMetadataByIdScope scope,
184
      String templateKey,
185
      DeleteFileMetadataByIdHeaders headers) {
UNCOV
186
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
UNCOV
187
    FetchResponse response =
×
188
        this.networkSession
UNCOV
189
            .getNetworkClient()
×
UNCOV
190
            .fetch(
×
191
                new FetchOptions.Builder(
UNCOV
192
                        String.join(
×
193
                            "",
UNCOV
194
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
195
                            "/2.0/files/",
UNCOV
196
                            convertToString(fileId),
×
197
                            "/metadata/",
UNCOV
198
                            convertToString(scope),
×
199
                            "/",
UNCOV
200
                            convertToString(templateKey)),
×
201
                        "DELETE")
UNCOV
202
                    .headers(headersMap)
×
UNCOV
203
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
UNCOV
204
                    .auth(this.auth)
×
UNCOV
205
                    .networkSession(this.networkSession)
×
UNCOV
206
                    .build());
×
UNCOV
207
  }
×
208

209
  public Authentication getAuth() {
210
    return auth;
×
211
  }
212

213
  public NetworkSession getNetworkSession() {
214
    return networkSession;
×
215
  }
216

217
  public static class Builder {
218

219
    protected Authentication auth;
220

221
    protected NetworkSession networkSession;
222

223
    public Builder() {
1✔
224
      this.networkSession = new NetworkSession();
1✔
225
    }
1✔
226

227
    public Builder auth(Authentication auth) {
228
      this.auth = auth;
1✔
229
      return this;
1✔
230
    }
231

232
    public Builder networkSession(NetworkSession networkSession) {
233
      this.networkSession = networkSession;
1✔
234
      return this;
1✔
235
    }
236

237
    public FileMetadataManager build() {
238
      return new FileMetadataManager(this);
1✔
239
    }
240
  }
241
}
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