Skip to content

Commit

Permalink
feat(api): adds closed state (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 21, 2024
1 parent 2749351 commit 232277a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lithic-java-core/src/main/kotlin/com/lithic/api/models/Account.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ private constructor(
* Account state:
* - `ACTIVE` - Account is able to transact and create new cards.
* - `PAUSED` - Account will not be able to transact or create new cards. It can be set back to
* `ACTIVE`.
* `ACTIVE`. `CLOSED` - Account will not be able to transact or create new cards. `CLOSED`
* cards are also unable to be transitioned to `ACTIVE` or `PAUSED` states.
*/
fun state(): State = state.getRequired("state")

Expand Down Expand Up @@ -83,7 +84,8 @@ private constructor(
* Account state:
* - `ACTIVE` - Account is able to transact and create new cards.
* - `PAUSED` - Account will not be able to transact or create new cards. It can be set back to
* `ACTIVE`.
* `ACTIVE`. `CLOSED` - Account will not be able to transact or create new cards. `CLOSED`
* cards are also unable to be transitioned to `ACTIVE` or `PAUSED` states.
*/
@JsonProperty("state") @ExcludeMissing fun _state() = state

Expand Down Expand Up @@ -216,15 +218,17 @@ private constructor(
* Account state:
* - `ACTIVE` - Account is able to transact and create new cards.
* - `PAUSED` - Account will not be able to transact or create new cards. It can be set back
* to `ACTIVE`.
* to `ACTIVE`. `CLOSED` - Account will not be able to transact or create new cards.
* `CLOSED` cards are also unable to be transitioned to `ACTIVE` or `PAUSED` states.
*/
fun state(state: State) = state(JsonField.of(state))

/**
* Account state:
* - `ACTIVE` - Account is able to transact and create new cards.
* - `PAUSED` - Account will not be able to transact or create new cards. It can be set back
* to `ACTIVE`.
* to `ACTIVE`. `CLOSED` - Account will not be able to transact or create new cards.
* `CLOSED` cards are also unable to be transitioned to `ACTIVE` or `PAUSED` states.
*/
@JsonProperty("state")
@ExcludeMissing
Expand Down Expand Up @@ -454,31 +458,37 @@ private constructor(

@JvmField val PAUSED = State(JsonField.of("PAUSED"))

@JvmField val CLOSED = State(JsonField.of("CLOSED"))

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

enum class Known {
ACTIVE,
PAUSED,
CLOSED,
}

enum class Value {
ACTIVE,
PAUSED,
CLOSED,
_UNKNOWN,
}

fun value(): Value =
when (this) {
ACTIVE -> Value.ACTIVE
PAUSED -> Value.PAUSED
CLOSED -> Value.CLOSED
else -> Value._UNKNOWN
}

fun known(): Known =
when (this) {
ACTIVE -> Known.ACTIVE
PAUSED -> Known.PAUSED
CLOSED -> Known.CLOSED
else -> throw LithicInvalidDataException("Unknown State: $value")
}

Expand Down

0 comments on commit 232277a

Please sign in to comment.