Skip to content

Commit e0941b9

Browse files
feat(api): api update
1 parent d591ac6 commit e0941b9

3 files changed

Lines changed: 218 additions & 6 deletions

File tree

.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-0926c5a3f3e790c6a972e1a7b851e436419a727bc8c541d7a270af78ee65eab3.yml
3-
openapi_spec_hash: bb1f4769845319413351c5bd9eb2d064
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-94cd7551c2a8e8b2e491c9e8ca44387f2d1c7a498046dd60150f254316b20090.yml
3+
openapi_spec_hash: c6f63a7d16d9ff16040c16a9633049fd
44
config_hash: d21a244fc073152c8dbecb8ece970209

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

Lines changed: 213 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,6 +2509,7 @@ private constructor(
25092509
private val id: JsonField<String>,
25102510
private val name: JsonField<String>,
25112511
private val sourceId: JsonField<String>,
2512+
private val status: JsonField<EntityConnectionStatus>,
25122513
private val additionalProperties: MutableMap<String, JsonValue>,
25132514
) {
25142515

@@ -2519,7 +2520,10 @@ private constructor(
25192520
@JsonProperty("source_id")
25202521
@ExcludeMissing
25212522
sourceId: JsonField<String> = JsonMissing.of(),
2522-
) : this(id, name, sourceId, mutableMapOf())
2523+
@JsonProperty("status")
2524+
@ExcludeMissing
2525+
status: JsonField<EntityConnectionStatus> = JsonMissing.of(),
2526+
) : this(id, name, sourceId, status, mutableMapOf())
25232527

25242528
/**
25252529
* The connection account ID for this entity
@@ -2545,6 +2549,14 @@ private constructor(
25452549
*/
25462550
fun sourceId(): Optional<String> = sourceId.getOptional("source_id")
25472551

2552+
/**
2553+
* The status of the entity connection
2554+
*
2555+
* @throws FinchInvalidDataException if the JSON field has an unexpected type or is
2556+
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
2557+
*/
2558+
fun status(): EntityConnectionStatus = status.getRequired("status")
2559+
25482560
/**
25492561
* Returns the raw JSON value of [id].
25502562
*
@@ -2566,6 +2578,15 @@ private constructor(
25662578
*/
25672579
@JsonProperty("source_id") @ExcludeMissing fun _sourceId(): JsonField<String> = sourceId
25682580

