com.lithic.api.models.AuthRuleUpdateParams.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.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import com.lithic.api.models.*
import java.util.Objects
import java.util.Optional
class AuthRuleUpdateParams
constructor(
private val authRuleToken: String,
private val allowedCountries: List?,
private val allowedMcc: List?,
private val blockedCountries: List?,
private val blockedMcc: List?,
private val additionalQueryParams: Map>,
private val additionalHeaders: Map>,
private val additionalBodyProperties: Map,
) {
fun authRuleToken(): String = authRuleToken
fun allowedCountries(): Optional> = Optional.ofNullable(allowedCountries)
fun allowedMcc(): Optional> = Optional.ofNullable(allowedMcc)
fun blockedCountries(): Optional> = Optional.ofNullable(blockedCountries)
fun blockedMcc(): Optional> = Optional.ofNullable(blockedMcc)
@JvmSynthetic
internal fun getBody(): AuthRuleUpdateBody {
return AuthRuleUpdateBody(
allowedCountries,
allowedMcc,
blockedCountries,
blockedMcc,
additionalBodyProperties,
)
}
@JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams
@JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders
fun getPathParam(index: Int): String {
return when (index) {
0 -> authRuleToken
else -> ""
}
}
@JsonDeserialize(builder = AuthRuleUpdateBody.Builder::class)
@NoAutoDetect
class AuthRuleUpdateBody
internal constructor(
private val allowedCountries: List?,
private val allowedMcc: List?,
private val blockedCountries: List?,
private val blockedMcc: List?,
private val additionalProperties: Map,
) {
/**
* Array of country codes for which the Auth Rule will permit transactions. Note that only
* this field or `blocked_countries` can be used for a given Auth Rule.
*/
@JsonProperty("allowed_countries") fun allowedCountries(): List? = allowedCountries
/**
* Array of merchant category codes for which the Auth Rule will permit transactions. Note
* that only this field or `blocked_mcc` can be used for a given Auth Rule.
*/
@JsonProperty("allowed_mcc") fun allowedMcc(): List? = allowedMcc
/**
* Array of country codes for which the Auth Rule will automatically decline transactions.
* Note that only this field or `allowed_countries` can be used for a given Auth Rule.
*/
@JsonProperty("blocked_countries") fun blockedCountries(): List? = blockedCountries
/**
* Array of merchant category codes for which the Auth Rule will automatically decline
* transactions. Note that only this field or `allowed_mcc` can be used for a given Auth
* Rule.
*/
@JsonProperty("blocked_mcc") fun blockedMcc(): List? = blockedMcc
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var allowedCountries: List? = null
private var allowedMcc: List? = null
private var blockedCountries: List? = null
private var blockedMcc: List? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(authRuleUpdateBody: AuthRuleUpdateBody) = apply {
this.allowedCountries = authRuleUpdateBody.allowedCountries
this.allowedMcc = authRuleUpdateBody.allowedMcc
this.blockedCountries = authRuleUpdateBody.blockedCountries
this.blockedMcc = authRuleUpdateBody.blockedMcc
additionalProperties(authRuleUpdateBody.additionalProperties)
}
/**
* Array of country codes for which the Auth Rule will permit transactions. Note that
* only this field or `blocked_countries` can be used for a given Auth Rule.
*/
@JsonProperty("allowed_countries")
fun allowedCountries(allowedCountries: List) = apply {
this.allowedCountries = allowedCountries
}
/**
* Array of merchant category codes for which the Auth Rule will permit transactions.
* Note that only this field or `blocked_mcc` can be used for a given Auth Rule.
*/
@JsonProperty("allowed_mcc")
fun allowedMcc(allowedMcc: List) = apply { this.allowedMcc = allowedMcc }
/**
* Array of country codes for which the Auth Rule will automatically decline
* transactions. Note that only this field or `allowed_countries` can be used for a
* given Auth Rule.
*/
@JsonProperty("blocked_countries")
fun blockedCountries(blockedCountries: List) = apply {
this.blockedCountries = blockedCountries
}
/**
* Array of merchant category codes for which the Auth Rule will automatically decline
* transactions. Note that only this field or `allowed_mcc` can be used for a given Auth
* Rule.
*/
@JsonProperty("blocked_mcc")
fun blockedMcc(blockedMcc: List) = apply { this.blockedMcc = blockedMcc }
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(): AuthRuleUpdateBody =
AuthRuleUpdateBody(
allowedCountries?.toUnmodifiable(),
allowedMcc?.toUnmodifiable(),
blockedCountries?.toUnmodifiable(),
blockedMcc?.toUnmodifiable(),
additionalProperties.toUnmodifiable(),
)
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return /* spotless:off */ other is AuthRuleUpdateBody && this.allowedCountries == other.allowedCountries && this.allowedMcc == other.allowedMcc && this.blockedCountries == other.blockedCountries && this.blockedMcc == other.blockedMcc && this.additionalProperties == other.additionalProperties /* spotless:on */
}
private var hashCode: Int = 0
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(allowedCountries, allowedMcc, blockedCountries, blockedMcc, additionalProperties) /* spotless:on */
}
return hashCode
}
override fun toString() =
"AuthRuleUpdateBody{allowedCountries=$allowedCountries, allowedMcc=$allowedMcc, blockedCountries=$blockedCountries, blockedMcc=$blockedMcc, additionalProperties=$additionalProperties}"
}
fun _additionalQueryParams(): Map> = additionalQueryParams
fun _additionalHeaders(): Map> = additionalHeaders
fun _additionalBodyProperties(): Map = additionalBodyProperties
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return /* spotless:off */ other is AuthRuleUpdateParams && this.authRuleToken == other.authRuleToken && this.allowedCountries == other.allowedCountries && this.allowedMcc == other.allowedMcc && this.blockedCountries == other.blockedCountries && this.blockedMcc == other.blockedMcc && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */
}
override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(authRuleToken, allowedCountries, allowedMcc, blockedCountries, blockedMcc, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */
}
override fun toString() =
"AuthRuleUpdateParams{authRuleToken=$authRuleToken, allowedCountries=$allowedCountries, allowedMcc=$allowedMcc, blockedCountries=$blockedCountries, blockedMcc=$blockedMcc, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
fun toBuilder() = Builder().from(this)
companion object {
@JvmStatic fun builder() = Builder()
}
@NoAutoDetect
class Builder {
private var authRuleToken: String? = null
private var allowedCountries: MutableList = mutableListOf()
private var allowedMcc: MutableList = mutableListOf()
private var blockedCountries: MutableList = mutableListOf()
private var blockedMcc: MutableList = mutableListOf()
private var additionalQueryParams: MutableMap> = mutableMapOf()
private var additionalHeaders: MutableMap> = mutableMapOf()
private var additionalBodyProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(authRuleUpdateParams: AuthRuleUpdateParams) = apply {
this.authRuleToken = authRuleUpdateParams.authRuleToken
this.allowedCountries(authRuleUpdateParams.allowedCountries ?: listOf())
this.allowedMcc(authRuleUpdateParams.allowedMcc ?: listOf())
this.blockedCountries(authRuleUpdateParams.blockedCountries ?: listOf())
this.blockedMcc(authRuleUpdateParams.blockedMcc ?: listOf())
additionalQueryParams(authRuleUpdateParams.additionalQueryParams)
additionalHeaders(authRuleUpdateParams.additionalHeaders)
additionalBodyProperties(authRuleUpdateParams.additionalBodyProperties)
}
fun authRuleToken(authRuleToken: String) = apply { this.authRuleToken = authRuleToken }
/**
* Array of country codes for which the Auth Rule will permit transactions. Note that only
* this field or `blocked_countries` can be used for a given Auth Rule.
*/
fun allowedCountries(allowedCountries: List) = apply {
this.allowedCountries.clear()
this.allowedCountries.addAll(allowedCountries)
}
/**
* Array of country codes for which the Auth Rule will permit transactions. Note that only
* this field or `blocked_countries` can be used for a given Auth Rule.
*/
fun addAllowedCountry(allowedCountry: String) = apply {
this.allowedCountries.add(allowedCountry)
}
/**
* Array of merchant category codes for which the Auth Rule will permit transactions. Note
* that only this field or `blocked_mcc` can be used for a given Auth Rule.
*/
fun allowedMcc(allowedMcc: List) = apply {
this.allowedMcc.clear()
this.allowedMcc.addAll(allowedMcc)
}
/**
* Array of merchant category codes for which the Auth Rule will permit transactions. Note
* that only this field or `blocked_mcc` can be used for a given Auth Rule.
*/
fun addAllowedMcc(allowedMcc: String) = apply { this.allowedMcc.add(allowedMcc) }
/**
* Array of country codes for which the Auth Rule will automatically decline transactions.
* Note that only this field or `allowed_countries` can be used for a given Auth Rule.
*/
fun blockedCountries(blockedCountries: List) = apply {
this.blockedCountries.clear()
this.blockedCountries.addAll(blockedCountries)
}
/**
* Array of country codes for which the Auth Rule will automatically decline transactions.
* Note that only this field or `allowed_countries` can be used for a given Auth Rule.
*/
fun addBlockedCountry(blockedCountry: String) = apply {
this.blockedCountries.add(blockedCountry)
}
/**
* Array of merchant category codes for which the Auth Rule will automatically decline
* transactions. Note that only this field or `allowed_mcc` can be used for a given Auth
* Rule.
*/
fun blockedMcc(blockedMcc: List) = apply {
this.blockedMcc.clear()
this.blockedMcc.addAll(blockedMcc)
}
/**
* Array of merchant category codes for which the Auth Rule will automatically decline
* transactions. Note that only this field or `allowed_mcc` can be used for a given Auth
* Rule.
*/
fun addBlockedMcc(blockedMcc: String) = apply { this.blockedMcc.add(blockedMcc) }
fun additionalQueryParams(additionalQueryParams: Map>) = apply {
this.additionalQueryParams.clear()
putAllQueryParams(additionalQueryParams)
}
fun putQueryParam(name: String, value: String) = apply {
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value)
}
fun putQueryParams(name: String, values: Iterable) = apply {
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values)
}
fun putAllQueryParams(additionalQueryParams: Map>) = apply {
additionalQueryParams.forEach(this::putQueryParams)
}
fun removeQueryParam(name: String) = apply {
this.additionalQueryParams.put(name, mutableListOf())
}
fun additionalHeaders(additionalHeaders: Map>) = apply {
this.additionalHeaders.clear()
putAllHeaders(additionalHeaders)
}
fun putHeader(name: String, value: String) = apply {
this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value)
}
fun putHeaders(name: String, values: Iterable) = apply {
this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values)
}
fun putAllHeaders(additionalHeaders: Map>) = apply {
additionalHeaders.forEach(this::putHeaders)
}
fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
this.additionalBodyProperties.clear()
this.additionalBodyProperties.putAll(additionalBodyProperties)
}
fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
this.additionalBodyProperties.put(key, value)
}
fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
apply {
this.additionalBodyProperties.putAll(additionalBodyProperties)
}
fun build(): AuthRuleUpdateParams =
AuthRuleUpdateParams(
checkNotNull(authRuleToken) { "`authRuleToken` is required but was not set" },
if (allowedCountries.size == 0) null else allowedCountries.toUnmodifiable(),
if (allowedMcc.size == 0) null else allowedMcc.toUnmodifiable(),
if (blockedCountries.size == 0) null else blockedCountries.toUnmodifiable(),
if (blockedMcc.size == 0) null else blockedMcc.toUnmodifiable(),
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy