Skip to content

Commit b4209cb

Browse files
feat(api): add transaction_token field to BacktestStats/ReportStats examples
1 parent 5bf85e9 commit b4209cb

File tree

10 files changed

+226
-15
lines changed

10 files changed

+226
-15
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 190
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-fde7dad9bd08702d5db270fdd3cb533bc927387c4ea5aa19b11c67dd3ea643d4.yml
3-
openapi_spec_hash: bf4c200978915ccdf7f4a5734e796a07
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-bc1866f92f50e1de35c16e782a13052913aeedc56723b13de396dea7c754889b.yml
3+
openapi_spec_hash: d7110a33edc390903093258735ee0cfb
44
config_hash: edbdfefeb0d3d927c2f9fe3402793215

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

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ private constructor(
320320
private val decision: JsonField<Decision>,
321321
private val eventToken: JsonField<String>,
322322
private val timestamp: JsonField<OffsetDateTime>,
323+
private val transactionToken: JsonField<String>,
323324
private val additionalProperties: MutableMap<String, JsonValue>,
324325
) {
325326

@@ -334,7 +335,10 @@ private constructor(
334335
@JsonProperty("timestamp")
335336
@ExcludeMissing
336337
timestamp: JsonField<OffsetDateTime> = JsonMissing.of(),
337-
) : this(decision, eventToken, timestamp, mutableMapOf())
338+
@JsonProperty("transaction_token")
339+
@ExcludeMissing
340+
transactionToken: JsonField<String> = JsonMissing.of(),
341+
) : this(decision, eventToken, timestamp, transactionToken, mutableMapOf())
338342

339343
/**
340344
* The decision made by the rule for this event.
@@ -360,6 +364,14 @@ private constructor(
360364
*/
361365
fun timestamp(): Optional<OffsetDateTime> = timestamp.getOptional("timestamp")
362366

