• 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

57.84
/src/main/java/com/box/sdkgen/schemas/postoauth2token/PostOAuth2Token.java
1
package com.box.sdkgen.schemas.postoauth2token;
2

3
import com.box.sdkgen.internal.NullableFieldTracker;
4
import com.box.sdkgen.internal.SerializableObject;
5
import com.box.sdkgen.serialization.json.EnumWrapper;
6
import com.fasterxml.jackson.annotation.JsonFilter;
7
import com.fasterxml.jackson.annotation.JsonProperty;
8
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
9
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
10
import java.util.Objects;
11

12
/** A request for a new OAuth 2.0 token. */
13
@JsonFilter("nullablePropertyFilter")
14
public class PostOAuth2Token extends SerializableObject {
15

16
  /**
17
   * The type of request being made, either using a client-side obtained authorization code, a
18
   * refresh token, a JWT assertion, client credentials grant or another access token for the
19
   * purpose of downscoping a token.
20
   */
21
  @JsonDeserialize(
22
      using = PostOAuth2TokenGrantTypeField.PostOAuth2TokenGrantTypeFieldDeserializer.class)
23
  @JsonSerialize(
24
      using = PostOAuth2TokenGrantTypeField.PostOAuth2TokenGrantTypeFieldSerializer.class)
25
  @JsonProperty("grant_type")
26
  protected final EnumWrapper<PostOAuth2TokenGrantTypeField> grantType;
27

28
  /**
29
   * The Client ID of the application requesting an access token.
30
   *
31
   * <p>Used in combination with `authorization_code`, `client_credentials`, or
32
   * `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`.
33
   */
34
  @JsonProperty("client_id")
35
  protected String clientId;
36

37
  /**
38
   * The client secret of the application requesting an access token.
39
   *
40
   * <p>Used in combination with `authorization_code`, `client_credentials`, or
41
   * `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`.
42
   */
43
  @JsonProperty("client_secret")
44
  protected String clientSecret;
45

46
  /**
47
   * The client-side authorization code passed to your application by Box in the browser redirect
48
   * after the user has successfully granted your application permission to make API calls on their
49
   * behalf.
50
   *
51
   * <p>Used in combination with `authorization_code` as the `grant_type`.
52
   */
53
  protected String code;
54

55
  /**
56
   * A refresh token used to get a new access token with.
57
   *
58
   * <p>Used in combination with `refresh_token` as the `grant_type`.
59
   */
60
  @JsonProperty("refresh_token")
61
  protected String refreshToken;
62

63
  /**
64
   * A JWT assertion for which to request a new access token.
65
   *
66
   * <p>Used in combination with `urn:ietf:params:oauth:grant-type:jwt-bearer` as the `grant_type`.
67
   */
68
  protected String assertion;
69

70
  /**
71
   * The token to exchange for a downscoped token. This can be a regular access token, a JWT
72
   * assertion, or an app token.
73
   *
74
   * <p>Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the
75
   * `grant_type`.
76
   */
77
  @JsonProperty("subject_token")
78
  protected String subjectToken;
79

80
  /**
81
   * The type of `subject_token` passed in.
82
   *
83
   * <p>Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the
84
   * `grant_type`.
85
   */
86
  @JsonDeserialize(
87
      using =
88
          PostOAuth2TokenSubjectTokenTypeField.PostOAuth2TokenSubjectTokenTypeFieldDeserializer
89
              .class)
90
  @JsonSerialize(
91
      using =
92
          PostOAuth2TokenSubjectTokenTypeField.PostOAuth2TokenSubjectTokenTypeFieldSerializer.class)
93
  @JsonProperty("subject_token_type")
94
  protected EnumWrapper<PostOAuth2TokenSubjectTokenTypeField> subjectTokenType;
95

96
  /**
97
   * The token used to create an annotator token. This is a JWT assertion.
98
   *
99
   * <p>Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the
100
   * `grant_type`.
101
   */
102
  @JsonProperty("actor_token")
103
  protected String actorToken;
104

105
  /**
106
   * The type of `actor_token` passed in.
107
   *
108
   * <p>Used in combination with `urn:ietf:params:oauth:grant-type:token-exchange` as the
109
   * `grant_type`.
110
   */
111
  @JsonDeserialize(
112
      using =
113
          PostOAuth2TokenActorTokenTypeField.PostOAuth2TokenActorTokenTypeFieldDeserializer.class)
114
  @JsonSerialize(
115
      using = PostOAuth2TokenActorTokenTypeField.PostOAuth2TokenActorTokenTypeFieldSerializer.class)
116
  @JsonProperty("actor_token_type")
117
  protected EnumWrapper<PostOAuth2TokenActorTokenTypeField> actorTokenType;
118

119
  /**
120
   * The space-delimited list of scopes that you want apply to the new access token.
121
   *
122
   * <p>The `subject_token` will need to have all of these scopes or the call will error with **401
123
   * Unauthorized**..
124
   */
125
  protected String scope;
126

127
  /** Full URL for the file that the token should be generated for. */
128
  protected String resource;
129

130
  /** Used in combination with `client_credentials` as the `grant_type`. */
131
  @JsonDeserialize(
132
      using =
133
          PostOAuth2TokenBoxSubjectTypeField.PostOAuth2TokenBoxSubjectTypeFieldDeserializer.class)
134
  @JsonSerialize(
135
      using = PostOAuth2TokenBoxSubjectTypeField.PostOAuth2TokenBoxSubjectTypeFieldSerializer.class)
136
  @JsonProperty("box_subject_type")
137
  protected EnumWrapper<PostOAuth2TokenBoxSubjectTypeField> boxSubjectType;
138

139
  /**
140
   * Used in combination with `client_credentials` as the `grant_type`. Value is determined by
141
   * `box_subject_type`. If `user` use user ID and if `enterprise` use enterprise ID.
142
   */
143
  @JsonProperty("box_subject_id")
144
  protected String boxSubjectId;
145

146
  /** Full URL of the shared link on the file or folder that the token should be generated for. */
147
  @JsonProperty("box_shared_link")
148
  protected String boxSharedLink;
149

150
  public PostOAuth2Token(PostOAuth2TokenGrantTypeField grantType) {
151
    super();
×
152
    this.grantType = new EnumWrapper<PostOAuth2TokenGrantTypeField>(grantType);
×
153
  }
×
154

155
  public PostOAuth2Token(
156
      @JsonProperty("grant_type") EnumWrapper<PostOAuth2TokenGrantTypeField> grantType) {
157
    super();
×
158
    this.grantType = grantType;
×
159
  }
×
160

161
  protected PostOAuth2Token(Builder builder) {
162
    super();
1✔
163
    this.grantType = builder.grantType;
1✔
164
    this.clientId = builder.clientId;
1✔
165
    this.clientSecret = builder.clientSecret;
1✔
166
    this.code = builder.code;
1✔
167
    this.refreshToken = builder.refreshToken;
1✔
168
    this.assertion = builder.assertion;
1✔
169
    this.subjectToken = builder.subjectToken;
1✔
170
    this.subjectTokenType = builder.subjectTokenType;
1✔
171
    this.actorToken = builder.actorToken;
1✔
172
    this.actorTokenType = builder.actorTokenType;
1✔
173
    this.scope = builder.scope;
1✔
174
    this.resource = builder.resource;
1✔
175
    this.boxSubjectType = builder.boxSubjectType;
1✔
176
    this.boxSubjectId = builder.boxSubjectId;
1✔
177
    this.boxSharedLink = builder.boxSharedLink;
1✔
178
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
1✔
179
  }
1✔
180

181
  public EnumWrapper<PostOAuth2TokenGrantTypeField> getGrantType() {
182
    return grantType;
1✔
183
  }
184

185
  public String getClientId() {
186
    return clientId;
1✔
187
  }
188

189
  public String getClientSecret() {
190
    return clientSecret;
1✔
191
  }
192

193
  public String getCode() {
194
    return code;
1✔
195
  }
196

197
  public String getRefreshToken() {
198
    return refreshToken;
1✔
199
  }
200

201
  public String getAssertion() {
202
    return assertion;
1✔
203
  }
204

205
  public String getSubjectToken() {
206
    return subjectToken;
1✔
207
  }
208

209
  public EnumWrapper<PostOAuth2TokenSubjectTokenTypeField> getSubjectTokenType() {
210
    return subjectTokenType;
1✔
211
  }
212

213
  public String getActorToken() {
214
    return actorToken;
1✔
215
  }
216

217
  public EnumWrapper<PostOAuth2TokenActorTokenTypeField> getActorTokenType() {
218
    return actorTokenType;
1✔
219
  }
220

221
  public String getScope() {
222
    return scope;
1✔
223
  }
224

225
  public String getResource() {
226
    return resource;
1✔
227
  }
228

229
  public EnumWrapper<PostOAuth2TokenBoxSubjectTypeField> getBoxSubjectType() {
230
    return boxSubjectType;
1✔
231
  }
232

233
  public String getBoxSubjectId() {
234
    return boxSubjectId;
1✔
235
  }
236

237
  public String getBoxSharedLink() {
238
    return boxSharedLink;
1✔
239
  }
240

241
  @Override
242
  public boolean equals(Object o) {
243
    if (this == o) {
×
244
      return true;
×
245
    }
246
    if (o == null || getClass() != o.getClass()) {
×
247
      return false;
×
248
    }
249
    PostOAuth2Token casted = (PostOAuth2Token) o;
×
250
    return Objects.equals(grantType, casted.grantType)
×
251
        && Objects.equals(clientId, casted.clientId)
×
252
        && Objects.equals(clientSecret, casted.clientSecret)
×
253
        && Objects.equals(code, casted.code)
×
254
        && Objects.equals(refreshToken, casted.refreshToken)
×
255
        && Objects.equals(assertion, casted.assertion)
×
256
        && Objects.equals(subjectToken, casted.subjectToken)
×
257
        && Objects.equals(subjectTokenType, casted.subjectTokenType)
×
258
        && Objects.equals(actorToken, casted.actorToken)
×
259
        && Objects.equals(actorTokenType, casted.actorTokenType)
×
260
        && Objects.equals(scope, casted.scope)
×
261
        && Objects.equals(resource, casted.resource)
×
262
        && Objects.equals(boxSubjectType, casted.boxSubjectType)
×
263
        && Objects.equals(boxSubjectId, casted.boxSubjectId)
×
264
        && Objects.equals(boxSharedLink, casted.boxSharedLink);
×
265
  }
266

267
  @Override
268
  public int hashCode() {
269
    return Objects.hash(
×
270
        grantType,
271
        clientId,
272
        clientSecret,
273
        code,
274
        refreshToken,
275
        assertion,
276
        subjectToken,
277
        subjectTokenType,
278
        actorToken,
279
        actorTokenType,
280
        scope,
281
        resource,
282
        boxSubjectType,
283
        boxSubjectId,
284
        boxSharedLink);
285
  }
286

287
  @Override
288
  public String toString() {
289
    return "PostOAuth2Token{"
×
290
        + "grantType='"
291
        + grantType
292
        + '\''
293
        + ", "
294
        + "clientId='"
295
        + clientId
296
        + '\''
297
        + ", "
298
        + "clientSecret='"
299
        + clientSecret
300
        + '\''
301
        + ", "
302
        + "code='"
303
        + code
304
        + '\''
305
        + ", "
306
        + "refreshToken='"
307
        + refreshToken
308
        + '\''
309
        + ", "
310
        + "assertion='"
311
        + assertion
312
        + '\''
313
        + ", "
314
        + "subjectToken='"
315
        + subjectToken
316
        + '\''
317
        + ", "
318
        + "subjectTokenType='"
319
        + subjectTokenType
320
        + '\''
321
        + ", "
322
        + "actorToken='"
323
        + actorToken
324
        + '\''
325
        + ", "
326
        + "actorTokenType='"
327
        + actorTokenType
328
        + '\''
329
        + ", "
330
        + "scope='"
331
        + scope
332
        + '\''
333
        + ", "
334
        + "resource='"
335
        + resource
336
        + '\''
337
        + ", "
338
        + "boxSubjectType='"
339
        + boxSubjectType
340
        + '\''
341
        + ", "
342
        + "boxSubjectId='"
343
        + boxSubjectId
344
        + '\''
345
        + ", "
346
        + "boxSharedLink='"
347
        + boxSharedLink
348
        + '\''
349
        + "}";
350
  }
351

352
  public static class Builder extends NullableFieldTracker {
353

354
    protected final EnumWrapper<PostOAuth2TokenGrantTypeField> grantType;
355

356
    protected String clientId;
357

358
    protected String clientSecret;
359

360
    protected String code;
361

362
    protected String refreshToken;
363

364
    protected String assertion;
365

366
    protected String subjectToken;
367

368
    protected EnumWrapper<PostOAuth2TokenSubjectTokenTypeField> subjectTokenType;
369

370
    protected String actorToken;
371

372
    protected EnumWrapper<PostOAuth2TokenActorTokenTypeField> actorTokenType;
373

374
    protected String scope;
375

376
    protected String resource;
377

378
    protected EnumWrapper<PostOAuth2TokenBoxSubjectTypeField> boxSubjectType;
379

380
    protected String boxSubjectId;
381

382
    protected String boxSharedLink;
383

384
    public Builder(PostOAuth2TokenGrantTypeField grantType) {
385
      super();
1✔
386
      this.grantType = new EnumWrapper<PostOAuth2TokenGrantTypeField>(grantType);
1✔
387
    }
1✔
388

389
    public Builder(EnumWrapper<PostOAuth2TokenGrantTypeField> grantType) {
390
      super();
×
391
      this.grantType = grantType;
×
392
    }
×
393

394
    public Builder clientId(String clientId) {
395
      this.clientId = clientId;
1✔
396
      return this;
1✔
397
    }
398

399
    public Builder clientSecret(String clientSecret) {
400
      this.clientSecret = clientSecret;
1✔
401
      return this;
1✔
402
    }
403

404
    public Builder code(String code) {
405
      this.code = code;
×
406
      return this;
×
407
    }
408

409
    public Builder refreshToken(String refreshToken) {
410
      this.refreshToken = refreshToken;
1✔
411
      return this;
1✔
412
    }
413

414
    public Builder assertion(String assertion) {
415
      this.assertion = assertion;
1✔
416
      return this;
1✔
417
    }
418

419
    public Builder subjectToken(String subjectToken) {
420
      this.subjectToken = subjectToken;
1✔
421
      return this;
1✔
422
    }
423

424
    public Builder subjectTokenType(PostOAuth2TokenSubjectTokenTypeField subjectTokenType) {
425
      this.subjectTokenType =
1✔
426
          new EnumWrapper<PostOAuth2TokenSubjectTokenTypeField>(subjectTokenType);
427
      return this;
1✔
428
    }
429

430
    public Builder subjectTokenType(
431
        EnumWrapper<PostOAuth2TokenSubjectTokenTypeField> subjectTokenType) {
432
      this.subjectTokenType = subjectTokenType;
×
433
      return this;
×
434
    }
435

436
    public Builder actorToken(String actorToken) {
437
      this.actorToken = actorToken;
×
438
      return this;
×
439
    }
440

441
    public Builder actorTokenType(PostOAuth2TokenActorTokenTypeField actorTokenType) {
442
      this.actorTokenType = new EnumWrapper<PostOAuth2TokenActorTokenTypeField>(actorTokenType);
×
443
      return this;
×
444
    }
445

446
    public Builder actorTokenType(EnumWrapper<PostOAuth2TokenActorTokenTypeField> actorTokenType) {
447
      this.actorTokenType = actorTokenType;
×
448
      return this;
×
449
    }
450

451
    public Builder scope(String scope) {
452
      this.scope = scope;
1✔
453
      return this;
1✔
454
    }
455

456
    public Builder resource(String resource) {
457
      this.resource = resource;
1✔
458
      return this;
1✔
459
    }
460

461
    public Builder boxSubjectType(PostOAuth2TokenBoxSubjectTypeField boxSubjectType) {
462
      this.boxSubjectType = new EnumWrapper<PostOAuth2TokenBoxSubjectTypeField>(boxSubjectType);
×
463
      return this;
×
464
    }
465

466
    public Builder boxSubjectType(EnumWrapper<PostOAuth2TokenBoxSubjectTypeField> boxSubjectType) {
467
      this.boxSubjectType = boxSubjectType;
1✔
468
      return this;
1✔
469
    }
470

471
    public Builder boxSubjectId(String boxSubjectId) {
472
      this.boxSubjectId = boxSubjectId;
1✔
473
      return this;
1✔
474
    }
475

476
    public Builder boxSharedLink(String boxSharedLink) {
477
      this.boxSharedLink = boxSharedLink;
1✔
478
      return this;
1✔
479
    }
480

481
    public PostOAuth2Token build() {
482
      return new PostOAuth2Token(this);
1✔
483
    }
484
  }
485
}
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