Skip to content

Commit a9fefbc

Browse files
feat(api): api update
1 parent 9e451d0 commit a9fefbc

File tree

4 files changed

+44
-46
lines changed

4 files changed

+44
-46
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 45
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-0583a6e86a80bc62551727b12c37e02a9b4e4ac5bce822b2e2c1cade3588a6f4.yml
3-
openapi_spec_hash: 53783b6cc1f63d9fb5d3a4dba7b0a806
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-e5ab676f0996530fe4c702d8cbb88862ab8382792d01197a9576e06f5a359d00.yml
3+
openapi_spec_hash: d5d110fa239579917a521521145c1264
44
config_hash: 53778a0b839c4f6ad34fbba051f5e8a6

finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,28 @@ import kotlin.jvm.optionals.getOrNull
3636
class Individual
3737
private constructor(
3838
private val unionMember0: UnionMember0? = null,
39-
private val unionMember1: UnionMember1? = null,
39+
private val batchError: BatchError? = null,
4040
private val _json: JsonValue? = null,
4141
) {
4242

4343
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
4444

45-
fun unionMember1(): Optional<UnionMember1> = Optional.ofNullable(unionMember1)
45+
fun batchError(): Optional<BatchError> = Optional.ofNullable(batchError)
4646

4747
fun isUnionMember0(): Boolean = unionMember0 != null
4848

49-
fun isUnionMember1(): Boolean = unionMember1 != null
49+
fun isBatchError(): Boolean = batchError != null
5050

5151
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
5252

53-
fun asUnionMember1(): UnionMember1 = unionMember1.getOrThrow("unionMember1")
53+
fun asBatchError(): BatchError = batchError.getOrThrow("batchError")
5454

5555
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
5656

5757
fun <T> accept(visitor: Visitor<T>): T =
5858
when {
5959
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
60-
unionMember1 != null -> visitor.visitUnionMember1(unionMember1)
60+
batchError != null -> visitor.visitBatchError(batchError)
6161
else -> visitor.unknown(_json)
6262
}
6363

@@ -74,8 +74,8 @@ private constructor(
7474
unionMember0.validate()
7575
}
7676

77-
override fun visitUnionMember1(unionMember1: UnionMember1) {
78-
unionMember1.validate()
77+
override fun visitBatchError(batchError: BatchError) {
78+
batchError.validate()
7979
}
8080
}
8181
)
@@ -101,7 +101,7 @@ private constructor(
101101
object : Visitor<Int> {
102102
override fun visitUnionMember0(unionMember0: UnionMember0) = unionMember0.validity()
103103

104-
override fun visitUnionMember1(unionMember1: UnionMember1) = unionMember1.validity()
104+
override fun visitBatchError(batchError: BatchError) = batchError.validity()
105105

106106
override fun unknown(json: JsonValue?) = 0
107107
}
@@ -112,15 +112,15 @@ private constructor(
112112
return true
113113
}
114114

115-
return /* spotless:off */ other is Individual && unionMember0 == other.unionMember0 && unionMember1 == other.unionMember1 /* spotless:on */
115+
return /* spotless:off */ other is Individual && unionMember0 == other.unionMember0 && batchError == other.batchError /* spotless:on */
116116
}
117117

118-
override fun hashCode(): Int = /* spotless:off */ Objects.hash(unionMember0, unionMember1) /* spotless:on */
118+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(unionMember0, batchError) /* spotless:on */
119119

120120
override fun toString(): String =
121121
when {
122122
unionMember0 != null -> "Individual{unionMember0=$unionMember0}"
123-
unionMember1 != null -> "Individual{unionMember1=$unionMember1}"
123+
batchError != null -> "Individual{batchError=$batchError}"
124124
_json != null -> "Individual{_unknown=$_json}"
125125
else -> throw IllegalStateException("Invalid Individual")
126126
}
@@ -130,16 +130,15 @@ private constructor(
130130
@JvmStatic
131131
fun ofUnionMember0(unionMember0: UnionMember0) = Individual(unionMember0 = unionMember0)
132132

133-
@JvmStatic
134-
fun ofUnionMember1(unionMember1: UnionMember1) = Individual(unionMember1 = unionMember1)
133+
@JvmStatic fun ofBatchError(batchError: BatchError) = Individual(batchError = batchError)
135134
}
136135

