Skip to content

Commit 0a90771

Browse files
refactor(client)!: improve some class names
1 parent b2a1763 commit 0a90771

File tree

1 file changed

+27
-58
lines changed

1 file changed

+27
-58
lines changed

lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt

Lines changed: 27 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,9 @@ private constructor(
101101
fun body(plaidCreateBankAccountApiRequest: Body.PlaidCreateBankAccountApiRequest) =
102102
body(Body.ofPlaidCreateBankAccountApiRequest(plaidCreateBankAccountApiRequest))
103103

104-
/**
105-
* Alias for calling [body] with
106-
* `Body.ofExternallyVerifiedCreateBankAccountApiRequest(externallyVerifiedCreateBankAccountApiRequest)`.
107-
*/
108-
fun body(
109-
externallyVerifiedCreateBankAccountApiRequest:
110-
Body.ExternallyVerifiedCreateBankAccountApiRequest
111-
) =
112-
body(
113-
Body.ofExternallyVerifiedCreateBankAccountApiRequest(
114-
externallyVerifiedCreateBankAccountApiRequest
115-
)
116-
)
104+
/** Alias for calling [body] with `Body.ofExternallyVerified(externallyVerified)`. */
105+
fun body(externallyVerified: Body.ExternallyVerifiedCreateBankAccountApiRequest) =
106+
body(Body.ofExternallyVerified(externallyVerified))
117107

118108
fun additionalHeaders(additionalHeaders: Headers) = apply {
119109
this.additionalHeaders.clear()
@@ -240,9 +230,7 @@ private constructor(
240230
BankVerifiedCreateBankAccountApiRequest? =
241231
null,
242232
private val plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest? = null,
243-
private val externallyVerifiedCreateBankAccountApiRequest:
244-
ExternallyVerifiedCreateBankAccountApiRequest? =
245-
null,
233+
private val externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest? = null,
246234
private val _json: JsonValue? = null,
247235
) {
248236

@@ -253,17 +241,15 @@ private constructor(
253241
fun plaidCreateBankAccountApiRequest(): Optional<PlaidCreateBankAccountApiRequest> =
254242
Optional.ofNullable(plaidCreateBankAccountApiRequest)
255243

256-
fun externallyVerifiedCreateBankAccountApiRequest():
257-
Optional<ExternallyVerifiedCreateBankAccountApiRequest> =
258-
Optional.ofNullable(externallyVerifiedCreateBankAccountApiRequest)
244+
fun externallyVerified(): Optional<ExternallyVerifiedCreateBankAccountApiRequest> =
245+
Optional.ofNullable(externallyVerified)
259246

260247
fun isBankVerifiedCreateBankAccountApiRequest(): Boolean =
261248
bankVerifiedCreateBankAccountApiRequest != null
262249

263250
fun isPlaidCreateBankAccountApiRequest(): Boolean = plaidCreateBankAccountApiRequest != null
264251

265-
fun isExternallyVerifiedCreateBankAccountApiRequest(): Boolean =
266-
externallyVerifiedCreateBankAccountApiRequest != null
252+
fun isExternallyVerified(): Boolean = externallyVerified != null
267253

268254
fun asBankVerifiedCreateBankAccountApiRequest(): BankVerifiedCreateBankAccountApiRequest =
269255
bankVerifiedCreateBankAccountApiRequest.getOrThrow(
@@ -273,11 +259,8 @@ private constructor(
273259
fun asPlaidCreateBankAccountApiRequest(): PlaidCreateBankAccountApiRequest =
274260
plaidCreateBankAccountApiRequest.getOrThrow("plaidCreateBankAccountApiRequest")
275261

276-
fun asExternallyVerifiedCreateBankAccountApiRequest():
277-
ExternallyVerifiedCreateBankAccountApiRequest =
278-
externallyVerifiedCreateBankAccountApiRequest.getOrThrow(
279-
"externallyVerifiedCreateBankAccountApiRequest"
280-
)
262+
fun asExternallyVerified(): ExternallyVerifiedCreateBankAccountApiRequest =
263+
externallyVerified.getOrThrow("externallyVerified")
281264

282265
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
283266

@@ -289,10 +272,7 @@ private constructor(
289272
)
290273
plaidCreateBankAccountApiRequest != null ->
291274
visitor.visitPlaidCreateBankAccountApiRequest(plaidCreateBankAccountApiRequest)
292-
externallyVerifiedCreateBankAccountApiRequest != null ->
293-
visitor.visitExternallyVerifiedCreateBankAccountApiRequest(
294-
externallyVerifiedCreateBankAccountApiRequest
295-
)
275+
externallyVerified != null -> visitor.visitExternallyVerified(externallyVerified)
296276
else -> visitor.unknown(_json)
297277
}
298278

@@ -318,11 +298,10 @@ private constructor(
318298
plaidCreateBankAccountApiRequest.validate()
319299
}
320300

321-
override fun visitExternallyVerifiedCreateBankAccountApiRequest(
322-
externallyVerifiedCreateBankAccountApiRequest:
323-
ExternallyVerifiedCreateBankAccountApiRequest
301+
override fun visitExternallyVerified(
302+
externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest
324303
) {
325-
externallyVerifiedCreateBankAccountApiRequest.validate()
304+
externallyVerified.validate()
326305
}
327306
}
328307
)
@@ -356,10 +335,9 @@ private constructor(
356335
plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest
357336
) = plaidCreateBankAccountApiRequest.validity()
358337

359-
override fun visitExternallyVerifiedCreateBankAccountApiRequest(
360-
externallyVerifiedCreateBankAccountApiRequest:
361-
ExternallyVerifiedCreateBankAccountApiRequest
362-
) = externallyVerifiedCreateBankAccountApiRequest.validity()
338+
override fun visitExternallyVerified(
339+
externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest
340+
) = externallyVerified.validity()
363341

364342
override fun unknown(json: JsonValue?) = 0
365343
}
@@ -370,19 +348,18 @@ private constructor(
370348
return true
371349
}
372350

373-
return /* spotless:off */ other is Body && bankVerifiedCreateBankAccountApiRequest == other.bankVerifiedCreateBankAccountApiRequest && plaidCreateBankAccountApiRequest == other.plaidCreateBankAccountApiRequest && externallyVerifiedCreateBankAccountApiRequest == other.externallyVerifiedCreateBankAccountApiRequest /* spotless:on */
351+
return /* spotless:off */ other is Body && bankVerifiedCreateBankAccountApiRequest == other.bankVerifiedCreateBankAccountApiRequest && plaidCreateBankAccountApiRequest == other.plaidCreateBankAccountApiRequest && externallyVerified == other.externallyVerified /* spotless:on */
374352
}
375353

376-
override fun hashCode(): Int = /* spotless:off */ Objects.hash(bankVerifiedCreateBankAccountApiRequest, plaidCreateBankAccountApiRequest, externallyVerifiedCreateBankAccountApiRequest) /* spotless:on */
354+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(bankVerifiedCreateBankAccountApiRequest, plaidCreateBankAccountApiRequest, externallyVerified) /* spotless:on */
377355

378356
override fun toString(): String =
379357
when {
380358
bankVerifiedCreateBankAccountApiRequest != null ->
381359
"Body{bankVerifiedCreateBankAccountApiRequest=$bankVerifiedCreateBankAccountApiRequest}"
382360
plaidCreateBankAccountApiRequest != null ->
383361
"Body{plaidCreateBankAccountApiRequest=$plaidCreateBankAccountApiRequest}"
384-
externallyVerifiedCreateBankAccountApiRequest != null ->
385-
"Body{externallyVerifiedCreateBankAccountApiRequest=$externallyVerifiedCreateBankAccountApiRequest}"
362+
externallyVerified != null -> "Body{externallyVerified=$externallyVerified}"
386363
_json != null -> "Body{_unknown=$_json}"
387364
else -> throw IllegalStateException("Invalid Body")
388365
}
@@ -404,14 +381,9 @@ private constructor(
404381
) = Body(plaidCreateBankAccountApiRequest = plaidCreateBankAccountApiRequest)
405382

406383
@JvmStatic
407-
fun ofExternallyVerifiedCreateBankAccountApiRequest(
408-
externallyVerifiedCreateBankAccountApiRequest:
409-
ExternallyVerifiedCreateBankAccountApiRequest
410-
) =
411-
Body(
412-
externallyVerifiedCreateBankAccountApiRequest =
413-
externallyVerifiedCreateBankAccountApiRequest
414-
)
384+
fun ofExternallyVerified(
385+
externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest
386+
) = Body(externallyVerified = externallyVerified)
415387
}
416388

417389
/** An interface that defines how to map each variant of [Body] to a value of type [T]. */
@@ -425,9 +397,8 @@ private constructor(
425397
plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest
426398
): T
427399

428-
fun visitExternallyVerifiedCreateBankAccountApiRequest(
429-
externallyVerifiedCreateBankAccountApiRequest:
430-
ExternallyVerifiedCreateBankAccountApiRequest
400+
fun visitExternallyVerified(
401+
externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest
431402
): T
432403

433404
/**
@@ -456,9 +427,7 @@ private constructor(
456427
node,
457428
jacksonTypeRef<ExternallyVerifiedCreateBankAccountApiRequest>(),
458429
)
459-
?.let {
460-
Body(externallyVerifiedCreateBankAccountApiRequest = it, _json = json)
461-
} ?: Body(_json = json)
430+
?.let { Body(externallyVerified = it, _json = json) } ?: Body(_json = json)
462431
}
463432

464433
val bestMatches =
@@ -501,8 +470,8 @@ private constructor(
501470
generator.writeObject(value.bankVerifiedCreateBankAccountApiRequest)
502471
value.plaidCreateBankAccountApiRequest != null ->
503472
generator.writeObject(value.plaidCreateBankAccountApiRequest)
504-
value.externallyVerifiedCreateBankAccountApiRequest != null ->
505-
generator.writeObject(value.externallyVerifiedCreateBankAccountApiRequest)
473+
value.externallyVerified != null ->
474+
generator.writeObject(value.externallyVerified)
506475
value._json != null -> generator.writeObject(value._json)
507476
else -> throw IllegalStateException("Invalid Body")
508477
}

0 commit comments

Comments
 (0)