• 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

92.72
/src/main/java/com/box/sdkgen/managers/docgentemplate/DocgenTemplateManager.java
1
package com.box.sdkgen.managers.docgentemplate;
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.docgenjobsv2025r0.DocGenJobsV2025R0;
15
import com.box.sdkgen.schemas.v2025r0.docgentagsv2025r0.DocGenTagsV2025R0;
16
import com.box.sdkgen.schemas.v2025r0.docgentemplatebasev2025r0.DocGenTemplateBaseV2025R0;
17
import com.box.sdkgen.schemas.v2025r0.docgentemplatecreaterequestv2025r0.DocGenTemplateCreateRequestV2025R0;
18
import com.box.sdkgen.schemas.v2025r0.docgentemplatesv2025r0.DocGenTemplatesV2025R0;
19
import com.box.sdkgen.schemas.v2025r0.docgentemplatev2025r0.DocGenTemplateV2025R0;
20
import com.box.sdkgen.serialization.json.JsonManager;
21
import java.util.Map;
22

23
public class DocgenTemplateManager {
24

25
  public Authentication auth;
26

27
  public NetworkSession networkSession;
28

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

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

38
  /**
39
   * Marks a file as a Box Doc Gen template.
40
   *
41
   * @param requestBody Request body of createDocgenTemplateV2025R0 method
42
   */
43
  public DocGenTemplateBaseV2025R0 createDocgenTemplateV2025R0(
44
      DocGenTemplateCreateRequestV2025R0 requestBody) {
45
    return createDocgenTemplateV2025R0(requestBody, new CreateDocgenTemplateV2025R0Headers());
1✔
46
  }
47

48
  /**
49
   * Marks a file as a Box Doc Gen template.
50
   *
51
   * @param requestBody Request body of createDocgenTemplateV2025R0 method
52
   * @param headers Headers of createDocgenTemplateV2025R0 method
53
   */
54
  public DocGenTemplateBaseV2025R0 createDocgenTemplateV2025R0(
55
      DocGenTemplateCreateRequestV2025R0 requestBody, CreateDocgenTemplateV2025R0Headers headers) {
56
    Map<String, String> headersMap =
1✔
57
        prepareParams(
1✔
58
            mergeMaps(
1✔
59
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
60
                headers.getExtraHeaders()));
1✔
61
    FetchResponse response =
1✔
62
        this.networkSession
63
            .getNetworkClient()
1✔
64
            .fetch(
1✔
65
                new FetchOptions.Builder(
66
                        String.join(
1✔
67
                            "",
68
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
69
                            "/2.0/docgen_templates"),
70
                        "POST")
71
                    .headers(headersMap)
1✔
72
                    .data(JsonManager.serialize(requestBody))
1✔
73
                    .contentType("application/json")
1✔
74
                    .responseFormat(ResponseFormat.JSON)
1✔
75
                    .auth(this.auth)
1✔
76
                    .networkSession(this.networkSession)
1✔
77
                    .build());
1✔
78
    return JsonManager.deserialize(response.getData(), DocGenTemplateBaseV2025R0.class);
1✔
79
  }
80

81
  /** Lists Box Doc Gen templates on which the user is a collaborator. */
82
  public DocGenTemplatesV2025R0 getDocgenTemplatesV2025R0() {
83
    return getDocgenTemplatesV2025R0(
1✔
84
        new GetDocgenTemplatesV2025R0QueryParams(), new GetDocgenTemplatesV2025R0Headers());
85
  }
86

87
  /**
88
   * Lists Box Doc Gen templates on which the user is a collaborator.
89
   *
90
   * @param queryParams Query parameters of getDocgenTemplatesV2025R0 method
91
   */
92
  public DocGenTemplatesV2025R0 getDocgenTemplatesV2025R0(
93
      GetDocgenTemplatesV2025R0QueryParams queryParams) {
94
    return getDocgenTemplatesV2025R0(queryParams, new GetDocgenTemplatesV2025R0Headers());
×
95
  }
96

97
  /**
98
   * Lists Box Doc Gen templates on which the user is a collaborator.
99
   *
100
   * @param headers Headers of getDocgenTemplatesV2025R0 method
101
   */
102
  public DocGenTemplatesV2025R0 getDocgenTemplatesV2025R0(
103
      GetDocgenTemplatesV2025R0Headers headers) {
104
    return getDocgenTemplatesV2025R0(new GetDocgenTemplatesV2025R0QueryParams(), headers);
×
105
  }
106

107
  /**
108
   * Lists Box Doc Gen templates on which the user is a collaborator.
109
   *
110
   * @param queryParams Query parameters of getDocgenTemplatesV2025R0 method
111
   * @param headers Headers of getDocgenTemplatesV2025R0 method
112
   */
113
  public DocGenTemplatesV2025R0 getDocgenTemplatesV2025R0(
114
      GetDocgenTemplatesV2025R0QueryParams queryParams, GetDocgenTemplatesV2025R0Headers headers) {
115
    Map<String, String> queryParamsMap =
1✔
116
        prepareParams(
1✔
117
            mapOf(
1✔
118
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
119
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
120
    Map<String, String> headersMap =
1✔
121
        prepareParams(
1✔
122
            mergeMaps(
1✔
123
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
124
                headers.getExtraHeaders()));
1✔
125
    FetchResponse response =
1✔
126
        this.networkSession
127
            .getNetworkClient()
1✔
128
            .fetch(
1✔
129
                new FetchOptions.Builder(
130
                        String.join(
1✔
131
                            "",
132
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
133
                            "/2.0/docgen_templates"),
134
                        "GET")
135
                    .params(queryParamsMap)
1✔
136
                    .headers(headersMap)
1✔
137
                    .responseFormat(ResponseFormat.JSON)
1✔
138
                    .auth(this.auth)
1✔
139
                    .networkSession(this.networkSession)
1✔
140
                    .build());
1✔
141
    return JsonManager.deserialize(response.getData(), DocGenTemplatesV2025R0.class);
1✔
142
  }
143

144
  /**
145
   * Unmarks file as Box Doc Gen template.
146
   *
147
   * @param templateId ID of the file which will no longer be marked as a Box Doc Gen template.
148
   *     Example: "123"
149
   */
150
  public void deleteDocgenTemplateByIdV2025R0(String templateId) {
151
    deleteDocgenTemplateByIdV2025R0(templateId, new DeleteDocgenTemplateByIdV2025R0Headers());
1✔
152
  }
1✔
153

154
  /**
155
   * Unmarks file as Box Doc Gen template.
156
   *
157
   * @param templateId ID of the file which will no longer be marked as a Box Doc Gen template.
158
   *     Example: "123"
159
   * @param headers Headers of deleteDocgenTemplateByIdV2025R0 method
160
   */
161
  public void deleteDocgenTemplateByIdV2025R0(
162
      String templateId, DeleteDocgenTemplateByIdV2025R0Headers headers) {
163
    Map<String, String> headersMap =
1✔
164
        prepareParams(
1✔
165
            mergeMaps(
1✔
166
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
167
                headers.getExtraHeaders()));
1✔
168
    FetchResponse response =
1✔
169
        this.networkSession
170
            .getNetworkClient()
1✔
171
            .fetch(
1✔
172
                new FetchOptions.Builder(
173
                        String.join(
1✔
174
                            "",
175
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
176
                            "/2.0/docgen_templates/",
177
                            convertToString(templateId)),
1✔
178
                        "DELETE")
179
                    .headers(headersMap)
1✔
180
                    .responseFormat(ResponseFormat.NO_CONTENT)
1✔
181
                    .auth(this.auth)
1✔
182
                    .networkSession(this.networkSession)
1✔
183
                    .build());
1✔
184
  }
1✔
185

186
  /**
187
   * Lists details of a specific Box Doc Gen template.
188
   *
189
   * @param templateId The ID of a Box Doc Gen template. Example: 123
190
   */
191
  public DocGenTemplateV2025R0 getDocgenTemplateByIdV2025R0(String templateId) {
192
    return getDocgenTemplateByIdV2025R0(templateId, new GetDocgenTemplateByIdV2025R0Headers());
1✔
193
  }
194

195
  /**
196
   * Lists details of a specific Box Doc Gen template.
197
   *
198
   * @param templateId The ID of a Box Doc Gen template. Example: 123
199
   * @param headers Headers of getDocgenTemplateByIdV2025R0 method
200
   */
201
  public DocGenTemplateV2025R0 getDocgenTemplateByIdV2025R0(
202
      String templateId, GetDocgenTemplateByIdV2025R0Headers headers) {
203
    Map<String, String> headersMap =
1✔
204
        prepareParams(
1✔
205
            mergeMaps(
1✔
206
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
207
                headers.getExtraHeaders()));
1✔
208
    FetchResponse response =
1✔
209
        this.networkSession
210
            .getNetworkClient()
1✔
211
            .fetch(
1✔
212
                new FetchOptions.Builder(
213
                        String.join(
1✔
214
                            "",
215
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
216
                            "/2.0/docgen_templates/",
217
                            convertToString(templateId)),
1✔
218
                        "GET")
219
                    .headers(headersMap)
1✔
220
                    .responseFormat(ResponseFormat.JSON)
1✔
221
                    .auth(this.auth)
1✔
222
                    .networkSession(this.networkSession)
1✔
223
                    .build());
1✔
224
    return JsonManager.deserialize(response.getData(), DocGenTemplateV2025R0.class);
1✔
225
  }
226

227
  /**
228
   * Lists all tags in a Box Doc Gen template.
229
   *
230
   * @param templateId ID of template. Example: 123
231
   */
232
  public DocGenTagsV2025R0 getDocgenTemplateTagsV2025R0(String templateId) {
233
    return getDocgenTemplateTagsV2025R0(
1✔
234
        templateId,
235
        new GetDocgenTemplateTagsV2025R0QueryParams(),
236
        new GetDocgenTemplateTagsV2025R0Headers());
237
  }
238

239
  /**
240
   * Lists all tags in a Box Doc Gen template.
241
   *
242
   * @param templateId ID of template. Example: 123
243
   * @param queryParams Query parameters of getDocgenTemplateTagsV2025R0 method
244
   */
245
  public DocGenTagsV2025R0 getDocgenTemplateTagsV2025R0(
246
      String templateId, GetDocgenTemplateTagsV2025R0QueryParams queryParams) {
247
    return getDocgenTemplateTagsV2025R0(
×
248
        templateId, queryParams, new GetDocgenTemplateTagsV2025R0Headers());
249
  }
250

251
  /**
252
   * Lists all tags in a Box Doc Gen template.
253
   *
254
   * @param templateId ID of template. Example: 123
255
   * @param headers Headers of getDocgenTemplateTagsV2025R0 method
256
   */
257
  public DocGenTagsV2025R0 getDocgenTemplateTagsV2025R0(
258
      String templateId, GetDocgenTemplateTagsV2025R0Headers headers) {
259
    return getDocgenTemplateTagsV2025R0(
×
260
        templateId, new GetDocgenTemplateTagsV2025R0QueryParams(), headers);
261
  }
262

263
  /**
264
   * Lists all tags in a Box Doc Gen template.
265
   *
266
   * @param templateId ID of template. Example: 123
267
   * @param queryParams Query parameters of getDocgenTemplateTagsV2025R0 method
268
   * @param headers Headers of getDocgenTemplateTagsV2025R0 method
269
   */
270
  public DocGenTagsV2025R0 getDocgenTemplateTagsV2025R0(
271
      String templateId,
272
      GetDocgenTemplateTagsV2025R0QueryParams queryParams,
273
      GetDocgenTemplateTagsV2025R0Headers headers) {
274
    Map<String, String> queryParamsMap =
1✔
275
        prepareParams(
1✔
276
            mapOf(
1✔
277
                entryOf("template_version_id", convertToString(queryParams.getTemplateVersionId())),
1✔
278
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
279
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
280
    Map<String, String> headersMap =
1✔
281
        prepareParams(
1✔
282
            mergeMaps(
1✔
283
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
284
                headers.getExtraHeaders()));
1✔
285
    FetchResponse response =
1✔
286
        this.networkSession
287
            .getNetworkClient()
1✔
288
            .fetch(
1✔
289
                new FetchOptions.Builder(
290
                        String.join(
1✔
291
                            "",
292
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
293
                            "/2.0/docgen_templates/",
294
                            convertToString(templateId),
1✔
295
                            "/tags"),
296
                        "GET")
297
                    .params(queryParamsMap)
1✔
298
                    .headers(headersMap)
1✔
299
                    .responseFormat(ResponseFormat.JSON)
1✔
300
                    .auth(this.auth)
1✔
301
                    .networkSession(this.networkSession)
1✔
302
                    .build());
1✔
303
    return JsonManager.deserialize(response.getData(), DocGenTagsV2025R0.class);
1✔
304
  }
305

306
  /**
307
   * Lists the users jobs which use this template.
308
   *
309
   * @param templateId Id of template to fetch jobs for. Example: 123
310
   */
311
  public DocGenJobsV2025R0 getDocgenTemplateJobByIdV2025R0(String templateId) {
312
    return getDocgenTemplateJobByIdV2025R0(
1✔
313
        templateId,
314
        new GetDocgenTemplateJobByIdV2025R0QueryParams(),
315
        new GetDocgenTemplateJobByIdV2025R0Headers());
316
  }
317

318
  /**
319
   * Lists the users jobs which use this template.
320
   *
321
   * @param templateId Id of template to fetch jobs for. Example: 123
322
   * @param queryParams Query parameters of getDocgenTemplateJobByIdV2025R0 method
323
   */
324
  public DocGenJobsV2025R0 getDocgenTemplateJobByIdV2025R0(
325
      String templateId, GetDocgenTemplateJobByIdV2025R0QueryParams queryParams) {
326
    return getDocgenTemplateJobByIdV2025R0(
×
327
        templateId, queryParams, new GetDocgenTemplateJobByIdV2025R0Headers());
328
  }
329

330
  /**
331
   * Lists the users jobs which use this template.
332
   *
333
   * @param templateId Id of template to fetch jobs for. Example: 123
334
   * @param headers Headers of getDocgenTemplateJobByIdV2025R0 method
335
   */
336
  public DocGenJobsV2025R0 getDocgenTemplateJobByIdV2025R0(
337
      String templateId, GetDocgenTemplateJobByIdV2025R0Headers headers) {
338
    return getDocgenTemplateJobByIdV2025R0(
×
339
        templateId, new GetDocgenTemplateJobByIdV2025R0QueryParams(), headers);
340
  }
341

342
  /**
343
   * Lists the users jobs which use this template.
344
   *
345
   * @param templateId Id of template to fetch jobs for. Example: 123
346
   * @param queryParams Query parameters of getDocgenTemplateJobByIdV2025R0 method
347
   * @param headers Headers of getDocgenTemplateJobByIdV2025R0 method
348
   */
349
  public DocGenJobsV2025R0 getDocgenTemplateJobByIdV2025R0(
350
      String templateId,
351
      GetDocgenTemplateJobByIdV2025R0QueryParams queryParams,
352
      GetDocgenTemplateJobByIdV2025R0Headers headers) {
353
    Map<String, String> queryParamsMap =
1✔
354
        prepareParams(
1✔
355
            mapOf(
1✔
356
                entryOf("marker", convertToString(queryParams.getMarker())),
1✔
357
                entryOf("limit", convertToString(queryParams.getLimit()))));
1✔
358
    Map<String, String> headersMap =
1✔
359
        prepareParams(
1✔
360
            mergeMaps(
1✔
361
                mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
1✔
362
                headers.getExtraHeaders()));
1✔
363
    FetchResponse response =
1✔
364
        this.networkSession
365
            .getNetworkClient()
1✔
366
            .fetch(
1✔
367
                new FetchOptions.Builder(
368
                        String.join(
1✔
369
                            "",
370
                            this.networkSession.getBaseUrls().getBaseUrl(),
1✔
371
                            "/2.0/docgen_template_jobs/",
372
                            convertToString(templateId)),
1✔
373
                        "GET")
374
                    .params(queryParamsMap)
1✔
375
                    .headers(headersMap)
1✔
376
                    .responseFormat(ResponseFormat.JSON)
1✔
377
                    .auth(this.auth)
1✔
378
                    .networkSession(this.networkSession)
1✔
379
                    .build());
1✔
380
    return JsonManager.deserialize(response.getData(), DocGenJobsV2025R0.class);
1✔
381
  }
382

383
  public Authentication getAuth() {
384
    return auth;
×
385
  }
386

387
  public NetworkSession getNetworkSession() {
388
    return networkSession;
×
389
  }
390

391
  public static class Builder {
392

393
    protected Authentication auth;
394

395
    protected NetworkSession networkSession;
396

397
    public Builder() {
1✔
398
      this.networkSession = new NetworkSession();
1✔
399
    }
1✔
400

401
    public Builder auth(Authentication auth) {
402
      this.auth = auth;
1✔
403
      return this;
1✔
404
    }
405

406
    public Builder networkSession(NetworkSession networkSession) {
407
      this.networkSession = networkSession;
1✔
408
      return this;
1✔
409
    }
410

411
    public DocgenTemplateManager build() {
412
      return new DocgenTemplateManager(this);
1✔
413
    }
414
  }
415
}
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