Skip to content

Commit

Permalink
feat(api): rename token and type to financial_account_token and…
Browse files Browse the repository at this point in the history
… `financial_account_type` (#131)
  • Loading branch information
stainless-bot committed Dec 15, 2023
1 parent 465e513 commit 815c889
Show file tree
Hide file tree
Showing 12 changed files with 320 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 106
configured_endpoints: 107
74 changes: 43 additions & 31 deletions lithic-java-core/src/main/kotlin/com/lithic/api/models/Balance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ private constructor(
private val lastTransactionEventToken: JsonField<String>,
private val lastTransactionToken: JsonField<String>,
private val pendingAmount: JsonField<Long>,
private val token: JsonField<String>,
private val financialAccountToken: JsonField<String>,
private val totalAmount: JsonField<Long>,
private val type: JsonField<Type>,
private val financialAccountType: JsonField<FinancialAccountType>,
private val updated: JsonField<OffsetDateTime>,
private val additionalProperties: Map<String, JsonValue>,
) {
Expand Down Expand Up @@ -65,7 +65,8 @@ private constructor(
fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount")

/** Globally unique identifier for the financial account that holds this balance. */
fun token(): String = token.getRequired("token")
fun financialAccountToken(): String =
financialAccountToken.getRequired("financial_account_token")

/**
* The sum of available and pending balance in the currency's smallest unit (e.g., cents for
Expand All @@ -74,7 +75,8 @@ private constructor(
fun totalAmount(): Long = totalAmount.getRequired("total_amount")

/** Type of financial account. */
fun type(): Type = type.getRequired("type")
fun financialAccountType(): FinancialAccountType =
financialAccountType.getRequired("financial_account_type")

/** Date and time for when the balance was last updated. */
fun updated(): OffsetDateTime = updated.getRequired("updated")
Expand Down Expand Up @@ -108,7 +110,9 @@ private constructor(
@JsonProperty("pending_amount") @ExcludeMissing fun _pendingAmount() = pendingAmount

/** Globally unique identifier for the financial account that holds this balance. */
@JsonProperty("token") @ExcludeMissing fun _token() = token
@JsonProperty("financial_account_token")
@ExcludeMissing
fun _financialAccountToken() = financialAccountToken

/**
* The sum of available and pending balance in the currency's smallest unit (e.g., cents for
Expand All @@ -117,7 +121,9 @@ private constructor(
@JsonProperty("total_amount") @ExcludeMissing fun _totalAmount() = totalAmount

/** Type of financial account. */
@JsonProperty("type") @ExcludeMissing fun _type() = type
@JsonProperty("financial_account_type")
@ExcludeMissing
fun _financialAccountType() = financialAccountType

/** Date and time for when the balance was last updated. */
@JsonProperty("updated") @ExcludeMissing fun _updated() = updated
Expand All @@ -134,9 +140,9 @@ private constructor(
lastTransactionEventToken()
lastTransactionToken()
pendingAmount()
token()
financialAccountToken()
totalAmount()
type()
financialAccountType()
updated()
validated = true
}
Expand All @@ -156,9 +162,9 @@ private constructor(
this.lastTransactionEventToken == other.lastTransactionEventToken &&
this.lastTransactionToken == other.lastTransactionToken &&
this.pendingAmount == other.pendingAmount &&
this.token == other.token &&
this.financialAccountToken == other.financialAccountToken &&
this.totalAmount == other.totalAmount &&
this.type == other.type &&
this.financialAccountType == other.financialAccountType &&
this.updated == other.updated &&
this.additionalProperties == other.additionalProperties
}
Expand All @@ -173,9 +179,9 @@ private constructor(
lastTransactionEventToken,
lastTransactionToken,
pendingAmount,
token,
financialAccountToken,
totalAmount,
type,
financialAccountType,
updated,
additionalProperties,
)
Expand All @@ -184,7 +190,7 @@ private constructor(
}

override fun toString() =
"Balance{availableAmount=$availableAmount, created=$created, currency=$currency, lastTransactionEventToken=$lastTransactionEventToken, lastTransactionToken=$lastTransactionToken, pendingAmount=$pendingAmount, token=$token, totalAmount=$totalAmount, type=$type, updated=$updated, additionalProperties=$additionalProperties}"
"Balance{availableAmount=$availableAmount, created=$created, currency=$currency, lastTransactionEventToken=$lastTransactionEventToken, lastTransactionToken=$lastTransactionToken, pendingAmount=$pendingAmount, financialAccountToken=$financialAccountToken, totalAmount=$totalAmount, financialAccountType=$financialAccountType, updated=$updated, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -199,9 +205,9 @@ private constructor(
private var lastTransactionEventToken: JsonField<String> = JsonMissing.of()
private var lastTransactionToken: JsonField<String> = JsonMissing.of()
private var pendingAmount: JsonField<Long> = JsonMissing.of()
private var token: JsonField<String> = JsonMissing.of()
private var financialAccountToken: JsonField<String> = JsonMissing.of()
private var totalAmount: JsonField<Long> = JsonMissing.of()
private var type: JsonField<Type> = JsonMissing.of()
private var financialAccountType: JsonField<FinancialAccountType> = JsonMissing.of()
private var updated: JsonField<OffsetDateTime> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

Expand All @@ -213,9 +219,9 @@ private constructor(
this.lastTransactionEventToken = balance.lastTransactionEventToken
this.lastTransactionToken = balance.lastTransactionToken
this.pendingAmount = balance.pendingAmount
this.token = balance.token
this.financialAccountToken = balance.financialAccountToken
this.totalAmount = balance.totalAmount
this.type = balance.type
this.financialAccountType = balance.financialAccountType
this.updated = balance.updated
additionalProperties(balance.additionalProperties)
}
Expand Down Expand Up @@ -295,12 +301,15 @@ private constructor(
}

/** Globally unique identifier for the financial account that holds this balance. */
fun token(token: String) = token(JsonField.of(token))
fun financialAccountToken(financialAccountToken: String) =
financialAccountToken(JsonField.of(financialAccountToken))

/** Globally unique identifier for the financial account that holds this balance. */
@JsonProperty("token")
@JsonProperty("financial_account_token")
@ExcludeMissing
fun token(token: JsonField<String>) = apply { this.token = token }
fun financialAccountToken(financialAccountToken: JsonField<String>) = apply {
this.financialAccountToken = financialAccountToken
}

/**
* The sum of available and pending balance in the currency's smallest unit (e.g., cents for
Expand All @@ -317,12 +326,15 @@ private constructor(
fun totalAmount(totalAmount: JsonField<Long>) = apply { this.totalAmount = totalAmount }

/** Type of financial account. */
fun type(type: Type) = type(JsonField.of(type))
fun financialAccountType(financialAccountType: FinancialAccountType) =
financialAccountType(JsonField.of(financialAccountType))

/** Type of financial account. */
@JsonProperty("type")
@JsonProperty("financial_account_type")
@ExcludeMissing
fun type(type: JsonField<Type>) = apply { this.type = type }
fun financialAccountType(financialAccountType: JsonField<FinancialAccountType>) = apply {
this.financialAccountType = financialAccountType
}

/** Date and time for when the balance was last updated. */
fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))
Expand Down Expand Up @@ -354,15 +366,15 @@ private constructor(
lastTransactionEventToken,
lastTransactionToken,
pendingAmount,
token,
financialAccountToken,
totalAmount,
type,
financialAccountType,
updated,
additionalProperties.toUnmodifiable(),
)
}

class Type
class FinancialAccountType
@JsonCreator
private constructor(
private val value: JsonField<String>,
Expand All @@ -375,7 +387,7 @@ private constructor(
return true
}

return other is Type && this.value == other.value
return other is FinancialAccountType && this.value == other.value
}

override fun hashCode() = value.hashCode()
Expand All @@ -384,11 +396,11 @@ private constructor(

companion object {

@JvmField val ISSUING = Type(JsonField.of("ISSUING"))
@JvmField val ISSUING = FinancialAccountType(JsonField.of("ISSUING"))

@JvmField val RESERVE = Type(JsonField.of("RESERVE"))
@JvmField val RESERVE = FinancialAccountType(JsonField.of("RESERVE"))

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
@JvmStatic fun of(value: String) = FinancialAccountType(JsonField.of(value))
}

enum class Known {
Expand All @@ -413,7 +425,7 @@ private constructor(
when (this) {
ISSUING -> Known.ISSUING
RESERVE -> Known.RESERVE
else -> throw LithicInvalidDataException("Unknown Type: $value")
else -> throw LithicInvalidDataException("Unknown FinancialAccountType: $value")
}

fun asString(): String = _value().asStringOrThrow()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// File generated from our OpenAPI spec by Stainless.

package com.lithic.api.models

import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import com.lithic.api.models.*
import java.util.Objects

class DigitalCardArtRetrieveParams
constructor(
private val digitalCardArtToken: String,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
) {

fun digitalCardArtToken(): String = digitalCardArtToken

@JvmSynthetic internal fun getQueryParams(): Map<String, List<String>> = additionalQueryParams

@JvmSynthetic internal fun getHeaders(): Map<String, List<String>> = additionalHeaders

fun getPathParam(index: Int): String {
return when (index) {
0 -> digitalCardArtToken
else -> ""
}
}

fun _additionalQueryParams(): Map<String, List<String>> = additionalQueryParams

fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is DigitalCardArtRetrieveParams &&
this.digitalCardArtToken == other.digitalCardArtToken &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders
}

override fun hashCode(): Int {
return Objects.hash(
digitalCardArtToken,
additionalQueryParams,
additionalHeaders,
)
}

override fun toString() =
"DigitalCardArtRetrieveParams{digitalCardArtToken=$digitalCardArtToken, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}"

fun toBuilder() = Builder().from(this)

companion object {

@JvmStatic fun builder() = Builder()
}

@NoAutoDetect
class Builder {

private var digitalCardArtToken: String? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()

@JvmSynthetic
internal fun from(digitalCardArtRetrieveParams: DigitalCardArtRetrieveParams) = apply {
this.digitalCardArtToken = digitalCardArtRetrieveParams.digitalCardArtToken
additionalQueryParams(digitalCardArtRetrieveParams.additionalQueryParams)
additionalHeaders(digitalCardArtRetrieveParams.additionalHeaders)
}

fun digitalCardArtToken(digitalCardArtToken: String) = apply {
this.digitalCardArtToken = digitalCardArtToken
}

fun additionalQueryParams(additionalQueryParams: Map<String, List<String>>) = apply {
this.additionalQueryParams.clear()
putAllQueryParams(additionalQueryParams)
}

fun putQueryParam(name: String, value: String) = apply {
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value)
}

fun putQueryParams(name: String, values: Iterable<String>) = apply {
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values)
}

fun putAllQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
additionalQueryParams.forEach(this::putQueryParams)
}

fun removeQueryParam(name: String) = apply {
this.additionalQueryParams.put(name, mutableListOf())
}

fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
this.additionalHeaders.clear()
putAllHeaders(additionalHeaders)
}

fun putHeader(name: String, value: String) = apply {
this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value)
}

fun putHeaders(name: String, values: Iterable<String>) = apply {
this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values)
}

fun putAllHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
additionalHeaders.forEach(this::putHeaders)
}

fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

fun build(): DigitalCardArtRetrieveParams =
DigitalCardArtRetrieveParams(
checkNotNull(digitalCardArtToken) {
"`digitalCardArtToken` is required but was not set"
},
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
package com.lithic.api.services.async

import com.lithic.api.core.RequestOptions
import com.lithic.api.models.DigitalCardArt
import com.lithic.api.models.DigitalCardArtListPageAsync
import com.lithic.api.models.DigitalCardArtListParams
import com.lithic.api.models.DigitalCardArtRetrieveParams
import java.util.concurrent.CompletableFuture

interface DigitalCardArtServiceAsync {

/** Get digital card art by token. */
@JvmOverloads
fun retrieve(
params: DigitalCardArtRetrieveParams,
requestOptions: RequestOptions = RequestOptions.none()
): CompletableFuture<DigitalCardArt>

/** List digital card art. */
@JvmOverloads
fun list(
Expand Down
Loading

0 comments on commit 815c889

Please sign in to comment.