com.tryfinch.api.models.IndividualResponse.kt Maven / Gradle / Ivy
// File generated from our OpenAPI spec by Stainless.
package com.tryfinch.api.models
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.tryfinch.api.core.ExcludeMissing
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.core.JsonMissing
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.NoAutoDetect
import com.tryfinch.api.core.toImmutable
import java.util.Objects
@JsonDeserialize(builder = IndividualResponse.Builder::class)
@NoAutoDetect
class IndividualResponse
private constructor(
private val individualId: JsonField,
private val code: JsonField,
private val body: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
fun individualId(): String? = individualId.getNullable("individual_id")
fun code(): Long? = code.getNullable("code")
fun body(): Individual? = body.getNullable("body")
@JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId
@JsonProperty("code") @ExcludeMissing fun _code() = code
@JsonProperty("body") @ExcludeMissing fun _body() = body
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): IndividualResponse = apply {
if (!validated) {
individualId()
code()
body()?.validate()
validated = true
}
}
fun toBuilder() = Builder().from(this)
companion object {
fun builder() = Builder()
}
class Builder {
private var individualId: JsonField = JsonMissing.of()
private var code: JsonField = JsonMissing.of()
private var body: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(individualResponse: IndividualResponse) = apply {
this.individualId = individualResponse.individualId
this.code = individualResponse.code
this.body = individualResponse.body
additionalProperties(individualResponse.additionalProperties)
}
fun individualId(individualId: String) = individualId(JsonField.of(individualId))
@JsonProperty("individual_id")
@ExcludeMissing
fun individualId(individualId: JsonField) = apply {
this.individualId = individualId
}
fun code(code: Long) = code(JsonField.of(code))
@JsonProperty("code")
@ExcludeMissing
fun code(code: JsonField) = apply { this.code = code }
fun body(body: Individual) = body(JsonField.of(body))
@JsonProperty("body")
@ExcludeMissing
fun body(body: JsonField) = apply { this.body = body }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}
@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): IndividualResponse =
IndividualResponse(
individualId,
code,
body,
additionalProperties.toImmutable(),
)
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return /* spotless:off */ other is IndividualResponse && individualId == other.individualId && code == other.code && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
private val hashCode: Int by lazy { Objects.hash(individualId, code, body, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
"IndividualResponse{individualId=$individualId, code=$code, body=$body, additionalProperties=$additionalProperties}"
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy