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

box / box-java-sdk / #5702

18 Nov 2025 06:13PM UTC coverage: 35.924% (-1.3%) from 37.182%
#5702

push

github

web-flow
fix: Fix parsing `OffsetDateTime` from String (box/box-codegen#887) (#1582)

7 of 10 new or added lines in 1 file covered. (70.0%)

433 existing lines in 45 files now uncovered.

18457 of 51378 relevant lines covered (35.92%)

0.36 hits per line

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

91.18
/src/main/java/com/box/sdkgen/managers/archives/ArchivesManager.java
1
package com.box.sdkgen.managers.archives;
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.v2025r0.archivesv2025r0.ArchivesV2025R0;
15
import com.box.sdkgen.schemas.v2025r0.archivev2025r0.ArchiveV2025R0;
16
import com.box.sdkgen.serialization.json.JsonManager;
17
import java.util.Map;
18

19
public class ArchivesManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

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

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

34
  /**
35
   * Retrieves archives for an enterprise.
36
   *
37
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
38
   */
39
  public ArchivesV2025R0 getArchivesV2025R0() {
40
    return getArchivesV2025R0(new GetArchivesV2025R0QueryParams(), new GetArchivesV2025R0Headers());
×
41
  }
42

43
  /**
44
   * Retrieves archives for an enterprise.
45
   *
46
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
47
   *
48
   * @param queryParams Query parameters of getArchivesV2025R0 method
49
   */
50
  public ArchivesV2025R0 getArchivesV2025R0(GetArchivesV2025R0QueryParams queryParams) {
51
    return getArchivesV2025R0(queryParams, new GetArchivesV2025R0Headers());
1✔
52
  }
53

54
  /**
55
   * Retrieves archives for an enterprise.
56
   *
57
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
58
   *
59
   * @param headers Headers of getArchivesV2025R0 method
60
   */
61
  public ArchivesV2025R0 getArchivesV2025R0(GetArchivesV2025R0Headers headers) {
62
    return getArchivesV2025R0(new GetArchivesV2025R0QueryParams(), headers);
×
63
  }
64

65
  /**
66
   * Retrieves archives for an enterprise.
67
   *
68
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
69
   *
70
   * @param queryParams Query parameters of getArchivesV2025R0 method
71
   * @param headers Headers of getArchivesV2025R0 method
72
   */
73
  public ArchivesV2025R0 getArchivesV2025R0(
74
      GetArchivesV2025R0QueryParams queryParams, GetArchivesV2025R0Headers headers) {
75
    Map<String, String> queryParamsMap =
1✔
76
        prepareParams(
1✔
77
            mapOf(
1✔
78
                entryOf("limit", convertToString(queryParams.getLimit())),
1✔
79
                entryOf("marker", convertToString(queryParams.getMarker()))));
1✔
80
    Map<String, String> headersMap =
1✔
81
        prepareParams(
1✔
82
            mergeMaps(
1✔
83
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
84
                headers.getExtraHeaders()));
1✔
85
    FetchResponse response =
1✔
86
        this.networkSession
87
            .getNetworkClient()
1✔
88
            .fetch(
1✔
89
                new FetchOptions.Builder(
90
                        String.join(
1✔
91
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/archives"),
1✔
92
                        "GET")
93
                    .params(queryParamsMap)
1✔
94
                    .headers(headersMap)
1✔
95
                    .responseFormat(ResponseFormat.JSON)
1✔
96
                    .auth(this.auth)
1✔
97
                    .networkSession(this.networkSession)
1✔
98
                    .build());
1✔
99
    return JsonManager.deserialize(response.getData(), ArchivesV2025R0.class);
1✔
100
  }
101

102
  /**
103
   * Creates an archive.
104
   *
105
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
106
   *
107
   * @param requestBody Request body of createArchiveV2025R0 method
108
   */
109
  public ArchiveV2025R0 createArchiveV2025R0(CreateArchiveV2025R0RequestBody requestBody) {
110
    return createArchiveV2025R0(requestBody, new CreateArchiveV2025R0Headers());
1✔
111
  }
112

113
  /**
114
   * Creates an archive.
115
   *
116
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
117
   *
118
   * @param requestBody Request body of createArchiveV2025R0 method
119
   * @param headers Headers of createArchiveV2025R0 method
120
   */
121
  public ArchiveV2025R0 createArchiveV2025R0(
122
      CreateArchiveV2025R0RequestBody requestBody, CreateArchiveV2025R0Headers headers) {
123
    Map<String, String> headersMap =
1✔
124
        prepareParams(
1✔
125
            mergeMaps(
1✔
126
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
127
                headers.getExtraHeaders()));
1✔
128
    FetchResponse response =
1✔
129
        this.networkSession
130
            .getNetworkClient()
1✔
131
            .fetch(
1✔
132
                new FetchOptions.Builder(
133
                        String.join(
1✔
134
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/archives"),
1✔
135
                        "POST")
136
                    .headers(headersMap)
1✔
137
                    .data(JsonManager.serialize(requestBody))
1✔
138
                    .contentType("application/json")
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(), ArchiveV2025R0.class);
1✔
144
  }
145

146
  /**
147
   * Permanently deletes an archive.
148
   *
149
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
150
   *
151
   * @param archiveId The ID of the archive. Example: "982312"
152
   */
153
  public void deleteArchiveByIdV2025R0(String archiveId) {
154
    deleteArchiveByIdV2025R0(archiveId, new DeleteArchiveByIdV2025R0Headers());
1✔
155
  }
1✔
156

157
  /**
158
   * Permanently deletes an archive.
159
   *
160
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
161
   *
162
   * @param archiveId The ID of the archive. Example: "982312"
163
   * @param headers Headers of deleteArchiveByIdV2025R0 method
164
   */
165
  public void deleteArchiveByIdV2025R0(String archiveId, DeleteArchiveByIdV2025R0Headers headers) {
166
    Map<String, String> headersMap =
1✔
167
        prepareParams(
1✔
168
            mergeMaps(
1✔
169
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
170
                headers.getExtraHeaders()));
1✔
171
    FetchResponse response =
1✔
172
        this.networkSession
173
            .getNetworkClient()
1✔
174
            .fetch(
1✔
175
                new FetchOptions.Builder(
176
                        String.join(
1✔
177
                            "",
178
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
179
                            "/2.0/archives/",
180
                            convertToString(archiveId)),
1✔
181
                        "DELETE")
182
                    .headers(headersMap)
1✔
183
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
184
                    .auth(this.auth)
1✔
185
                    .networkSession(this.networkSession)
1✔
186
                    .build());
1✔
187
  }
1✔
188

189
  /**
190
   * Updates an archive.
191
   *
192
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
193
   *
194
   * @param archiveId The ID of the archive. Example: "982312"
195
   */
196
  public ArchiveV2025R0 updateArchiveByIdV2025R0(String archiveId) {
UNCOV
197
    return updateArchiveByIdV2025R0(
×
198
        archiveId,
199
        new UpdateArchiveByIdV2025R0RequestBody(),
200
        new UpdateArchiveByIdV2025R0Headers());
201
  }
202

203
  /**
204
   * Updates an archive.
205
   *
206
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
207
   *
208
   * @param archiveId The ID of the archive. Example: "982312"
209
   * @param requestBody Request body of updateArchiveByIdV2025R0 method
210
   */
211
  public ArchiveV2025R0 updateArchiveByIdV2025R0(
212
      String archiveId, UpdateArchiveByIdV2025R0RequestBody requestBody) {
213
    return updateArchiveByIdV2025R0(archiveId, requestBody, new UpdateArchiveByIdV2025R0Headers());
1✔
214
  }
215

216
  /**
217
   * Updates an archive.
218
   *
219
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
220
   *
221
   * @param archiveId The ID of the archive. Example: "982312"
222
   * @param headers Headers of updateArchiveByIdV2025R0 method
223
   */
224
  public ArchiveV2025R0 updateArchiveByIdV2025R0(
225
      String archiveId, UpdateArchiveByIdV2025R0Headers headers) {
UNCOV
226
    return updateArchiveByIdV2025R0(archiveId, new UpdateArchiveByIdV2025R0RequestBody(), headers);
×
227
  }
228

229
  /**
230
   * Updates an archive.
231
   *
232
   * <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
233
   *
234
   * @param archiveId The ID of the archive. Example: "982312"
235
   * @param requestBody Request body of updateArchiveByIdV2025R0 method
236
   * @param headers Headers of updateArchiveByIdV2025R0 method
237
   */
238
  public ArchiveV2025R0 updateArchiveByIdV2025R0(
239
      String archiveId,
240
      UpdateArchiveByIdV2025R0RequestBody requestBody,
241
      UpdateArchiveByIdV2025R0Headers headers) {
242
    Map<String, String> headersMap =
1✔
243
        prepareParams(
1✔
244
            mergeMaps(
1✔
245
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
246
                headers.getExtraHeaders()));
1✔
247
    FetchResponse response =
1✔
248
        this.networkSession
249
            .getNetworkClient()
1✔
250
            .fetch(
1✔
251
                new FetchOptions.Builder(
252
                        String.join(
1✔
253
                            "",
254
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
255
                            "/2.0/archives/",
256
                            convertToString(archiveId)),
1✔
257
                        "PUT")
258
                    .headers(headersMap)
1✔
259
                    .data(JsonManager.serialize(requestBody))
1✔
260
                    .contentType("application/json")
1✔
261
                    .responseFormat(ResponseFormat.JSON)
1✔
262
                    .auth(this.auth)
1✔
263
                    .networkSession(this.networkSession)
1✔
264
                    .build());
1✔
265
    return JsonManager.deserialize(response.getData(), ArchiveV2025R0.class);
1✔
266
  }
267

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

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

276
  public static class Builder {
277

278
    protected Authentication auth;
279

280
    protected NetworkSession networkSession;
281

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

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

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

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