Skip to content

Commit cee6086

Browse files
fix(types): add enum values, make fields optional in Balance/SettlementDetail/Statement
1 parent 0658929 commit cee6086

15 files changed

Lines changed: 175 additions & 71 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 194
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-659808bfd15f4eafd418ec0db871b22be857ca94f771c9539792ecda2d2d0dbe.yml
3-
openapi_spec_hash: e870e6403121ac3bbd1667deec6788de
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-89ce5b3ff634397bdfc05a63d3103b9c767726dfc6b042883d220d08d4156c99.yml
3+
openapi_spec_hash: 867ab9ab196ad28740f46ec4e7bf7aba
44
config_hash: 1c5c139a2aa0d1d45c063f953a9bc803

lithic-java-core/src/main/kotlin/com/lithic/api/models/Balance.kt

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.lithic.api.errors.LithicInvalidDataException
1616
import java.time.OffsetDateTime
1717
import java.util.Collections
1818
import java.util.Objects
19+
import java.util.Optional
1920
import kotlin.jvm.optionals.getOrNull
2021

2122
/** Balance */
@@ -125,19 +126,20 @@ private constructor(
125126
* Globally unique identifier for the last financial transaction event that impacted this
126127
* balance.
127128
*
128-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
129-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
129+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
130+
* server responded with an unexpected value).
130131
*/
131-
fun lastTransactionEventToken(): String =
132-
lastTransactionEventToken.getRequired("last_transaction_event_token")
132+
fun lastTransactionEventToken(): Optional<String> =
133+
lastTransactionEventToken.getOptional("last_transaction_event_token")
133134

134135
/**
135136
* Globally unique identifier for the last financial transaction that impacted this balance.
136137
*
137-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
138-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
138+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
139+
* server responded with an unexpected value).
139140
*/
140-
fun lastTransactionToken(): String = lastTransactionToken.getRequired("last_transaction_token")
141+
fun lastTransactionToken(): Optional<String> =
142+
lastTransactionToken.getOptional("last_transaction_token")
141143

142144
/**
143145
* Funds not available for spend due to card authorizations or pending ACH release. Shown in the
@@ -386,8 +388,15 @@ private constructor(
386388
* Globally unique identifier for the last financial transaction event that impacted this
387389
* balance.
388390
*/
389-
fun lastTransactionEventToken(lastTransactionEventToken: String) =
390-
lastTransactionEventToken(JsonField.of(lastTransactionEventToken))
391+
fun lastTransactionEventToken(lastTransactionEventToken: String?) =
392+
lastTransactionEventToken(JsonField.ofNullable(lastTransactionEventToken))
393+
394+
/**
395+
* Alias for calling [Builder.lastTransactionEventToken] with
396+
* `lastTransactionEventToken.orElse(null)`.
397+
*/
398+
fun lastTransactionEventToken(lastTransactionEventToken: Optional<String>) =
399+
lastTransactionEventToken(lastTransactionEventToken.getOrNull())
391400

392401
/**
393402
* Sets [Builder.lastTransactionEventToken] to an arbitrary JSON value.
@@ -403,8 +412,15 @@ private constructor(
403412
/**
404413
* Globally unique identifier for the last financial transaction that impacted this balance.
405414
*/
406-
fun lastTransactionToken(lastTransactionToken: String) =
407-
lastTransactionToken(JsonField.of(lastTransactionToken))
415+
fun lastTransactionToken(lastTransactionToken: String?) =
416+
lastTransactionToken(JsonField.ofNullable(lastTransactionToken))
417+
418+
/**
419+
* Alias for calling [Builder.lastTransactionToken] with
420+
* `lastTransactionToken.orElse(null)`.
421+
*/
422+
fun lastTransactionToken(lastTransactionToken: Optional<String>) =
423+
lastTransactionToken(lastTransactionToken.getOrNull())
408424