367+
/**
368+
* The token of the transaction associated with the event
369+
*
370+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
371+
* server responded with an unexpected value).
372+
*/
373+
fun transactionToken(): Optional<String> = transactionToken.getOptional("transaction_token")
374+
363375
/**
364376
* Returns the raw JSON value of [decision].
365377
*
@@ -385,6 +397,16 @@ private constructor(
385397
@ExcludeMissing
386398
fun _timestamp(): JsonField<OffsetDateTime> = timestamp
387399

400+
/**
401+
* Returns the raw JSON value of [transactionToken].
402+
*
403+
* Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected
404+
* type.
405+
*/
406+
@JsonProperty("transaction_token")
407+
@ExcludeMissing
408+
fun _transactionToken(): JsonField<String> = transactionToken
409+
388410
@JsonAnySetter
389411
private fun putAdditionalProperty(key: String, value: JsonValue) {
390412
additionalProperties.put(key, value)
@@ -409,13 +431,15 @@ private constructor(
409431
private var decision: JsonField<Decision> = JsonMissing.of()
410432
private var eventToken: JsonField<String> = JsonMissing.of()
411433
private var timestamp: JsonField<OffsetDateTime> = JsonMissing.of()
434+
private var transactionToken: JsonField<String> = JsonMissing.of()
412435
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
413436

414437
@JvmSynthetic
415438
internal fun from(example: Example) = apply {
416439
decision = example.decision
417440
eventToken = example.eventToken
418441
timestamp = example.timestamp
442+
transactionToken = example.transactionToken
419443
additionalProperties = example.additionalProperties.toMutableMap()
420444
}
421445

@@ -457,6 +481,27 @@ private constructor(
457481
this.timestamp = timestamp
458482
}
459483

484+
/** The token of the transaction associated with the event */
485+
fun transactionToken(transactionToken: String?) =
486+
transactionToken(JsonField.ofNullable(transactionToken))
487+
488+
/**
489+
* Alias for calling [Builder.transactionToken] with `transactionToken.orElse(null)`.
490+
*/
491+
fun transactionToken(transactionToken: Optional<String>) =
492+
transactionToken(transactionToken.getOrNull())
493+
494+
/**
495+
* Sets [Builder.transactionToken] to an arbitrary JSON value.
496+
*
497+
* You should usually call [Builder.transactionToken] with a well-typed [String] value
498+
* instead. This method is primarily for setting the field to an undocumented or not yet
499+
* supported value.
500+
*/
501+
fun transactionToken(transactionToken: JsonField<String>) = apply {
502+
this.transactionToken = transactionToken
503+
}
504+
460505
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
461506
this.additionalProperties.clear()
462507
putAllAdditionalProperties(additionalProperties)
@@ -482,7 +527,13 @@ private constructor(
482527
* Further updates to this [Builder] will not mutate the returned instance.
483528
*/
484529
fun build(): Example =
485-
Example(decision, eventToken, timestamp, additionalProperties.toMutableMap())
530+
Example(
531+
decision,
532+
eventToken,
533+
timestamp,
534+
transactionToken,
535+
additionalProperties.toMutableMap(),
536+
)
486537
}
487538

488539
private var validated: Boolean = false
@@ -495,6 +546,7 @@ private constructor(
495546
decision().ifPresent { it.validate() }
496547
eventToken()
497548
timestamp()
549+
transactionToken()
498550
validated = true
499551
}
500552

@@ -516,7 +568,8 @@ private constructor(
516568
internal fun validity(): Int =
517569
(decision.asKnown().getOrNull()?.validity() ?: 0) +
518570
(if (eventToken.asKnown().isPresent) 1 else 0) +
519-
(if (timestamp.asKnown().isPresent) 1 else 0)
571+
(if (timestamp.asKnown().isPresent) 1 else 0) +
572+
(if (transactionToken.asKnown().isPresent) 1 else 0)
520573

521574
/** The decision made by the rule for this event. */
522575
class Decision @JsonCreator private constructor(private val value: JsonField<String>) :
@@ -664,17 +717,18 @@ private constructor(
664717
decision == other.decision &&
665718
eventToken == other.eventToken &&
666719
timestamp == other.timestamp &&
720+
transactionToken == other.transactionToken &&
667721
additionalProperties == other.additionalProperties
668722
}
669723

670724
private val hashCode: Int by lazy {
671-
Objects.hash(decision, eventToken, timestamp, additionalProperties)
725+
Objects.hash(decision, eventToken, timestamp, transactionToken, additionalProperties)
672726
}
673727

674728
override fun hashCode(): Int = hashCode
675729

676730
override fun toString() =
677-
"Example{decision=$decision, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}"
731+
"Example{decision=$decision, eventToken=$eventToken, timestamp=$timestamp, transactionToken=$transactionToken, additionalProperties=$additionalProperties}"
678732
}
679733

680734
override fun equals(other: Any?): Boolean {

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

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ private constructor(
468468
private val decision: JsonField<Decision>,
469469
private val eventToken: JsonField<String>,
470470
private val timestamp: JsonField<OffsetDateTime>,
471+
private val transactionToken: JsonField<String>,
471472
private val additionalProperties: MutableMap<String, JsonValue>,
472473
) {
473474

@@ -488,7 +489,18 @@ private constructor(
488489
@JsonProperty("timestamp")
489490
@ExcludeMissing
490491
timestamp: JsonField<OffsetDateTime> = JsonMissing.of(),
491-
) : this(actions, approved, decision, eventToken, timestamp, mutableMapOf())
492+
@JsonProperty("transaction_token")
493+
@ExcludeMissing
494+
transactionToken: JsonField<String> = JsonMissing.of(),
495+
) : this(
496+
actions,
497+
approved,
498+
decision,
499+
eventToken,
500+
timestamp,
501+
transactionToken,
502+
mutableMapOf(),
503+
)
492504

493505
/**
494506
* The actions taken by the rule for this event.
@@ -532,6 +544,14 @@ private constructor(
532544
*/
533545
fun timestamp(): Optional<OffsetDateTime> = timestamp.getOptional("timestamp")
534546

547+
/**
548+
* The token of the transaction associated with the event
549+
*
550+
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
551+
* server responded with an unexpected value).
552+
*/
553+
fun transactionToken(): Optional<String> = transactionToken.getOptional("transaction_token")
554+
535555
/**
536556
* Returns the raw JSON value of [actions].
537557
*
@@ -577,6 +597,16 @@ private constructor(
577597
@ExcludeMissing
578598
fun _timestamp(): JsonField<OffsetDateTime> = timestamp
579599

600+
/**
601+
* Returns the raw JSON value of [transactionToken].
602+
*
603+
* Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected
604+
* type.
605+
*/
606+
@JsonProperty("transaction_token")
607+
@ExcludeMissing
608+
fun _transactionToken(): JsonField<String> = transactionToken
609+
580610
@JsonAnySetter
581611
private fun putAdditionalProperty(key: String, value: JsonValue) {
582612
additionalProperties.put(key, value)
@@ -603,6 +633,7 @@ private constructor(
603633
private var decision: JsonField<Decision> = JsonMissing.of()
604634
private var eventToken: JsonField<String> = JsonMissing.of()
605635
private var timestamp: JsonField<OffsetDateTime> = JsonMissing.of()
636+
private var transactionToken: JsonField<String> = JsonMissing.of()
606637
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
607638

608639
@JvmSynthetic
@@ -612,6 +643,7 @@ private constructor(
612643
decision = example.decision
613644
eventToken = example.eventToken
614645
timestamp = example.timestamp
646+
transactionToken = example.transactionToken
615647
additionalProperties = example.additionalProperties.toMutableMap()
616648
}
617649

@@ -735,6 +767,27 @@ private constructor(
735767
this.timestamp = timestamp
736768
}
737769

770+
/** The token of the transaction associated with the event */
771+
fun transactionToken(transactionToken: String?) =
772+
transactionToken(JsonField.ofNullable(transactionToken))
773+
774+
/**
775+
* Alias for calling [Builder.transactionToken] with `transactionToken.orElse(null)`.
776+
*/
777+
fun transactionToken(transactionToken: Optional<String>) =
778+
transactionToken(transactionToken.getOrNull())
779+
780+
/**
781+
* Sets [Builder.transactionToken] to an arbitrary JSON value.
782+
*
783+
* You should usually call [Builder.transactionToken] with a well-typed [String] value
784+
* instead. This method is primarily for setting the field to an undocumented or not yet
785+
* supported value.
786+
*/
787+
fun transactionToken(transactionToken: JsonField<String>) = apply {
788+
this.transactionToken = transactionToken
789+
}
790+
738791
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
739792
this.additionalProperties.clear()
740793
putAllAdditionalProperties(additionalProperties)
@@ -766,6 +819,7 @@ private constructor(
766819
decision,
767820
eventToken,
768821
timestamp,
822+
transactionToken,
769823
additionalProperties.toMutableMap(),
770824
)
771825
}
@@ -782,6 +836,7 @@ private constructor(
782836
decision().ifPresent { it.validate() }
783837
eventToken()
784838
timestamp()
839+
transactionToken()
785840
validated = true
786841
}
787842

@@ -805,7 +860,8 @@ private constructor(
805860
(if (approved.asKnown().isPresent) 1 else 0) +
806861
(decision.asKnown().getOrNull()?.validity() ?: 0) +
807862
(if (eventToken.asKnown().isPresent) 1 else 0) +
808-
(if (timestamp.asKnown().isPresent) 1 else 0)
863+
(if (timestamp.asKnown().isPresent) 1 else 0) +
864+
(if (transactionToken.asKnown().isPresent) 1 else 0)
809865

810866
@JsonDeserialize(using = Action.Deserializer::class)
811867
@JsonSerialize(using = Action.Serializer::class)
@@ -5041,17 +5097,26 @@ private constructor(
50415097
decision == other.decision &&
50425098
eventToken == other.eventToken &&
50435099
timestamp == other.timestamp &&
5100+
transactionToken == other.transactionToken &&
50445101
additionalProperties == other.additionalProperties
50455102
}
50465103

50475104
private val hashCode: Int by lazy {
5048-
Objects.hash(actions, approved, decision, eventToken, timestamp, additionalProperties)
5105+
Objects.hash(
5106+
actions,
5107+
approved,
5108+
decision,
5109+
eventToken,
5110+
timestamp,
5111+
transactionToken,
5112+
additionalProperties,
5113+
)
50495114
}
50505115

50515116
override fun hashCode(): Int = hashCode
50525117

50535118
override fun toString() =
5054-
"Example{actions=$actions, approved=$approved, decision=$decision, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}"
5119+
"Example{actions=$actions, approved=$approved, decision=$decision, eventToken=$eventToken, timestamp=$timestamp, transactionToken=$transactionToken, additionalProperties=$additionalProperties}"
50555120
}
50565121

50575122
override fun equals(other: Any?): Boolean {

0 commit comments

Comments
 (0)