com.lithic.api.models.ResponderEndpointStatus.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lithic-java-core Show documentation
Show all versions of lithic-java-core Show documentation
The Lithic Developer API is designed to provide a predictable programmatic
interface for accessing your Lithic account through an API and transaction
webhooks. Note that your API key is a secret and should be treated as such.
Don't share it with anyone, including us. We will never ask you for it.
// File generated from our OpenAPI spec by Stainless.
package com.lithic.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.lithic.api.core.ExcludeMissing
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import java.util.Objects
import java.util.Optional
@JsonDeserialize(builder = ResponderEndpointStatus.Builder::class)
@NoAutoDetect
class ResponderEndpointStatus
private constructor(
private val enrolled: JsonField,
private val url: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
/** True if the instance has an endpoint enrolled. */
fun enrolled(): Optional = Optional.ofNullable(enrolled.getNullable("enrolled"))
/** The URL of the currently enrolled endpoint or null. */
fun url(): Optional = Optional.ofNullable(url.getNullable("url"))
/** True if the instance has an endpoint enrolled. */
@JsonProperty("enrolled") @ExcludeMissing fun _enrolled() = enrolled
/** The URL of the currently enrolled endpoint or null. */
@JsonProperty("url") @ExcludeMissing fun _url() = url
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): ResponderEndpointStatus = apply {
if (!validated) {
enrolled()
url()
validated = true
}
}
fun toBuilder() = Builder().from(this)
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var enrolled: JsonField = JsonMissing.of()
private var url: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(responderEndpointStatus: ResponderEndpointStatus) = apply {
this.enrolled = responderEndpointStatus.enrolled
this.url = responderEndpointStatus.url
additionalProperties(responderEndpointStatus.additionalProperties)
}
/** True if the instance has an endpoint enrolled. */
fun enrolled(enrolled: Boolean) = enrolled(JsonField.of(enrolled))
/** True if the instance has an endpoint enrolled. */
@JsonProperty("enrolled")
@ExcludeMissing
fun enrolled(enrolled: JsonField) = apply { this.enrolled = enrolled }
/** The URL of the currently enrolled endpoint or null. */
fun url(url: String) = url(JsonField.of(url))
/** The URL of the currently enrolled endpoint or null. */
@JsonProperty("url")
@ExcludeMissing
fun url(url: JsonField) = apply { this.url = url }
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(): ResponderEndpointStatus =
ResponderEndpointStatus(
enrolled,
url,
additionalProperties.toUnmodifiable(),
)
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is ResponderEndpointStatus &&
this.enrolled == other.enrolled &&
this.url == other.url &&
this.additionalProperties == other.additionalProperties
}
private var hashCode: Int = 0
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
enrolled,
url,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"ResponderEndpointStatus{enrolled=$enrolled, url=$url, additionalProperties=$additionalProperties}"
}