409425
/**
410426
* Sets [Builder.lastTransactionToken] to an arbitrary JSON value.
@@ -588,10 +604,14 @@ private constructor(
588604

589605
companion object {
590606

607+
@JvmField val CARD = of("CARD")
608+
591609
@JvmField val ISSUING = of("ISSUING")
592610

593611
@JvmField val OPERATING = of("OPERATING")
594612

613+
@JvmField val PROGRAM_RECEIVABLES = of("PROGRAM_RECEIVABLES")
614+
595615
@JvmField val RESERVE = of("RESERVE")
596616

597617
@JvmField val SECURITY = of("SECURITY")
@@ -601,8 +621,10 @@ private constructor(
601621

602622
/** An enum containing [FinancialAccountType]'s known values. */
603623
enum class Known {
624+
CARD,
604625
ISSUING,
605626
OPERATING,
627+
PROGRAM_RECEIVABLES,
606628
RESERVE,
607629
SECURITY,
608630
}
@@ -618,8 +640,10 @@ private constructor(
618640
* - It was constructed with an arbitrary value using the [of] method.
619641
*/
620642
enum class Value {
643+
CARD,
621644
ISSUING,
622645
OPERATING,
646+
PROGRAM_RECEIVABLES,
623647
RESERVE,
624648
SECURITY,
625649
/**
@@ -638,8 +662,10 @@ private constructor(
638662
*/
639663
fun value(): Value =
640664
when (this) {
665+
CARD -> Value.CARD
641666
ISSUING -> Value.ISSUING
642667
OPERATING -> Value.OPERATING
668+
PROGRAM_RECEIVABLES -> Value.PROGRAM_RECEIVABLES
643669
RESERVE -> Value.RESERVE
644670
SECURITY -> Value.SECURITY
645671
else -> Value._UNKNOWN
@@ -656,8 +682,10 @@ private constructor(
656682
*/
657683
fun known(): Known =
658684
when (this) {
685+
CARD -> Known.CARD
659686
ISSUING -> Known.ISSUING
660687
OPERATING -> Known.OPERATING
688+
PROGRAM_RECEIVABLES -> Known.PROGRAM_RECEIVABLES
661689
RESERVE -> Known.RESERVE
662690
SECURITY -> Known.SECURITY
663691
else -> throw LithicInvalidDataException("Unknown FinancialAccountType: $value")

lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialEvent.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,8 @@ private constructor(
623623

624624
@JvmField val MONTHLY_REVERSAL = of("MONTHLY_REVERSAL")
625625

626+
@JvmField val ACCOUNT_TO_ACCOUNT = of("ACCOUNT_TO_ACCOUNT")
627+
626628
@JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value))
627629
}
628630

@@ -715,6 +717,7 @@ private constructor(
715717
QUARTERLY_REVERSAL,
716718
MONTHLY,
717719
MONTHLY_REVERSAL,
720+
ACCOUNT_TO_ACCOUNT,
718721
}
719722

720723
/**
@@ -814,6 +817,7 @@ private constructor(
814817
QUARTERLY_REVERSAL,
815818
MONTHLY,
816819
MONTHLY_REVERSAL,
820+
ACCOUNT_TO_ACCOUNT,
817821
/**
818822
* An enum member indicating that [FinancialEventType] was instantiated with an unknown
819823
* value.
@@ -917,6 +921,7 @@ private constructor(
917921
QUARTERLY_REVERSAL -> Value.QUARTERLY_REVERSAL
918922
MONTHLY -> Value.MONTHLY
919923
MONTHLY_REVERSAL -> Value.MONTHLY_REVERSAL
924+
ACCOUNT_TO_ACCOUNT -> Value.ACCOUNT_TO_ACCOUNT
920925
else -> Value._UNKNOWN
921926
}
922927

@@ -1018,6 +1023,7 @@ private constructor(
10181023
QUARTERLY_REVERSAL -> Known.QUARTERLY_REVERSAL
10191024
MONTHLY -> Known.MONTHLY
10201025
MONTHLY_REVERSAL -> Known.MONTHLY_REVERSAL
1026+
ACCOUNT_TO_ACCOUNT -> Known.ACCOUNT_TO_ACCOUNT
10211027
else -> throw LithicInvalidDataException("Unknown FinancialEventType: $value")
10221028
}
10231029

lithic-java-core/src/main/kotlin/com/lithic/api/models/SettlementDetail.kt

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -139,27 +139,27 @@ private constructor(
139139
/**
140140
* Globally unique identifier denoting the account that the associated transaction occurred on.
141141
*
142-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
143-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
142+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
143+
* server responded with an unexpected value).
144144
*/
145-
fun accountToken(): String = accountToken.getRequired("account_token")
145+
fun accountToken(): Optional<String> = accountToken.getOptional("account_token")
146146

147147
/**
148148
* Globally unique identifier denoting the card program that the associated transaction occurred
149149
* on.
150150
*
151-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
152-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
151+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
152+
* server responded with an unexpected value).
153153
*/
154-
fun cardProgramToken(): String = cardProgramToken.getRequired("card_program_token")
154+
fun cardProgramToken(): Optional<String> = cardProgramToken.getOptional("card_program_token")
155155

156156
/**
157157
* Globally unique identifier denoting the card that the associated transaction occurred on.
158158
*
159-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
160-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
159+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
160+
* server responded with an unexpected value).
161161
*/
162-
fun cardToken(): String = cardToken.getRequired("card_token")
162+
fun cardToken(): Optional<String> = cardToken.getOptional("card_token")
163163

164164
/**
165165
* Date and time when the transaction first occurred. UTC time zone.
@@ -264,15 +264,15 @@ private constructor(
264264

265265
/**
266266
* Globally unique identifier denoting the associated transaction. For settlement records with
267-
* type `CLEARING`, `FINANCIAL`, or `NON-FINANCIAL`, this references a card transaction token.
267+
* type `CLEARING`, `FINANCIAL`, or `NON_FINANCIAL`, this references a card transaction token.
268268
* For settlement records with type `CHARGEBACK`, `REPRESENTMENT`, `PREARBITRATION`,
269269
* `ARBITRATION`, or `COLLABORATION`, this references the dispute transaction token. May be null
270270
* for certain settlement types.
271271
*
272-
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
273-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
272+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
273+
* server responded with an unexpected value).
274274
*/
275-
fun transactionToken(): String = transactionToken.getRequired("transaction_token")
275+
fun transactionToken(): Optional<String> = transactionToken.getOptional("transaction_token")
276276

277277
/**
278278
* The total amount of settlement impacting transactions (excluding interchange, fees, and
@@ -598,7 +598,10 @@ private constructor(
598598
* Globally unique identifier denoting the account that the associated transaction occurred
599599
* on.
600600
*/
601-
fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken))
601+
fun accountToken(accountToken: String?) = accountToken(JsonField.ofNullable(accountToken))
602+
603+
/** Alias for calling [Builder.accountToken] with `accountToken.orElse(null)`. */
604+
fun accountToken(accountToken: Optional<String>) = accountToken(accountToken.getOrNull())
602605

603606
/**
604607
* Sets [Builder.accountToken] to an arbitrary JSON value.
@@ -615,8 +618,12 @@ private constructor(
615618
* Globally unique identifier denoting the card program that the associated transaction
616619
* occurred on.
617620
*/
618-
fun cardProgramToken(cardProgramToken: String) =
619-
cardProgramToken(JsonField.of(cardProgramToken))
621+
fun cardProgramToken(cardProgramToken: String?) =
622+
cardProgramToken(JsonField.ofNullable(cardProgramToken))
623+
624+
/** Alias for calling [Builder.cardProgramToken] with `cardProgramToken.orElse(null)`. */
625+
fun cardProgramToken(cardProgramToken: Optional<String>) =
626+
cardProgramToken(cardProgramToken.getOrNull())
620627

621628
/**
622629
* Sets [Builder.cardProgramToken] to an arbitrary JSON value.
@@ -632,7 +639,10 @@ private constructor(
632639
/**
633640
* Globally unique identifier denoting the card that the associated transaction occurred on.
634641
*/
635-
fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken))
642+
fun cardToken(cardToken: String?) = cardToken(JsonField.ofNullable(cardToken))
643+
644+
/** Alias for calling [Builder.cardToken] with `cardToken.orElse(null)`. */
645+
fun cardToken(cardToken: Optional<String>) = cardToken(cardToken.getOrNull())
636646

