Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 40
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-df94542d153a8558bbe63b273e8d6ae79f46b8d81df1ebeeacd07fee6f9ee22a.yml
openapi_spec_hash: aeb92e382ee0a9b86e2ba39e54cdfe9a
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-972e563922dedeeb94dca9a3ca8bac536488fcee56b55fcf09e6af044d3740e3.yml
openapi_spec_hash: 08b86ecbec3323717d48e4aaee48ed54
config_hash: 8303e755d3e16cf28542d5f0aec83851
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.tryfinch.api.core.Enum
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.errors.FinchInvalidDataException

/** The frequency of the benefit deduction/contribution. */
class BenefitFrequency @JsonCreator private constructor(private val value: JsonField<String>) :
Enum {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ private constructor(
) : this(benefitId, description, frequency, type, mutableMapOf())

/**
* The id of the benefit.
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
* missing or null (e.g. if the server responded with an unexpected value).
*/
Expand All @@ -52,6 +54,8 @@ private constructor(
Optional.ofNullable(description.getNullable("description"))

/**
* The frequency of the benefit deduction/contribution.
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
Expand Down Expand Up @@ -142,6 +146,7 @@ private constructor(
additionalProperties = companyBenefit.additionalProperties.toMutableMap()
}

/** The id of the benefit. */
fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId))

/**
Expand All @@ -167,6 +172,7 @@ private constructor(
*/
fun description(description: JsonField<String>) = apply { this.description = description }

/** The frequency of the benefit deduction/contribution. */
fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency))

/** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private constructor(
) : this(benefitId, mutableMapOf())

/**
* The id of the benefit.
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
* missing or null (e.g. if the server responded with an unexpected value).
*/
Expand Down Expand Up @@ -77,6 +79,7 @@ private constructor(
additionalProperties = createCompanyBenefitsResponse.additionalProperties.toMutableMap()
}

/** The id of the benefit. */
fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId))

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private constructor(
) : this(finchCode, message, name, mutableMapOf())

/**
* A descriptive identifier for the response
* A descriptive identifier for the response.
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -302,7 +302,7 @@ private constructor(
additionalProperties = body.additionalProperties.toMutableMap()
}

/** A descriptive identifier for the response */
/** A descriptive identifier for the response. */
fun finchCode(finchCode: String?) = finchCode(JsonField.ofNullable(finchCode))

/** Alias for calling [Builder.finchCode] with `finchCode.orElse(null)`. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ private constructor(
fun description(): Optional<String> = body.description()

/**
* The frequency of the benefit deduction/contribution.
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
Expand Down Expand Up @@ -119,6 +121,7 @@ private constructor(
*/
fun description(description: JsonField<String>) = apply { body.description(description) }

/** The frequency of the benefit deduction/contribution. */
fun frequency(frequency: BenefitFrequency?) = apply { body.frequency(frequency) }

/** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */
Expand Down Expand Up @@ -314,6 +317,8 @@ private constructor(
Optional.ofNullable(description.getNullable("description"))

/**
* The frequency of the benefit deduction/contribution.
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
Expand Down Expand Up @@ -405,6 +410,7 @@ private constructor(
this.description = description
}

/** The frequency of the benefit deduction/contribution. */
fun frequency(frequency: BenefitFrequency?) = frequency(JsonField.ofNullable(frequency))

/** Alias for calling [Builder.frequency] with `frequency.orElse(null)`. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private constructor(

fun response(): Response = response

fun items(): List<UnenrolledIndividual> = response().items()
fun items(): List<IndividualUnenrollManyResponse> = response().items()

override fun equals(other: Any?): Boolean {
if (this === other) {
Expand Down Expand Up @@ -69,19 +69,21 @@ private constructor(
}

class Response(
private val items: JsonField<List<UnenrolledIndividual>>,
private val items: JsonField<List<IndividualUnenrollManyResponse>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("items") items: JsonField<List<UnenrolledIndividual>> = JsonMissing.of()
@JsonProperty("items")
items: JsonField<List<IndividualUnenrollManyResponse>> = JsonMissing.of()
) : this(items, mutableMapOf())

fun items(): List<UnenrolledIndividual> = items.getNullable("items") ?: listOf()
fun items(): List<IndividualUnenrollManyResponse> = items.getNullable("items") ?: listOf()

@JsonProperty("items")
fun _items(): Optional<JsonField<List<UnenrolledIndividual>>> = Optional.ofNullable(items)
fun _items(): Optional<JsonField<List<IndividualUnenrollManyResponse>>> =
Optional.ofNullable(items)

@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
Expand Down Expand Up @@ -138,7 +140,7 @@ private constructor(

class Builder {

private var items: JsonField<List<UnenrolledIndividual>> = JsonMissing.of()
private var items: JsonField<List<IndividualUnenrollManyResponse>> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -147,9 +149,11 @@ private constructor(
this.additionalProperties.putAll(page.additionalProperties)
}

fun items(items: List<UnenrolledIndividual>) = items(JsonField.of(items))
fun items(items: List<IndividualUnenrollManyResponse>) = items(JsonField.of(items))

fun items(items: JsonField<List<UnenrolledIndividual>>) = apply { this.items = items }
fun items(items: JsonField<List<IndividualUnenrollManyResponse>>) = apply {
this.items = items
}

fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
Expand All @@ -165,9 +169,9 @@ private constructor(
}

class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPage) :
Iterable<UnenrolledIndividual> {
Iterable<IndividualUnenrollManyResponse> {

override fun iterator(): Iterator<UnenrolledIndividual> = iterator {
override fun iterator(): Iterator<IndividualUnenrollManyResponse> = iterator {
var page = firstPage
var index = 0
while (true) {
Expand All @@ -179,7 +183,7 @@ private constructor(
}
}

fun stream(): Stream<UnenrolledIndividual> {
fun stream(): Stream<IndividualUnenrollManyResponse> {
return StreamSupport.stream(spliterator(), false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private constructor(

fun response(): Response = response

fun items(): List<UnenrolledIndividual> = response().items()
fun items(): List<IndividualUnenrollManyResponse> = response().items()

override fun equals(other: Any?): Boolean {
if (this === other) {
Expand Down Expand Up @@ -71,19 +71,21 @@ private constructor(
}

class Response(
private val items: JsonField<List<UnenrolledIndividual>>,
private val items: JsonField<List<IndividualUnenrollManyResponse>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {

@JsonCreator
private constructor(
@JsonProperty("items") items: JsonField<List<UnenrolledIndividual>> = JsonMissing.of()
@JsonProperty("items")
items: JsonField<List<IndividualUnenrollManyResponse>> = JsonMissing.of()
) : this(items, mutableMapOf())

fun items(): List<UnenrolledIndividual> = items.getNullable("items") ?: listOf()
fun items(): List<IndividualUnenrollManyResponse> = items.getNullable("items") ?: listOf()

@JsonProperty("items")
fun _items(): Optional<JsonField<List<UnenrolledIndividual>>> = Optional.ofNullable(items)
fun _items(): Optional<JsonField<List<IndividualUnenrollManyResponse>>> =
Optional.ofNullable(items)

@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
Expand Down Expand Up @@ -140,7 +142,7 @@ private constructor(

class Builder {

private var items: JsonField<List<UnenrolledIndividual>> = JsonMissing.of()
private var items: JsonField<List<IndividualUnenrollManyResponse>> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -149,9 +151,11 @@ private constructor(
this.additionalProperties.putAll(page.additionalProperties)
}

fun items(items: List<UnenrolledIndividual>) = items(JsonField.of(items))
fun items(items: List<IndividualUnenrollManyResponse>) = items(JsonField.of(items))

fun items(items: JsonField<List<UnenrolledIndividual>>) = apply { this.items = items }
fun items(items: JsonField<List<IndividualUnenrollManyResponse>>) = apply {
this.items = items
}

fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
Expand All @@ -169,11 +173,11 @@ private constructor(
class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPageAsync) {

fun forEach(
action: Predicate<UnenrolledIndividual>,
action: Predicate<IndividualUnenrollManyResponse>,
executor: Executor,
): CompletableFuture<Void> {
fun CompletableFuture<Optional<HrisBenefitIndividualUnenrollManyPageAsync>>.forEach(
action: (UnenrolledIndividual) -> Boolean,
action: (IndividualUnenrollManyResponse) -> Boolean,
executor: Executor,
): CompletableFuture<Void> =
thenComposeAsync(
Expand All @@ -189,8 +193,8 @@ private constructor(
.forEach(action::test, executor)
}

fun toList(executor: Executor): CompletableFuture<List<UnenrolledIndividual>> {
val values = mutableListOf<UnenrolledIndividual>()
fun toList(executor: Executor): CompletableFuture<List<IndividualUnenrollManyResponse>> {
val values = mutableListOf<IndividualUnenrollManyResponse>()
return forEach(values::add, executor).thenApply { values }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ private constructor(
) : this(benefitId, individualIds, mutableMapOf())

/**
* The id of the benefit.
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
* missing or null (e.g. if the server responded with an unexpected value).
*/
Expand Down Expand Up @@ -102,6 +104,7 @@ private constructor(
additionalProperties = individualEnrolledIdsResponse.additionalProperties.toMutableMap()
}

/** The id of the benefit. */
fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId))

/**
Expand Down
Loading