com.lithic.api.models.Carrier.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lithic-kotlin-core Show documentation
Show all versions of lithic-kotlin-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
@JsonDeserialize(builder = Carrier.Builder::class)
@NoAutoDetect
class Carrier
private constructor(
private val qrCodeUrl: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** QR code url to display on the card carrier */
fun qrCodeUrl(): String? = qrCodeUrl.getNullable("qr_code_url")
/** QR code url to display on the card carrier */
@JsonProperty("qr_code_url") @ExcludeMissing fun _qrCodeUrl() = qrCodeUrl
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): Carrier = apply {
if (!validated) {
qrCodeUrl()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Carrier &&
this.qrCodeUrl == other.qrCodeUrl &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = Objects.hash(qrCodeUrl, additionalProperties)
}
return hashCode
}
override fun toString() =
"Carrier{qrCodeUrl=$qrCodeUrl, additionalProperties=$additionalProperties}"
companion object {
fun builder() = Builder()
}
class Builder {
private var qrCodeUrl: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(carrier: Carrier) = apply {
this.qrCodeUrl = carrier.qrCodeUrl
additionalProperties(carrier.additionalProperties)
}
/** QR code url to display on the card carrier */
fun qrCodeUrl(qrCodeUrl: String) = qrCodeUrl(JsonField.of(qrCodeUrl))
/** QR code url to display on the card carrier */
@JsonProperty("qr_code_url")
@ExcludeMissing
fun qrCodeUrl(qrCodeUrl: JsonField) = apply { this.qrCodeUrl = qrCodeUrl }
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(): Carrier = Carrier(qrCodeUrl, additionalProperties.toUnmodifiable())
}
}