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

box / box-java-sdk / #6243

10 Feb 2026 05:27PM UTC coverage: 18.192% (-17.5%) from 35.714%
#6243

push

github

web-flow
fix(boxsdkgen): Move assigning default values from builder constructor to `build()` method (box/box-codegen#922) (#1712)

0 of 1677 new or added lines in 569 files covered. (0.0%)

2147 existing lines in 545 files now uncovered.

7388 of 40611 relevant lines covered (18.19%)

0.21 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/retentionpolicies/RetentionPoliciesManager.java
1
package com.box.sdkgen.managers.retentionpolicies;
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.retentionpolicies.RetentionPolicies;
15
import com.box.sdkgen.schemas.retentionpolicy.RetentionPolicy;
16
import com.box.sdkgen.serialization.json.JsonManager;
17
import java.util.Map;
18

19
public class RetentionPoliciesManager {
20

21
  public Authentication auth;
22

23
  public NetworkSession networkSession;
24

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

29
  protected RetentionPoliciesManager(Builder builder) {
×
30
    this.auth = builder.auth;
×
31
    this.networkSession = builder.networkSession;
×
32
  }
×
33

34
  /** Retrieves all of the retention policies for an enterprise. */
35
  public RetentionPolicies getRetentionPolicies() {
36
    return getRetentionPolicies(
×
37
        new GetRetentionPoliciesQueryParams(), new GetRetentionPoliciesHeaders());
38
  }
39

40
  /**
41
   * Retrieves all of the retention policies for an enterprise.
42
   *
43
   * @param queryParams Query parameters of getRetentionPolicies method
44
   */
45
  public RetentionPolicies getRetentionPolicies(GetRetentionPoliciesQueryParams queryParams) {
46
    return getRetentionPolicies(queryParams, new GetRetentionPoliciesHeaders());
×
47
  }
48

49
  /**
50
   * Retrieves all of the retention policies for an enterprise.
51
   *
52
   * @param headers Headers of getRetentionPolicies method
53
   */
54
  public RetentionPolicies getRetentionPolicies(GetRetentionPoliciesHeaders headers) {
55
    return getRetentionPolicies(new GetRetentionPoliciesQueryParams(), headers);
×
56
  }
57

58
  /**
59
   * Retrieves all of the retention policies for an enterprise.
60
   *
61
   * @param queryParams Query parameters of getRetentionPolicies method
62
   * @param headers Headers of getRetentionPolicies method
63
   */
64
  public RetentionPolicies getRetentionPolicies(
65
      GetRetentionPoliciesQueryParams queryParams, GetRetentionPoliciesHeaders headers) {
66
    Map<String, String> queryParamsMap =
×
67
        prepareParams(
×
68
            mapOf(
×
69
                entryOf("policy_name", convertToString(queryParams.getPolicyName())),
×
70
                entryOf("policy_type", convertToString(queryParams.getPolicyType())),
×
71
                entryOf("created_by_user_id", convertToString(queryParams.getCreatedByUserId())),
×
72
                entryOf("fields", convertToString(queryParams.getFields())),
×
73
                entryOf("limit", convertToString(queryParams.getLimit())),
×
74
                entryOf("marker", convertToString(queryParams.getMarker()))));
×
75
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
76
    FetchResponse response =
×
77
        this.networkSession
78
            .getNetworkClient()
×
79
            .fetch(
×
80
                new FetchOptions.Builder(
81
                        String.join(
×
82
                            "",
83
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
84
                            "/2.0/retention_policies"),
85
                        "GET")
86
                    .params(queryParamsMap)
×
87
                    .headers(headersMap)
×
88
                    .responseFormat(ResponseFormat.JSON)
×
89
                    .auth(this.auth)
×
90
                    .networkSession(this.networkSession)
×
91
                    .build());
×
92
    return JsonManager.deserialize(response.getData(), RetentionPolicies.class);
×
93
  }
94

95
  /**
96
   * Creates a retention policy.
97
   *
98
   * @param requestBody Request body of createRetentionPolicy method
99
   */
100
  public RetentionPolicy createRetentionPolicy(CreateRetentionPolicyRequestBody requestBody) {
101
    return createRetentionPolicy(requestBody, new CreateRetentionPolicyHeaders());
×
102
  }
103

104
  /**
105
   * Creates a retention policy.
106
   *
107
   * @param requestBody Request body of createRetentionPolicy method
108
   * @param headers Headers of createRetentionPolicy method
109
   */
110
  public RetentionPolicy createRetentionPolicy(
111
      CreateRetentionPolicyRequestBody requestBody, CreateRetentionPolicyHeaders headers) {
112
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
113
    FetchResponse response =
×
114
        this.networkSession
115
            .getNetworkClient()
×
116
            .fetch(
×
117
                new FetchOptions.Builder(
118
                        String.join(
×
119
                            "",
120
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
121
                            "/2.0/retention_policies"),
122
                        "POST")
123
                    .headers(headersMap)
×
124
                    .data(JsonManager.serialize(requestBody))
×
125
                    .contentType("application/json")
×
126
                    .responseFormat(ResponseFormat.JSON)
×
127
                    .auth(this.auth)
×
128
                    .networkSession(this.networkSession)
×
129
                    .build());
×
130
    return JsonManager.deserialize(response.getData(), RetentionPolicy.class);
×
131
  }
132

133
  /**
134
   * Retrieves a retention policy.
135
   *
136
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
137
   */
138
  public RetentionPolicy getRetentionPolicyById(String retentionPolicyId) {
139
    return getRetentionPolicyById(
×
140
        retentionPolicyId,
141
        new GetRetentionPolicyByIdQueryParams(),
142
        new GetRetentionPolicyByIdHeaders());
143
  }
144

145
  /**
146
   * Retrieves a retention policy.
147
   *
148
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
149
   * @param queryParams Query parameters of getRetentionPolicyById method
150
   */
151
  public RetentionPolicy getRetentionPolicyById(
152
      String retentionPolicyId, GetRetentionPolicyByIdQueryParams queryParams) {
153
    return getRetentionPolicyById(
×
154
        retentionPolicyId, queryParams, new GetRetentionPolicyByIdHeaders());
155
  }
156

157
  /**
158
   * Retrieves a retention policy.
159
   *
160
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
161
   * @param headers Headers of getRetentionPolicyById method
162
   */
163
  public RetentionPolicy getRetentionPolicyById(
164
      String retentionPolicyId, GetRetentionPolicyByIdHeaders headers) {
165
    return getRetentionPolicyById(
×
166
        retentionPolicyId, new GetRetentionPolicyByIdQueryParams(), headers);
167
  }
168

169
  /**
170
   * Retrieves a retention policy.
171
   *
172
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
173
   * @param queryParams Query parameters of getRetentionPolicyById method
174
   * @param headers Headers of getRetentionPolicyById method
175
   */
176
  public RetentionPolicy getRetentionPolicyById(
177
      String retentionPolicyId,
178
      GetRetentionPolicyByIdQueryParams queryParams,
179
      GetRetentionPolicyByIdHeaders headers) {
180
    Map<String, String> queryParamsMap =
×
181
        prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields()))));