137136
/** An interface that defines how to map each variant of [Individual] to a value of type [T]. */
138137
interface Visitor<out T> {
139138

140139
fun visitUnionMember0(unionMember0: UnionMember0): T
141140

142-
fun visitUnionMember1(unionMember1: UnionMember1): T
141+
fun visitBatchError(batchError: BatchError): T
143142

144143
/**
145144
* Maps an unknown variant of [Individual] to a value of type [T].
@@ -165,8 +164,8 @@ private constructor(
165164
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
166165
Individual(unionMember0 = it, _json = json)
167166
},
168-
tryDeserialize(node, jacksonTypeRef<UnionMember1>())?.let {
169-
Individual(unionMember1 = it, _json = json)
167+
tryDeserialize(node, jacksonTypeRef<BatchError>())?.let {
168+
Individual(batchError = it, _json = json)
170169
},
171170
)
172171
.filterNotNull()
@@ -193,7 +192,7 @@ private constructor(
193192
) {
194193
when {
195194
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
196-
value.unionMember1 != null -> generator.writeObject(value.unionMember1)
195+
value.batchError != null -> generator.writeObject(value.batchError)
197196
value._json != null -> generator.writeObject(value._json)
198197
else -> throw IllegalStateException("Invalid Individual")
199198
}
@@ -1874,7 +1873,7 @@ private constructor(
18741873
"UnionMember0{id=$id, dob=$dob, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, emails=$emails, encryptedSsn=$encryptedSsn, ssn=$ssn, additionalProperties=$additionalProperties}"
18751874
}
18761875

1877-
class UnionMember1
1876+
class BatchError
18781877
private constructor(
18791878
private val code: JsonField<Double>,
18801879
private val message: JsonField<String>,
@@ -1960,7 +1959,7 @@ private constructor(
19601959
companion object {
19611960

19621961
/**
1963-
* Returns a mutable builder for constructing an instance of [UnionMember1].
1962+
* Returns a mutable builder for constructing an instance of [BatchError].
19641963
*
19651964
* The following fields are required:
19661965
* ```java
@@ -1972,7 +1971,7 @@ private constructor(
19721971
@JvmStatic fun builder() = Builder()
19731972
}
19741973

1975-
/** A builder for [UnionMember1]. */
1974+
/** A builder for [BatchError]. */
19761975
class Builder internal constructor() {
19771976

19781977
private var code: JsonField<Double>? = null
@@ -1982,12 +1981,12 @@ private constructor(
19821981
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
19831982

19841983
@JvmSynthetic
1985-
internal fun from(unionMember1: UnionMember1) = apply {
1986-
code = unionMember1.code
1987-
message = unionMember1.message
1988-
name = unionMember1.name
1989-
finchCode = unionMember1.finchCode
1990-
additionalProperties = unionMember1.additionalProperties.toMutableMap()
1984+
internal fun from(batchError: BatchError) = apply {
1985+
code = batchError.code
1986+
message = batchError.message
1987+
name = batchError.name
1988+
finchCode = batchError.finchCode
1989+
additionalProperties = batchError.additionalProperties.toMutableMap()
19911990
}
19921991

19931992
fun code(code: Double) = code(JsonField.of(code))
@@ -2054,7 +2053,7 @@ private constructor(
20542053
}
20552054

20562055
/**
2057-
* Returns an immutable instance of [UnionMember1].
2056+
* Returns an immutable instance of [BatchError].
20582057
*
20592058
* Further updates to this [Builder] will not mutate the returned instance.
20602059
*
@@ -2067,8 +2066,8 @@ private constructor(
20672066
*
20682067
* @throws IllegalStateException if any required field is unset.
20692068
*/
2070-
fun build(): UnionMember1 =
2071-
UnionMember1(
2069+
fun build(): BatchError =
2070+
BatchError(
20722071
checkRequired("code", code),
20732072
checkRequired("message", message),
20742073
checkRequired("name", name),
@@ -2079,7 +2078,7 @@ private constructor(
20792078

20802079
private var validated: Boolean = false
20812080

2082-
fun validate(): UnionMember1 = apply {
2081+
fun validate(): BatchError = apply {
20832082
if (validated) {
20842083
return@apply
20852084
}
@@ -2117,7 +2116,7 @@ private constructor(
21172116
return true
21182117
}
21192118

2120-
return /* spotless:off */ other is UnionMember1 && code == other.code && message == other.message && name == other.name && finchCode == other.finchCode && additionalProperties == other.additionalProperties /* spotless:on */
2119+
return /* spotless:off */ other is BatchError && code == other.code && message == other.message && name == other.name && finchCode == other.finchCode && additionalProperties == other.additionalProperties /* spotless:on */
21212120
}
21222121

21232122
/* spotless:off */
@@ -2127,6 +2126,6 @@ private constructor(
21272126
override fun hashCode(): Int = hashCode
21282127

21292128
override fun toString() =
2130-
"UnionMember1{code=$code, message=$message, name=$name, finchCode=$finchCode, additionalProperties=$additionalProperties}"
2129+
"BatchError{code=$code, message=$message, name=$name, finchCode=$finchCode, additionalProperties=$additionalProperties}"
21312130
}
21322131
}

finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ private constructor(
131131
fun body(unionMember0: Individual.UnionMember0) =
132132
body(Individual.ofUnionMember0(unionMember0))
133133

134-
/** Alias for calling [body] with `Individual.ofUnionMember1(unionMember1)`. */
135-
fun body(unionMember1: Individual.UnionMember1) =
136-
body(Individual.ofUnionMember1(unionMember1))
134+
/** Alias for calling [body] with `Individual.ofBatchError(batchError)`. */
135+
fun body(batchError: Individual.BatchError) = body(Individual.ofBatchError(batchError))
137136

138137
fun code(code: Long) = code(JsonField.of(code))
139138

finch-java-core/src/test/kotlin/com/tryfinch/api/models/IndividualTest.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal class IndividualTest {
5757
val individual = Individual.ofUnionMember0(unionMember0)
5858

5959
assertThat(individual.unionMember0()).contains(unionMember0)
60-
assertThat(individual.unionMember1()).isEmpty
60+
assertThat(individual.batchError()).isEmpty
6161
}
6262

6363
@Test
@@ -113,27 +113,27 @@ internal class IndividualTest {
113113
}
114114

115115
@Test
116-
fun ofUnionMember1() {
117-
val unionMember1 =
118-
Individual.UnionMember1.builder()
116+
fun ofBatchError() {
117+
val batchError =
118+
Individual.BatchError.builder()
119119
.code(0.0)
120120
.message("message")
121121
.name("name")
122122
.finchCode("finch_code")
123123
.build()
124124

125-
val individual = Individual.ofUnionMember1(unionMember1)
125+
val individual = Individual.ofBatchError(batchError)
126126

127127
assertThat(individual.unionMember0()).isEmpty
128-
assertThat(individual.unionMember1()).contains(unionMember1)
128+
assertThat(individual.batchError()).contains(batchError)
129129
}
130130

131131
@Test
132-
fun ofUnionMember1Roundtrip() {
132+
fun ofBatchErrorRoundtrip() {
133133
val jsonMapper = jsonMapper()
134134
val individual =
135-
Individual.ofUnionMember1(
136-
Individual.UnionMember1.builder()
135+
Individual.ofBatchError(
136+
Individual.BatchError.builder()
137137
.code(0.0)
138138
.message("message")
139139
.name("name")

0 commit comments

Comments
 (0)