From ffef46fdc01c36d476c0144ab5a92aded046f9f7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 17:34:07 +0000 Subject: [PATCH] feat(api)!: removes AuthRules V1 (#367) AuthRulesV2 has now replaced AuthRulesV1. See https://docs.lithic.com/docs/authorization-rules-v2 for more details # Migration To migrate, please replace all calls to AuthRulesV1 with their corresponding AuthRulesV2 methods. --- .stats.yml | 2 +- .../lithic/api/models/AuthRuleApplyParams.kt | 360 ------------- .../lithic/api/models/AuthRuleCreateParams.kt | 479 ------------------ .../com/lithic/api/models/AuthRuleListPage.kt | 184 ------- .../api/models/AuthRuleListPageAsync.kt | 190 ------- .../lithic/api/models/AuthRuleListParams.kt | 185 ------- .../api/models/AuthRuleMigrateV1ToV2Params.kt | 185 ------- .../lithic/api/models/AuthRuleRemoveParams.kt | 345 ------------- .../api/models/AuthRuleRemoveResponse.kt | 139 ----- .../api/models/AuthRuleRetrieveParams.kt | 160 ------ .../api/models/AuthRuleRetrieveResponse.kt | 105 ---- .../lithic/api/models/AuthRuleUpdateParams.kt | 428 ---------------- .../services/async/AuthRuleServiceAsync.kt | 71 --- .../async/AuthRuleServiceAsyncImpl.kt | 243 --------- .../async/FinancialAccountServiceAsyncImpl.kt | 2 +- .../api/services/blocking/AuthRuleService.kt | 71 --- .../services/blocking/AuthRuleServiceImpl.kt | 234 --------- .../blocking/FinancialAccountServiceImpl.kt | 2 +- .../api/models/AuthRuleApplyParamsTest.kt | 59 --- .../api/models/AuthRuleCreateParamsTest.kt | 53 -- .../api/models/AuthRuleListParamsTest.kt | 41 -- .../models/AuthRuleMigrateV1ToV2ParamsTest.kt | 30 -- .../api/models/AuthRuleRemoveParamsTest.kt | 41 -- .../api/models/AuthRuleRemoveResponseTest.kt | 23 - .../api/models/AuthRuleRetrieveParamsTest.kt | 30 -- .../models/AuthRuleRetrieveResponseTest.kt | 46 -- .../api/models/AuthRuleUpdateParamsTest.kt | 62 --- .../services/blocking/AuthRuleServiceTest.kt | 152 ------ 28 files changed, 3 insertions(+), 3919 deletions(-) delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleApplyParams.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleCreateParams.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPage.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPageAsync.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListParams.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2Params.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveParams.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveResponse.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveParams.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveResponse.kt delete mode 100644 lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleUpdateParams.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleApplyParamsTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleCreateParamsTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleListParamsTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2ParamsTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveParamsTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveResponseTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveParamsTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveResponseTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleUpdateParamsTest.kt delete mode 100644 lithic-kotlin-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 5a026d5a..9f97df3f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 156 +configured_endpoints: 149 diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleApplyParams.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleApplyParams.kt deleted file mode 100644 index 9650f34f..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleApplyParams.kt +++ /dev/null @@ -1,360 +0,0 @@ -// 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.google.common.collect.ArrayListMultimap -import com.google.common.collect.ListMultimap -import com.lithic.api.core.ExcludeMissing -import com.lithic.api.core.JsonValue -import com.lithic.api.core.NoAutoDetect -import com.lithic.api.core.toImmutable -import com.lithic.api.models.* -import java.util.Objects - -class AuthRuleApplyParams -constructor( - private val authRuleToken: String, - private val accountTokens: List?, - private val cardTokens: List?, - private val programLevel: Boolean?, - private val additionalHeaders: Map>, - private val additionalQueryParams: Map>, - private val additionalBodyProperties: Map, -) { - - fun authRuleToken(): String = authRuleToken - - fun accountTokens(): List? = accountTokens - - fun cardTokens(): List? = cardTokens - - fun programLevel(): Boolean? = programLevel - - internal fun getBody(): AuthRuleApplyBody { - return AuthRuleApplyBody( - accountTokens, - cardTokens, - programLevel, - additionalBodyProperties, - ) - } - - internal fun getHeaders(): Map> = additionalHeaders - - internal fun getQueryParams(): Map> = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> authRuleToken - else -> "" - } - } - - @JsonDeserialize(builder = AuthRuleApplyBody.Builder::class) - @NoAutoDetect - class AuthRuleApplyBody - internal constructor( - private val accountTokens: List?, - private val cardTokens: List?, - private val programLevel: Boolean?, - private val additionalProperties: Map, - ) { - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("account_tokens") fun accountTokens(): List? = accountTokens - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("card_tokens") fun cardTokens(): List? = cardTokens - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - @JsonProperty("program_level") fun programLevel(): Boolean? = programLevel - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - class Builder { - - private var accountTokens: List? = null - private var cardTokens: List? = null - private var programLevel: Boolean? = null - private var additionalProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleApplyBody: AuthRuleApplyBody) = apply { - this.accountTokens = authRuleApplyBody.accountTokens - this.cardTokens = authRuleApplyBody.cardTokens - this.programLevel = authRuleApplyBody.programLevel - additionalProperties(authRuleApplyBody.additionalProperties) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. - * Note that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("account_tokens") - fun accountTokens(accountTokens: List) = apply { - this.accountTokens = accountTokens - } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("card_tokens") - fun cardTokens(cardTokens: List) = apply { this.cardTokens = cardTokens } - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - @JsonProperty("program_level") - fun programLevel(programLevel: Boolean) = apply { this.programLevel = programLevel } - - 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(): AuthRuleApplyBody = - AuthRuleApplyBody( - accountTokens?.toImmutable(), - cardTokens?.toImmutable(), - programLevel, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleApplyBody && this.accountTokens == other.accountTokens && this.cardTokens == other.cardTokens && this.programLevel == other.programLevel && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(accountTokens, cardTokens, programLevel, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "AuthRuleApplyBody{accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}" - } - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleApplyParams && this.authRuleToken == other.authRuleToken && this.accountTokens == other.accountTokens && this.cardTokens == other.cardTokens && this.programLevel == other.programLevel && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(authRuleToken, accountTokens, cardTokens, programLevel, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ - } - - override fun toString() = - "AuthRuleApplyParams{authRuleToken=$authRuleToken, accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var authRuleToken: String? = null - private var accountTokens: MutableList = mutableListOf() - private var cardTokens: MutableList = mutableListOf() - private var programLevel: Boolean? = null - private var additionalHeaders: ListMultimap = ArrayListMultimap.create() - private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleApplyParams: AuthRuleApplyParams) = apply { - this.authRuleToken = authRuleApplyParams.authRuleToken - this.accountTokens(authRuleApplyParams.accountTokens ?: listOf()) - this.cardTokens(authRuleApplyParams.cardTokens ?: listOf()) - this.programLevel = authRuleApplyParams.programLevel - additionalHeaders(authRuleApplyParams.additionalHeaders) - additionalQueryParams(authRuleApplyParams.additionalQueryParams) - additionalBodyProperties(authRuleApplyParams.additionalBodyProperties) - } - - fun authRuleToken(authRuleToken: String) = apply { this.authRuleToken = authRuleToken } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - fun accountTokens(accountTokens: List) = apply { - this.accountTokens.clear() - this.accountTokens.addAll(accountTokens) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - fun addAccountToken(accountToken: String) = apply { this.accountTokens.add(accountToken) } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - fun cardTokens(cardTokens: List) = apply { - this.cardTokens.clear() - this.cardTokens.addAll(cardTokens) - } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - fun addCardToken(cardToken: String) = apply { this.cardTokens.add(cardToken) } - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - fun programLevel(programLevel: Boolean) = apply { this.programLevel = programLevel } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.putAll(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::putAdditionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replaceValues(name, listOf(value)) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replaceValues(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::replaceAdditionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - names.forEach(::removeAdditionalHeaders) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.putAll(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::putAdditionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replaceValues(key, listOf(value)) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replaceValues(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::replaceAdditionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { - additionalQueryParams.removeAll(key) - } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - keys.forEach(::removeAdditionalQueryParams) - } - - 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(): AuthRuleApplyParams = - AuthRuleApplyParams( - checkNotNull(authRuleToken) { "`authRuleToken` is required but was not set" }, - if (accountTokens.size == 0) null else accountTokens.toImmutable(), - if (cardTokens.size == 0) null else cardTokens.toImmutable(), - programLevel, - additionalHeaders - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalQueryParams - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalBodyProperties.toImmutable(), - ) - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleCreateParams.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleCreateParams.kt deleted file mode 100644 index 7d17c41f..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleCreateParams.kt +++ /dev/null @@ -1,479 +0,0 @@ -// 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.google.common.collect.ArrayListMultimap -import com.google.common.collect.ListMultimap -import com.lithic.api.core.ExcludeMissing -import com.lithic.api.core.JsonValue -import com.lithic.api.core.NoAutoDetect -import com.lithic.api.core.toImmutable -import com.lithic.api.models.* -import java.util.Objects - -class AuthRuleCreateParams -constructor( - private val accountTokens: List?, - private val allowedCountries: List?, - private val allowedMcc: List?, - private val blockedCountries: List?, - private val blockedMcc: List?, - private val cardTokens: List?, - private val programLevel: Boolean?, - private val additionalHeaders: Map>, - private val additionalQueryParams: Map>, - private val additionalBodyProperties: Map, -) { - - fun accountTokens(): List? = accountTokens - - fun allowedCountries(): List? = allowedCountries - - fun allowedMcc(): List? = allowedMcc - - fun blockedCountries(): List? = blockedCountries - - fun blockedMcc(): List? = blockedMcc - - fun cardTokens(): List? = cardTokens - - fun programLevel(): Boolean? = programLevel - - internal fun getBody(): AuthRuleCreateBody { - return AuthRuleCreateBody( - accountTokens, - allowedCountries, - allowedMcc, - blockedCountries, - blockedMcc, - cardTokens, - programLevel, - additionalBodyProperties, - ) - } - - internal fun getHeaders(): Map> = additionalHeaders - - internal fun getQueryParams(): Map> = additionalQueryParams - - @JsonDeserialize(builder = AuthRuleCreateBody.Builder::class) - @NoAutoDetect - class AuthRuleCreateBody - internal constructor( - private val accountTokens: List?, - private val allowedCountries: List?, - private val allowedMcc: List?, - private val blockedCountries: List?, - private val blockedMcc: List?, - private val cardTokens: List?, - private val programLevel: Boolean?, - private val additionalProperties: Map, - ) { - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("account_tokens") fun accountTokens(): List? = accountTokens - - /** - * Countries in which the Auth Rule permits transactions. Note that Lithic maintains a list - * of countries in which all transactions are blocked; "allowing" those countries in an Auth - * Rule does not override the Lithic-wide restrictions. - */ - @JsonProperty("allowed_countries") fun allowedCountries(): List? = allowedCountries - - /** Merchant category codes for which the Auth Rule permits transactions. */ - @JsonProperty("allowed_mcc") fun allowedMcc(): List? = allowedMcc - - /** Countries in which the Auth Rule automatically declines transactions. */ - @JsonProperty("blocked_countries") fun blockedCountries(): List? = blockedCountries - - /** Merchant category codes for which the Auth Rule automatically declines transactions. */ - @JsonProperty("blocked_mcc") fun blockedMcc(): List? = blockedMcc - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("card_tokens") fun cardTokens(): List? = cardTokens - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - @JsonProperty("program_level") fun programLevel(): Boolean? = programLevel - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - class Builder { - - private var accountTokens: List? = null - private var allowedCountries: List? = null - private var allowedMcc: List? = null - private var blockedCountries: List? = null - private var blockedMcc: List? = null - private var cardTokens: List? = null - private var programLevel: Boolean? = null - private var additionalProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleCreateBody: AuthRuleCreateBody) = apply { - this.accountTokens = authRuleCreateBody.accountTokens - this.allowedCountries = authRuleCreateBody.allowedCountries - this.allowedMcc = authRuleCreateBody.allowedMcc - this.blockedCountries = authRuleCreateBody.blockedCountries - this.blockedMcc = authRuleCreateBody.blockedMcc - this.cardTokens = authRuleCreateBody.cardTokens - this.programLevel = authRuleCreateBody.programLevel - additionalProperties(authRuleCreateBody.additionalProperties) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. - * Note that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("account_tokens") - fun accountTokens(accountTokens: List) = apply { - this.accountTokens = accountTokens - } - - /** - * Countries in which the Auth Rule permits transactions. Note that Lithic maintains a - * list of countries in which all transactions are blocked; "allowing" those countries - * in an Auth Rule does not override the Lithic-wide restrictions. - */ - @JsonProperty("allowed_countries") - fun allowedCountries(allowedCountries: List) = apply { - this.allowedCountries = allowedCountries - } - - /** Merchant category codes for which the Auth Rule permits transactions. */ - @JsonProperty("allowed_mcc") - fun allowedMcc(allowedMcc: List) = apply { this.allowedMcc = allowedMcc } - - /** Countries in which the Auth Rule automatically declines transactions. */ - @JsonProperty("blocked_countries") - fun blockedCountries(blockedCountries: List) = apply { - this.blockedCountries = blockedCountries - } - - /** - * Merchant category codes for which the Auth Rule automatically declines transactions. - */ - @JsonProperty("blocked_mcc") - fun blockedMcc(blockedMcc: List) = apply { this.blockedMcc = blockedMcc } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("card_tokens") - fun cardTokens(cardTokens: List) = apply { this.cardTokens = cardTokens } - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - @JsonProperty("program_level") - fun programLevel(programLevel: Boolean) = apply { this.programLevel = programLevel } - - 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(): AuthRuleCreateBody = - AuthRuleCreateBody( - accountTokens?.toImmutable(), - allowedCountries?.toImmutable(), - allowedMcc?.toImmutable(), - blockedCountries?.toImmutable(), - blockedMcc?.toImmutable(), - cardTokens?.toImmutable(), - programLevel, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleCreateBody && this.accountTokens == other.accountTokens && this.allowedCountries == other.allowedCountries && this.allowedMcc == other.allowedMcc && this.blockedCountries == other.blockedCountries && this.blockedMcc == other.blockedMcc && this.cardTokens == other.cardTokens && this.programLevel == other.programLevel && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(accountTokens, allowedCountries, allowedMcc, blockedCountries, blockedMcc, cardTokens, programLevel, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "AuthRuleCreateBody{accountTokens=$accountTokens, allowedCountries=$allowedCountries, allowedMcc=$allowedMcc, blockedCountries=$blockedCountries, blockedMcc=$blockedMcc, cardTokens=$cardTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}" - } - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleCreateParams && this.accountTokens == other.accountTokens && this.allowedCountries == other.allowedCountries && this.allowedMcc == other.allowedMcc && this.blockedCountries == other.blockedCountries && this.blockedMcc == other.blockedMcc && this.cardTokens == other.cardTokens && this.programLevel == other.programLevel && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(accountTokens, allowedCountries, allowedMcc, blockedCountries, blockedMcc, cardTokens, programLevel, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ - } - - override fun toString() = - "AuthRuleCreateParams{accountTokens=$accountTokens, allowedCountries=$allowedCountries, allowedMcc=$allowedMcc, blockedCountries=$blockedCountries, blockedMcc=$blockedMcc, cardTokens=$cardTokens, programLevel=$programLevel, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var accountTokens: MutableList = mutableListOf() - private var allowedCountries: MutableList = mutableListOf() - private var allowedMcc: MutableList = mutableListOf() - private var blockedCountries: MutableList = mutableListOf() - private var blockedMcc: MutableList = mutableListOf() - private var cardTokens: MutableList = mutableListOf() - private var programLevel: Boolean? = null - private var additionalHeaders: ListMultimap = ArrayListMultimap.create() - private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleCreateParams: AuthRuleCreateParams) = apply { - this.accountTokens(authRuleCreateParams.accountTokens ?: listOf()) - this.allowedCountries(authRuleCreateParams.allowedCountries ?: listOf()) - this.allowedMcc(authRuleCreateParams.allowedMcc ?: listOf()) - this.blockedCountries(authRuleCreateParams.blockedCountries ?: listOf()) - this.blockedMcc(authRuleCreateParams.blockedMcc ?: listOf()) - this.cardTokens(authRuleCreateParams.cardTokens ?: listOf()) - this.programLevel = authRuleCreateParams.programLevel - additionalHeaders(authRuleCreateParams.additionalHeaders) - additionalQueryParams(authRuleCreateParams.additionalQueryParams) - additionalBodyProperties(authRuleCreateParams.additionalBodyProperties) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - fun accountTokens(accountTokens: List) = apply { - this.accountTokens.clear() - this.accountTokens.addAll(accountTokens) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - fun addAccountToken(accountToken: String) = apply { this.accountTokens.add(accountToken) } - - /** - * Countries in which the Auth Rule permits transactions. Note that Lithic maintains a list - * of countries in which all transactions are blocked; "allowing" those countries in an Auth - * Rule does not override the Lithic-wide restrictions. - */ - fun allowedCountries(allowedCountries: List) = apply { - this.allowedCountries.clear() - this.allowedCountries.addAll(allowedCountries) - } - - /** - * Countries in which the Auth Rule permits transactions. Note that Lithic maintains a list - * of countries in which all transactions are blocked; "allowing" those countries in an Auth - * Rule does not override the Lithic-wide restrictions. - */ - fun addAllowedCountry(allowedCountry: String) = apply { - this.allowedCountries.add(allowedCountry) - } - - /** Merchant category codes for which the Auth Rule permits transactions. */ - fun allowedMcc(allowedMcc: List) = apply { - this.allowedMcc.clear() - this.allowedMcc.addAll(allowedMcc) - } - - /** Merchant category codes for which the Auth Rule permits transactions. */ - fun addAllowedMcc(allowedMcc: String) = apply { this.allowedMcc.add(allowedMcc) } - - /** Countries in which the Auth Rule automatically declines transactions. */ - fun blockedCountries(blockedCountries: List) = apply { - this.blockedCountries.clear() - this.blockedCountries.addAll(blockedCountries) - } - - /** Countries in which the Auth Rule automatically declines transactions. */ - fun addBlockedCountry(blockedCountry: String) = apply { - this.blockedCountries.add(blockedCountry) - } - - /** Merchant category codes for which the Auth Rule automatically declines transactions. */ - fun blockedMcc(blockedMcc: List) = apply { - this.blockedMcc.clear() - this.blockedMcc.addAll(blockedMcc) - } - - /** Merchant category codes for which the Auth Rule automatically declines transactions. */ - fun addBlockedMcc(blockedMcc: String) = apply { this.blockedMcc.add(blockedMcc) } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - fun cardTokens(cardTokens: List) = apply { - this.cardTokens.clear() - this.cardTokens.addAll(cardTokens) - } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - fun addCardToken(cardToken: String) = apply { this.cardTokens.add(cardToken) } - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - fun programLevel(programLevel: Boolean) = apply { this.programLevel = programLevel } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.putAll(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::putAdditionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replaceValues(name, listOf(value)) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replaceValues(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::replaceAdditionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - names.forEach(::removeAdditionalHeaders) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.putAll(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::putAdditionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replaceValues(key, listOf(value)) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replaceValues(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::replaceAdditionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { - additionalQueryParams.removeAll(key) - } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - keys.forEach(::removeAdditionalQueryParams) - } - - 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(): AuthRuleCreateParams = - AuthRuleCreateParams( - if (accountTokens.size == 0) null else accountTokens.toImmutable(), - if (allowedCountries.size == 0) null else allowedCountries.toImmutable(), - if (allowedMcc.size == 0) null else allowedMcc.toImmutable(), - if (blockedCountries.size == 0) null else blockedCountries.toImmutable(), - if (blockedMcc.size == 0) null else blockedMcc.toImmutable(), - if (cardTokens.size == 0) null else cardTokens.toImmutable(), - programLevel, - additionalHeaders - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalQueryParams - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalBodyProperties.toImmutable(), - ) - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPage.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPage.kt deleted file mode 100644 index 4dfeb40f..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPage.kt +++ /dev/null @@ -1,184 +0,0 @@ -// 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.toImmutable -import com.lithic.api.services.blocking.AuthRuleService -import java.util.Objects - -class AuthRuleListPage -private constructor( - private val authRulesService: AuthRuleService, - private val params: AuthRuleListParams, - private val response: Response, -) { - - fun response(): Response = response - - fun data(): List = response().data() - - fun hasMore(): Boolean = response().hasMore() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleListPage && this.authRulesService == other.authRulesService && this.params == other.params && this.response == other.response /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(authRulesService, params, response) /* spotless:on */ - } - - override fun toString() = - "AuthRuleListPage{authRulesService=$authRulesService, params=$params, response=$response}" - - fun hasNextPage(): Boolean { - return !data().isEmpty() - } - - fun getNextPageParams(): AuthRuleListParams? { - if (!hasNextPage()) { - return null - } - - return if (params.endingBefore() != null) { - AuthRuleListParams.builder().from(params).endingBefore(data().first().token()).build() - } else { - AuthRuleListParams.builder().from(params).startingAfter(data().last().token()).build() - } - } - - fun getNextPage(): AuthRuleListPage? { - return getNextPageParams()?.let { authRulesService.list(it) } - } - - fun autoPager(): AutoPager = AutoPager(this) - - companion object { - - fun of(authRulesService: AuthRuleService, params: AuthRuleListParams, response: Response) = - AuthRuleListPage( - authRulesService, - params, - response, - ) - } - - @JsonDeserialize(builder = Response.Builder::class) - @NoAutoDetect - class Response - constructor( - private val data: JsonField>, - private val hasMore: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - fun data(): List = data.getNullable("data") ?: listOf() - - fun hasMore(): Boolean = hasMore.getRequired("has_more") - - @JsonProperty("data") fun _data(): JsonField>? = data - - @JsonProperty("has_more") fun _hasMore(): JsonField? = hasMore - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Response = apply { - if (!validated) { - data().map { it.validate() } - hasMore() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Response && this.data == other.data && this.hasMore == other.hasMore && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(data, hasMore, additionalProperties) /* spotless:on */ - } - - override fun toString() = - "AuthRuleListPage.Response{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}" - - companion object { - - fun builder() = Builder() - } - - class Builder { - - private var data: JsonField> = JsonMissing.of() - private var hasMore: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - internal fun from(page: Response) = apply { - this.data = page.data - this.hasMore = page.hasMore - this.additionalProperties.putAll(page.additionalProperties) - } - - fun data(data: List) = data(JsonField.of(data)) - - @JsonProperty("data") - fun data(data: JsonField>) = apply { this.data = data } - - fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) - - @JsonProperty("has_more") - fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun build() = - Response( - data, - hasMore, - additionalProperties.toImmutable(), - ) - } - } - - class AutoPager - constructor( - private val firstPage: AuthRuleListPage, - ) : Sequence { - - override fun iterator(): Iterator = iterator { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - yield(page.data()[index++]) - } - page = page.getNextPage() ?: break - index = 0 - } - } - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPageAsync.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPageAsync.kt deleted file mode 100644 index 2888216b..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListPageAsync.kt +++ /dev/null @@ -1,190 +0,0 @@ -// 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.toImmutable -import com.lithic.api.services.async.AuthRuleServiceAsync -import java.util.Objects -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.FlowCollector - -class AuthRuleListPageAsync -private constructor( - private val authRulesService: AuthRuleServiceAsync, - private val params: AuthRuleListParams, - private val response: Response, -) { - - fun response(): Response = response - - fun data(): List = response().data() - - fun hasMore(): Boolean = response().hasMore() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleListPageAsync && this.authRulesService == other.authRulesService && this.params == other.params && this.response == other.response /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(authRulesService, params, response) /* spotless:on */ - } - - override fun toString() = - "AuthRuleListPageAsync{authRulesService=$authRulesService, params=$params, response=$response}" - - fun hasNextPage(): Boolean { - return !data().isEmpty() - } - - fun getNextPageParams(): AuthRuleListParams? { - if (!hasNextPage()) { - return null - } - - return if (params.endingBefore() != null) { - AuthRuleListParams.builder().from(params).endingBefore(data().first().token()).build() - } else { - AuthRuleListParams.builder().from(params).startingAfter(data().last().token()).build() - } - } - - suspend fun getNextPage(): AuthRuleListPageAsync? { - return getNextPageParams()?.let { authRulesService.list(it) } - } - - fun autoPager(): AutoPager = AutoPager(this) - - companion object { - - fun of( - authRulesService: AuthRuleServiceAsync, - params: AuthRuleListParams, - response: Response - ) = - AuthRuleListPageAsync( - authRulesService, - params, - response, - ) - } - - @JsonDeserialize(builder = Response.Builder::class) - @NoAutoDetect - class Response - constructor( - private val data: JsonField>, - private val hasMore: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - fun data(): List = data.getNullable("data") ?: listOf() - - fun hasMore(): Boolean = hasMore.getRequired("has_more") - - @JsonProperty("data") fun _data(): JsonField>? = data - - @JsonProperty("has_more") fun _hasMore(): JsonField? = hasMore - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Response = apply { - if (!validated) { - data().map { it.validate() } - hasMore() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Response && this.data == other.data && this.hasMore == other.hasMore && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(data, hasMore, additionalProperties) /* spotless:on */ - } - - override fun toString() = - "AuthRuleListPageAsync.Response{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}" - - companion object { - - fun builder() = Builder() - } - - class Builder { - - private var data: JsonField> = JsonMissing.of() - private var hasMore: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - internal fun from(page: Response) = apply { - this.data = page.data - this.hasMore = page.hasMore - this.additionalProperties.putAll(page.additionalProperties) - } - - fun data(data: List) = data(JsonField.of(data)) - - @JsonProperty("data") - fun data(data: JsonField>) = apply { this.data = data } - - fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) - - @JsonProperty("has_more") - fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun build() = - Response( - data, - hasMore, - additionalProperties.toImmutable(), - ) - } - } - - class AutoPager - constructor( - private val firstPage: AuthRuleListPageAsync, - ) : Flow { - - override suspend fun collect(collector: FlowCollector) { - var page = firstPage - var index = 0 - while (true) { - while (index < page.data().size) { - collector.emit(page.data()[index++]) - } - page = page.getNextPage() ?: break - index = 0 - } - } - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListParams.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListParams.kt deleted file mode 100644 index 99eb94d0..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleListParams.kt +++ /dev/null @@ -1,185 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.google.common.collect.ArrayListMultimap -import com.google.common.collect.ListMultimap -import com.lithic.api.core.NoAutoDetect -import com.lithic.api.core.toImmutable -import com.lithic.api.models.* -import java.util.Objects - -class AuthRuleListParams -constructor( - private val endingBefore: String?, - private val pageSize: Long?, - private val startingAfter: String?, - private val additionalHeaders: Map>, - private val additionalQueryParams: Map>, -) { - - fun endingBefore(): String? = endingBefore - - fun pageSize(): Long? = pageSize - - fun startingAfter(): String? = startingAfter - - internal fun getHeaders(): Map> = additionalHeaders - - internal fun getQueryParams(): Map> { - val params = mutableMapOf>() - this.endingBefore?.let { params.put("ending_before", listOf(it.toString())) } - this.pageSize?.let { params.put("page_size", listOf(it.toString())) } - this.startingAfter?.let { params.put("starting_after", listOf(it.toString())) } - params.putAll(additionalQueryParams) - return params.toImmutable() - } - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalQueryParams(): Map> = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleListParams && this.endingBefore == other.endingBefore && this.pageSize == other.pageSize && this.startingAfter == other.startingAfter && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(endingBefore, pageSize, startingAfter, additionalHeaders, additionalQueryParams) /* spotless:on */ - } - - override fun toString() = - "AuthRuleListParams{endingBefore=$endingBefore, pageSize=$pageSize, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var endingBefore: String? = null - private var pageSize: Long? = null - private var startingAfter: String? = null - private var additionalHeaders: ListMultimap = ArrayListMultimap.create() - private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() - - internal fun from(authRuleListParams: AuthRuleListParams) = apply { - this.endingBefore = authRuleListParams.endingBefore - this.pageSize = authRuleListParams.pageSize - this.startingAfter = authRuleListParams.startingAfter - additionalHeaders(authRuleListParams.additionalHeaders) - additionalQueryParams(authRuleListParams.additionalQueryParams) - } - - /** - * A cursor representing an item's token before which a page of results should end. Used to - * retrieve the previous page of results before this item. - */ - fun endingBefore(endingBefore: String) = apply { this.endingBefore = endingBefore } - - /** Page size (for pagination). */ - fun pageSize(pageSize: Long) = apply { this.pageSize = pageSize } - - /** - * A cursor representing an item's token after which a page of results should begin. Used to - * retrieve the next page of results after this item. - */ - fun startingAfter(startingAfter: String) = apply { this.startingAfter = startingAfter } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.putAll(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::putAdditionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replaceValues(name, listOf(value)) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replaceValues(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::replaceAdditionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - names.forEach(::removeAdditionalHeaders) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.putAll(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::putAdditionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replaceValues(key, listOf(value)) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replaceValues(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::replaceAdditionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { - additionalQueryParams.removeAll(key) - } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - keys.forEach(::removeAdditionalQueryParams) - } - - fun build(): AuthRuleListParams = - AuthRuleListParams( - endingBefore, - pageSize, - startingAfter, - additionalHeaders - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalQueryParams - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - ) - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2Params.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2Params.kt deleted file mode 100644 index 96a75644..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2Params.kt +++ /dev/null @@ -1,185 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.google.common.collect.ArrayListMultimap -import com.google.common.collect.ListMultimap -import com.lithic.api.core.JsonValue -import com.lithic.api.core.NoAutoDetect -import com.lithic.api.core.toImmutable -import com.lithic.api.models.* -import java.util.Objects - -class AuthRuleMigrateV1ToV2Params -constructor( - private val authRuleToken: String, - private val additionalHeaders: Map>, - private val additionalQueryParams: Map>, - private val additionalBodyProperties: Map, -) { - - fun authRuleToken(): String = authRuleToken - - internal fun getBody(): Map? { - return additionalBodyProperties.ifEmpty { null } - } - - internal fun getHeaders(): Map> = additionalHeaders - - internal fun getQueryParams(): Map> = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> authRuleToken - else -> "" - } - } - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleMigrateV1ToV2Params && this.authRuleToken == other.authRuleToken && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(authRuleToken, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ - } - - override fun toString() = - "AuthRuleMigrateV1ToV2Params{authRuleToken=$authRuleToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var authRuleToken: String? = null - private var additionalHeaders: ListMultimap = ArrayListMultimap.create() - private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleMigrateV1ToV2Params: AuthRuleMigrateV1ToV2Params) = apply { - this.authRuleToken = authRuleMigrateV1ToV2Params.authRuleToken - additionalHeaders(authRuleMigrateV1ToV2Params.additionalHeaders) - additionalQueryParams(authRuleMigrateV1ToV2Params.additionalQueryParams) - additionalBodyProperties(authRuleMigrateV1ToV2Params.additionalBodyProperties) - } - - fun authRuleToken(authRuleToken: String) = apply { this.authRuleToken = authRuleToken } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.putAll(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::putAdditionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replaceValues(name, listOf(value)) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replaceValues(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::replaceAdditionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - names.forEach(::removeAdditionalHeaders) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.putAll(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::putAdditionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replaceValues(key, listOf(value)) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replaceValues(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::replaceAdditionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { - additionalQueryParams.removeAll(key) - } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - keys.forEach(::removeAdditionalQueryParams) - } - - 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(): AuthRuleMigrateV1ToV2Params = - AuthRuleMigrateV1ToV2Params( - checkNotNull(authRuleToken) { "`authRuleToken` is required but was not set" }, - additionalHeaders - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalQueryParams - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalBodyProperties.toImmutable(), - ) - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveParams.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveParams.kt deleted file mode 100644 index ff48e491..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveParams.kt +++ /dev/null @@ -1,345 +0,0 @@ -// 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.google.common.collect.ArrayListMultimap -import com.google.common.collect.ListMultimap -import com.lithic.api.core.ExcludeMissing -import com.lithic.api.core.JsonValue -import com.lithic.api.core.NoAutoDetect -import com.lithic.api.core.toImmutable -import com.lithic.api.models.* -import java.util.Objects - -class AuthRuleRemoveParams -constructor( - private val accountTokens: List?, - private val cardTokens: List?, - private val programLevel: Boolean?, - private val additionalHeaders: Map>, - private val additionalQueryParams: Map>, - private val additionalBodyProperties: Map, -) { - - fun accountTokens(): List? = accountTokens - - fun cardTokens(): List? = cardTokens - - fun programLevel(): Boolean? = programLevel - - internal fun getBody(): AuthRuleRemoveBody { - return AuthRuleRemoveBody( - accountTokens, - cardTokens, - programLevel, - additionalBodyProperties, - ) - } - - internal fun getHeaders(): Map> = additionalHeaders - - internal fun getQueryParams(): Map> = additionalQueryParams - - @JsonDeserialize(builder = AuthRuleRemoveBody.Builder::class) - @NoAutoDetect - class AuthRuleRemoveBody - internal constructor( - private val accountTokens: List?, - private val cardTokens: List?, - private val programLevel: Boolean?, - private val additionalProperties: Map, - ) { - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("account_tokens") fun accountTokens(): List? = accountTokens - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("card_tokens") fun cardTokens(): List? = cardTokens - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - @JsonProperty("program_level") fun programLevel(): Boolean? = programLevel - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - class Builder { - - private var accountTokens: List? = null - private var cardTokens: List? = null - private var programLevel: Boolean? = null - private var additionalProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleRemoveBody: AuthRuleRemoveBody) = apply { - this.accountTokens = authRuleRemoveBody.accountTokens - this.cardTokens = authRuleRemoveBody.cardTokens - this.programLevel = authRuleRemoveBody.programLevel - additionalProperties(authRuleRemoveBody.additionalProperties) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. - * Note that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("account_tokens") - fun accountTokens(accountTokens: List) = apply { - this.accountTokens = accountTokens - } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - @JsonProperty("card_tokens") - fun cardTokens(cardTokens: List) = apply { this.cardTokens = cardTokens } - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - @JsonProperty("program_level") - fun programLevel(programLevel: Boolean) = apply { this.programLevel = programLevel } - - 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(): AuthRuleRemoveBody = - AuthRuleRemoveBody( - accountTokens?.toImmutable(), - cardTokens?.toImmutable(), - programLevel, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleRemoveBody && this.accountTokens == other.accountTokens && this.cardTokens == other.cardTokens && this.programLevel == other.programLevel && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(accountTokens, cardTokens, programLevel, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "AuthRuleRemoveBody{accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}" - } - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalQueryParams(): Map> = additionalQueryParams - - fun _additionalBodyProperties(): Map = additionalBodyProperties - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleRemoveParams && this.accountTokens == other.accountTokens && this.cardTokens == other.cardTokens && this.programLevel == other.programLevel && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(accountTokens, cardTokens, programLevel, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ - } - - override fun toString() = - "AuthRuleRemoveParams{accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var accountTokens: MutableList = mutableListOf() - private var cardTokens: MutableList = mutableListOf() - private var programLevel: Boolean? = null - private var additionalHeaders: ListMultimap = ArrayListMultimap.create() - private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleRemoveParams: AuthRuleRemoveParams) = apply { - this.accountTokens(authRuleRemoveParams.accountTokens ?: listOf()) - this.cardTokens(authRuleRemoveParams.cardTokens ?: listOf()) - this.programLevel = authRuleRemoveParams.programLevel - additionalHeaders(authRuleRemoveParams.additionalHeaders) - additionalQueryParams(authRuleRemoveParams.additionalQueryParams) - additionalBodyProperties(authRuleRemoveParams.additionalBodyProperties) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - fun accountTokens(accountTokens: List) = apply { - this.accountTokens.clear() - this.accountTokens.addAll(accountTokens) - } - - /** - * Array of account_token(s) identifying the accounts that the Auth Rule applies to. Note - * that only this field or `card_tokens` can be provided for a given Auth Rule. - */ - fun addAccountToken(accountToken: String) = apply { this.accountTokens.add(accountToken) } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - fun cardTokens(cardTokens: List) = apply { - this.cardTokens.clear() - this.cardTokens.addAll(cardTokens) - } - - /** - * Array of card_token(s) identifying the cards that the Auth Rule applies to. Note that - * only this field or `account_tokens` can be provided for a given Auth Rule. - */ - fun addCardToken(cardToken: String) = apply { this.cardTokens.add(cardToken) } - - /** Boolean indicating whether the Auth Rule is applied at the program level. */ - fun programLevel(programLevel: Boolean) = apply { this.programLevel = programLevel } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.putAll(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::putAdditionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replaceValues(name, listOf(value)) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replaceValues(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::replaceAdditionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - names.forEach(::removeAdditionalHeaders) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.putAll(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::putAdditionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replaceValues(key, listOf(value)) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replaceValues(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::replaceAdditionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { - additionalQueryParams.removeAll(key) - } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - keys.forEach(::removeAdditionalQueryParams) - } - - 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(): AuthRuleRemoveParams = - AuthRuleRemoveParams( - if (accountTokens.size == 0) null else accountTokens.toImmutable(), - if (cardTokens.size == 0) null else cardTokens.toImmutable(), - programLevel, - additionalHeaders - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalQueryParams - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalBodyProperties.toImmutable(), - ) - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveResponse.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveResponse.kt deleted file mode 100644 index 6dd2250d..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRemoveResponse.kt +++ /dev/null @@ -1,139 +0,0 @@ -// 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.toImmutable -import java.util.Objects - -@JsonDeserialize(builder = AuthRuleRemoveResponse.Builder::class) -@NoAutoDetect -class AuthRuleRemoveResponse -private constructor( - private val accountTokens: JsonField>, - private val cardTokens: JsonField>, - private val programLevel: JsonField, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - fun accountTokens(): List? = accountTokens.getNullable("account_tokens") - - fun cardTokens(): List? = cardTokens.getNullable("card_tokens") - - fun programLevel(): Boolean? = programLevel.getNullable("program_level") - - @JsonProperty("account_tokens") @ExcludeMissing fun _accountTokens() = accountTokens - - @JsonProperty("card_tokens") @ExcludeMissing fun _cardTokens() = cardTokens - - @JsonProperty("program_level") @ExcludeMissing fun _programLevel() = programLevel - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): AuthRuleRemoveResponse = apply { - if (!validated) { - accountTokens() - cardTokens() - programLevel() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - class Builder { - - private var accountTokens: JsonField> = JsonMissing.of() - private var cardTokens: JsonField> = JsonMissing.of() - private var programLevel: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleRemoveResponse: AuthRuleRemoveResponse) = apply { - this.accountTokens = authRuleRemoveResponse.accountTokens - this.cardTokens = authRuleRemoveResponse.cardTokens - this.programLevel = authRuleRemoveResponse.programLevel - additionalProperties(authRuleRemoveResponse.additionalProperties) - } - - fun accountTokens(accountTokens: List) = accountTokens(JsonField.of(accountTokens)) - - @JsonProperty("account_tokens") - @ExcludeMissing - fun accountTokens(accountTokens: JsonField>) = apply { - this.accountTokens = accountTokens - } - - fun cardTokens(cardTokens: List) = cardTokens(JsonField.of(cardTokens)) - - @JsonProperty("card_tokens") - @ExcludeMissing - fun cardTokens(cardTokens: JsonField>) = apply { this.cardTokens = cardTokens } - - fun programLevel(programLevel: Boolean) = programLevel(JsonField.of(programLevel)) - - @JsonProperty("program_level") - @ExcludeMissing - fun programLevel(programLevel: JsonField) = apply { - this.programLevel = programLevel - } - - 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(): AuthRuleRemoveResponse = - AuthRuleRemoveResponse( - accountTokens.map { it.toImmutable() }, - cardTokens.map { it.toImmutable() }, - programLevel, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleRemoveResponse && this.accountTokens == other.accountTokens && this.cardTokens == other.cardTokens && this.programLevel == other.programLevel && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(accountTokens, cardTokens, programLevel, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "AuthRuleRemoveResponse{accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}" -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveParams.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveParams.kt deleted file mode 100644 index 0f9e11c8..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveParams.kt +++ /dev/null @@ -1,160 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.google.common.collect.ArrayListMultimap -import com.google.common.collect.ListMultimap -import com.lithic.api.core.NoAutoDetect -import com.lithic.api.core.toImmutable -import com.lithic.api.models.* -import java.util.Objects - -class AuthRuleRetrieveParams -constructor( - private val authRuleToken: String, - private val additionalHeaders: Map>, - private val additionalQueryParams: Map>, -) { - - fun authRuleToken(): String = authRuleToken - - internal fun getHeaders(): Map> = additionalHeaders - - internal fun getQueryParams(): Map> = additionalQueryParams - - fun getPathParam(index: Int): String { - return when (index) { - 0 -> authRuleToken - else -> "" - } - } - - fun _additionalHeaders(): Map> = additionalHeaders - - fun _additionalQueryParams(): Map> = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleRetrieveParams && this.authRuleToken == other.authRuleToken && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(authRuleToken, additionalHeaders, additionalQueryParams) /* spotless:on */ - } - - override fun toString() = - "AuthRuleRetrieveParams{authRuleToken=$authRuleToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - @NoAutoDetect - class Builder { - - private var authRuleToken: String? = null - private var additionalHeaders: ListMultimap = ArrayListMultimap.create() - private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() - - internal fun from(authRuleRetrieveParams: AuthRuleRetrieveParams) = apply { - this.authRuleToken = authRuleRetrieveParams.authRuleToken - additionalHeaders(authRuleRetrieveParams.additionalHeaders) - additionalQueryParams(authRuleRetrieveParams.additionalQueryParams) - } - - fun authRuleToken(authRuleToken: String) = apply { this.authRuleToken = authRuleToken } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.putAll(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::putAdditionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replaceValues(name, listOf(value)) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replaceValues(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::replaceAdditionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - names.forEach(::removeAdditionalHeaders) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.putAll(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::putAdditionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replaceValues(key, listOf(value)) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replaceValues(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::replaceAdditionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { - additionalQueryParams.removeAll(key) - } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - keys.forEach(::removeAdditionalQueryParams) - } - - fun build(): AuthRuleRetrieveParams = - AuthRuleRetrieveParams( - checkNotNull(authRuleToken) { "`authRuleToken` is required but was not set" }, - additionalHeaders - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalQueryParams - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - ) - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveResponse.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveResponse.kt deleted file mode 100644 index fb209214..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleRetrieveResponse.kt +++ /dev/null @@ -1,105 +0,0 @@ -// 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.toImmutable -import java.util.Objects - -@JsonDeserialize(builder = AuthRuleRetrieveResponse.Builder::class) -@NoAutoDetect -class AuthRuleRetrieveResponse -private constructor( - private val data: JsonField>, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - fun data(): List? = data.getNullable("data") - - @JsonProperty("data") @ExcludeMissing fun _data() = data - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): AuthRuleRetrieveResponse = apply { - if (!validated) { - data()?.forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - fun builder() = Builder() - } - - class Builder { - - private var data: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - internal fun from(authRuleRetrieveResponse: AuthRuleRetrieveResponse) = apply { - this.data = authRuleRetrieveResponse.data - additionalProperties(authRuleRetrieveResponse.additionalProperties) - } - - fun data(data: List) = data(JsonField.of(data)) - - @JsonProperty("data") - @ExcludeMissing - fun data(data: JsonField>) = apply { this.data = data } - - 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(): AuthRuleRetrieveResponse = - AuthRuleRetrieveResponse( - data.map { it.toImmutable() }, - additionalProperties.toImmutable() - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is AuthRuleRetrieveResponse && this.data == other.data && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(data, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "AuthRuleRetrieveResponse{data=$data, additionalProperties=$additionalProperties}" -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleUpdateParams.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleUpdateParams.kt deleted file mode 100644 index c4c6f4e7..00000000 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/AuthRuleUpdateParams.kt +++ /dev/null @@ -1,428 +0,0 @@ -// 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.google.common.collect.ArrayListMultimap -import com.google.common.collect.ListMultimap -import com.lithic.api.core.ExcludeMissing -import com.lithic.api.core.JsonValue -import com.lithic.api.core.NoAutoDetect -import com.lithic.api.core.toImmutable -import com.lithic.api.models.* -import java.util.Objects - -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 additionalHeaders: Map>, - private val additionalQueryParams: Map>, - private val additionalBodyProperties: Map, -) { - - fun authRuleToken(): String = authRuleToken - - fun allowedCountries(): List? = allowedCountries - - fun allowedMcc(): List? = allowedMcc - - fun blockedCountries(): List? = blockedCountries - - fun blockedMcc(): List? = blockedMcc - - internal fun getBody(): AuthRuleUpdateBody { - return AuthRuleUpdateBody( - allowedCountries, - allowedMcc, - blockedCountries, - blockedMcc, - additionalBodyProperties, - ) - } - - internal fun getHeaders(): Map> = additionalHeaders - - internal fun getQueryParams(): Map> = additionalQueryParams - - 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 { - - 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() - - 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?.toImmutable(), - allowedMcc?.toImmutable(), - blockedCountries?.toImmutable(), - blockedMcc?.toImmutable(), - additionalProperties.toImmutable(), - ) - } - - 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 _additionalHeaders(): Map> = additionalHeaders - - fun _additionalQueryParams(): Map> = additionalQueryParams - - 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.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ - } - - override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(authRuleToken, allowedCountries, allowedMcc, blockedCountries, blockedMcc, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ - } - - override fun toString() = - "AuthRuleUpdateParams{authRuleToken=$authRuleToken, allowedCountries=$allowedCountries, allowedMcc=$allowedMcc, blockedCountries=$blockedCountries, blockedMcc=$blockedMcc, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" - - fun toBuilder() = Builder().from(this) - - companion object { - - 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 additionalHeaders: ListMultimap = ArrayListMultimap.create() - private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - 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()) - additionalHeaders(authRuleUpdateParams.additionalHeaders) - additionalQueryParams(authRuleUpdateParams.additionalQueryParams) - 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 additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.putAll(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::putAdditionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replaceValues(name, listOf(value)) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replaceValues(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(::replaceAdditionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - names.forEach(::removeAdditionalHeaders) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.putAll(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::putAdditionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replaceValues(key, listOf(value)) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replaceValues(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - additionalQueryParams.forEach(::replaceAdditionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { - additionalQueryParams.removeAll(key) - } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - keys.forEach(::removeAdditionalQueryParams) - } - - 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.toImmutable(), - if (allowedMcc.size == 0) null else allowedMcc.toImmutable(), - if (blockedCountries.size == 0) null else blockedCountries.toImmutable(), - if (blockedMcc.size == 0) null else blockedMcc.toImmutable(), - additionalHeaders - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalQueryParams - .asMap() - .mapValues { it.value.toList().toImmutable() } - .toImmutable(), - additionalBodyProperties.toImmutable(), - ) - } -} diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt index 7937c905..4f375cd8 100644 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt +++ b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt @@ -2,80 +2,9 @@ package com.lithic.api.services.async -import com.lithic.api.core.RequestOptions -import com.lithic.api.models.AuthRule -import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleListPageAsync -import com.lithic.api.models.AuthRuleListParams -import com.lithic.api.models.AuthRuleMigrateV1ToV2Params -import com.lithic.api.models.AuthRuleRemoveParams -import com.lithic.api.models.AuthRuleRemoveResponse -import com.lithic.api.models.AuthRuleRetrieveParams -import com.lithic.api.models.AuthRuleRetrieveResponse -import com.lithic.api.models.AuthRuleUpdateParams import com.lithic.api.services.async.authRules.V2ServiceAsync interface AuthRuleServiceAsync { fun v2(): V2ServiceAsync - - /** - * Creates an authorization rule (Auth Rule) and applies it at the program, account, or card - * level. - */ - suspend fun create( - params: AuthRuleCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRule - - /** - * Detail the properties and entities (program, accounts, and cards) associated with an existing - * authorization rule (Auth Rule). - */ - suspend fun retrieve( - params: AuthRuleRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleRetrieveResponse - - /** Update the properties associated with an existing authorization rule (Auth Rule). */ - suspend fun update( - params: AuthRuleUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRule - - /** Return all of the Auth Rules under the program. */ - suspend fun list( - params: AuthRuleListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleListPageAsync - - /** Applies an existing authorization rule (Auth Rule) to an program, account, or card level. */ - suspend fun apply( - params: AuthRuleApplyParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRule - - /** - * Migrates an existing V1 authorization rule to a V2 authorization rule. Depending on the - * configuration of the V1 Auth Rule, this will yield one or two V2 authorization rules. This - * endpoint will alter the internal structure of the Auth Rule such that the resulting rules - * become a V2 Authorization Rule that can be operated on through the /v2/auth_rules endpoints. - * - * After a V1 Auth Rule has been migrated, it can no longer be operated on through the - * /v1/auth_rules/\* endpoints. Eventually, Lithic will deprecate the /v1/auth_rules endpoints - * and migrate all existing V1 Auth Rules to V2 Auth Rules. - */ - suspend fun migrateV1ToV2( - params: AuthRuleMigrateV1ToV2Params, - requestOptions: RequestOptions = RequestOptions.none() - ): List - - /** - * Remove an existing authorization rule (Auth Rule) from an program, account, or card-level. - */ - suspend fun remove( - params: AuthRuleRemoveParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleRemoveResponse } diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt index 6f62cb13..59b26de5 100644 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt +++ b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt @@ -3,26 +3,6 @@ package com.lithic.api.services.async import com.lithic.api.core.ClientOptions -import com.lithic.api.core.RequestOptions -import com.lithic.api.core.handlers.errorHandler -import com.lithic.api.core.handlers.jsonHandler -import com.lithic.api.core.handlers.withErrorHandler -import com.lithic.api.core.http.HttpMethod -import com.lithic.api.core.http.HttpRequest -import com.lithic.api.core.http.HttpResponse.Handler -import com.lithic.api.core.json -import com.lithic.api.errors.LithicError -import com.lithic.api.models.AuthRule -import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleListPageAsync -import com.lithic.api.models.AuthRuleListParams -import com.lithic.api.models.AuthRuleMigrateV1ToV2Params -import com.lithic.api.models.AuthRuleRemoveParams -import com.lithic.api.models.AuthRuleRemoveResponse -import com.lithic.api.models.AuthRuleRetrieveParams -import com.lithic.api.models.AuthRuleRetrieveResponse -import com.lithic.api.models.AuthRuleUpdateParams import com.lithic.api.services.async.authRules.V2ServiceAsync import com.lithic.api.services.async.authRules.V2ServiceAsyncImpl @@ -31,230 +11,7 @@ constructor( private val clientOptions: ClientOptions, ) : AuthRuleServiceAsync { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val v2: V2ServiceAsync by lazy { V2ServiceAsyncImpl(clientOptions) } override fun v2(): V2ServiceAsync = v2 - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Creates an authorization rule (Auth Rule) and applies it at the program, account, or card - * level. - */ - override suspend fun create( - params: AuthRuleCreateParams, - requestOptions: RequestOptions - ): AuthRule { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("v1", "auth_rules") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * Detail the properties and entities (program, accounts, and cards) associated with an existing - * authorization rule (Auth Rule). - */ - override suspend fun retrieve( - params: AuthRuleRetrieveParams, - requestOptions: RequestOptions - ): AuthRuleRetrieveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("v1", "auth_rules", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> - response - .use { retrieveHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Update the properties associated with an existing authorization rule (Auth Rule). */ - override suspend fun update( - params: AuthRuleUpdateParams, - requestOptions: RequestOptions - ): AuthRule { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("v1", "auth_rules", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Return all of the Auth Rules under the program. */ - override suspend fun list( - params: AuthRuleListParams, - requestOptions: RequestOptions - ): AuthRuleListPageAsync { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("v1", "auth_rules") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - .let { AuthRuleListPageAsync.of(this, params, it) } - } - } - - private val applyHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Applies an existing authorization rule (Auth Rule) to an program, account, or card level. */ - override suspend fun apply( - params: AuthRuleApplyParams, - requestOptions: RequestOptions - ): AuthRule { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("v1", "auth_rules", params.getPathParam(0), "apply") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> - response - .use { applyHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val migrateV1ToV2Handler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Migrates an existing V1 authorization rule to a V2 authorization rule. Depending on the - * configuration of the V1 Auth Rule, this will yield one or two V2 authorization rules. This - * endpoint will alter the internal structure of the Auth Rule such that the resulting rules - * become a V2 Authorization Rule that can be operated on through the /v2/auth_rules endpoints. - * - * After a V1 Auth Rule has been migrated, it can no longer be operated on through the - * /v1/auth_rules/\* endpoints. Eventually, Lithic will deprecate the /v1/auth_rules endpoints - * and migrate all existing V1 Auth Rules to V2 Auth Rules. - */ - override suspend fun migrateV1ToV2( - params: AuthRuleMigrateV1ToV2Params, - requestOptions: RequestOptions - ): List { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("v1", "auth_rules", params.getPathParam(0), "migrate") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .apply { params.getBody()?.also { body(json(clientOptions.jsonMapper, it)) } } - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> - response - .use { migrateV1ToV2Handler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - forEach { it.validate() } - } - } - } - } - - private val removeHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Remove an existing authorization rule (Auth Rule) from an program, account, or card-level. - */ - override suspend fun remove( - params: AuthRuleRemoveParams, - requestOptions: RequestOptions - ): AuthRuleRemoveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .addPathSegments("v1", "auth_rules", "remove") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.executeAsync(request, requestOptions).let { response -> - response - .use { removeHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } } diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt index e1635866..ddd5931b 100644 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt +++ b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt @@ -191,7 +191,7 @@ constructor( ): FinancialAccountCreditConfig { val request = HttpRequest.builder() - .method(HttpMethod.PATCH) + .method(HttpMethod.POST) .addPathSegments("v1", "financial_accounts", params.getPathParam(0), "charge_off") .putAllQueryParams(clientOptions.queryParams.asMap()) .replaceAllQueryParams(params.getQueryParams()) diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt index b7db0094..ce355214 100644 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt +++ b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt @@ -2,80 +2,9 @@ package com.lithic.api.services.blocking -import com.lithic.api.core.RequestOptions -import com.lithic.api.models.AuthRule -import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleListPage -import com.lithic.api.models.AuthRuleListParams -import com.lithic.api.models.AuthRuleMigrateV1ToV2Params -import com.lithic.api.models.AuthRuleRemoveParams -import com.lithic.api.models.AuthRuleRemoveResponse -import com.lithic.api.models.AuthRuleRetrieveParams -import com.lithic.api.models.AuthRuleRetrieveResponse -import com.lithic.api.models.AuthRuleUpdateParams import com.lithic.api.services.blocking.authRules.V2Service interface AuthRuleService { fun v2(): V2Service - - /** - * Creates an authorization rule (Auth Rule) and applies it at the program, account, or card - * level. - */ - fun create( - params: AuthRuleCreateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRule - - /** - * Detail the properties and entities (program, accounts, and cards) associated with an existing - * authorization rule (Auth Rule). - */ - fun retrieve( - params: AuthRuleRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleRetrieveResponse - - /** Update the properties associated with an existing authorization rule (Auth Rule). */ - fun update( - params: AuthRuleUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRule - - /** Return all of the Auth Rules under the program. */ - fun list( - params: AuthRuleListParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleListPage - - /** Applies an existing authorization rule (Auth Rule) to an program, account, or card level. */ - fun apply( - params: AuthRuleApplyParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRule - - /** - * Migrates an existing V1 authorization rule to a V2 authorization rule. Depending on the - * configuration of the V1 Auth Rule, this will yield one or two V2 authorization rules. This - * endpoint will alter the internal structure of the Auth Rule such that the resulting rules - * become a V2 Authorization Rule that can be operated on through the /v2/auth_rules endpoints. - * - * After a V1 Auth Rule has been migrated, it can no longer be operated on through the - * /v1/auth_rules/\* endpoints. Eventually, Lithic will deprecate the /v1/auth_rules endpoints - * and migrate all existing V1 Auth Rules to V2 Auth Rules. - */ - fun migrateV1ToV2( - params: AuthRuleMigrateV1ToV2Params, - requestOptions: RequestOptions = RequestOptions.none() - ): List - - /** - * Remove an existing authorization rule (Auth Rule) from an program, account, or card-level. - */ - fun remove( - params: AuthRuleRemoveParams, - requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleRemoveResponse } diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt index 18063d57..27501f61 100644 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt +++ b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt @@ -3,26 +3,6 @@ package com.lithic.api.services.blocking import com.lithic.api.core.ClientOptions -import com.lithic.api.core.RequestOptions -import com.lithic.api.core.handlers.errorHandler -import com.lithic.api.core.handlers.jsonHandler -import com.lithic.api.core.handlers.withErrorHandler -import com.lithic.api.core.http.HttpMethod -import com.lithic.api.core.http.HttpRequest -import com.lithic.api.core.http.HttpResponse.Handler -import com.lithic.api.core.json -import com.lithic.api.errors.LithicError -import com.lithic.api.models.AuthRule -import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleListPage -import com.lithic.api.models.AuthRuleListParams -import com.lithic.api.models.AuthRuleMigrateV1ToV2Params -import com.lithic.api.models.AuthRuleRemoveParams -import com.lithic.api.models.AuthRuleRemoveResponse -import com.lithic.api.models.AuthRuleRetrieveParams -import com.lithic.api.models.AuthRuleRetrieveResponse -import com.lithic.api.models.AuthRuleUpdateParams import com.lithic.api.services.blocking.authRules.V2Service import com.lithic.api.services.blocking.authRules.V2ServiceImpl @@ -31,221 +11,7 @@ constructor( private val clientOptions: ClientOptions, ) : AuthRuleService { - private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val v2: V2Service by lazy { V2ServiceImpl(clientOptions) } override fun v2(): V2Service = v2 - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Creates an authorization rule (Auth Rule) and applies it at the program, account, or card - * level. - */ - override fun create(params: AuthRuleCreateParams, requestOptions: RequestOptions): AuthRule { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("v1", "auth_rules") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { createHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** - * Detail the properties and entities (program, accounts, and cards) associated with an existing - * authorization rule (Auth Rule). - */ - override fun retrieve( - params: AuthRuleRetrieveParams, - requestOptions: RequestOptions - ): AuthRuleRetrieveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("v1", "auth_rules", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { retrieveHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Update the properties associated with an existing authorization rule (Auth Rule). */ - override fun update(params: AuthRuleUpdateParams, requestOptions: RequestOptions): AuthRule { - val request = - HttpRequest.builder() - .method(HttpMethod.PUT) - .addPathSegments("v1", "auth_rules", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { updateHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - .withErrorHandler(errorHandler) - - /** Return all of the Auth Rules under the program. */ - override fun list( - params: AuthRuleListParams, - requestOptions: RequestOptions - ): AuthRuleListPage { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .addPathSegments("v1", "auth_rules") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { listHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - .let { AuthRuleListPage.of(this, params, it) } - } - } - - private val applyHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** Applies an existing authorization rule (Auth Rule) to an program, account, or card level. */ - override fun apply(params: AuthRuleApplyParams, requestOptions: RequestOptions): AuthRule { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("v1", "auth_rules", params.getPathParam(0), "apply") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { applyHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } - - private val migrateV1ToV2Handler: Handler> = - jsonHandler>(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Migrates an existing V1 authorization rule to a V2 authorization rule. Depending on the - * configuration of the V1 Auth Rule, this will yield one or two V2 authorization rules. This - * endpoint will alter the internal structure of the Auth Rule such that the resulting rules - * become a V2 Authorization Rule that can be operated on through the /v2/auth_rules endpoints. - * - * After a V1 Auth Rule has been migrated, it can no longer be operated on through the - * /v1/auth_rules/\* endpoints. Eventually, Lithic will deprecate the /v1/auth_rules endpoints - * and migrate all existing V1 Auth Rules to V2 Auth Rules. - */ - override fun migrateV1ToV2( - params: AuthRuleMigrateV1ToV2Params, - requestOptions: RequestOptions - ): List { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .addPathSegments("v1", "auth_rules", params.getPathParam(0), "migrate") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .apply { params.getBody()?.also { body(json(clientOptions.jsonMapper, it)) } } - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { migrateV1ToV2Handler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - forEach { it.validate() } - } - } - } - } - - private val removeHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) - - /** - * Remove an existing authorization rule (Auth Rule) from an program, account, or card-level. - */ - override fun remove( - params: AuthRuleRemoveParams, - requestOptions: RequestOptions - ): AuthRuleRemoveResponse { - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .addPathSegments("v1", "auth_rules", "remove") - .putAllQueryParams(clientOptions.queryParams.asMap()) - .replaceAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers.asMap()) - .replaceAllHeaders(params.getHeaders()) - .body(json(clientOptions.jsonMapper, params.getBody())) - .build() - return clientOptions.httpClient.execute(request, requestOptions).let { response -> - response - .use { removeHandler.handle(it) } - .apply { - if (requestOptions.responseValidation ?: clientOptions.responseValidation) { - validate() - } - } - } - } } diff --git a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceImpl.kt b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceImpl.kt index ddc74658..d44cae1f 100644 --- a/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceImpl.kt +++ b/lithic-kotlin-core/src/main/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceImpl.kt @@ -189,7 +189,7 @@ constructor( ): FinancialAccountCreditConfig { val request = HttpRequest.builder() - .method(HttpMethod.PATCH) + .method(HttpMethod.POST) .addPathSegments("v1", "financial_accounts", params.getPathParam(0), "charge_off") .putAllQueryParams(clientOptions.queryParams.asMap()) .replaceAllQueryParams(params.getQueryParams()) diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleApplyParamsTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleApplyParamsTest.kt deleted file mode 100644 index 3920084f..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleApplyParamsTest.kt +++ /dev/null @@ -1,59 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleApplyParamsTest { - - @Test - fun createAuthRuleApplyParams() { - AuthRuleApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - } - - @Test - fun getBody() { - val params = - AuthRuleApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.accountTokens()).isEqualTo(listOf("string")) - assertThat(body.cardTokens()).isEqualTo(listOf("string")) - assertThat(body.programLevel()).isEqualTo(true) - } - - @Test - fun getBodyWithoutOptionalFields() { - val params = - AuthRuleApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val body = params.getBody() - assertThat(body).isNotNull - } - - @Test - fun getPathParam() { - val params = - AuthRuleApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "authRuleToken" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleCreateParamsTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleCreateParamsTest.kt deleted file mode 100644 index 3bd85b2b..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleCreateParamsTest.kt +++ /dev/null @@ -1,53 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleCreateParamsTest { - - @Test - fun createAuthRuleCreateParams() { - AuthRuleCreateParams.builder() - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - } - - @Test - fun getBody() { - val params = - AuthRuleCreateParams.builder() - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.accountTokens()).isEqualTo(listOf("string")) - assertThat(body.allowedCountries()).isEqualTo(listOf("string")) - assertThat(body.allowedMcc()).isEqualTo(listOf("string")) - assertThat(body.blockedCountries()).isEqualTo(listOf("string")) - assertThat(body.blockedMcc()).isEqualTo(listOf("string")) - assertThat(body.cardTokens()).isEqualTo(listOf("string")) - assertThat(body.programLevel()).isEqualTo(true) - } - - @Test - fun getBodyWithoutOptionalFields() { - val params = AuthRuleCreateParams.builder().build() - val body = params.getBody() - assertThat(body).isNotNull - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleListParamsTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleListParamsTest.kt deleted file mode 100644 index 9719743f..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleListParamsTest.kt +++ /dev/null @@ -1,41 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleListParamsTest { - - @Test - fun createAuthRuleListParams() { - AuthRuleListParams.builder() - .endingBefore("ending_before") - .pageSize(100L) - .startingAfter("starting_after") - .build() - } - - @Test - fun getQueryParams() { - val params = - AuthRuleListParams.builder() - .endingBefore("ending_before") - .pageSize(100L) - .startingAfter("starting_after") - .build() - val expected = mutableMapOf>() - expected.put("ending_before", listOf("ending_before")) - expected.put("page_size", listOf("100")) - expected.put("starting_after", listOf("starting_after")) - assertThat(params.getQueryParams()).isEqualTo(expected) - } - - @Test - fun getQueryParamsWithoutOptionalFields() { - val params = AuthRuleListParams.builder().build() - val expected = mutableMapOf>() - assertThat(params.getQueryParams()).isEqualTo(expected) - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2ParamsTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2ParamsTest.kt deleted file mode 100644 index 1d6810e0..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleMigrateV1ToV2ParamsTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleMigrateV1ToV2ParamsTest { - - @Test - fun createAuthRuleMigrateV1ToV2Params() { - AuthRuleMigrateV1ToV2Params.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun getPathParam() { - val params = - AuthRuleMigrateV1ToV2Params.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "authRuleToken" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveParamsTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveParamsTest.kt deleted file mode 100644 index 060e5076..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveParamsTest.kt +++ /dev/null @@ -1,41 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleRemoveParamsTest { - - @Test - fun createAuthRuleRemoveParams() { - AuthRuleRemoveParams.builder() - .accountTokens(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - } - - @Test - fun getBody() { - val params = - AuthRuleRemoveParams.builder() - .accountTokens(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.accountTokens()).isEqualTo(listOf("string")) - assertThat(body.cardTokens()).isEqualTo(listOf("string")) - assertThat(body.programLevel()).isEqualTo(true) - } - - @Test - fun getBodyWithoutOptionalFields() { - val params = AuthRuleRemoveParams.builder().build() - val body = params.getBody() - assertThat(body).isNotNull - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveResponseTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveResponseTest.kt deleted file mode 100644 index b21cf95e..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRemoveResponseTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleRemoveResponseTest { - - @Test - fun createAuthRuleRemoveResponse() { - val authRuleRemoveResponse = - AuthRuleRemoveResponse.builder() - .accountTokens(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - assertThat(authRuleRemoveResponse).isNotNull - assertThat(authRuleRemoveResponse.accountTokens()).containsExactly("string") - assertThat(authRuleRemoveResponse.cardTokens()).containsExactly("string") - assertThat(authRuleRemoveResponse.programLevel()).isEqualTo(true) - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveParamsTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveParamsTest.kt deleted file mode 100644 index 6262867a..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveParamsTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleRetrieveParamsTest { - - @Test - fun createAuthRuleRetrieveParams() { - AuthRuleRetrieveParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun getPathParam() { - val params = - AuthRuleRetrieveParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "authRuleToken" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveResponseTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveResponseTest.kt deleted file mode 100644 index 7ee539d4..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleRetrieveResponseTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleRetrieveResponseTest { - - @Test - fun createAuthRuleRetrieveResponse() { - val authRuleRetrieveResponse = - AuthRuleRetrieveResponse.builder() - .data( - listOf( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .state(AuthRule.State.ACTIVE) - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - ) - ) - .build() - assertThat(authRuleRetrieveResponse).isNotNull - assertThat(authRuleRetrieveResponse.data()) - .containsExactly( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .state(AuthRule.State.ACTIVE) - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - ) - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleUpdateParamsTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleUpdateParamsTest.kt deleted file mode 100644 index ed122e78..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/models/AuthRuleUpdateParamsTest.kt +++ /dev/null @@ -1,62 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.models.* -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleUpdateParamsTest { - - @Test - fun createAuthRuleUpdateParams() { - AuthRuleUpdateParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .build() - } - - @Test - fun getBody() { - val params = - AuthRuleUpdateParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .build() - val body = params.getBody() - assertThat(body).isNotNull - assertThat(body.allowedCountries()).isEqualTo(listOf("string")) - assertThat(body.allowedMcc()).isEqualTo(listOf("string")) - assertThat(body.blockedCountries()).isEqualTo(listOf("string")) - assertThat(body.blockedMcc()).isEqualTo(listOf("string")) - } - - @Test - fun getBodyWithoutOptionalFields() { - val params = - AuthRuleUpdateParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - val body = params.getBody() - assertThat(body).isNotNull - } - - @Test - fun getPathParam() { - val params = - AuthRuleUpdateParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(params).isNotNull - // path param "authRuleToken" - assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - // out-of-bound path param - assertThat(params.getPathParam(1)).isEqualTo("") - } -} diff --git a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt b/lithic-kotlin-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt deleted file mode 100644 index d6fb4c5f..00000000 --- a/lithic-kotlin-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt +++ /dev/null @@ -1,152 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.services.blocking - -import com.lithic.api.TestServerExtension -import com.lithic.api.client.okhttp.LithicOkHttpClient -import com.lithic.api.models.* -import com.lithic.api.models.AuthRuleListParams -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -class AuthRuleServiceTest { - - @Test - fun callCreate() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val authRuleService = client.authRules() - val authRule = - authRuleService.create( - AuthRuleCreateParams.builder() - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - ) - println(authRule) - authRule.validate() - } - - @Test - fun callRetrieve() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val authRuleService = client.authRules() - val authRuleRetrieveResponse = - authRuleService.retrieve( - AuthRuleRetrieveParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - println(authRuleRetrieveResponse) - authRuleRetrieveResponse.validate() - } - - @Test - fun callUpdate() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val authRuleService = client.authRules() - val authRule = - authRuleService.update( - AuthRuleUpdateParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .build() - ) - println(authRule) - authRule.validate() - } - - @Test - fun callList() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val authRuleService = client.authRules() - val response = authRuleService.list(AuthRuleListParams.builder().build()) - println(response) - response.data().forEach { it.validate() } - } - - @Test - fun callApply() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val authRuleService = client.authRules() - val authRule = - authRuleService.apply( - AuthRuleApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - ) - println(authRule) - authRule.validate() - } - - @Test - fun callMigrateV1ToV2() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val authRuleService = client.authRules() - val authRuleMigrateV1ToV2Response = - authRuleService.migrateV1ToV2( - AuthRuleMigrateV1ToV2Params.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - println(authRuleMigrateV1ToV2Response) - for (authRule: AuthRule in authRuleMigrateV1ToV2Response) { - authRule.validate() - } - } - - @Test - fun callRemove() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val authRuleService = client.authRules() - val authRuleRemoveResponse = - authRuleService.remove( - AuthRuleRemoveParams.builder() - .accountTokens(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .build() - ) - println(authRuleRemoveResponse) - authRuleRemoveResponse.validate() - } -}