Skip to content

Commit f7178fe

Browse files
feat(api): add hold adjustment action to conditional authorization action parameters
1 parent 6d373d8 commit f7178fe

3 files changed

Lines changed: 54 additions & 55 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 195
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-841a8ecd13fc28d3df06e6e11f63df6106be819aad9fe3dd6637afd7bc142a56.yml
3-
openapi_spec_hash: 705fb3eb9dc54e3b2b542896154cff80
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-93254f6abf9fab9e687be2f48198b5126c298b634e2ad626abf413f560f1cbe1.yml
3+
openapi_spec_hash: 6aaac55fbf96d785ca3867adc3c7ca0e
44
config_hash: a0a579b0564a5c18568a78f5ba2b6653

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

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ import kotlin.jvm.optionals.getOrNull
2424
class ConditionalAuthorizationAdjustmentParameters
2525
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2626
private constructor(
27-
private val adjustment: JsonField<Adjustment>,
27+
private val action: JsonField<HoldAdjustmentAction>,
2828
private val conditions: JsonField<List<Condition>>,
2929
private val additionalProperties: MutableMap<String, JsonValue>,
3030
) {
3131

3232
@JsonCreator
3333
private constructor(
34-
@JsonProperty("adjustment")
34+
@JsonProperty("action")
3535
@ExcludeMissing
36-
adjustment: JsonField<Adjustment> = JsonMissing.of(),
36+
action: JsonField<HoldAdjustmentAction> = JsonMissing.of(),
3737
@JsonProperty("conditions")
3838
@ExcludeMissing
3939
conditions: JsonField<List<Condition>> = JsonMissing.of(),
40-
) : this(adjustment, conditions, mutableMapOf())
40+
) : this(action, conditions, mutableMapOf())
4141

4242
/**
43-
* The hold adjustment to apply if the conditions are met
43+
* The hold adjustment to apply if the conditions are met.
4444
*
4545
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
4646
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
4747
*/
48-
fun adjustment(): Adjustment = adjustment.getRequired("adjustment")
48+
fun action(): HoldAdjustmentAction = action.getRequired("action")
4949

5050
/**
5151
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
@@ -54,13 +54,11 @@ private constructor(
5454
fun conditions(): List<Condition> = conditions.getRequired("conditions")
5555

5656
/**
57-
* Returns the raw JSON value of [adjustment].
57+
* Returns the raw JSON value of [action].
5858
*
59-
* Unlike [adjustment], this method doesn't throw if the JSON field has an unexpected type.
59+
* Unlike [action], this method doesn't throw if the JSON field has an unexpected type.
6060
*/
61-
@JsonProperty("adjustment")
62-
@ExcludeMissing
63-
fun _adjustment(): JsonField<Adjustment> = adjustment
61+
@JsonProperty("action") @ExcludeMissing fun _action(): JsonField<HoldAdjustmentAction> = action
6462