637647
/**
638648
* Sets [Builder.cardToken] to an arbitrary JSON value.
@@ -828,13 +838,17 @@ private constructor(
828838

829839
/**
830840
* Globally unique identifier denoting the associated transaction. For settlement records
831-
* with type `CLEARING`, `FINANCIAL`, or `NON-FINANCIAL`, this references a card transaction
841+
* with type `CLEARING`, `FINANCIAL`, or `NON_FINANCIAL`, this references a card transaction
832842
* token. For settlement records with type `CHARGEBACK`, `REPRESENTMENT`, `PREARBITRATION`,
833843
* `ARBITRATION`, or `COLLABORATION`, this references the dispute transaction token. May be
834844
* null for certain settlement types.
835845
*/
836-
fun transactionToken(transactionToken: String) =
837-
transactionToken(JsonField.of(transactionToken))
846+
fun transactionToken(transactionToken: String?) =
847+
transactionToken(JsonField.ofNullable(transactionToken))
848+
849+
/** Alias for calling [Builder.transactionToken] with `transactionToken.orElse(null)`. */
850+
fun transactionToken(transactionToken: Optional<String>) =
851+
transactionToken(transactionToken.getOrNull())
838852

839853
/**
840854
* Sets [Builder.transactionToken] to an arbitrary JSON value.
@@ -1392,7 +1406,7 @@ private constructor(
13921406

13931407
@JvmField val FINANCIAL = of("FINANCIAL")
13941408

1395-
@JvmField val NON_FINANCIAL = of("NON-FINANCIAL")
1409+
@JvmField val NON_FINANCIAL = of("NON_FINANCIAL")
13961410

13971411
@JvmField val PREARBITRATION = of("PREARBITRATION")
13981412

lithic-java-core/src/main/kotlin/com/lithic/api/models/Statement.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,14 @@ private constructor(
897897
}
898898

899899
/** Date when the next payment is due */
900-
fun nextPaymentDueDate(nextPaymentDueDate: LocalDate) =
901-
nextPaymentDueDate(JsonField.of(nextPaymentDueDate))
900+
fun nextPaymentDueDate(nextPaymentDueDate: LocalDate?) =
901+
nextPaymentDueDate(JsonField.ofNullable(nextPaymentDueDate))
902+
903+
/**
904+
* Alias for calling [Builder.nextPaymentDueDate] with `nextPaymentDueDate.orElse(null)`.
905+
*/
906+
fun nextPaymentDueDate(nextPaymentDueDate: Optional<LocalDate>) =
907+
nextPaymentDueDate(nextPaymentDueDate.getOrNull())
902908