2581+
/**
2582+
* Returns the raw JSON value of [status].
2583+
*
2584+
* Unlike [status], this method doesn't throw if the JSON field has an unexpected type.
2585+
*/
2586+
@JsonProperty("status")
2587+
@ExcludeMissing
2588+
fun _status(): JsonField<EntityConnectionStatus> = status
2589+
25692590
@JsonAnySetter
25702591
private fun putAdditionalProperty(key: String, value: JsonValue) {
25712592
additionalProperties.put(key, value)
@@ -2588,6 +2609,7 @@ private constructor(
25882609
* .id()
25892610
* .name()
25902611
* .sourceId()
2612+
* .status()
25912613
* ```
25922614
*/
25932615
@JvmStatic fun builder() = Builder()
@@ -2599,13 +2621,15 @@ private constructor(
25992621
private var id: JsonField<String>? = null
26002622
private var name: JsonField<String>? = null
26012623
private var sourceId: JsonField<String>? = null
2624+
private var status: JsonField<EntityConnectionStatus>? = null
26022625
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
26032626

26042627
@JvmSynthetic
26052628
internal fun from(multiAccountEntity: MultiAccountEntity) = apply {
26062629
id = multiAccountEntity.id
26072630
name = multiAccountEntity.name
26082631
sourceId = multiAccountEntity.sourceId
2632+
status = multiAccountEntity.status
26092633
additionalProperties = multiAccountEntity.additionalProperties.toMutableMap()
26102634
}
26112635

@@ -2651,6 +2675,18 @@ private constructor(
26512675
*/
26522676
fun sourceId(sourceId: JsonField<String>) = apply { this.sourceId = sourceId }
26532677

2678+
/** The status of the entity connection */
2679+
fun status(status: EntityConnectionStatus) = status(JsonField.of(status))
2680+
2681+
/**
2682+
* Sets [Builder.status] to an arbitrary JSON value.
2683+
*
2684+
* You should usually call [Builder.status] with a well-typed [EntityConnectionStatus]
2685+
* value instead. This method is primarily for setting the field to an undocumented or
2686+
* not yet supported value.
2687+
*/
2688+
fun status(status: JsonField<EntityConnectionStatus>) = apply { this.status = status }
2689+
26542690
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
26552691
this.additionalProperties.clear()
26562692
putAllAdditionalProperties(additionalProperties)
@@ -2680,6 +2716,7 @@ private constructor(
26802716
* .id()
26812717
* .name()
26822718
* .sourceId()
2719+
* .status()
26832720
* ```
26842721
*
26852722
* @throws IllegalStateException if any required field is unset.
@@ -2689,6 +2726,7 @@ private constructor(
26892726
checkRequired("id", id),
26902727
checkRequired("name", name),
26912728
checkRequired("sourceId", sourceId),
2729+
checkRequired("status", status),
26922730
additionalProperties.toMutableMap(),
26932731
)
26942732
}
@@ -2703,6 +2741,7 @@ private constructor(
27032741
id()
27042742
name()
27052743
sourceId()
2744+
status().validate()
27062745
validated = true
27072746
}
27082747

@@ -2724,7 +2763,174 @@ private constructor(
27242763
internal fun validity(): Int =
27252764
(if (id.asKnown().isPresent) 1 else 0) +
27262765
(if (name.asKnown().isPresent) 1 else 0) +
2727-
(if (sourceId.asKnown().isPresent) 1 else 0)
2766+
(if (sourceId.asKnown().isPresent) 1 else 0) +
2767+
(status.asKnown().getOrNull()?.validity() ?: 0)
2768+
2769+
/** The status of the entity connection */
2770+
class EntityConnectionStatus
2771+
@JsonCreator
2772+
private constructor(private val value: JsonField<String>) : Enum {
2773+
2774+
/**
2775+
* Returns this class instance's raw value.
2776+
*
2777+
* This is usually only useful if this instance was deserialized from data that doesn't
2778+
* match any known member, and you want to know that value. For example, if the SDK is
2779+
* on an older version than the API, then the API may respond with new members that the
2780+
* SDK is unaware of.
2781+
*/
2782+
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
2783+
2784+
companion object {
2785+
2786+
@JvmField val PENDING = of("pending")
2787+
2788+
@JvmField val PROCESSING = of("processing")
2789+
2790+
@JvmField val CONNECTED = of("connected")
2791+
2792+
@JvmField val ERROR_NO_ACCOUNT_SETUP = of("error_no_account_setup")
2793+
2794+
@JvmField val ERROR_PERMISSIONS = of("error_permissions")
2795+
2796+
@JvmField val REAUTH = of("reauth")
2797+
2798+
@JvmField val DISCONNECTED = of("disconnected")
2799+
2800+
@JvmStatic fun of(value: String) = EntityConnectionStatus(JsonField.of(value))
2801+
}
2802+
2803+
/** An enum containing [EntityConnectionStatus]'s known values. */
2804+
enum class Known {
2805+
PENDING,
2806+
PROCESSING,
2807+
CONNECTED,
2808+
ERROR_NO_ACCOUNT_SETUP,
2809+
ERROR_PERMISSIONS,
2810+
REAUTH,
2811+
DISCONNECTED,
2812+
}
2813+
2814+
/**
2815+
* An enum containing [EntityConnectionStatus]'s known values, as well as an [_UNKNOWN]
2816+
* member.
2817+
*
2818+
* An instance of [EntityConnectionStatus] can contain an unknown value in a couple of
2819+
* cases:
2820+
* - It was deserialized from data that doesn't match any known member. For example, if
2821+
* the SDK is on an older version than the API, then the API may respond with new
2822+
* members that the SDK is unaware of.
2823+
* - It was constructed with an arbitrary value using the [of] method.
2824+
*/
2825+
enum class Value {
2826+
PENDING,
2827+
PROCESSING,
2828+
CONNECTED,
2829+
ERROR_NO_ACCOUNT_SETUP,
2830+
ERROR_PERMISSIONS,
2831+
REAUTH,
2832+
DISCONNECTED,
2833+
/**
2834+
* An enum member indicating that [EntityConnectionStatus] was instantiated with an
2835+
* unknown value.
2836+
*/
2837+
_UNKNOWN,
2838+
}
2839+
2840+
/**
2841+
* Returns an enum member corresponding to this class instance's value, or
2842+
* [Value._UNKNOWN] if the class was instantiated with an unknown value.
2843+
*
2844+
* Use the [known] method instead if you're certain the value is always known or if you
2845+
* want to throw for the unknown case.
2846+
*/
2847+
fun value(): Value =
2848+
when (this) {
2849+
PENDING -> Value.PENDING
2850+
PROCESSING -> Value.PROCESSING
2851+
CONNECTED -> Value.CONNECTED
2852+
ERROR_NO_ACCOUNT_SETUP -> Value.ERROR_NO_ACCOUNT_SETUP
2853+
ERROR_PERMISSIONS -> Value.ERROR_PERMISSIONS
2854+
REAUTH -> Value.REAUTH
2855+
DISCONNECTED -> Value.DISCONNECTED
2856+
else -> Value._UNKNOWN
2857+
}
2858+
2859+
/**
2860+
* Returns an enum member corresponding to this class instance's value.
2861+
*
2862+
* Use the [value] method instead if you're uncertain the value is always known and
2863+
* don't want to throw for the unknown case.
2864+
*
2865+
* @throws FinchInvalidDataException if this class instance's value is a not a known
2866+
* member.
2867+
*/
2868+
fun known(): Known =
2869+
when (this) {
2870+
PENDING -> Known.PENDING
2871+
PROCESSING -> Known.PROCESSING
2872+
CONNECTED -> Known.CONNECTED
2873+
ERROR_NO_ACCOUNT_SETUP -> Known.ERROR_NO_ACCOUNT_SETUP
2874+
ERROR_PERMISSIONS -> Known.ERROR_PERMISSIONS
2875+
REAUTH -> Known.REAUTH
2876+
DISCONNECTED -> Known.DISCONNECTED
2877+
else ->
2878+
throw FinchInvalidDataException("Unknown EntityConnectionStatus: $value")
2879+
}
2880+
2881+
/**
2882+
* Returns this class instance's primitive wire representation.
2883+
*
2884+
* This differs from the [toString] method because that method is primarily for
2885+
* debugging and generally doesn't throw.
2886+
*
2887+
* @throws FinchInvalidDataException if this class instance's value does not have the
2888+
* expected primitive type.
2889+
*/
2890+
fun asString(): String =
2891+
_value().asString().orElseThrow {
2892+
FinchInvalidDataException("Value is not a String")
2893+
}
2894+
2895+
private var validated: Boolean = false
2896+
2897+
fun validate(): EntityConnectionStatus = apply {
2898+
if (validated) {
2899+
return@apply
2900+
}
2901+
2902+
known()
2903+
validated = true
2904+
}
2905+
2906+
fun isValid(): Boolean =
2907+
try {
2908+
validate()
2909+
true
2910+
} catch (e: FinchInvalidDataException) {
2911+
false
2912+
}
2913+
2914+
/**
2915+
* Returns a score indicating how many valid values are contained in this object
2916+
* recursively.
2917+
*
2918+
* Used for best match union deserialization.
2919+
*/
2920+
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
2921+
2922+
override fun equals(other: Any?): Boolean {
2923+
if (this === other) {
2924+
return true
2925+
}
2926+
2927+
return other is EntityConnectionStatus && value == other.value
2928+
}
2929+
2930+
override fun hashCode() = value.hashCode()
2931+
2932+
override fun toString() = value.toString()
2933+
}
27282934

27292935
override fun equals(other: Any?): Boolean {
27302936
if (this === other) {
@@ -2735,15 +2941,18 @@ private constructor(
27352941
id == other.id &&
27362942
name == other.name &&
27372943
sourceId == other.sourceId &&
2944+
status == other.status &&
27382945
additionalProperties == other.additionalProperties
27392946
}
27402947

2741-
private val hashCode: Int by lazy { Objects.hash(id, name, sourceId, additionalProperties) }
2948+
private val hashCode: Int by lazy {
2949+
Objects.hash(id, name, sourceId, status, additionalProperties)
2950+
}
27422951

27432952
override fun hashCode(): Int = hashCode
27442953

27452954
override fun toString() =
2746-
"MultiAccountEntity{id=$id, name=$name, sourceId=$sourceId, additionalProperties=$additionalProperties}"
2955+
"MultiAccountEntity{id=$id, name=$name, sourceId=$sourceId, status=$status, additionalProperties=$additionalProperties}"
27472956
}
27482957

27492958
override fun equals(other: Any?): Boolean {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ internal class IntrospectionTest {
5555
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
5656
.name("name")
5757
.sourceId("source_id")
58+
.status(Introspection.MultiAccountEntity.EntityConnectionStatus.PENDING)
5859
.build()
5960
)
6061
.manual(true)
@@ -102,6 +103,7 @@ internal class IntrospectionTest {
102103
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
103104
.name("name")
104105
.sourceId("source_id")
106+
.status(Introspection.MultiAccountEntity.EntityConnectionStatus.PENDING)
105107
.build()
106108
)
107109
assertThat(introspection.manual()).contains(true)
@@ -154,6 +156,7 @@ internal class IntrospectionTest {
154156
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
155157
.name("name")
156158
.sourceId("source_id")
159+
.status(Introspection.MultiAccountEntity.EntityConnectionStatus.PENDING)
157160
.build()
158161
)
159162
.manual(true)

0 commit comments

Comments
 (0)