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

box / box-java-sdk / #5538

06 Nov 2025 12:18PM UTC coverage: 13.292% (-0.02%) from 13.315%
#5538

Pull #1552

github

web-flow
Merge 158cb9946 into 7fe53b9a9
Pull Request #1552: docs(boxsdkgen): Modify Archive API (box/box-openapi#563)

0 of 115 new or added lines in 7 files covered. (0.0%)

1 existing line in 1 file now uncovered.

8368 of 62957 relevant lines covered (13.29%)

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/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) {
×
30
    this.auth = builder.auth;
×
31
    this.networkSession = builder.networkSession;
×
32
  }
×
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());
×
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 =
×
76
        prepareParams(
×
77
            mapOf(
×
78
                entryOf("limit", convertToString(queryParams.getLimit())),
×
79
                entryOf("marker", convertToString(queryParams.getMarker()))));
×
80
    Map<String, String> headersMap =
×
81
        prepareParams(
×
82
            mergeMaps(
×
83
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
84
                headers.getExtraHeaders()));
×
85
    FetchResponse response =
×
86
        this.networkSession
87
            .getNetworkClient()
×
88
            .fetch(
×
89
                new FetchOptions.Builder(
90
                        String.join(
×
91
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/archives"),
×
92
                        "GET")
93
                    .params(queryParamsMap)
×
94
                    .headers(headersMap)
×
95
                    .responseFormat(ResponseFormat.JSON)
×
96
                    .auth(this.auth)
×
97
                    .networkSession(this.networkSession)
×
98
                    .build());
×
99
    return JsonManager.deserialize(response.getData(), ArchivesV2025R0.class);
×
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());
×
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 =
×
124
        prepareParams(
×
125
            mergeMaps(
×
126
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
127
                headers.getExtraHeaders()));
×
128
    FetchResponse response =
×
129
        this.networkSession
130
            .getNetworkClient()
×
131
            .fetch(
×
132
                new FetchOptions.Builder(
133
                        String.join(
×
134
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/archives"),
×
135
                        "POST")
136
                    .headers(headersMap)
×
137
                    .data(JsonManager.serialize(requestBody))
×
138
                    .contentType("application/json")
×
139
                    .responseFormat(ResponseFormat.JSON)
×
140
                    .auth(this.auth)
×
141
                    .networkSession(this.networkSession)
×
142
                    .build());
×
143
    return JsonManager.deserialize(response.getData(), ArchiveV2025R0.class);
×
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());
×
155
  }
×
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 =
×
167
        prepareParams(
×
168
            mergeMaps(
×
169
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
170
                headers.getExtraHeaders()));
×
171
    FetchResponse response =
×
172
        this.networkSession
173
            .getNetworkClient()
×
174
            .fetch(
×
175
                new FetchOptions.Builder(
176
                        String.join(
×
177
                            "",
178
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
179
                            "/2.0/archives/",
180
                            convertToString(archiveId)),
×
181
                        "DELETE")
182
                    .headers(headersMap)
×
183
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
184
                    .auth(this.auth)
×
185
                    .networkSession(this.networkSession)
×
186
                    .build());
×
187
  }
×
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) {
NEW
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) {
NEW
213
    return updateArchiveByIdV2025R0(archiveId, requestBody, new UpdateArchiveByIdV2025R0Headers());
×
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) {
NEW
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) {
NEW
242
    Map<String, String> headersMap =
×
NEW
243
        prepareParams(
×
NEW
244
            mergeMaps(
×
NEW
245
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
×
NEW
246
                headers.getExtraHeaders()));
×
NEW
247
    FetchResponse response =
×
248
        this.networkSession
NEW
249
            .getNetworkClient()
×
NEW
250
            .fetch(
×
251
                new FetchOptions.Builder(
NEW
252
                        String.join(
×
253
                            "",
NEW
254
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
255
                            "/2.0/archives/",
NEW
256
                            convertToString(archiveId)),
×
257
                        "PUT")
NEW
258
                    .headers(headersMap)
×
NEW
259
                    .data(JsonManager.serialize(requestBody))
×
NEW
260
                    .contentType("application/json")
×
NEW
261
                    .responseFormat(ResponseFormat.JSON)
×
NEW
262
                    .auth(this.auth)
×
NEW
263
                    .networkSession(this.networkSession)
×
NEW
264
                    .build());
×
NEW
265
    return JsonManager.deserialize(response.getData(), ArchiveV2025R0.class);
×
266
  }
267

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

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

276
  public static class Builder {
277

278
    protected Authentication auth;
279

280
    protected NetworkSession networkSession;
281

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

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

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

296
    public ArchivesManager build() {
297
      return new ArchivesManager(this);
×
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

© 2025 Coveralls, Inc