×
182
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
183
    FetchResponse response =
×
184
        this.networkSession
185
            .getNetworkClient()
×
186
            .fetch(
×
187
                new FetchOptions.Builder(
188
                        String.join(
×
189
                            "",
190
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
191
                            "/2.0/retention_policies/",
192
                            convertToString(retentionPolicyId)),
×
193
                        "GET")
194
                    .params(queryParamsMap)
×
195
                    .headers(headersMap)
×
196
                    .responseFormat(ResponseFormat.JSON)
×
197
                    .auth(this.auth)
×
198
                    .networkSession(this.networkSession)
×
199
                    .build());
×
200
    return JsonManager.deserialize(response.getData(), RetentionPolicy.class);
×
201
  }
202

203
  /**
204
   * Updates a retention policy.
205
   *
206
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
207
   */
208
  public RetentionPolicy updateRetentionPolicyById(String retentionPolicyId) {
209
    return updateRetentionPolicyById(
×
210
        retentionPolicyId,
211
        new UpdateRetentionPolicyByIdRequestBody(),
212
        new UpdateRetentionPolicyByIdHeaders());
213
  }
214

215
  /**
216
   * Updates a retention policy.
217
   *
218
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
219
   * @param requestBody Request body of updateRetentionPolicyById method
220
   */
