Skip to content

Commit ff1495c

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): adds additional request types for updating an Auth Rule (#468)
- updates to documentation for Auth Rules - adds additional request types for updating Auth Rules - adds a delete method for Auth Rules
1 parent ac8eabd commit ff1495c

26 files changed

+1558
-499
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 153
1+
configured_endpoints: 154

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

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,14 @@ private constructor(
244244
fun value(value: JsonField<Value>) = apply { this.value = value }
245245

246246
/** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
247-
fun value(string: String) = value(Value.ofString(string))
247+
fun value(regex: String) = value(Value.ofRegex(regex))
248248

249249
/** A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
250-
fun value(integer: Long) = value(Value.ofInteger(integer))
250+
fun value(number: Long) = value(Value.ofNumber(number))
251251

252252
/** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
253-
fun valueOfStrings(strings: List<String>) = value(Value.ofStrings(strings))
253+
fun valueOfListOfStrings(listOfStrings: List<String>) =
254+
value(Value.ofListOfStrings(listOfStrings))
254255

255256
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
256257
this.additionalProperties.clear()
@@ -404,43 +405,43 @@ private constructor(
404405
@JsonSerialize(using = Value.Serializer::class)
405406
class Value
406407
private constructor(
407-
private val string: String? = null,
408-
private val integer: Long? = null,
409-
private val strings: List<String>? = null,
408+
private val regex: String? = null,
409+
private val number: Long? = null,
410+
private val listOfStrings: List<String>? = null,
410411
private val _json: JsonValue? = null,
411412
) {
412413

413414
/** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
414-
fun string(): Optional<String> = Optional.ofNullable(string)
415+
fun regex(): Optional<String> = Optional.ofNullable(regex)
415416

416417
/** A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
417-
fun integer(): Optional<Long> = Optional.ofNullable(integer)
418+
fun number(): Optional<Long> = Optional.ofNullable(number)
418419

419420
/** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
420-
fun strings(): Optional<List<String>> = Optional.ofNullable(strings)
421+
fun listOfStrings(): Optional<List<String>> = Optional.ofNullable(listOfStrings)
421422

422-
fun isString(): Boolean = string != null
423+
fun isRegex(): Boolean = regex != null
423424

424-
fun isInteger(): Boolean = integer != null
425+
fun isNumber(): Boolean = number != null
425426

426-
fun isStrings(): Boolean = strings != null
427+
fun isListOfStrings(): Boolean = listOfStrings != null
427428

428429
/** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
429-
fun asString(): String = string.getOrThrow("string")
430+
fun asRegex(): String = regex.getOrThrow("regex")
430431

431432
/** A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
432-
fun asInteger(): Long = integer.getOrThrow("integer")
433+
fun asNumber(): Long = number.getOrThrow("number")
433434

434435
/** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
435-
fun asStrings(): List<String> = strings.getOrThrow("strings")
436+
fun asListOfStrings(): List<String> = listOfStrings.getOrThrow("listOfStrings")
436437

437438
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
438439

439440
fun <T> accept(visitor: Visitor<T>): T {
440441
return when {
441-
string != null -> visitor.visitString(string)
442-
integer != null -> visitor.visitInteger(integer)
443-
strings != null -> visitor.visitStrings(strings)
442+
regex != null -> visitor.visitRegex(regex)
443+
number != null -> visitor.visitNumber(number)
444+
listOfStrings != null -> visitor.visitListOfStrings(listOfStrings)
444445
else -> visitor.unknown(_json)
445446
}
446447
}
@@ -454,11 +455,11 @@ private constructor(
454455

455456
accept(
456457
object : Visitor<Unit> {
457-
override fun visitString(string: String) {}
458+
override fun visitRegex(regex: String) {}
458459

459-
override fun visitInteger(integer: Long) {}
460+
override fun visitNumber(number: Long) {}
460461

461-
override fun visitStrings(strings: List<String>) {}
462+
override fun visitListOfStrings(listOfStrings: List<String>) {}
462463
}
463464
)
464465
validated = true
@@ -469,43 +470,44 @@ private constructor(
469470
return true
470471
}
471472

472-
return /* spotless:off */ other is Value && string == other.string && integer == other.integer && strings == other.strings /* spotless:on */
473+
return /* spotless:off */ other is Value && regex == other.regex && number == other.number && listOfStrings == other.listOfStrings /* spotless:on */
473474
}
474475

475-
override fun hashCode(): Int = /* spotless:off */ Objects.hash(string, integer, strings) /* spotless:on */
476+
override fun hashCode(): Int = /* spotless:off */ Objects.hash(regex, number, listOfStrings) /* spotless:on */
476477

477478
override fun toString(): String =
478479
when {
479-
string != null -> "Value{string=$string}"
480-
integer != null -> "Value{integer=$integer}"
481-
strings != null -> "Value{strings=$strings}"
480+
regex != null -> "Value{regex=$regex}"
481+
number != null -> "Value{number=$number}"
482+
listOfStrings != null -> "Value{listOfStrings=$listOfStrings}"
482483
_json != null -> "Value{_unknown=$_json}"
483484
else -> throw IllegalStateException("Invalid Value")
484485
}
485486

486487
companion object {
487488

488489
/** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
489-
@JvmStatic fun ofString(string: String) = Value(string = string)
490+
@JvmStatic fun ofRegex(regex: String) = Value(regex = regex)
490491

491492
/** A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
492-
@JvmStatic fun ofInteger(integer: Long) = Value(integer = integer)
493+
@JvmStatic fun ofNumber(number: Long) = Value(number = number)
493494

494495
/** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
495-
@JvmStatic fun ofStrings(strings: List<String>) = Value(strings = strings)
496+
@JvmStatic
497+
fun ofListOfStrings(listOfStrings: List<String>) = Value(listOfStrings = listOfStrings)
496498
}
497499

498500
/** An interface that defines how to map each variant of [Value] to a value of type [T]. */
499501
interface Visitor<out T> {
500502

501503
/** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
502-
fun visitString(string: String): T
504+
fun visitRegex(regex: String): T
503505

504506
/** A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
505-
fun visitInteger(integer: Long): T
507+
fun visitNumber(number: Long): T
506508

507509
/** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
508-
fun visitStrings(strings: List<String>): T
510+
fun visitListOfStrings(listOfStrings: List<String>): T
509511

510512
/**
511513
* Maps an unknown variant of [Value] to a value of type [T].
@@ -528,13 +530,13 @@ private constructor(
528530
val json = JsonValue.fromJsonNode(node)
529531

530532
tryDeserialize(node, jacksonTypeRef<String>())?.let {
531-
return Value(string = it, _json = json)
533+
return Value(regex = it, _json = json)
532534
}
533535
tryDeserialize(node, jacksonTypeRef<Long>())?.let {
534-
return Value(integer = it, _json = json)
536+
return Value(number = it, _json = json)
535537
}
536538
tryDeserialize(node, jacksonTypeRef<List<String>>())?.let {
537-
return Value(strings = it, _json = json)
539+
return Value(listOfStrings = it, _json = json)
538540
}
539541

540542
return Value(_json = json)
@@ -549,9 +551,9 @@ private constructor(
549551
provider: SerializerProvider
550552
) {
551553
when {
552-
value.string != null -> generator.writeObject(value.string)
553-
value.integer != null -> generator.writeObject(value.integer)
554-
value.strings != null -> generator.writeObject(value.strings)
554+
value.regex != null -> generator.writeObject(value.regex)
555+
value.number != null -> generator.writeObject(value.number)
556+
value.listOfStrings != null -> generator.writeObject(value.listOfStrings)
555557
value._json != null -> generator.writeObject(value._json)
556558
else -> throw IllegalStateException("Invalid Value")
557559
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import java.util.Objects
3131
import java.util.Optional
3232

3333
/**
34-
* Associates an authorization rules with a card program, the provided account(s) or card(s).
34+
* Associates a V2 authorization rule with a card program, the provided account(s) or card(s).
3535
*
36-
* This endpoint will replace any existing associations with the provided list of entities.
36+
* Prefer using the `PATCH` method for this operation.
3737
*/
3838
class AuthRuleV2ApplyParams
3939
private constructor(

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private constructor(
423423
/** Auth Rule Name */
424424
fun name(): Optional<String> = Optional.ofNullable(name.getNullable("name"))
425425

426-
/** Parameters for the current version of the Auth Rule */
426+
/** Parameters for the Auth Rule */
427427
fun parameters(): Optional<Parameters> =
428428
Optional.ofNullable(parameters.getNullable("parameters"))
429429

@@ -438,7 +438,7 @@ private constructor(
438438
/** Auth Rule Name */
439439
@JsonProperty("name") @ExcludeMissing fun _name(): JsonField<String> = name
440440

441-
/** Parameters for the current version of the Auth Rule */
441+
/** Parameters for the Auth Rule */
442442
@JsonProperty("parameters")
443443
@ExcludeMissing
444444
fun _parameters(): JsonField<Parameters> = parameters
@@ -525,19 +525,19 @@ private constructor(
525525
/** Auth Rule Name */
526526
fun name(name: JsonField<String>) = apply { this.name = name }
527527

528-
/** Parameters for the current version of the Auth Rule */
528+
/** Parameters for the Auth Rule */
529529
fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters))
530530

531-
/** Parameters for the current version of the Auth Rule */
531+
/** Parameters for the Auth Rule */
532532
fun parameters(parameters: JsonField<Parameters>) = apply {
533533
this.parameters = parameters
534534
}
535535

536-
/** Parameters for the current version of the Auth Rule */
536+
/** Parameters for the Auth Rule */
537537
fun parameters(conditionalBlock: ConditionalBlockParameters) =
538538
parameters(Parameters.ofConditionalBlock(conditionalBlock))
539539

540-
/** Parameters for the current version of the Auth Rule */
540+
/** Parameters for the Auth Rule */
541541
fun parameters(velocityLimitParams: VelocityLimitParams) =
542542
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
543543

@@ -576,7 +576,7 @@ private constructor(
576576
)
577577
}
578578

579-
/** Parameters for the current version of the Auth Rule */
579+
/** Parameters for the Auth Rule */
580580
@JsonDeserialize(using = Parameters.Deserializer::class)
581581
@JsonSerialize(using = Parameters.Serializer::class)
582582
class Parameters
@@ -872,7 +872,7 @@ private constructor(
872872
/** Auth Rule Name */
873873
fun name(): Optional<String> = Optional.ofNullable(name.getNullable("name"))
874874

875-
/** Parameters for the current version of the Auth Rule */
875+
/** Parameters for the Auth Rule */
876876
fun parameters(): Optional<Parameters> =
877877
Optional.ofNullable(parameters.getNullable("parameters"))
878878

@@ -887,7 +887,7 @@ private constructor(
887887
/** Auth Rule Name */
888888
@JsonProperty("name") @ExcludeMissing fun _name(): JsonField<String> = name
889889

890-
/** Parameters for the current version of the Auth Rule */
890+
/** Parameters for the Auth Rule */
891891
@JsonProperty("parameters")
892892
@ExcludeMissing
893893
fun _parameters(): JsonField<Parameters> = parameters
@@ -972,19 +972,19 @@ private constructor(
972972
/** Auth Rule Name */
973973
fun name(name: JsonField<String>) = apply { this.name = name }
974974

975-
/** Parameters for the current version of the Auth Rule */
975+
/** Parameters for the Auth Rule */
976976
fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters))
977977

978-
/** Parameters for the current version of the Auth Rule */
978+
/** Parameters for the Auth Rule */
979979
fun parameters(parameters: JsonField<Parameters>) = apply {
980980
this.parameters = parameters
981981
}
982982

983-
/** Parameters for the current version of the Auth Rule */
983+
/** Parameters for the Auth Rule */
984984
fun parameters(conditionalBlock: ConditionalBlockParameters) =
985985
parameters(Parameters.ofConditionalBlock(conditionalBlock))
986986

987-
/** Parameters for the current version of the Auth Rule */
987+
/** Parameters for the Auth Rule */
988988
fun parameters(velocityLimitParams: VelocityLimitParams) =
989989
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
990990

@@ -1023,7 +1023,7 @@ private constructor(
10231023
)
10241024
}
10251025

1026-
/** Parameters for the current version of the Auth Rule */
1026+
/** Parameters for the Auth Rule */
10271027
@JsonDeserialize(using = Parameters.Deserializer::class)
10281028
@JsonSerialize(using = Parameters.Serializer::class)
10291029
class Parameters
@@ -1326,7 +1326,7 @@ private constructor(
13261326
/** Auth Rule Name */
13271327
fun name(): Optional<String> = Optional.ofNullable(name.getNullable("name"))
13281328

1329-
/** Parameters for the current version of the Auth Rule */
1329+
/** Parameters for the Auth Rule */
13301330
fun parameters(): Optional<Parameters> =
13311331
Optional.ofNullable(parameters.getNullable("parameters"))
13321332

@@ -1346,7 +1346,7 @@ private constructor(
13461346
/** Auth Rule Name */
13471347
@JsonProperty("name") @ExcludeMissing fun _name(): JsonField<String> = name
13481348

1349-
/** Parameters for the current version of the Auth Rule */
1349+
/** Parameters for the Auth Rule */
13501350
@JsonProperty("parameters")
13511351
@ExcludeMissing
13521352
fun _parameters(): JsonField<Parameters> = parameters
@@ -1444,19 +1444,19 @@ private constructor(
14441444
/** Auth Rule Name */
14451445
fun name(name: JsonField<String>) = apply { this.name = name }
14461446

1447-
/** Parameters for the current version of the Auth Rule */
1447+
/** Parameters for the Auth Rule */
14481448
fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters))
14491449

1450-
/** Parameters for the current version of the Auth Rule */
1450+
/** Parameters for the Auth Rule */
14511451
fun parameters(parameters: JsonField<Parameters>) = apply {
14521452
this.parameters = parameters
14531453
}
14541454

1455-
/** Parameters for the current version of the Auth Rule */
1455+
/** Parameters for the Auth Rule */
14561456
fun parameters(conditionalBlock: ConditionalBlockParameters) =
14571457
parameters(Parameters.ofConditionalBlock(conditionalBlock))
14581458

1459-
/** Parameters for the current version of the Auth Rule */
1459+
/** Parameters for the Auth Rule */
14601460
fun parameters(velocityLimitParams: VelocityLimitParams) =
14611461
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
14621462

@@ -1496,7 +1496,7 @@ private constructor(
14961496
)
14971497
}
14981498

1499-
/** Parameters for the current version of the Auth Rule */
1499+
/** Parameters for the Auth Rule */
15001500
@JsonDeserialize(using = Parameters.Deserializer::class)
15011501
@JsonSerialize(using = Parameters.Serializer::class)
15021502
class Parameters

0 commit comments

Comments
 (0)