• 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

91.25
/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
  public Authentication getAuth() {
190
    return auth;
×
191
  }
192

193
  public NetworkSession getNetworkSession() {
194
    return networkSession;
×
195
  }
196

197
  public static class Builder {
198

199
    protected Authentication auth;
200

201
    protected NetworkSession networkSession;
202

203
    public Builder() {
1✔
204
      this.networkSession = new NetworkSession();
1✔
205
    }
1✔
206

207
    public Builder auth(Authentication auth) {
208
      this.auth = auth;
1✔
209
      return this;
1✔
210
    }
211

212
    public Builder networkSession(NetworkSession networkSession) {
213
      this.networkSession = networkSession;
1✔
214
      return this;
1✔
215
    }
216

217
    public ArchivesManager build() {
218
      return new ArchivesManager(this);
1✔
219
    }
220
  }
221
}
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