221
  public RetentionPolicy updateRetentionPolicyById(
222
      String retentionPolicyId, UpdateRetentionPolicyByIdRequestBody requestBody) {
223
    return updateRetentionPolicyById(
×
224
        retentionPolicyId, requestBody, new UpdateRetentionPolicyByIdHeaders());
225
  }
226

227
  /**
228
   * Updates a retention policy.
229
   *
230
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
231
   * @param headers Headers of updateRetentionPolicyById method
232
   */
233
  public RetentionPolicy updateRetentionPolicyById(
234
      String retentionPolicyId, UpdateRetentionPolicyByIdHeaders headers) {
235
    return updateRetentionPolicyById(
×
236
        retentionPolicyId, new UpdateRetentionPolicyByIdRequestBody(), headers);
237
  }
238

239
  /**
240
   * Updates a retention policy.
241
   *
242
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
243
   * @param requestBody Request body of updateRetentionPolicyById method
244
   * @param headers Headers of updateRetentionPolicyById method
245
   */
246
  public RetentionPolicy updateRetentionPolicyById(
247
      String retentionPolicyId,
248
      UpdateRetentionPolicyByIdRequestBody requestBody,
249
      UpdateRetentionPolicyByIdHeaders headers) {
250
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
251
    FetchResponse response =
×
252
        this.networkSession
253
            .getNetworkClient()
×
254
            .fetch(
×
255
                new FetchOptions.Builder(
256
                        String.join(
×
257
                            "",
258
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
259
                            "/2.0/retention_policies/",
260
                            convertToString(retentionPolicyId)),
×
261
                        "PUT")
262
                    .headers(headersMap)
×
263
                    .data(JsonManager.serialize(requestBody))
×
264
                    .contentType("application/json")
×
265
                    .responseFormat(ResponseFormat.JSON)
×
266
                    .auth(this.auth)
×
267
                    .networkSession(this.networkSession)
×
268
                    .build());
×
269
    return JsonManager.deserialize(response.getData(), RetentionPolicy.class);
×
270
  }
271

272
  /**
273
   * Permanently deletes a retention policy.
274
   *
275
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
276
   */
277
  public void deleteRetentionPolicyById(String retentionPolicyId) {
278
    deleteRetentionPolicyById(retentionPolicyId, new DeleteRetentionPolicyByIdHeaders());
×
279
  }
×
280

281
  /**
282
   * Permanently deletes a retention policy.
283
   *
284
   * @param retentionPolicyId The ID of the retention policy. Example: "982312"
285
   * @param headers Headers of deleteRetentionPolicyById method
286
   */
287
  public void deleteRetentionPolicyById(
288
      String retentionPolicyId, DeleteRetentionPolicyByIdHeaders headers) {
289
    Map<String, String> headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders()));
×
290
    FetchResponse response =
×
291
        this.networkSession
292
            .getNetworkClient()
×
293
            .fetch(
×
294
                new FetchOptions.Builder(
295
                        String.join(
×
296
                            "",
297
                            this.networkSession.getBaseUrls().getBaseUrl(),
×
298
                            "/2.0/retention_policies/",
299
                            convertToString(retentionPolicyId)),
×
300
                        "DELETE")
301
                    .headers(headersMap)
×
302
                    .responseFormat(ResponseFormat.NO_CONTENT)
×
303
                    .auth(this.auth)
×
304
                    .networkSession(this.networkSession)
×
305
                    .build());
×
306
  }
×
307

308
  public Authentication getAuth() {
309
    return auth;
×
310
  }
311

312
  public NetworkSession getNetworkSession() {
313
    return networkSession;
×
314
  }
315

316
  public static class Builder {
317

318
    protected Authentication auth;
319

320
    protected NetworkSession networkSession;
321

NEW
322
    public Builder() {}
×
323

324
    public Builder auth(Authentication auth) {
UNCOV
325
      this.auth = auth;
×
UNCOV
326
      return this;
×
327
    }
328

329
    public Builder networkSession(NetworkSession networkSession) {
UNCOV
330
      this.networkSession = networkSession;
×
UNCOV
331
      return this;
×
332
    }
333

334
    public RetentionPoliciesManager build() {
NEW
335
      if (this.networkSession == null) {
×
NEW
336
        this.networkSession = new NetworkSession();
×
337
      }
338
      return new RetentionPoliciesManager(this);
×
339
    }
340
  }
341
}
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