• 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.43
/src/main/java/com/box/sdkgen/managers/docgen/DocgenManager.java
1
package com.box.sdkgen.managers.docgen;
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.docgenbatchbasev2025r0.DocGenBatchBaseV2025R0;
15
import com.box.sdkgen.schemas.v2025r0.docgenbatchcreaterequestv2025r0.DocGenBatchCreateRequestV2025R0;
16
import com.box.sdkgen.schemas.v2025r0.docgenjobsfullv2025r0.DocGenJobsFullV2025R0;
17
import com.box.sdkgen.schemas.v2025r0.docgenjobsv2025r0.DocGenJobsV2025R0;
18
import com.box.sdkgen.schemas.v2025r0.docgenjobv2025r0.DocGenJobV2025R0;
19
import com.box.sdkgen.serialization.json.JsonManager;
20
import java.util.Map;
21

22
public class DocgenManager {
23

24
  public Authentication auth;
25

26
  public NetworkSession networkSession;
27

28
  public DocgenManager() {
×
29
    this.networkSession = new NetworkSession();
×
30
  }
×
31

32
  protected DocgenManager(Builder builder) {
1✔
33
    this.auth = builder.auth;
1✔
34
    this.networkSession = builder.networkSession;
1✔
35
  }
1✔
36

37
  /**
38
   * Get details of the Box Doc Gen job.
39
   *
40
   * @param jobId Box Doc Gen job ID. Example: 123
41
   */
42
  public DocGenJobV2025R0 getDocgenJobByIdV2025R0(String jobId) {
43
    return getDocgenJobByIdV2025R0(jobId, new GetDocgenJobByIdV2025R0Headers());
1✔
44
  }
45

46
  /**
47
   * Get details of the Box Doc Gen job.
48
   *
49
   * @param jobId Box Doc Gen job ID. Example: 123
50
   * @param headers Headers of getDocgenJobByIdV2025R0 method
51
   */
52
  public DocGenJobV2025R0 getDocgenJobByIdV2025R0(
53
      String jobId, GetDocgenJobByIdV2025R0Headers headers) {
54
    Map<String, String> headersMap =
1✔
55
        prepareParams(
1✔
56
            mergeMaps(
1✔
57
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
58
                headers.getExtraHeaders()));
1✔
59
    FetchResponse response =
1✔
60
        this.networkSession
61
            .getNetworkClient()
1✔
62
            .fetch(
1✔
63
                new FetchOptions.Builder(
64
                        String.join(
1✔
65
                            "",
66
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
67
                            "/2.0/docgen_jobs/",
68
                            convertToString(jobId)),
1✔
69
                        "GET")
70
                    .headers(headersMap)
1✔
71
                    .responseFormat(ResponseFormat.JSON)
1✔
72
                    .auth(this.auth)
1✔
73
                    .networkSession(this.networkSession)
1✔
74
                    .build());
1✔
75
    return JsonManager.deserialize(response.getData(), DocGenJobV2025R0.class);
1✔
76
  }
77

78
  /** Lists all Box Doc Gen jobs for a user. */
79
  public DocGenJobsFullV2025R0 getDocgenJobsV2025R0() {
80
    return getDocgenJobsV2025R0(
×
81
        new GetDocgenJobsV2025R0QueryParams(), new GetDocgenJobsV2025R0Headers());
82
  }
83

84
  /**
85
   * Lists all Box Doc Gen jobs for a user.
86
   *
87
   * @param queryParams Query parameters of getDocgenJobsV2025R0 method
88
   */
89
  public DocGenJobsFullV2025R0 getDocgenJobsV2025R0(GetDocgenJobsV2025R0QueryParams queryParams) {
90
    return getDocgenJobsV2025R0(queryParams, new GetDocgenJobsV2025R0Headers());
1✔
91
  }
92

93
  /**
94
   * Lists all Box Doc Gen jobs for a user.
95
   *
96
   * @param headers Headers of getDocgenJobsV2025R0 method
97
   */
98
  public DocGenJobsFullV2025R0 getDocgenJobsV2025R0(GetDocgenJobsV2025R0Headers headers) {
99
    return getDocgenJobsV2025R0(new GetDocgenJobsV2025R0QueryParams(), headers);
×
100
  }
101

102
  /**
103
   * Lists all Box Doc Gen jobs for a user.
104
   *
105
   * @param queryParams Query parameters of getDocgenJobsV2025R0 method
106
   * @param headers Headers of getDocgenJobsV2025R0 method
107
   */
108
  public DocGenJobsFullV2025R0 getDocgenJobsV2025R0(
109
      GetDocgenJobsV2025R0QueryParams queryParams, GetDocgenJobsV2025R0Headers headers) {
110
    Map<String, String> queryParamsMap =
1✔
111
        prepareParams(
1✔
112
            mapOf(
1✔
113
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
114
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
115
    Map<String, String> headersMap =
1✔
116
        prepareParams(
1✔
117
            mergeMaps(
1✔
118
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
119
                headers.getExtraHeaders()));
1✔
120
    FetchResponse response =
1✔
121
        this.networkSession
122
            .getNetworkClient()
1✔
123
            .fetch(
1✔
124
                new FetchOptions.Builder(
125
                        String.join(
1✔
126
                            "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/docgen_jobs"),
1✔
127
                        "GET")
128
                    .params(queryParamsMap)
1✔
129
                    .headers(headersMap)
1✔
130
                    .responseFormat(ResponseFormat.JSON)
1✔
131
                    .auth(this.auth)
1✔
132
                    .networkSession(this.networkSession)
1✔
133
                    .build());
1✔
134
    return JsonManager.deserialize(response.getData(), DocGenJobsFullV2025R0.class);
1✔
135
  }
136

137
  /**
138
   * Lists Box Doc Gen jobs in a batch.
139
   *
140
   * @param batchId Box Doc Gen batch ID. Example: 123
141
   */
142
  public DocGenJobsV2025R0 getDocgenBatchJobByIdV2025R0(String batchId) {
143
    return getDocgenBatchJobByIdV2025R0(
1✔
144
        batchId,
145
        new GetDocgenBatchJobByIdV2025R0QueryParams(),
146
        new GetDocgenBatchJobByIdV2025R0Headers());
147
  }
148

149
  /**
150
   * Lists Box Doc Gen jobs in a batch.
151
   *
152
   * @param batchId Box Doc Gen batch ID. Example: 123
153
   * @param queryParams Query parameters of getDocgenBatchJobByIdV2025R0 method
154
   */
155
  public DocGenJobsV2025R0 getDocgenBatchJobByIdV2025R0(
156
      String batchId, GetDocgenBatchJobByIdV2025R0QueryParams queryParams) {
157
    return getDocgenBatchJobByIdV2025R0(
×
158
        batchId, queryParams, new GetDocgenBatchJobByIdV2025R0Headers());
159
  }
160

161
  /**
162
   * Lists Box Doc Gen jobs in a batch.
163
   *
164
   * @param batchId Box Doc Gen batch ID. Example: 123
165
   * @param headers Headers of getDocgenBatchJobByIdV2025R0 method
166
   */
167
  public DocGenJobsV2025R0 getDocgenBatchJobByIdV2025R0(
168
      String batchId, GetDocgenBatchJobByIdV2025R0Headers headers) {
169
    return getDocgenBatchJobByIdV2025R0(
×
170
        batchId, new GetDocgenBatchJobByIdV2025R0QueryParams(), headers);
171
  }
172

173
  /**
174
   * Lists Box Doc Gen jobs in a batch.
175
   *
176
   * @param batchId Box Doc Gen batch ID. Example: 123
177
   * @param queryParams Query parameters of getDocgenBatchJobByIdV2025R0 method
178
   * @param headers Headers of getDocgenBatchJobByIdV2025R0 method
179
   */
180
  public DocGenJobsV2025R0 getDocgenBatchJobByIdV2025R0(
181
      String batchId,
182
      GetDocgenBatchJobByIdV2025R0QueryParams queryParams,
183
      GetDocgenBatchJobByIdV2025R0Headers headers) {
184
    Map<String, String> queryParamsMap =
1✔
185
        prepareParams(
1✔
186
            mapOf(
1✔
187
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
188
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
189
    Map<String, String> headersMap =
1✔
190
        prepareParams(
1✔
191
            mergeMaps(
1✔
192
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
193
                headers.getExtraHeaders()));
1✔
194
    FetchResponse response =
1✔
195
        this.networkSession
196
            .getNetworkClient()
1✔
197
            .fetch(
1✔
198
                new FetchOptions.Builder(
199
                        String.join(
1✔
200
                            "",
201
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
202
                            "/2.0/docgen_batch_jobs/",
203
                            convertToString(batchId)),
1✔
204
                        "GET")
205
                    .params(queryParamsMap)
1✔
206
                    .headers(headersMap)
1✔
207
                    .responseFormat(ResponseFormat.JSON)
1✔
208
                    .auth(this.auth)
1✔
209
                    .networkSession(this.networkSession)
1✔
210
                    .build());
1✔
211
    return JsonManager.deserialize(response.getData(), DocGenJobsV2025R0.class);
1✔
212
  }
213

214
  /**
215
   * Generates a document using a Box Doc Gen template.
216
   *
217
   * @param requestBody Request body of createDocgenBatchV2025R0 method
218
   */
219
  public DocGenBatchBaseV2025R0 createDocgenBatchV2025R0(
220
      DocGenBatchCreateRequestV2025R0 requestBody) {
221
    return createDocgenBatchV2025R0(requestBody, new CreateDocgenBatchV2025R0Headers());
1✔
222
  }
223

224
  /**
225
   * Generates a document using a Box Doc Gen template.
226
   *
227
   * @param requestBody Request body of createDocgenBatchV2025R0 method
228
   * @param headers Headers of createDocgenBatchV2025R0 method
229
   */
230
  public DocGenBatchBaseV2025R0 createDocgenBatchV2025R0(
231
      DocGenBatchCreateRequestV2025R0 requestBody, CreateDocgenBatchV2025R0Headers headers) {
232
    Map<String, String> headersMap =
1✔
233
        prepareParams(
1✔
234
            mergeMaps(
1✔
235
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
236
                headers.getExtraHeaders()));
1✔
237
    FetchResponse response =
1✔
238
        this.networkSession
239
            .getNetworkClient()
1✔
240
            .fetch(
1✔
241
                new FetchOptions.Builder(
242
                        String.join(
1✔
243
                            "",
244
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
245
                            "/2.0/docgen_batches"),
246
                        "POST")
247
                    .headers(headersMap)
1✔
248
                    .data(JsonManager.serialize(requestBody))
1✔
249
                    .contentType("application/json")
1✔
250
                    .responseFormat(ResponseFormat.JSON)
1✔
251
                    .auth(this.auth)
1✔
252
                    .networkSession(this.networkSession)
1✔
253
                    .build());
1✔
254
    return JsonManager.deserialize(response.getData(), DocGenBatchBaseV2025R0.class);
1✔
255
  }
256

257
  public Authentication getAuth() {
258
    return auth;
×
259
  }
260

261
  public NetworkSession getNetworkSession() {
262
    return networkSession;
×
263
  }
264

265
  public static class Builder {
266

267
    protected Authentication auth;
268

269
    protected NetworkSession networkSession;
270

271
    public Builder() {
1✔
272
      this.networkSession = new NetworkSession();
1✔
273
    }
1✔
274

275
    public Builder auth(Authentication auth) {
276
      this.auth = auth;
1✔
277
      return this;
1✔
278
    }
279

280
    public Builder networkSession(NetworkSession networkSession) {
281
      this.networkSession = networkSession;
1✔
282
      return this;
1✔
283
    }
284

285
    public DocgenManager build() {
286
      return new DocgenManager(this);
1✔
287
    }
288
  }
289
}
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