diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 5272e554..c3e01e1e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.52.2"
+ ".": "0.53.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 037b2232..f2253470 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-95a3d7780935a38e0cf076d4ad2d68bd1a5641bced8398d972db2e92751d364a.yml
openapi_spec_hash: 9ebe818c4ad4f2d9c4e473b5192d7544
-config_hash: ec4f1e02d3528e3a93a73e33bca17c2a
+config_hash: 3dc5bc1df028fc7301fb2ada9846f038
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7719043b..b1a9f7ec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,22 @@
# Changelog
+## 0.53.0 (2025-04-02)
+
+Full Changelog: [v0.52.2...v0.53.0](https://github.com/orbcorp/orb-java/compare/v0.52.2...v0.53.0)
+
+### Features
+
+* **client:** add enum validation method ([d6fdaa3](https://github.com/orbcorp/orb-java/commit/d6fdaa34309a8c1bcc4f2bd84beaae587f3a3e9d))
+* **client:** make union deserialization more robust ([#379](https://github.com/orbcorp/orb-java/issues/379)) ([d6fdaa3](https://github.com/orbcorp/orb-java/commit/d6fdaa34309a8c1bcc4f2bd84beaae587f3a3e9d))
+
+
+### Chores
+
+* **client:** remove unnecessary json state from some query param classes ([d6fdaa3](https://github.com/orbcorp/orb-java/commit/d6fdaa34309a8c1bcc4f2bd84beaae587f3a3e9d))
+* **internal:** add invalid json deserialization tests ([d6fdaa3](https://github.com/orbcorp/orb-java/commit/d6fdaa34309a8c1bcc4f2bd84beaae587f3a3e9d))
+* **internal:** add json roundtripping tests ([d6fdaa3](https://github.com/orbcorp/orb-java/commit/d6fdaa34309a8c1bcc4f2bd84beaae587f3a3e9d))
+* **internal:** codegen related update ([#381](https://github.com/orbcorp/orb-java/issues/381)) ([1373dc9](https://github.com/orbcorp/orb-java/commit/1373dc9c246351e40eb442e4af9af81c1b8cb881))
+
## 0.52.2 (2025-04-01)
Full Changelog: [v0.52.1...v0.52.2](https://github.com/orbcorp/orb-java/compare/v0.52.1...v0.52.2)
diff --git a/README.md b/README.md
index 2898dac9..fe7a91e1 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.52.2)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.53.0)
@@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho
### Gradle
```kotlin
-implementation("com.withorb.api:orb-java:0.52.2")
+implementation("com.withorb.api:orb-java:0.53.0")
```
### Maven
@@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.52.2")
com.withorb.api
orb-java
- 0.52.2
+ 0.53.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 153bd1ba..c113fc72 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,4 @@
allprojects {
group = "com.withorb.api"
- version = "0.52.2" // x-release-please-version
+ version = "0.53.0" // x-release-please-version
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt
index 2a73d238..4735d626 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt
@@ -7,11 +7,9 @@ import com.fasterxml.jackson.databind.BeanProperty
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.JavaType
import com.fasterxml.jackson.databind.JsonDeserializer
-import com.fasterxml.jackson.databind.JsonMappingException
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.deser.ContextualDeserializer
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
-import com.withorb.api.errors.OrbInvalidDataException
import kotlin.reflect.KClass
abstract class BaseDeserializer(type: KClass) :
@@ -30,38 +28,17 @@ abstract class BaseDeserializer(type: KClass) :
protected abstract fun ObjectCodec.deserialize(node: JsonNode): T
- protected fun ObjectCodec.deserialize(node: JsonNode, type: TypeReference): T =
+ protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: TypeReference): T? =
try {
readValue(treeAsTokens(node), type)
} catch (e: Exception) {
- throw OrbInvalidDataException("Error deserializing", e)
- }
-
- protected fun ObjectCodec.tryDeserialize(
- node: JsonNode,
- type: TypeReference,
- validate: (T) -> Unit = {},
- ): T? {
- return try {
- readValue(treeAsTokens(node), type).apply(validate)
- } catch (e: JsonMappingException) {
- null
- } catch (e: RuntimeException) {
null
}
- }
- protected fun ObjectCodec.tryDeserialize(
- node: JsonNode,
- type: JavaType,
- validate: (T) -> Unit = {},
- ): T? {
- return try {
- readValue(treeAsTokens(node), type).apply(validate)
- } catch (e: JsonMappingException) {
- null
- } catch (e: RuntimeException) {
+ protected fun ObjectCodec.tryDeserialize(node: JsonNode, type: JavaType): T? =
+ try {
+ readValue(treeAsTokens(node), type)
+ } catch (e: Exception) {
null
}
- }
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt
index 8710064b..df2451e5 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt
@@ -4,12 +4,16 @@ package com.withorb.api.core
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.JsonParseException
+import com.fasterxml.jackson.core.JsonParser
+import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.MapperFeature
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.cfg.CoercionAction
import com.fasterxml.jackson.databind.cfg.CoercionInputShape
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.databind.module.SimpleModule
import com.fasterxml.jackson.databind.type.LogicalType
@@ -17,13 +21,23 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.kotlinModule
import java.io.InputStream
+import java.time.DateTimeException
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.ZonedDateTime
+import java.time.format.DateTimeFormatter
+import java.time.temporal.ChronoField
fun jsonMapper(): JsonMapper =
JsonMapper.builder()
.addModule(kotlinModule())
.addModule(Jdk8Module())
.addModule(JavaTimeModule())
- .addModule(SimpleModule().addSerializer(InputStreamJsonSerializer))
+ .addModule(
+ SimpleModule()
+ .addSerializer(InputStreamSerializer)
+ .addDeserializer(LocalDateTime::class.java, LenientLocalDateTimeDeserializer())
+ )
.withCoercionConfig(LogicalType.Boolean) {
it.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail)
.setCoercion(CoercionInputShape.Float, CoercionAction.Fail)
@@ -91,7 +105,10 @@ fun jsonMapper(): JsonMapper =
.disable(MapperFeature.AUTO_DETECT_SETTERS)
.build()
-private object InputStreamJsonSerializer : BaseSerializer(InputStream::class) {
+/** A serializer that serializes [InputStream] to bytes. */
+private object InputStreamSerializer : BaseSerializer(InputStream::class) {
+
+ private fun readResolve(): Any = InputStreamSerializer
override fun serialize(
value: InputStream?,
@@ -105,3 +122,46 @@ private object InputStreamJsonSerializer : BaseSerializer(InputStre
}
}
}
+
+/**
+ * A deserializer that can deserialize [LocalDateTime] from datetimes, dates, and zoned datetimes.
+ */
+private class LenientLocalDateTimeDeserializer :
+ StdDeserializer(LocalDateTime::class.java) {
+
+ companion object {
+
+ private val DATE_TIME_FORMATTERS =
+ listOf(
+ DateTimeFormatter.ISO_LOCAL_DATE_TIME,
+ DateTimeFormatter.ISO_LOCAL_DATE,
+ DateTimeFormatter.ISO_ZONED_DATE_TIME,
+ )
+ }
+
+ override fun logicalType(): LogicalType = LogicalType.DateTime
+
+ override fun deserialize(p: JsonParser, context: DeserializationContext?): LocalDateTime {
+ val exceptions = mutableListOf()
+
+ for (formatter in DATE_TIME_FORMATTERS) {
+ try {
+ val temporal = formatter.parse(p.text)
+
+ return when {
+ !temporal.isSupported(ChronoField.HOUR_OF_DAY) ->
+ LocalDate.from(temporal).atStartOfDay()
+ !temporal.isSupported(ChronoField.OFFSET_SECONDS) ->
+ LocalDateTime.from(temporal)
+ else -> ZonedDateTime.from(temporal).toLocalDateTime()
+ }
+ } catch (e: DateTimeException) {
+ exceptions.add(e)
+ }
+ }
+
+ throw JsonParseException(p, "Cannot parse `LocalDateTime` from value: ${p.text}").apply {
+ exceptions.forEach { addSuppressed(it) }
+ }
+ }
+}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt
index 9cf3ba5a..e0ad480d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Utils.kt
@@ -26,6 +26,34 @@ internal fun , V> SortedMap.toImmutable(): SortedMap> Sequence.allMaxBy(selector: (T) -> R): List {
+ var maxValue: R? = null
+ val maxElements = mutableListOf()
+
+ val iterator = iterator()
+ while (iterator.hasNext()) {
+ val element = iterator.next()
+ val value = selector(element)
+ if (maxValue == null || value > maxValue) {
+ maxValue = value
+ maxElements.clear()
+ maxElements.add(element)
+ } else if (value == maxValue) {
+ maxElements.add(element)
+ }
+ }
+
+ return maxElements
+}
+
/**
* Returns whether [this] is equal to [other].
*
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
index 981f9010..ca2be828 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
@@ -518,10 +518,36 @@ private constructor(
plan().ifPresent { it.validate() }
subscription().ifPresent { it.validate() }
thresholds().ifPresent { it.forEach { it.validate() } }
- type()
+ type().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (enabled.asKnown().isPresent) 1 else 0) +
+ (metric.asKnown().getOrNull()?.validity() ?: 0) +
+ (plan.asKnown().getOrNull()?.validity() ?: 0) +
+ (subscription.asKnown().getOrNull()?.validity() ?: 0) +
+ (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
/** The customer the alert applies to. */
class Customer
private constructor(
@@ -692,6 +718,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -829,6 +874,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1098,6 +1159,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalPlanId.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (if (planVersion.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1235,6 +1317,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1380,6 +1478,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (value.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1501,6 +1615,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
index ab06c22b..daa6485f 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
@@ -538,11 +538,31 @@ private constructor(
}
currency()
- type()
+ type().validate()
thresholds().ifPresent { it.forEach { it.validate() } }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -652,6 +672,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -793,6 +840,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (value.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
index caa76db5..52fa366f 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
@@ -544,11 +544,31 @@ private constructor(
}
currency()
- type()
+ type().validate()
thresholds().ifPresent { it.forEach { it.validate() } }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -658,6 +678,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -799,6 +846,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (value.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
index 5aa2c875..fd1f910d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
@@ -542,11 +542,31 @@ private constructor(
}
thresholds().forEach { it.validate() }
- type()
+ type().validate()
metricId()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (metricId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -693,6 +713,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (value.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -796,6 +832,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
index e9b4474b..a49dabee 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.AlertService
import java.util.Collections
import java.util.Objects
@@ -136,6 +137,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt
index 4d3af4d1..19fde1bb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.AlertServiceAsync
import java.util.Collections
import java.util.Objects
@@ -138,6 +139,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt
index 089cef3d..92c864c9 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt
@@ -19,6 +19,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Collections
import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
/** This endpoint updates the thresholds of an alert. */
class AlertUpdateParams
@@ -402,6 +403,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (thresholds.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -548,6 +567,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (value.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
index d7fc6768..9ea82316 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
@@ -274,11 +274,31 @@ private constructor(
amountDiscount()
appliesToPriceIds()
- discountType()
+ discountType().validate()
reason()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amountDiscount.asKnown().isPresent) 1 else 0) +
+ (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) +
+ (discountType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (reason.asKnown().isPresent) 1 else 0)
+
class DiscountType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -360,6 +380,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): DiscountType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
index 8585a17c..face5dc8 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
@@ -320,10 +320,32 @@ private constructor(
item().validate()
metadata().validate()
name()
- status()
+ status().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (item.asKnown().getOrNull()?.validity() ?: 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (status.asKnown().getOrNull()?.validity() ?: 0)
+
/**
* User specified key-value pairs for the resource. If not present, this defaults to an empty
* dictionary. Individual keys can be removed by setting the value to `null`, and the entire
@@ -395,6 +417,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -502,6 +542,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Status = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt
index 9266aa90..1852fa6b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt
@@ -96,6 +96,32 @@ private constructor(private val value: JsonField) : Enum {
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): BillingCycleRelativeDate = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
index a2c4dac0..ce4b90e6 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
@@ -452,6 +452,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (archivedAt.asKnown().isPresent) 1 else 0) +
+ (discount.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (durationInMonths.asKnown().isPresent) 1 else 0) +
+ (if (maxRedemptions.asKnown().isPresent) 1 else 0) +
+ (if (redemptionCode.asKnown().isPresent) 1 else 0) +
+ (if (timesRedeemed.asKnown().isPresent) 1 else 0)
+
@JsonDeserialize(using = Discount.Deserializer::class)
@JsonSerialize(using = Discount.Serializer::class)
class Discount
@@ -475,13 +498,12 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
percentage != null -> visitor.visitPercentage(percentage)
amount != null -> visitor.visitAmount(amount)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -504,6 +526,33 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitPercentage(percentage: PercentageDiscount) =
+ percentage.validity()
+
+ override fun visitAmount(amount: AmountDiscount) = amount.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -563,16 +612,14 @@ private constructor(
when (discountType) {
"percentage" -> {
- return Discount(
- percentage = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ Discount(percentage = it, _json = json)
+ } ?: Discount(_json = json)
}
"amount" -> {
- return Discount(
- amount = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ Discount(amount = it, _json = json)
+ } ?: Discount(_json = json)
}
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
index 19d1b3b2..83e01d4c 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
@@ -737,6 +737,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (discount.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (redemptionCode.asKnown().isPresent) 1 else 0) +
+ (if (durationInMonths.asKnown().isPresent) 1 else 0) +
+ (if (maxRedemptions.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -782,13 +803,12 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
newCouponPercentage != null -> visitor.visitNewCouponPercentage(newCouponPercentage)
newCouponAmount != null -> visitor.visitNewCouponAmount(newCouponAmount)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -813,6 +833,35 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitNewCouponPercentage(
+ newCouponPercentage: NewCouponPercentageDiscount
+ ) = newCouponPercentage.validity()
+
+ override fun visitNewCouponAmount(newCouponAmount: NewCouponAmountDiscount) =
+ newCouponAmount.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -875,18 +924,14 @@ private constructor(
when (discountType) {
"percentage" -> {
- return Discount(
- newCouponPercentage =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { Discount(newCouponPercentage = it, _json = json) }
+ ?: Discount(_json = json)
}
"amount" -> {
- return Discount(
- newCouponAmount =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { Discount(newCouponAmount = it, _json = json) }
+ ?: Discount(_json = json)
}
}
@@ -1083,11 +1128,30 @@ private constructor(
return@apply
}
- discountType()
+ discountType().validate()
percentageDiscount()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (discountType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (percentageDiscount.asKnown().isPresent) 1 else 0)
+
class DiscountType
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -1175,6 +1239,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): DiscountType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1378,10 +1469,29 @@ private constructor(
}
amountDiscount()
- discountType()
+ discountType().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amountDiscount.asKnown().isPresent) 1 else 0) +
+ (discountType.asKnown().getOrNull()?.validity() ?: 0)
+
class DiscountType
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -1469,6 +1579,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): DiscountType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
index 812a9001..9939054a 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.CouponService
import java.util.Collections
import java.util.Objects
@@ -132,6 +133,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt
index 49150cde..3b1e71fb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.CouponServiceAsync
import java.util.Collections
import java.util.Objects
@@ -134,6 +135,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
index 22529703..21f1e662 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.coupons.SubscriptionService
import java.util.Collections
import java.util.Objects
@@ -134,6 +135,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt
index 0199a125..c9bd5656 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.coupons.SubscriptionServiceAsync
import java.util.Collections
import java.util.Objects
@@ -136,6 +137,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
index 73704c29..c9228a33 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
@@ -772,15 +772,47 @@ private constructor(
maximumAmountAdjustment().ifPresent { it.validate() }
memo()
minimumAmountRefunded()
- reason()
+ reason().ifPresent { it.validate() }
subtotal()
total()
- type()
+ type().validate()
voidedAt()
discounts().ifPresent { it.forEach { it.validate() } }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (if (creditNoteNumber.asKnown().isPresent) 1 else 0) +
+ (if (creditNotePdf.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (invoiceId.asKnown().isPresent) 1 else 0) +
+ (lineItems.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (maximumAmountAdjustment.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (minimumAmountRefunded.asKnown().isPresent) 1 else 0) +
+ (reason.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (subtotal.asKnown().isPresent) 1 else 0) +
+ (if (total.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (voidedAt.asKnown().isPresent) 1 else 0) +
+ (discounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
class Customer
private constructor(
private val id: JsonField,
@@ -950,6 +982,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1396,6 +1447,31 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (itemId.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (if (quantity.asKnown().isPresent) 1 else 0) +
+ (if (subtotal.asKnown().isPresent) 1 else 0) +
+ (taxAmounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (discounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
class TaxAmount
private constructor(
private val amount: JsonField,
@@ -1622,6 +1698,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (taxRateDescription.asKnown().isPresent) 1 else 0) +
+ (if (taxRatePercentage.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2024,13 +2120,37 @@ private constructor(
id()
amountApplied()
appliesToPriceIds()
- discountType()
+ discountType().validate()
percentageDiscount()
amountDiscount()
reason()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amountApplied.asKnown().isPresent) 1 else 0) +
+ (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) +
+ (discountType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (percentageDiscount.asKnown().isPresent) 1 else 0) +
+ (if (amountDiscount.asKnown().isPresent) 1 else 0) +
+ (if (reason.asKnown().isPresent) 1 else 0)
+
class DiscountType
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -2124,6 +2244,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): DiscountType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2469,13 +2616,35 @@ private constructor(
}
amountApplied()
- discountType()
+ discountType().validate()
percentageDiscount()
appliesToPrices().ifPresent { it.forEach { it.validate() } }
reason()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amountApplied.asKnown().isPresent) 1 else 0) +
+ (discountType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (percentageDiscount.asKnown().isPresent) 1 else 0) +
+ (appliesToPrices.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (reason.asKnown().isPresent) 1 else 0)
+
class DiscountType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -2559,6 +2728,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): DiscountType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2730,6 +2926,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) + (if (name.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2862,6 +3076,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Reason = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2959,6 +3200,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3267,13 +3535,35 @@ private constructor(
}
amountApplied()
- discountType()
+ discountType().validate()
percentageDiscount()
appliesToPrices().ifPresent { it.forEach { it.validate() } }
reason()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amountApplied.asKnown().isPresent) 1 else 0) +
+ (discountType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (percentageDiscount.asKnown().isPresent) 1 else 0) +
+ (appliesToPrices.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (reason.asKnown().isPresent) 1 else 0)
+
class DiscountType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -3357,6 +3647,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): DiscountType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3528,6 +3845,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) + (if (name.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
index a44f7e88..a31d4a31 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
@@ -505,10 +505,30 @@ private constructor(
lineItems().forEach { it.validate() }
memo()
- reason()
+ reason().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (lineItems.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (reason.asKnown().getOrNull()?.validity() ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -694,6 +714,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (invoiceLineItemId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -809,6 +848,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Reason = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
index e61aa839..0b80d72f 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.CreditNoteService
import java.util.Collections
import java.util.Objects
@@ -133,6 +134,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt
index 0b6c9f7f..e9db3e7b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.CreditNoteServiceAsync
import java.util.Collections
import java.util.Objects
@@ -135,6 +136,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
index 2f05f017..2e73bf1a 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
@@ -1275,7 +1275,7 @@ private constructor(
hierarchy().validate()
metadata().validate()
name()
- paymentProvider()
+ paymentProvider().ifPresent { it.validate() }
paymentProviderId()
portalUrl()
shippingAddress().ifPresent { it.validate() }
@@ -1286,6 +1286,44 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (additionalEmails.asKnown().getOrNull()?.size ?: 0) +
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (balance.asKnown().isPresent) 1 else 0) +
+ (billingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (email.asKnown().isPresent) 1 else 0) +
+ (if (emailDelivery.asKnown().isPresent) 1 else 0) +
+ (if (exemptFromAutomatedTax.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0) +
+ (hierarchy.asKnown().getOrNull()?.validity() ?: 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (paymentProvider.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (paymentProviderId.asKnown().isPresent) 1 else 0) +
+ (if (portalUrl.asKnown().isPresent) 1 else 0) +
+ (shippingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (taxId.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (timezone.asKnown().isPresent) 1 else 0) +
+ (accountingSyncConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (reportingConfiguration.asKnown().getOrNull()?.validity() ?: 0)
+
class BillingAddress
private constructor(
private val city: JsonField,
@@ -1590,6 +1628,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1781,6 +1842,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (children.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (parent.asKnown().getOrNull()?.validity() ?: 0)
+
class Child
private constructor(
private val id: JsonField,
@@ -1954,6 +2034,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2145,6 +2244,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2252,6 +2370,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2379,6 +2515,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): PaymentProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2696,6 +2859,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2999,12 +3185,32 @@ private constructor(
return@apply
}
- country()
- type()
+ country().validate()
+ type().validate()
value()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (country.asKnown().getOrNull()?.validity() ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (value.asKnown().isPresent) 1 else 0)
+
class Country @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -3549,6 +3755,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Country = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4061,6 +4294,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4274,6 +4534,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (accountingProviders.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (excluded.asKnown().isPresent) 1 else 0)
+
class AccountingProvider
private constructor(
private val externalProviderId: JsonField,
@@ -4451,10 +4730,29 @@ private constructor(
}
externalProviderId()
- providerType()
+ providerType().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (externalProviderId.asKnown().isPresent) 1 else 0) +
+ (providerType.asKnown().getOrNull()?.validity() ?: 0)
+
class ProviderType
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -4548,6 +4846,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): ProviderType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4718,6 +5043,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (exempt.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
index 0e2bc28e..601a114d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
@@ -499,11 +499,31 @@ private constructor(
}
amount()
- type()
+ type().validate()
description()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -606,6 +626,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
index 8560244a..2398d2ad 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
@@ -486,7 +486,7 @@ private constructor(
}
id()
- action()
+ action().validate()
amount()
createdAt()
creditNote().ifPresent { it.validate() }
@@ -494,10 +494,36 @@ private constructor(
endingBalance()
invoice().ifPresent { it.validate() }
startingBalance()
- type()
+ type().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (action.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditNote.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (invoice.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
class Action @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
@@ -624,6 +650,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Action = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -758,6 +811,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -896,6 +965,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -997,6 +1082,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
index f867d2cd..ce40b241 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.customers.BalanceTransactionService
import java.util.Collections
import java.util.Objects
@@ -157,6 +158,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt
index cbb1c9f9..41173313 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.customers.BalanceTransactionServiceAsync
import java.util.Collections
import java.util.Objects
@@ -159,6 +160,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
index 864290df..693a4e46 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
@@ -486,7 +486,7 @@ private constructor(
}
id()
- action()
+ action().validate()
amount()
createdAt()
creditNote().ifPresent { it.validate() }
@@ -494,10 +494,36 @@ private constructor(
endingBalance()
invoice().ifPresent { it.validate() }
startingBalance()
- type()
+ type().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (action.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditNote.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (invoice.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
+
class Action @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
@@ -624,6 +650,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Action = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -758,6 +811,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -896,6 +965,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -997,6 +1082,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
index a846e45d..fd63e2d1 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
@@ -467,6 +467,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ViewMode = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
index edf2ea2a..b4c35fe8 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
@@ -158,6 +158,23 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
class Data
private constructor(
private val perPriceCosts: JsonField>,
@@ -451,6 +468,28 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (perPriceCosts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (subtotal.asKnown().isPresent) 1 else 0) +
+ (if (timeframeEnd.asKnown().isPresent) 1 else 0) +
+ (if (timeframeStart.asKnown().isPresent) 1 else 0) +
+ (if (total.asKnown().isPresent) 1 else 0)
+
class PerPriceCost
private constructor(
private val price: JsonField,
@@ -893,6 +932,28 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (price.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (priceId.asKnown().isPresent) 1 else 0) +
+ (if (subtotal.asKnown().isPresent) 1 else 0) +
+ (if (total.asKnown().isPresent) 1 else 0) +
+ (if (quantity.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt
index 5e187a6e..75f29da0 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt
@@ -462,6 +462,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ViewMode = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt
index 4edde920..66be2c2b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt
@@ -154,6 +154,23 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
class Data
private constructor(
private val perPriceCosts: JsonField>,
@@ -447,6 +464,28 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (perPriceCosts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (subtotal.asKnown().isPresent) 1 else 0) +
+ (if (timeframeEnd.asKnown().isPresent) 1 else 0) +
+ (if (timeframeStart.asKnown().isPresent) 1 else 0) +
+ (if (total.asKnown().isPresent) 1 else 0)
+
class PerPriceCost
private constructor(
private val price: JsonField,
@@ -889,6 +928,28 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (price.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (priceId.asKnown().isPresent) 1 else 0) +
+ (if (subtotal.asKnown().isPresent) 1 else 0) +
+ (if (total.asKnown().isPresent) 1 else 0) +
+ (if (quantity.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt
index 794d1fb7..9271ddd6 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt
@@ -2328,7 +2328,7 @@ private constructor(
externalCustomerId()
hierarchy().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
- paymentProvider()
+ paymentProvider().ifPresent { it.validate() }
paymentProviderId()
reportingConfiguration().ifPresent { it.validate() }
shippingAddress().ifPresent { it.validate() }
@@ -2338,6 +2338,41 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (email.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (accountingSyncConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (additionalEmails.asKnown().getOrNull()?.size ?: 0) +
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (billingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (emailDelivery.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0) +
+ (hierarchy.asKnown().getOrNull()?.validity() ?: 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (paymentProvider.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (paymentProviderId.asKnown().isPresent) 1 else 0) +
+ (reportingConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (shippingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (taxConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (taxId.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (timezone.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2539,6 +2574,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (accountingProviders.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (excluded.asKnown().isPresent) 1 else 0)
+
class AccountingProvider
private constructor(
private val externalProviderId: JsonField,
@@ -2713,6 +2767,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (externalProviderId.asKnown().isPresent) 1 else 0) +
+ (if (providerType.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3029,6 +3102,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3235,6 +3331,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (childCustomerIds.asKnown().getOrNull()?.size ?: 0) +
+ (if (parentCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3324,6 +3439,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3451,6 +3584,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): PaymentProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3585,6 +3745,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (exempt.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3883,6 +4059,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3924,13 +4123,12 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
newAvalara != null -> visitor.visitNewAvalara(newAvalara)
newTaxJar != null -> visitor.visitNewTaxJar(newTaxJar)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -3953,6 +4151,34 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) =
+ newAvalara.validity()
+
+ override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) =
+ newTaxJar.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4016,17 +4242,14 @@ private constructor(
when (taxProvider) {
"avalara" -> {
- return TaxConfiguration(
- newAvalara =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { TaxConfiguration(newAvalara = it, _json = json) }
+ ?: TaxConfiguration(_json = json)
}
"taxjar" -> {
- return TaxConfiguration(
- newTaxJar = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ TaxConfiguration(newTaxJar = it, _json = json)
+ } ?: TaxConfiguration(_json = json)
}
}
@@ -4263,11 +4486,31 @@ private constructor(
}
taxExempt()
- taxProvider()
+ taxProvider().validate()
taxExemptionCode()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (taxExempt.asKnown().isPresent) 1 else 0) +
+ (taxProvider.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (taxExemptionCode.asKnown().isPresent) 1 else 0)
+
class TaxProvider
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -4354,6 +4597,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): TaxProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4553,10 +4823,29 @@ private constructor(
}
taxExempt()
- taxProvider()
+ taxProvider().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (taxExempt.asKnown().isPresent) 1 else 0) +
+ (taxProvider.asKnown().getOrNull()?.validity() ?: 0)
+
class TaxProvider
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -4643,6 +4932,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): TaxProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4960,12 +5276,32 @@ private constructor(
return@apply
}
- country()
- type()
+ country().validate()
+ type().validate()
value()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (country.asKnown().getOrNull()?.validity() ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (value.asKnown().isPresent) 1 else 0)
+
class Country @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -5510,6 +5846,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Country = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6022,6 +6385,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
index 16b0054d..cb0a76ac 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
@@ -527,8 +527,8 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
addIncrementCreditLedgerEntryRequestParams != null ->
visitor.visitAddIncrementCreditLedgerEntryRequestParams(
addIncrementCreditLedgerEntryRequestParams
@@ -551,7 +551,6 @@ private constructor(
)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -600,6 +599,52 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitAddIncrementCreditLedgerEntryRequestParams(
+ addIncrementCreditLedgerEntryRequestParams:
+ AddIncrementCreditLedgerEntryRequestParams
+ ) = addIncrementCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddDecrementCreditLedgerEntryRequestParams(
+ addDecrementCreditLedgerEntryRequestParams:
+ AddDecrementCreditLedgerEntryRequestParams
+ ) = addDecrementCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddExpirationChangeCreditLedgerEntryRequestParams(
+ addExpirationChangeCreditLedgerEntryRequestParams:
+ AddExpirationChangeCreditLedgerEntryRequestParams
+ ) = addExpirationChangeCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddVoidCreditLedgerEntryRequestParams(
+ addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams
+ ) = addVoidCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddAmendmentCreditLedgerEntryRequestParams(
+ addAmendmentCreditLedgerEntryRequestParams:
+ AddAmendmentCreditLedgerEntryRequestParams
+ ) = addAmendmentCreditLedgerEntryRequestParams.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -724,56 +769,51 @@ private constructor(
when (entryType) {
"increment" -> {
- return Body(
- addIncrementCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(addIncrementCreditLedgerEntryRequestParams = it, _json = json)
+ } ?: Body(_json = json)
}
"decrement" -> {
- return Body(
- addDecrementCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(addDecrementCreditLedgerEntryRequestParams = it, _json = json)
+ } ?: Body(_json = json)
}
"expiration_change" -> {
- return Body(
- addExpirationChangeCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef<
- AddExpirationChangeCreditLedgerEntryRequestParams
- >(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(
+ addExpirationChangeCreditLedgerEntryRequestParams = it,
+ _json = json,
+ )
+ } ?: Body(_json = json)
}
"void" -> {
- return Body(
- addVoidCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let { Body(addVoidCreditLedgerEntryRequestParams = it, _json = json) }
+ ?: Body(_json = json)
}
"amendment" -> {
- return Body(
- addAmendmentCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(addAmendmentCreditLedgerEntryRequestParams = it, _json = json)
+ } ?: Body(_json = json)
}
}
@@ -1333,7 +1373,7 @@ private constructor(
}
amount()
- entryType()
+ entryType().validate()
currency()
description()
effectiveDate()
@@ -1344,6 +1384,32 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (effectiveDate.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -1429,6 +1495,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1722,6 +1815,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1814,6 +1928,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2165,13 +2299,35 @@ private constructor(
}
amount()
- entryType()
+ entryType().validate()
currency()
description()
metadata().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -2257,6 +2413,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2344,6 +2527,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2851,7 +3054,7 @@ private constructor(
return@apply
}
- entryType()
+ entryType().validate()
expiryDate()
targetExpiryDate()
amount()
@@ -2862,6 +3065,31 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (targetExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (blockId.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -2947,6 +3175,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3034,6 +3289,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3475,14 +3750,38 @@ private constructor(
amount()
blockId()
- entryType()
+ entryType().validate()
currency()
description()
metadata().ifPresent { it.validate() }
- voidReason()
+ voidReason().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (blockId.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (voidReason.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -3568,6 +3867,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3655,6 +3981,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3759,6 +4105,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): VoidReason = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4144,13 +4517,36 @@ private constructor(
amount()
blockId()
- entryType()
+ entryType().validate()
currency()
description()
metadata().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (blockId.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -4236,6 +4632,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4323,6 +4746,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt
index d724db6f..773c7bae 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt
@@ -104,8 +104,8 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry)
decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry)
expirationChangeLedgerEntry != null ->
@@ -118,7 +118,6 @@ private constructor(
amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -167,6 +166,51 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) =
+ incrementLedgerEntry.validity()
+
+ override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) =
+ decrementLedgerEntry.validity()
+
+ override fun visitExpirationChangeLedgerEntry(
+ expirationChangeLedgerEntry: ExpirationChangeLedgerEntry
+ ) = expirationChangeLedgerEntry.validity()
+
+ override fun visitCreditBlockExpiryLedgerEntry(
+ creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry
+ ) = creditBlockExpiryLedgerEntry.validity()
+
+ override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) =
+ voidLedgerEntry.validity()
+
+ override fun visitVoidInitiatedLedgerEntry(
+ voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry
+ ) = voidInitiatedLedgerEntry.validity()
+
+ override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) =
+ amendmentLedgerEntry.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -302,52 +346,62 @@ private constructor(
when (entryType) {
"increment" -> {
- return CustomerCreditLedgerCreateEntryByExternalIdResponse(
- incrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryByExternalIdResponse(
+ incrementLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json)
}
"decrement" -> {
- return CustomerCreditLedgerCreateEntryByExternalIdResponse(
- decrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryByExternalIdResponse(
+ decrementLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json)
}
"expiration_change" -> {
- return CustomerCreditLedgerCreateEntryByExternalIdResponse(
- expirationChangeLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerCreateEntryByExternalIdResponse(
+ expirationChangeLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json)
}
"credit_block_expiry" -> {
- return CustomerCreditLedgerCreateEntryByExternalIdResponse(
- creditBlockExpiryLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerCreateEntryByExternalIdResponse(
+ creditBlockExpiryLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json)
}
"void" -> {
- return CustomerCreditLedgerCreateEntryByExternalIdResponse(
- voidLedgerEntry = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryByExternalIdResponse(
+ voidLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json)
}
"void_initiated" -> {
- return CustomerCreditLedgerCreateEntryByExternalIdResponse(
- voidInitiatedLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryByExternalIdResponse(
+ voidInitiatedLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json)
}
"amendment" -> {
- return CustomerCreditLedgerCreateEntryByExternalIdResponse(
- amendmentLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryByExternalIdResponse(
+ amendmentLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryByExternalIdResponse(_json = json)
}
}
@@ -971,14 +1025,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -1197,6 +1281,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1388,6 +1492,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1495,6 +1618,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1591,6 +1741,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1678,6 +1855,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2397,8 +2592,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -2408,6 +2603,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (eventId.asKnown().isPresent) 1 else 0) +
+ (if (invoiceId.asKnown().isPresent) 1 else 0) +
+ (if (priceId.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -2626,6 +2854,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2817,6 +3065,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2924,6 +3191,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3020,6 +3314,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3107,6 +3428,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3775,8 +4114,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -3784,6 +4123,37 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -4002,6 +4372,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4193,6 +4583,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4300,6 +4709,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4396,6 +4832,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4483,6 +4946,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5103,14 +5584,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -5329,6 +5840,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5520,6 +6051,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5627,6 +6177,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5723,6 +6300,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5810,6 +6414,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6504,8 +7126,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -6514,6 +7136,38 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -6732,6 +7386,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6923,6 +7597,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7030,6 +7723,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7126,6 +7846,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7213,6 +7960,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7948,8 +8713,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -7959,6 +8724,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -8177,6 +8975,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8368,6 +9186,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8475,6 +9312,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8571,6 +9435,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8658,6 +9549,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9276,14 +10185,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -9502,6 +10441,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9693,6 +10652,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9800,6 +10778,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9896,6 +10901,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9983,6 +11015,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt
index 9f9f60b6..a07e3234 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt
@@ -522,8 +522,8 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
addIncrementCreditLedgerEntryRequestParams != null ->
visitor.visitAddIncrementCreditLedgerEntryRequestParams(
addIncrementCreditLedgerEntryRequestParams
@@ -546,7 +546,6 @@ private constructor(
)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -595,6 +594,52 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitAddIncrementCreditLedgerEntryRequestParams(
+ addIncrementCreditLedgerEntryRequestParams:
+ AddIncrementCreditLedgerEntryRequestParams
+ ) = addIncrementCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddDecrementCreditLedgerEntryRequestParams(
+ addDecrementCreditLedgerEntryRequestParams:
+ AddDecrementCreditLedgerEntryRequestParams
+ ) = addDecrementCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddExpirationChangeCreditLedgerEntryRequestParams(
+ addExpirationChangeCreditLedgerEntryRequestParams:
+ AddExpirationChangeCreditLedgerEntryRequestParams
+ ) = addExpirationChangeCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddVoidCreditLedgerEntryRequestParams(
+ addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams
+ ) = addVoidCreditLedgerEntryRequestParams.validity()
+
+ override fun visitAddAmendmentCreditLedgerEntryRequestParams(
+ addAmendmentCreditLedgerEntryRequestParams:
+ AddAmendmentCreditLedgerEntryRequestParams
+ ) = addAmendmentCreditLedgerEntryRequestParams.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -719,56 +764,51 @@ private constructor(
when (entryType) {
"increment" -> {
- return Body(
- addIncrementCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(addIncrementCreditLedgerEntryRequestParams = it, _json = json)
+ } ?: Body(_json = json)
}
"decrement" -> {
- return Body(
- addDecrementCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(addDecrementCreditLedgerEntryRequestParams = it, _json = json)
+ } ?: Body(_json = json)
}
"expiration_change" -> {
- return Body(
- addExpirationChangeCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef<
- AddExpirationChangeCreditLedgerEntryRequestParams
- >(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(
+ addExpirationChangeCreditLedgerEntryRequestParams = it,
+ _json = json,
+ )
+ } ?: Body(_json = json)
}
"void" -> {
- return Body(
- addVoidCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let { Body(addVoidCreditLedgerEntryRequestParams = it, _json = json) }
+ ?: Body(_json = json)
}
"amendment" -> {
- return Body(
- addAmendmentCreditLedgerEntryRequestParams =
- deserialize(
- node,
- jacksonTypeRef(),
- ),
- _json = json,
- )
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ Body(addAmendmentCreditLedgerEntryRequestParams = it, _json = json)
+ } ?: Body(_json = json)
}
}
@@ -1328,7 +1368,7 @@ private constructor(
}
amount()
- entryType()
+ entryType().validate()
currency()
description()
effectiveDate()
@@ -1339,6 +1379,32 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (effectiveDate.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -1424,6 +1490,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1717,6 +1810,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1809,6 +1923,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2160,13 +2294,35 @@ private constructor(
}
amount()
- entryType()
+ entryType().validate()
currency()
description()
metadata().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -2252,6 +2408,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2339,6 +2522,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2846,7 +3049,7 @@ private constructor(
return@apply
}
- entryType()
+ entryType().validate()
expiryDate()
targetExpiryDate()
amount()
@@ -2857,6 +3060,31 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (targetExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (blockId.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -2942,6 +3170,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3029,6 +3284,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3470,14 +3745,38 @@ private constructor(
amount()
blockId()
- entryType()
+ entryType().validate()
currency()
description()
metadata().ifPresent { it.validate() }
- voidReason()
+ voidReason().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (blockId.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (voidReason.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -3563,6 +3862,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3650,6 +3976,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3754,6 +4100,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): VoidReason = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4139,13 +4512,36 @@ private constructor(
amount()
blockId()
- entryType()
+ entryType().validate()
currency()
description()
metadata().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (blockId.asKnown().isPresent) 1 else 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0)
+
class EntryType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -4231,6 +4627,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4318,6 +4741,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt
index cb660d53..aafcb4ed 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt
@@ -104,8 +104,8 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry)
decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry)
expirationChangeLedgerEntry != null ->
@@ -118,7 +118,6 @@ private constructor(
amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -167,6 +166,51 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) =
+ incrementLedgerEntry.validity()
+
+ override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) =
+ decrementLedgerEntry.validity()
+
+ override fun visitExpirationChangeLedgerEntry(
+ expirationChangeLedgerEntry: ExpirationChangeLedgerEntry
+ ) = expirationChangeLedgerEntry.validity()
+
+ override fun visitCreditBlockExpiryLedgerEntry(
+ creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry
+ ) = creditBlockExpiryLedgerEntry.validity()
+
+ override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) =
+ voidLedgerEntry.validity()
+
+ override fun visitVoidInitiatedLedgerEntry(
+ voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry
+ ) = voidInitiatedLedgerEntry.validity()
+
+ override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) =
+ amendmentLedgerEntry.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -291,52 +335,59 @@ private constructor(
when (entryType) {
"increment" -> {
- return CustomerCreditLedgerCreateEntryResponse(
- incrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryResponse(
+ incrementLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryResponse(_json = json)
}
"decrement" -> {
- return CustomerCreditLedgerCreateEntryResponse(
- decrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryResponse(
+ decrementLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryResponse(_json = json)
}
"expiration_change" -> {
- return CustomerCreditLedgerCreateEntryResponse(
- expirationChangeLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerCreateEntryResponse(
+ expirationChangeLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryResponse(_json = json)
}
"credit_block_expiry" -> {
- return CustomerCreditLedgerCreateEntryResponse(
- creditBlockExpiryLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerCreateEntryResponse(
+ creditBlockExpiryLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryResponse(_json = json)
}
"void" -> {
- return CustomerCreditLedgerCreateEntryResponse(
- voidLedgerEntry = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryResponse(voidLedgerEntry = it, _json = json)
+ } ?: CustomerCreditLedgerCreateEntryResponse(_json = json)
}
"void_initiated" -> {
- return CustomerCreditLedgerCreateEntryResponse(
- voidInitiatedLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryResponse(
+ voidInitiatedLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryResponse(_json = json)
}
"amendment" -> {
- return CustomerCreditLedgerCreateEntryResponse(
- amendmentLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerCreateEntryResponse(
+ amendmentLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerCreateEntryResponse(_json = json)
}
}
@@ -958,14 +1009,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -1184,6 +1265,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1375,6 +1476,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1482,6 +1602,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1578,6 +1725,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1665,6 +1839,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2384,8 +2576,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -2395,6 +2587,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (eventId.asKnown().isPresent) 1 else 0) +
+ (if (invoiceId.asKnown().isPresent) 1 else 0) +
+ (if (priceId.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -2613,6 +2838,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2804,6 +3049,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2911,6 +3175,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3007,6 +3298,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3094,6 +3412,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3762,8 +4098,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -3771,6 +4107,37 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -3989,6 +4356,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4180,6 +4567,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4287,6 +4693,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4383,6 +4816,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4470,6 +4930,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5090,14 +5568,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -5316,6 +5824,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5507,6 +6035,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5614,6 +6161,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5710,6 +6284,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5797,6 +6398,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6491,8 +7110,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -6501,6 +7120,38 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -6719,6 +7370,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6910,6 +7581,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7017,6 +7707,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7113,6 +7830,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7200,6 +7944,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7935,8 +8697,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -7946,6 +8708,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -8164,6 +8959,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8355,6 +9170,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8462,6 +9296,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8558,6 +9419,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8645,6 +9533,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9263,14 +10169,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -9489,6 +10425,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9680,6 +10636,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9787,6 +10762,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9883,6 +10885,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9970,6 +10999,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt
index 0335a1e1..d26c9ab7 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.customers.credits.LedgerService
import java.util.Collections
import java.util.Objects
@@ -208,6 +209,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt
index 07bfabe6..853422bf 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.customers.credits.LedgerServiceAsync
import java.util.Collections
import java.util.Objects
@@ -210,6 +211,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt
index 739b45d8..2271ced0 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt
@@ -516,6 +516,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -645,6 +672,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt
index b30e0a89..d9d2e5ec 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponse.kt
@@ -104,8 +104,8 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry)
decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry)
expirationChangeLedgerEntry != null ->
@@ -118,7 +118,6 @@ private constructor(
amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -167,6 +166,51 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) =
+ incrementLedgerEntry.validity()
+
+ override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) =
+ decrementLedgerEntry.validity()
+
+ override fun visitExpirationChangeLedgerEntry(
+ expirationChangeLedgerEntry: ExpirationChangeLedgerEntry
+ ) = expirationChangeLedgerEntry.validity()
+
+ override fun visitCreditBlockExpiryLedgerEntry(
+ creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry
+ ) = creditBlockExpiryLedgerEntry.validity()
+
+ override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) =
+ voidLedgerEntry.validity()
+
+ override fun visitVoidInitiatedLedgerEntry(
+ voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry
+ ) = voidInitiatedLedgerEntry.validity()
+
+ override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) =
+ amendmentLedgerEntry.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -300,52 +344,62 @@ private constructor(
when (entryType) {
"increment" -> {
- return CustomerCreditLedgerListByExternalIdResponse(
- incrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListByExternalIdResponse(
+ incrementLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json)
}
"decrement" -> {
- return CustomerCreditLedgerListByExternalIdResponse(
- decrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListByExternalIdResponse(
+ decrementLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json)
}
"expiration_change" -> {
- return CustomerCreditLedgerListByExternalIdResponse(
- expirationChangeLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerListByExternalIdResponse(
+ expirationChangeLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json)
}
"credit_block_expiry" -> {
- return CustomerCreditLedgerListByExternalIdResponse(
- creditBlockExpiryLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerListByExternalIdResponse(
+ creditBlockExpiryLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json)
}
"void" -> {
- return CustomerCreditLedgerListByExternalIdResponse(
- voidLedgerEntry = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListByExternalIdResponse(
+ voidLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json)
}
"void_initiated" -> {
- return CustomerCreditLedgerListByExternalIdResponse(
- voidInitiatedLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListByExternalIdResponse(
+ voidInitiatedLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json)
}
"amendment" -> {
- return CustomerCreditLedgerListByExternalIdResponse(
- amendmentLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListByExternalIdResponse(
+ amendmentLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListByExternalIdResponse(_json = json)
}
}
@@ -969,14 +1023,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -1195,6 +1279,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1386,6 +1490,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1493,6 +1616,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1589,6 +1739,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1676,6 +1853,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2395,8 +2590,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -2406,6 +2601,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (eventId.asKnown().isPresent) 1 else 0) +
+ (if (invoiceId.asKnown().isPresent) 1 else 0) +
+ (if (priceId.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -2624,6 +2852,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2815,6 +3063,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2922,6 +3189,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3018,6 +3312,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3105,6 +3426,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3773,8 +4112,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -3782,6 +4121,37 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -4000,6 +4370,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4191,6 +4581,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4298,6 +4707,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4394,6 +4830,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4481,6 +4944,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5101,14 +5582,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -5327,6 +5838,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5518,6 +6049,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5625,6 +6175,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5721,6 +6298,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5808,6 +6412,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6502,8 +7124,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -6512,6 +7134,38 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -6730,6 +7384,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6921,6 +7595,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7028,6 +7721,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7124,6 +7844,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7211,6 +7958,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7946,8 +8711,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -7957,6 +8722,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -8175,6 +8973,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8366,6 +9184,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8473,6 +9310,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8569,6 +9433,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8656,6 +9547,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9274,14 +10183,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -9500,6 +10439,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9691,6 +10650,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9798,6 +10776,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9894,6 +10899,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9981,6 +11013,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt
index 650287b1..ecc6ed2a 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.customers.credits.LedgerService
import java.util.Collections
import java.util.Objects
@@ -207,6 +208,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt
index cff005eb..48e5c277 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.customers.credits.LedgerServiceAsync
import java.util.Collections
import java.util.Objects
@@ -209,6 +210,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt
index 35c503f5..9d9efa69 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt
@@ -510,6 +510,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -639,6 +666,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt
index 81c15399..edb510d6 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponse.kt
@@ -104,8 +104,8 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
incrementLedgerEntry != null -> visitor.visitIncrementLedgerEntry(incrementLedgerEntry)
decrementLedgerEntry != null -> visitor.visitDecrementLedgerEntry(decrementLedgerEntry)
expirationChangeLedgerEntry != null ->
@@ -118,7 +118,6 @@ private constructor(
amendmentLedgerEntry != null -> visitor.visitAmendmentLedgerEntry(amendmentLedgerEntry)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -167,6 +166,51 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitIncrementLedgerEntry(incrementLedgerEntry: IncrementLedgerEntry) =
+ incrementLedgerEntry.validity()
+
+ override fun visitDecrementLedgerEntry(decrementLedgerEntry: DecrementLedgerEntry) =
+ decrementLedgerEntry.validity()
+
+ override fun visitExpirationChangeLedgerEntry(
+ expirationChangeLedgerEntry: ExpirationChangeLedgerEntry
+ ) = expirationChangeLedgerEntry.validity()
+
+ override fun visitCreditBlockExpiryLedgerEntry(
+ creditBlockExpiryLedgerEntry: CreditBlockExpiryLedgerEntry
+ ) = creditBlockExpiryLedgerEntry.validity()
+
+ override fun visitVoidLedgerEntry(voidLedgerEntry: VoidLedgerEntry) =
+ voidLedgerEntry.validity()
+
+ override fun visitVoidInitiatedLedgerEntry(
+ voidInitiatedLedgerEntry: VoidInitiatedLedgerEntry
+ ) = voidInitiatedLedgerEntry.validity()
+
+ override fun visitAmendmentLedgerEntry(amendmentLedgerEntry: AmendmentLedgerEntry) =
+ amendmentLedgerEntry.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -286,52 +330,50 @@ private constructor(
when (entryType) {
"increment" -> {
- return CustomerCreditLedgerListResponse(
- incrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListResponse(incrementLedgerEntry = it, _json = json)
+ } ?: CustomerCreditLedgerListResponse(_json = json)
}
"decrement" -> {
- return CustomerCreditLedgerListResponse(
- decrementLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListResponse(decrementLedgerEntry = it, _json = json)
+ } ?: CustomerCreditLedgerListResponse(_json = json)
}
"expiration_change" -> {
- return CustomerCreditLedgerListResponse(
- expirationChangeLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerListResponse(
+ expirationChangeLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListResponse(_json = json)
}
"credit_block_expiry" -> {
- return CustomerCreditLedgerListResponse(
- creditBlockExpiryLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ CustomerCreditLedgerListResponse(
+ creditBlockExpiryLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListResponse(_json = json)
}
"void" -> {
- return CustomerCreditLedgerListResponse(
- voidLedgerEntry = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListResponse(voidLedgerEntry = it, _json = json)
+ } ?: CustomerCreditLedgerListResponse(_json = json)
}
"void_initiated" -> {
- return CustomerCreditLedgerListResponse(
- voidInitiatedLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListResponse(
+ voidInitiatedLedgerEntry = it,
+ _json = json,
+ )
+ } ?: CustomerCreditLedgerListResponse(_json = json)
}
"amendment" -> {
- return CustomerCreditLedgerListResponse(
- amendmentLedgerEntry =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ CustomerCreditLedgerListResponse(amendmentLedgerEntry = it, _json = json)
+ } ?: CustomerCreditLedgerListResponse(_json = json)
}
}
@@ -950,14 +992,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -1176,6 +1248,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1367,6 +1459,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1474,6 +1585,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1570,6 +1708,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1657,6 +1822,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2376,8 +2559,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -2387,6 +2570,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (eventId.asKnown().isPresent) 1 else 0) +
+ (if (invoiceId.asKnown().isPresent) 1 else 0) +
+ (if (priceId.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -2605,6 +2821,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2796,6 +3032,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2903,6 +3158,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2999,6 +3281,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3086,6 +3395,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3754,8 +4081,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -3763,6 +4090,37 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -3981,6 +4339,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4172,6 +4550,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4279,6 +4676,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4375,6 +4799,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4462,6 +4913,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5082,14 +5551,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -5308,6 +5807,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5499,6 +6018,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5606,6 +6144,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5702,6 +6267,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5789,6 +6381,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6483,8 +7093,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
@@ -6493,6 +7103,38 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -6711,6 +7353,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -6902,6 +7564,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7009,6 +7690,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7105,6 +7813,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7192,6 +7927,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -7927,8 +8680,8 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
newBlockExpiryDate()
@@ -7938,6 +8691,39 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (newBlockExpiryDate.asKnown().isPresent) 1 else 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0) +
+ (if (voidAmount.asKnown().isPresent) 1 else 0) +
+ (if (voidReason.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -8156,6 +8942,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8347,6 +9153,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8454,6 +9279,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8550,6 +9402,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -8637,6 +9516,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9255,14 +10152,44 @@ private constructor(
customer().validate()
description()
endingBalance()
- entryStatus()
- entryType()
+ entryStatus().validate()
+ entryType().validate()
ledgerSequenceNumber()
metadata().validate()
startingBalance()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (createdAt.asKnown().isPresent) 1 else 0) +
+ (creditBlock.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (customer.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (description.asKnown().isPresent) 1 else 0) +
+ (if (endingBalance.asKnown().isPresent) 1 else 0) +
+ (entryStatus.asKnown().getOrNull()?.validity() ?: 0) +
+ (entryType.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ledgerSequenceNumber.asKnown().isPresent) 1 else 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (startingBalance.asKnown().isPresent) 1 else 0)
+
class CreditBlock
private constructor(
private val id: JsonField,
@@ -9481,6 +10408,26 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9672,6 +10619,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9779,6 +10745,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryStatus = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9875,6 +10868,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): EntryType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -9962,6 +10982,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt
index 28b2175d..a0a313bd 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.customers.CreditService
import java.util.Collections
import java.util.Objects
@@ -140,6 +141,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt
index f97f7b30..183db5fb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.customers.CreditServiceAsync
import java.util.Collections
import java.util.Objects
@@ -142,6 +143,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt
index 20e72ffd..a3aad357 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt
@@ -397,10 +397,33 @@ private constructor(
expiryDate()
maximumInitialBalance()
perUnitCostBasis()
- status()
+ status().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (balance.asKnown().isPresent) 1 else 0) +
+ (if (effectiveDate.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (maximumInitialBalance.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (status.asKnown().getOrNull()?.validity() ?: 0)
+
class Status @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
@@ -485,6 +508,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Status = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt
index 34c10cb8..1a3a4cd1 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.customers.CreditService
import java.util.Collections
import java.util.Objects
@@ -139,6 +140,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt
index 51d1d0d1..28fa0aa2 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.customers.CreditServiceAsync
import java.util.Collections
import java.util.Objects
@@ -141,6 +142,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt
index 1b121e8a..1e4451c4 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt
@@ -393,10 +393,33 @@ private constructor(
expiryDate()
maximumInitialBalance()
perUnitCostBasis()
- status()
+ status().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (balance.asKnown().isPresent) 1 else 0) +
+ (if (effectiveDate.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
+ (if (maximumInitialBalance.asKnown().isPresent) 1 else 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (status.asKnown().getOrNull()?.validity() ?: 0)
+
class Status @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
@@ -481,6 +504,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Status = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt
index 1c5a9c37..e0d32c2c 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt
@@ -958,10 +958,35 @@ private constructor(
threshold()
activeFrom()
expiresAfter()
- expiresAfterUnit()
+ expiresAfterUnit().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (if (threshold.asKnown().isPresent) 1 else 0) +
+ (if (activeFrom.asKnown().isPresent) 1 else 0) +
+ (if (expiresAfter.asKnown().isPresent) 1 else 0) +
+ (expiresAfterUnit.asKnown().getOrNull()?.validity() ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1238,6 +1263,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1345,6 +1391,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ExpiresAfterUnit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt
index 0c7f139d..f21258d3 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt
@@ -443,10 +443,34 @@ private constructor(
perUnitCostBasis()
threshold()
expiresAfter()
- expiresAfterUnit()
+ expiresAfterUnit().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (if (threshold.asKnown().isPresent) 1 else 0) +
+ (if (expiresAfter.asKnown().isPresent) 1 else 0) +
+ (expiresAfterUnit.asKnown().getOrNull()?.validity() ?: 0)
+
/** Settings for invoices generated by triggered top-ups. */
class InvoiceSettings
private constructor(
@@ -705,6 +729,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -812,6 +857,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ExpiresAfterUnit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt
index 59a9d5db..b27cc368 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt
@@ -954,10 +954,35 @@ private constructor(
threshold()
activeFrom()
expiresAfter()
- expiresAfterUnit()
+ expiresAfterUnit().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (if (threshold.asKnown().isPresent) 1 else 0) +
+ (if (activeFrom.asKnown().isPresent) 1 else 0) +
+ (if (expiresAfter.asKnown().isPresent) 1 else 0) +
+ (expiresAfterUnit.asKnown().getOrNull()?.validity() ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1234,6 +1259,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1341,6 +1387,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ExpiresAfterUnit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt
index cff36b4b..04724cef 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt
@@ -441,10 +441,34 @@ private constructor(
perUnitCostBasis()
threshold()
expiresAfter()
- expiresAfterUnit()
+ expiresAfterUnit().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (if (threshold.asKnown().isPresent) 1 else 0) +
+ (if (expiresAfter.asKnown().isPresent) 1 else 0) +
+ (expiresAfterUnit.asKnown().getOrNull()?.validity() ?: 0)
+
/** Settings for invoices generated by triggered top-ups. */
class InvoiceSettings
private constructor(
@@ -703,6 +727,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -810,6 +855,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ExpiresAfterUnit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt
index f4cee4cb..385a7a54 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.customers.credits.TopUpService
import java.util.Collections
import java.util.Objects
@@ -132,6 +133,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt
index 0d676ee5..975efb67 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.customers.credits.TopUpServiceAsync
import java.util.Collections
import java.util.Objects
@@ -134,6 +135,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt
index d5e2adee..7d6c8232 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt
@@ -442,10 +442,34 @@ private constructor(
perUnitCostBasis()
threshold()
expiresAfter()
- expiresAfterUnit()
+ expiresAfterUnit().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (if (threshold.asKnown().isPresent) 1 else 0) +
+ (if (expiresAfter.asKnown().isPresent) 1 else 0) +
+ (expiresAfterUnit.asKnown().getOrNull()?.validity() ?: 0)
+
/** Settings for invoices generated by triggered top-ups. */
class InvoiceSettings
private constructor(
@@ -704,6 +728,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -811,6 +856,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ExpiresAfterUnit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt
index db733984..2865107b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.customers.credits.TopUpService
import java.util.Collections
import java.util.Objects
@@ -131,6 +132,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt
index 53804a58..31b3a249 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.customers.credits.TopUpServiceAsync
import java.util.Collections
import java.util.Objects
@@ -133,6 +134,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt
index 8f1e18dc..331562cb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt
@@ -441,10 +441,34 @@ private constructor(
perUnitCostBasis()
threshold()
expiresAfter()
- expiresAfterUnit()
+ expiresAfterUnit().ifPresent { it.validate() }
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (id.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (invoiceSettings.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (perUnitCostBasis.asKnown().isPresent) 1 else 0) +
+ (if (threshold.asKnown().isPresent) 1 else 0) +
+ (if (expiresAfter.asKnown().isPresent) 1 else 0) +
+ (expiresAfterUnit.asKnown().getOrNull()?.validity() ?: 0)
+
/** Settings for invoices generated by triggered top-ups. */
class InvoiceSettings
private constructor(
@@ -703,6 +727,27 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (if (netTerms.asKnown().isPresent) 1 else 0) +
+ (if (memo.asKnown().isPresent) 1 else 0) +
+ (if (requireSuccessfulPayment.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -810,6 +855,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): ExpiresAfterUnit = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt
index 3b918190..775b1e75 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPage.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.blocking.CustomerService
import java.util.Collections
import java.util.Objects
@@ -132,6 +133,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt
index cd9e93db..77559c10 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListPageAsync.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
+import com.withorb.api.errors.OrbInvalidDataException
import com.withorb.api.services.async.CustomerServiceAsync
import java.util.Collections
import java.util.Objects
@@ -137,6 +138,14 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt
index 914eead0..468fc632 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt
@@ -2257,7 +2257,7 @@ private constructor(
hierarchy().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
name()
- paymentProvider()
+ paymentProvider().ifPresent { it.validate() }
paymentProviderId()
reportingConfiguration().ifPresent { it.validate() }
shippingAddress().ifPresent { it.validate() }
@@ -2266,6 +2266,40 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (accountingSyncConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (additionalEmails.asKnown().getOrNull()?.size ?: 0) +
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (billingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (email.asKnown().isPresent) 1 else 0) +
+ (if (emailDelivery.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0) +
+ (hierarchy.asKnown().getOrNull()?.validity() ?: 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (paymentProvider.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (paymentProviderId.asKnown().isPresent) 1 else 0) +
+ (reportingConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (shippingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (taxConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (taxId.asKnown().getOrNull()?.validity() ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2467,6 +2501,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (accountingProviders.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (excluded.asKnown().isPresent) 1 else 0)
+
class AccountingProvider
private constructor(
private val externalProviderId: JsonField,
@@ -2641,6 +2694,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (externalProviderId.asKnown().isPresent) 1 else 0) +
+ (if (providerType.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2957,6 +3029,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3163,6 +3258,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (childCustomerIds.asKnown().getOrNull()?.size ?: 0) +
+ (if (parentCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3252,6 +3366,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3382,6 +3514,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): PaymentProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3516,6 +3675,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (exempt.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3814,6 +3989,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3855,13 +4053,12 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
newAvalara != null -> visitor.visitNewAvalara(newAvalara)
newTaxJar != null -> visitor.visitNewTaxJar(newTaxJar)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -3884,6 +4081,34 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) =
+ newAvalara.validity()
+
+ override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) =
+ newTaxJar.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3947,17 +4172,14 @@ private constructor(
when (taxProvider) {
"avalara" -> {
- return TaxConfiguration(
- newAvalara =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { TaxConfiguration(newAvalara = it, _json = json) }
+ ?: TaxConfiguration(_json = json)
}
"taxjar" -> {
- return TaxConfiguration(
- newTaxJar = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ TaxConfiguration(newTaxJar = it, _json = json)
+ } ?: TaxConfiguration(_json = json)
}
}
@@ -4194,11 +4416,31 @@ private constructor(
}
taxExempt()
- taxProvider()
+ taxProvider().validate()
taxExemptionCode()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (taxExempt.asKnown().isPresent) 1 else 0) +
+ (taxProvider.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (taxExemptionCode.asKnown().isPresent) 1 else 0)
+
class TaxProvider
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -4285,6 +4527,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): TaxProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4484,10 +4753,29 @@ private constructor(
}
taxExempt()
- taxProvider()
+ taxProvider().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (taxExempt.asKnown().isPresent) 1 else 0) +
+ (taxProvider.asKnown().getOrNull()?.validity() ?: 0)
+
class TaxProvider
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -4574,6 +4862,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): TaxProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4891,12 +5206,32 @@ private constructor(
return@apply
}
- country()
- type()
+ country().validate()
+ type().validate()
value()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (country.asKnown().getOrNull()?.validity() ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (value.asKnown().isPresent) 1 else 0)
+
class Country @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -5441,6 +5776,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Country = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -5953,6 +6315,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt
index 9f7b8181..7cefced6 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt
@@ -2253,7 +2253,7 @@ private constructor(
hierarchy().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
name()
- paymentProvider()
+ paymentProvider().ifPresent { it.validate() }
paymentProviderId()
reportingConfiguration().ifPresent { it.validate() }
shippingAddress().ifPresent { it.validate() }
@@ -2262,6 +2262,40 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (accountingSyncConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (additionalEmails.asKnown().getOrNull()?.size ?: 0) +
+ (if (autoCollection.asKnown().isPresent) 1 else 0) +
+ (billingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (currency.asKnown().isPresent) 1 else 0) +
+ (if (email.asKnown().isPresent) 1 else 0) +
+ (if (emailDelivery.asKnown().isPresent) 1 else 0) +
+ (if (externalCustomerId.asKnown().isPresent) 1 else 0) +
+ (hierarchy.asKnown().getOrNull()?.validity() ?: 0) +
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (name.asKnown().isPresent) 1 else 0) +
+ (paymentProvider.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (paymentProviderId.asKnown().isPresent) 1 else 0) +
+ (reportingConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (shippingAddress.asKnown().getOrNull()?.validity() ?: 0) +
+ (taxConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
+ (taxId.asKnown().getOrNull()?.validity() ?: 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2463,6 +2497,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (accountingProviders.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (excluded.asKnown().isPresent) 1 else 0)
+
class AccountingProvider
private constructor(
private val externalProviderId: JsonField,
@@ -2637,6 +2690,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (externalProviderId.asKnown().isPresent) 1 else 0) +
+ (if (providerType.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -2953,6 +3025,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3159,6 +3254,25 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (childCustomerIds.asKnown().getOrNull()?.size ?: 0) +
+ (if (parentCustomerId.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3248,6 +3362,24 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3378,6 +3510,33 @@ private constructor(
fun asString(): String =
_value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") }
+ private var validated: Boolean = false
+
+ fun validate(): PaymentProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3512,6 +3671,22 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = (if (exempt.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3810,6 +3985,29 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (postalCode.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0)
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3851,13 +4049,12 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
- fun accept(visitor: Visitor): T {
- return when {
+ fun accept(visitor: Visitor): T =
+ when {
newAvalara != null -> visitor.visitNewAvalara(newAvalara)
newTaxJar != null -> visitor.visitNewTaxJar(newTaxJar)
else -> visitor.unknown(_json)
}
- }
private var validated: Boolean = false
@@ -3880,6 +4077,34 @@ private constructor(
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitNewAvalara(newAvalara: NewAvalaraTaxConfiguration) =
+ newAvalara.validity()
+
+ override fun visitNewTaxJar(newTaxJar: NewTaxJarConfiguration) =
+ newTaxJar.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3943,17 +4168,14 @@ private constructor(
when (taxProvider) {
"avalara" -> {
- return TaxConfiguration(
- newAvalara =
- deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { TaxConfiguration(newAvalara = it, _json = json) }
+ ?: TaxConfiguration(_json = json)
}
"taxjar" -> {
- return TaxConfiguration(
- newTaxJar = deserialize(node, jacksonTypeRef()),
- _json = json,
- )
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ TaxConfiguration(newTaxJar = it, _json = json)
+ } ?: TaxConfiguration(_json = json)
}
}
@@ -4190,11 +4412,31 @@ private constructor(
}
taxExempt()
- taxProvider()
+ taxProvider().validate()
taxExemptionCode()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (taxExempt.asKnown().isPresent) 1 else 0) +
+ (taxProvider.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (taxExemptionCode.asKnown().isPresent) 1 else 0)
+
class TaxProvider
@JsonCreator
private constructor(private val value: JsonField) : Enum {
@@ -4281,6 +4523,33 @@ private constructor(
OrbInvalidDataException("Value is not a String")
}
+ private var validated: Boolean = false
+
+ fun validate(): TaxProvider = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -4480,10 +4749,29 @@ private constructor(
}
taxExempt()
- taxProvider()
+ taxProvider().validate()
validated = true
}
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (taxExempt.asKnown().isPresent) 1 else 0) +
+ (taxProvider.asKnown().getOrNull()?.validity() ?: 0)
+
class TaxProvider
@JsonCreator
private constructor(private val value: JsonField