6563
/**
6664
* Returns the raw JSON value of [conditions].
@@ -91,7 +89,7 @@ private constructor(
9189
*
9290
* The following fields are required:
9391
* ```java
94-
* .adjustment()
92+
* .action()
9593
* .conditions()
9694
* ```
9795
*/
@@ -101,7 +99,7 @@ private constructor(
10199
/** A builder for [ConditionalAuthorizationAdjustmentParameters]. */
102100
class Builder internal constructor() {
103101

104-
private var adjustment: JsonField<Adjustment>? = null
102+
private var action: JsonField<HoldAdjustmentAction>? = null
105103
private var conditions: JsonField<MutableList<Condition>>? = null
106104
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
107105

@@ -110,24 +108,24 @@ private constructor(
110108
conditionalAuthorizationAdjustmentParameters:
111109
ConditionalAuthorizationAdjustmentParameters
112110
) = apply {
113-
adjustment = conditionalAuthorizationAdjustmentParameters.adjustment
111+
action = conditionalAuthorizationAdjustmentParameters.action
114112
conditions =
115113
conditionalAuthorizationAdjustmentParameters.conditions.map { it.toMutableList() }
116114
additionalProperties =
117115
conditionalAuthorizationAdjustmentParameters.additionalProperties.toMutableMap()
118116
}
119117

120-
/** The hold adjustment to apply if the conditions are met */
121-
fun adjustment(adjustment: Adjustment) = adjustment(JsonField.of(adjustment))
118+
/** The hold adjustment to apply if the conditions are met. */
119+
fun action(action: HoldAdjustmentAction) = action(JsonField.of(action))
122120

123121
/**
124-
* Sets [Builder.adjustment] to an arbitrary JSON value.
122+
* Sets [Builder.action] to an arbitrary JSON value.
125123
*
126-
* You should usually call [Builder.adjustment] with a well-typed [Adjustment] value
124+
* You should usually call [Builder.action] with a well-typed [HoldAdjustmentAction] value
127125
* instead. This method is primarily for setting the field to an undocumented or not yet
128126
* supported value.
129127
*/
130-
fun adjustment(adjustment: JsonField<Adjustment>) = apply { this.adjustment = adjustment }
128+
fun action(action: JsonField<HoldAdjustmentAction>) = apply { this.action = action }
131129

132130
fun conditions(conditions: List<Condition>) = conditions(JsonField.of(conditions))
133131

@@ -180,15 +178,15 @@ private constructor(
180178
*
181179
* The following fields are required:
182180
* ```java
183-
* .adjustment()
181+
* .action()
184182
* .conditions()
185183
* ```
186184
*
187185
* @throws IllegalStateException if any required field is unset.
188186
*/
189187
fun build(): ConditionalAuthorizationAdjustmentParameters =
190188
ConditionalAuthorizationAdjustmentParameters(
191-
checkRequired("adjustment", adjustment),
189+
checkRequired("action", action),
192190
checkRequired("conditions", conditions).map { it.toImmutable() },
193191
additionalProperties.toMutableMap(),
194192
)
@@ -209,7 +207,7 @@ private constructor(
209207
return@apply
210208
}
211209

212-
adjustment().validate()
210+
action().validate()
213211
conditions().forEach { it.validate() }
214212
validated = true
215213
}
@@ -229,11 +227,11 @@ private constructor(
229227
*/
230228
@JvmSynthetic
231229
internal fun validity(): Int =
232-
(adjustment.asKnown().getOrNull()?.validity() ?: 0) +
230+
(action.asKnown().getOrNull()?.validity() ?: 0) +
233231
(conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
234232

235-
/** The hold adjustment to apply if the conditions are met */
236-
class Adjustment
233+
/** The hold adjustment to apply if the conditions are met. */
234+
class HoldAdjustmentAction
237235
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
238236
private constructor(
239237
private val mode: JsonField<Mode>,
@@ -313,7 +311,7 @@ private constructor(
313311
companion object {
314312

315313
/**
316-
* Returns a mutable builder for constructing an instance of [Adjustment].
314+
* Returns a mutable builder for constructing an instance of [HoldAdjustmentAction].
317315
*
318316
* The following fields are required:
319317
* ```java
@@ -325,7 +323,7 @@ private constructor(
325323
@JvmStatic fun builder() = Builder()
326324
}
327325

328-
/** A builder for [Adjustment]. */
326+
/** A builder for [HoldAdjustmentAction]. */
329327
class Builder internal constructor() {
330328

331329
private var mode: JsonField<Mode>? = null
@@ -334,11 +332,11 @@ private constructor(
334332
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
335333

336334
@JvmSynthetic
337-
internal fun from(adjustment: Adjustment) = apply {
338-
mode = adjustment.mode
339-
type = adjustment.type
340-
value = adjustment.value
341-
additionalProperties = adjustment.additionalProperties.toMutableMap()
335+
internal fun from(holdAdjustmentAction: HoldAdjustmentAction) = apply {
336+
mode = holdAdjustmentAction.mode
337+
type = holdAdjustmentAction.type
338+
value = holdAdjustmentAction.value
339+
additionalProperties = holdAdjustmentAction.additionalProperties.toMutableMap()
342340
}
343341

344342
/**
@@ -403,7 +401,7 @@ private constructor(
403401
}
404402

405403
/**
406-
* Returns an immutable instance of [Adjustment].
404+
* Returns an immutable instance of [HoldAdjustmentAction].
407405
*
408406
* Further updates to this [Builder] will not mutate the returned instance.
409407
*
@@ -416,8 +414,8 @@ private constructor(
416414
*
417415
* @throws IllegalStateException if any required field is unset.
418416
*/
419-
fun build(): Adjustment =
420-
Adjustment(
417+
fun build(): HoldAdjustmentAction =
418+
HoldAdjustmentAction(
421419
checkRequired("mode", mode),
422420
checkRequired("type", type),
423421
checkRequired("value", value),
@@ -436,7 +434,7 @@ private constructor(
436434
* @throws LithicInvalidDataException if any value type in this object doesn't match its
437435
* expected type.
438436
*/
439-
fun validate(): Adjustment = apply {
437+
fun validate(): HoldAdjustmentAction = apply {
440438
if (validated) {
441439
return@apply
442440
}
@@ -754,7 +752,7 @@ private constructor(
754752
return true
755753
}
756754

757-
return other is Adjustment &&
755+
return other is HoldAdjustmentAction &&
758756
mode == other.mode &&
759757
type == other.type &&
760758
value == other.value &&
@@ -766,7 +764,7 @@ private constructor(
766764
override fun hashCode(): Int = hashCode
767765

768766
override fun toString() =
769-
"Adjustment{mode=$mode, type=$type, value=$value, additionalProperties=$additionalProperties}"
767+
"HoldAdjustmentAction{mode=$mode, type=$type, value=$value, additionalProperties=$additionalProperties}"
770768
}
771769

772770
class Condition
@@ -2521,15 +2519,15 @@ private constructor(
25212519
}
25222520

25232521
return other is ConditionalAuthorizationAdjustmentParameters &&
2524-
adjustment == other.adjustment &&
2522+
action == other.action &&
25252523
conditions == other.conditions &&
25262524
additionalProperties == other.additionalProperties
25272525
}
25282526

2529-
private val hashCode: Int by lazy { Objects.hash(adjustment, conditions, additionalProperties) }
2527+
private val hashCode: Int by lazy { Objects.hash(action, conditions, additionalProperties) }
25302528

25312529
override fun hashCode(): Int = hashCode
25322530

25332531
override fun toString() =
2534-
"ConditionalAuthorizationAdjustmentParameters{adjustment=$adjustment, conditions=$conditions, additionalProperties=$additionalProperties}"
2532+
"ConditionalAuthorizationAdjustmentParameters{action=$action, conditions=$conditions, additionalProperties=$additionalProperties}"
25352533
}

lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAuthorizationAdjustmentParametersTest.kt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ internal class ConditionalAuthorizationAdjustmentParametersTest {
1313
fun create() {
1414
val conditionalAuthorizationAdjustmentParameters =
1515
ConditionalAuthorizationAdjustmentParameters.builder()
16-
.adjustment(
17-
ConditionalAuthorizationAdjustmentParameters.Adjustment.builder()
16+
.action(
17+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.builder()
1818
.mode(
19-
ConditionalAuthorizationAdjustmentParameters.Adjustment.Mode
19+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.Mode
2020
.REPLACE_WITH_AMOUNT
2121
)
2222
.type(
23-
ConditionalAuthorizationAdjustmentParameters.Adjustment.Type
23+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.Type
2424
.HOLD_ADJUSTMENT
2525
)
2626
.value(0L)
@@ -60,15 +60,16 @@ internal class ConditionalAuthorizationAdjustmentParametersTest {
6060
)
6161
.build()
6262

63-
assertThat(conditionalAuthorizationAdjustmentParameters.adjustment())
63+
assertThat(conditionalAuthorizationAdjustmentParameters.action())
6464
.isEqualTo(
65-
ConditionalAuthorizationAdjustmentParameters.Adjustment.builder()
65+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.builder()
6666
.mode(
67-
ConditionalAuthorizationAdjustmentParameters.Adjustment.Mode
67+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.Mode
6868
.REPLACE_WITH_AMOUNT
6969
)
7070
.type(
71-
ConditionalAuthorizationAdjustmentParameters.Adjustment.Type.HOLD_ADJUSTMENT
71+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.Type
72+
.HOLD_ADJUSTMENT
7273
)
7374
.value(0L)
7475
.build()
@@ -107,14 +108,14 @@ internal class ConditionalAuthorizationAdjustmentParametersTest {
107108
val jsonMapper = jsonMapper()
108109
val conditionalAuthorizationAdjustmentParameters =
109110
ConditionalAuthorizationAdjustmentParameters.builder()
110-
.adjustment(
111-
ConditionalAuthorizationAdjustmentParameters.Adjustment.builder()
111+
.action(
112+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.builder()
112113
.mode(
113-
ConditionalAuthorizationAdjustmentParameters.Adjustment.Mode
114+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.Mode
114115
.REPLACE_WITH_AMOUNT
115116
)
116117
.type(
117-
ConditionalAuthorizationAdjustmentParameters.Adjustment.Type
118+
ConditionalAuthorizationAdjustmentParameters.HoldAdjustmentAction.Type
118119
.HOLD_ADJUSTMENT
119120
)
120121
.value(0L)

0 commit comments

Comments
 (0)