Skip to content

Commit 7fdbde9

Browse files
feat(api): benefits mutation API endpoints (create benefit, update benefit, enroll individual, unenroll individual) now properly return async response types (#539)
1 parent 8cf5e9f commit 7fdbde9

File tree

13 files changed

+312
-226
lines changed

13 files changed

+312
-226
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-8c83f0eae70d2a02ed3e2059fc251affdccd2f848f45445e4fed64dfd9ca5985.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-bf858f37d7ab420841ddc6329dad8c46377308b6a5c8e935908011d0f9845e22.yml
33
openapi_spec_hash: 2523952a32436e3c7fd3b55508c2e7ee
4-
config_hash: ce10384813f68ba3fed61c7b601b396b
4+
config_hash: 4a8def48077df6382ed9fe00588baecf
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.tryfinch.api.models
4+
5+
import com.fasterxml.jackson.annotation.JsonAnyGetter
6+
import com.fasterxml.jackson.annotation.JsonAnySetter
7+
import com.fasterxml.jackson.annotation.JsonCreator
8+
import com.fasterxml.jackson.annotation.JsonProperty
9+
import com.tryfinch.api.core.ExcludeMissing
10+
import com.tryfinch.api.core.JsonField
11+
import com.tryfinch.api.core.JsonMissing
12+
import com.tryfinch.api.core.JsonValue
13+
import com.tryfinch.api.core.checkRequired
14+
import com.tryfinch.api.errors.FinchInvalidDataException
15+
import java.util.Collections
16+
import java.util.Objects
17+
18+
class EnrolledIndividualBenifit
19+
private constructor(
20+
private val jobId: JsonField<String>,
21+
private val additionalProperties: MutableMap<String, JsonValue>,
22+
) {
23+
24+
@JsonCreator
25+
private constructor(
26+
@JsonProperty("job_id") @ExcludeMissing jobId: JsonField<String> = JsonMissing.of()
27+
) : this(jobId, mutableMapOf())
28+
29+
/**
30+
* @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
31+
* missing or null (e.g. if the server responded with an unexpected value).
32+
*/
33+
fun jobId(): String = jobId.getRequired("job_id")
34+
35+
/**
36+
* Returns the raw JSON value of [jobId].
37+
*
38+
* Unlike [jobId], this method doesn't throw if the JSON field has an unexpected type.
39+
*/
40+
@JsonProperty("job_id") @ExcludeMissing fun _jobId(): JsonField<String> = jobId
41+
42+
@JsonAnySetter
43+
private fun putAdditionalProperty(key: String, value: JsonValue) {
44+
additionalProperties.put(key, value)
45+
}
46+
47+
@JsonAnyGetter
48+
@ExcludeMissing
49+
fun _additionalProperties(): Map<String, JsonValue> =
50+
Collections.unmodifiableMap(additionalProperties)
51+
52+
fun toBuilder() = Builder().from(this)
53+
54+
companion object {
55+
56+
/**
57+
* Returns a mutable builder for constructing an instance of [EnrolledIndividualBenifit].
58+
*
59+
* The following fields are required:
60+
* ```java
61+
* .jobId()
62+
* ```
63+
*/
64+
@JvmStatic fun builder() = Builder()
65+
}
66+
67+
/** A builder for [EnrolledIndividualBenifit]. */
68+
class Builder internal constructor() {
69+
70+
private var jobId: JsonField<String>? = null
71+
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
72+
73+
@JvmSynthetic
74+
internal fun from(enrolledIndividualBenifit: EnrolledIndividualBenifit) = apply {
75+
jobId = enrolledIndividualBenifit.jobId
76+
additionalProperties = enrolledIndividualBenifit.additionalProperties.toMutableMap()
77+
}
78+
79+
fun jobId(jobId: String) = jobId(JsonField.of(jobId))
80+
81+
/**
82+
* Sets [Builder.jobId] to an arbitrary JSON value.
83+
*
84+
* You should usually call [Builder.jobId] with a well-typed [String] value instead. This
85+
* method is primarily for setting the field to an undocumented or not yet supported value.
86+
*/
87+
fun jobId(jobId: JsonField<String>) = apply { this.jobId = jobId }
88+
89+
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
90+
this.additionalProperties.clear()
91+
putAllAdditionalProperties(additionalProperties)
92+
}
93+
94+
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
95+
additionalProperties.put(key, value)
96+
}
97+
98+
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
99+
this.additionalProperties.putAll(additionalProperties)
100+
}
101+
102+
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
103+
104+
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
105+
keys.forEach(::removeAdditionalProperty)
106+
}
107+
108+
/**
109+
* Returns an immutable instance of [EnrolledIndividualBenifit].
110+
*
111+
* Further updates to this [Builder] will not mutate the returned instance.
112+
*
113+
* The following fields are required:
114+
* ```java
115+
* .jobId()
116+
* ```
117+
*
118+
* @throws IllegalStateException if any required field is unset.
119+
*/
120+
fun build(): EnrolledIndividualBenifit =
121+
EnrolledIndividualBenifit(
122+
checkRequired("jobId", jobId),
123+
additionalProperties.toMutableMap(),
124+
)
125+
}
126+
127+
private var validated: Boolean = false
128+
129+
fun validate(): EnrolledIndividualBenifit = apply {
130+
if (validated) {
131+
return@apply
132+
}
133+
134+
jobId()
135+
validated = true
136+
}
137+
138+
fun isValid(): Boolean =
139+
try {
140+
validate()
141+
true
142+
} catch (e: FinchInvalidDataException) {
143+
false
144+
}
145+
146+
/**
147+
* Returns a score indicating how many valid values are contained in this object recursively.
148+
*
149+
* Used for best match union deserialization.
150+
*/
151+
@JvmSynthetic internal fun validity(): Int = (if (jobId.asKnown().isPresent) 1 else 0)
152+
153+
override fun equals(other: Any?): Boolean {
154+
if (this === other) {
155+
return true
156+
}
157+
158+
return /* spotless:off */ other is EnrolledIndividualBenifit && jobId == other.jobId && additionalProperties == other.additionalProperties /* spotless:on */
159+
}
160+
161+
/* spotless:off */
162+
private val hashCode: Int by lazy { Objects.hash(jobId, additionalProperties) }
163+
/* spotless:on */
164+
165+
override fun hashCode(): Int = hashCode
166+
167+
override fun toString() =
168+
"EnrolledIndividualBenifit{jobId=$jobId, additionalProperties=$additionalProperties}"
169+
}

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

Lines changed: 0 additions & 80 deletions
This file was deleted.

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

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)