903909
/**
904910
* Sets [Builder.nextPaymentDueDate] to an arbitrary JSON value.
@@ -912,8 +918,15 @@ private constructor(
912918
}
913919

914920
/** Date when the next billing period will end */
915-
fun nextStatementEndDate(nextStatementEndDate: LocalDate) =
916-
nextStatementEndDate(JsonField.of(nextStatementEndDate))
921+
fun nextStatementEndDate(nextStatementEndDate: LocalDate?) =
922+
nextStatementEndDate(JsonField.ofNullable(nextStatementEndDate))
923+
924+
/**
925+
* Alias for calling [Builder.nextStatementEndDate] with
926+
* `nextStatementEndDate.orElse(null)`.
927+
*/
928+
fun nextStatementEndDate(nextStatementEndDate: Optional<LocalDate>) =
929+
nextStatementEndDate(nextStatementEndDate.getOrNull())
917930

918931
/**
919932
* Sets [Builder.nextStatementEndDate] to an arbitrary JSON value.

lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,10 @@ private constructor(
744744
}
745745

746746
/** Globally unique identifier for a card */
747-
fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken))
747+
fun cardToken(cardToken: String?) = cardToken(JsonField.ofNullable(cardToken))
748+
749+
/** Alias for calling [Builder.cardToken] with `cardToken.orElse(null)`. */
750+
fun cardToken(cardToken: Optional<String>) = cardToken(cardToken.getOrNull())
748751

749752
/**
750753
* Sets [Builder.cardToken] to an arbitrary JSON value.
@@ -1386,6 +1389,8 @@ private constructor(
13861389

13871390
@JvmField val MONTHLY_REVERSAL = of("MONTHLY_REVERSAL")
13881391

1392+
@JvmField val ACCOUNT_TO_ACCOUNT = of("ACCOUNT_TO_ACCOUNT")
1393+
13891394
@JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value))
13901395
}
13911396

@@ -1478,6 +1483,7 @@ private constructor(
14781483
QUARTERLY_REVERSAL,
14791484
MONTHLY,
14801485
MONTHLY_REVERSAL,
1486+
ACCOUNT_TO_ACCOUNT,
14811487
}
14821488

14831489
/**
@@ -1579,6 +1585,7 @@ private constructor(
15791585
QUARTERLY_REVERSAL,
15801586
MONTHLY,
15811587
MONTHLY_REVERSAL,
1588+
ACCOUNT_TO_ACCOUNT,
15821589
/**
15831590
* An enum member indicating that [FinancialEventType] was instantiated with an
15841591
* unknown value.
@@ -1682,6 +1689,7 @@ private constructor(
16821689
QUARTERLY_REVERSAL -> Value.QUARTERLY_REVERSAL
16831690
MONTHLY -> Value.MONTHLY
16841691
MONTHLY_REVERSAL -> Value.MONTHLY_REVERSAL
1692+
ACCOUNT_TO_ACCOUNT -> Value.ACCOUNT_TO_ACCOUNT
16851693
else -> Value._UNKNOWN
16861694
}
16871695

@@ -1783,6 +1791,7 @@ private constructor(
17831791
QUARTERLY_REVERSAL -> Known.QUARTERLY_REVERSAL
17841792
MONTHLY -> Known.MONTHLY
17851793
MONTHLY_REVERSAL -> Known.MONTHLY_REVERSAL
1794+
ACCOUNT_TO_ACCOUNT -> Known.ACCOUNT_TO_ACCOUNT
17861795
else -> throw LithicInvalidDataException("Unknown FinancialEventType: $value")
17871796
}
17881797

0 commit comments

Comments
 (0)