Skip to content

Commit 464fcae

Browse files
fix(api): mark AppleWebPushProvisioningResponse fields required
1 parent ad467a4 commit 464fcae

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 176
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-eeeb62a4869ba1436c9252f9630006a829695178e86305aea232f6be0d1e3d81.yml
3-
openapi_spec_hash: 25bf9c499cd22240949862e622c534f2
4-
config_hash: 2af43c32faa12490c9c9caa2ce62bccb
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d6e80e52c9f20d95780f2cf4869f80ee2c4b270ff9470941dc057e79d15bda1a.yml
3+
openapi_spec_hash: f2bb7084cd5225769302589cd1563241
4+
config_hash: 31d71922d7838f34ae0875c9b8026d99

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

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.lithic.api.core.JsonField
2020
import com.lithic.api.core.JsonMissing
2121
import com.lithic.api.core.JsonValue
2222
import com.lithic.api.core.allMaxBy
23+
import com.lithic.api.core.checkRequired
2324
import com.lithic.api.core.getOrThrow
2425
import com.lithic.api.errors.LithicInvalidDataException
2526
import java.util.Collections
@@ -256,18 +257,18 @@ private constructor(
256257
/**
257258
* JWS object required for handoff to Apple's script.
258259
*
259-
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
260-
* server responded with an unexpected value).
260+
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
261+
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
261262
*/
262-
fun jws(): Optional<WebPushProvisioningResponseJws> = jws.getOptional("jws")
263+
fun jws(): WebPushProvisioningResponseJws = jws.getRequired("jws")
263264

264265
/**
265266
* A unique identifier for the JWS object.
266267
*
267-
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
268-
* server responded with an unexpected value).
268+
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
269+
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
269270
*/
270-
fun state(): Optional<String> = state.getOptional("state")
271+
fun state(): String = state.getRequired("state")
271272

272273
/**
273274
* Returns the raw JSON value of [jws].
@@ -302,15 +303,21 @@ private constructor(
302303
/**
303304
* Returns a mutable builder for constructing an instance of
304305
* [AppleWebPushProvisioningResponse].
306+
*
307+
* The following fields are required:
308+
* ```java
309+
* .jws()
310+
* .state()
311+
* ```
305312
*/
306313
@JvmStatic fun builder() = Builder()
307314
}
308315

309316
/** A builder for [AppleWebPushProvisioningResponse]. */
310317
class Builder internal constructor() {
311318

312-
private var jws: JsonField<WebPushProvisioningResponseJws> = JsonMissing.of()
313-
private var state: JsonField<String> = JsonMissing.of()
319+
private var jws: JsonField<WebPushProvisioningResponseJws>? = null
320+
private var state: JsonField<String>? = null
314321
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
315322

316323
@JvmSynthetic
@@ -369,9 +376,21 @@ private constructor(
369376
* Returns an immutable instance of [AppleWebPushProvisioningResponse].
370377
*
371378
* Further updates to this [Builder] will not mutate the returned instance.
379+
*
380+
* The following fields are required:
381+
* ```java
382+
* .jws()
383+
* .state()
384+
* ```
385+
*
386+
* @throws IllegalStateException if any required field is unset.
372387
*/
373388
fun build(): AppleWebPushProvisioningResponse =
374-
AppleWebPushProvisioningResponse(jws, state, additionalProperties.toMutableMap())
389+
AppleWebPushProvisioningResponse(
390+
checkRequired("jws", jws),
391+
checkRequired("state", state),
392+
additionalProperties.toMutableMap(),
393+
)
375394
}
376395

377396
private var validated: Boolean = false
@@ -381,7 +400,7 @@ private constructor(
381400
return@apply
382401
}
383402

384-
jws().ifPresent { it.validate() }
403+
jws().validate()
385404
state()
386405
validated = true
387406
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ private constructor(
10971097
@JsonProperty("sec_code")
10981098
@ExcludeMissing
10991099
secCode: JsonField<SecCode> = JsonMissing.of(),
1100-
@JsonProperty("ach_hold__period")
1100+
@JsonProperty("ach_hold_period")
11011101
@ExcludeMissing
11021102
achHoldPeriod: JsonField<Long> = JsonMissing.of(),
11031103
@JsonProperty("addenda") @ExcludeMissing addenda: JsonField<String> = JsonMissing.of(),
@@ -1115,7 +1115,7 @@ private constructor(
11151115
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
11161116
* server responded with an unexpected value).
11171117
*/
1118-
fun achHoldPeriod(): Optional<Long> = achHoldPeriod.getOptional("ach_hold__period")
1118+
fun achHoldPeriod(): Optional<Long> = achHoldPeriod.getOptional("ach_hold_period")
11191119

11201120
/**
11211121
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -1136,7 +1136,7 @@ private constructor(
11361136
* Unlike [achHoldPeriod], this method doesn't throw if the JSON field has an unexpected
11371137
* type.
11381138
*/
1139-
@JsonProperty("ach_hold__period")
1139+
@JsonProperty("ach_hold_period")
11401140
@ExcludeMissing
11411141
fun _achHoldPeriod(): JsonField<Long> = achHoldPeriod
11421142

0 commit comments

Comments
 (0)