@@ -11,11 +11,11 @@ import com.lithic.api.core.JsonField
1111import com.lithic.api.core.JsonMissing
1212import com.lithic.api.core.JsonValue
1313import com.lithic.api.core.checkKnown
14+ import com.lithic.api.core.checkRequired
1415import com.lithic.api.core.toImmutable
1516import com.lithic.api.errors.LithicInvalidDataException
1617import java.util.Collections
1718import java.util.Objects
18- import java.util.Optional
1919import kotlin.jvm.optionals.getOrNull
2020
2121/* * A response containing a list of transactions */
@@ -36,18 +36,18 @@ private constructor(
3636 ) : this (data, hasMore, mutableMapOf ())
3737
3838 /* *
39- * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
40- * server responded with an unexpected value).
39+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
40+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
4141 */
42- fun data (): Optional < List <AccountActivityListResponse >> = data.getOptional (" data" )
42+ fun data (): List <AccountActivityListResponse > = data.getRequired (" data" )
4343
4444 /* *
4545 * Indicates if there are more transactions available for pagination
4646 *
47- * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
48- * server responded with an unexpected value).
47+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
48+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
4949 */
50- fun hasMore (): Optional < Boolean > = hasMore.getOptional (" has_more" )
50+ fun hasMore (): Boolean = hasMore.getRequired (" has_more" )
5151
5252 /* *
5353 * Returns the raw JSON value of [data].
@@ -82,6 +82,12 @@ private constructor(
8282 /* *
8383 * Returns a mutable builder for constructing an instance of
8484 * [AccountActivityListPageResponse].
85+ *
86+ * The following fields are required:
87+ * ```java
88+ * .data()
89+ * .hasMore()
90+ * ```
8591 */
8692 @JvmStatic fun builder () = Builder ()
8793 }
@@ -90,7 +96,7 @@ private constructor(
9096 class Builder internal constructor() {
9197
9298 private var data: JsonField <MutableList <AccountActivityListResponse >>? = null
93- private var hasMore: JsonField <Boolean > = JsonMissing .of()
99+ private var hasMore: JsonField <Boolean >? = null
94100 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
95101
96102 @JvmSynthetic
@@ -193,11 +199,19 @@ private constructor(
193199 * Returns an immutable instance of [AccountActivityListPageResponse].
194200 *
195201 * Further updates to this [Builder] will not mutate the returned instance.
202+ *
203+ * The following fields are required:
204+ * ```java
205+ * .data()
206+ * .hasMore()
207+ * ```
208+ *
209+ * @throws IllegalStateException if any required field is unset.
196210 */
197211 fun build (): AccountActivityListPageResponse =
198212 AccountActivityListPageResponse (
199- ( data ? : JsonMissing .of() ).map { it.toImmutable() },
200- hasMore,
213+ checkRequired( " data" , data ).map { it.toImmutable() },
214+ checkRequired( " hasMore" , hasMore) ,
201215 additionalProperties.toMutableMap(),
202216 )
203217 }
@@ -209,7 +223,7 @@ private constructor(
209223 return @apply
210224 }
211225
212- data().ifPresent { it. forEach { it.validate() } }
226+ data().forEach { it.validate() }
213227 hasMore()
214228 validated = true
215229 }
0 commit comments