Skip to content

Commit 5339c9d

Browse files
feat(api): api update
1 parent 81a6f54 commit 5339c9d

File tree

5 files changed

+82
-9
lines changed

5 files changed

+82
-9
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: 202
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-c3c84498ed204ebe6297ac77700cd63bf1353915e4577508baabf8ed1e4201ae.yml
3-
openapi_spec_hash: e6cfa093a4bba7d0d1961515b0aed651
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-7f26440e2137fb4f39521c361e76d56bad7c56d81cd06d0677d7735e73f7c160.yml
3+
openapi_spec_hash: aa475d425f493e41eb8485ae17a3d0f9
44
config_hash: a185e9a72778cc4658ea73fb3a7f1354

increase-kotlin-core/src/main/kotlin/com/increase/api/models/accounts/AccountUpdateParams.kt

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ private constructor(
2929
/** The identifier of the Account to update. */
3030
fun accountId(): String? = accountId
3131

32+
/**
33+
* The new credit limit of the Account, if and only if the Account is a loan account.
34+
*
35+
* @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
36+
* server responded with an unexpected value).
37+
*/
38+
fun creditLimit(): Long? = body.creditLimit()
39+
3240
/**
3341
* The new name of the Account.
3442
*
@@ -37,6 +45,13 @@ private constructor(
3745
*/
3846
fun name(): String? = body.name()
3947

48+
/**
49+
* Returns the raw JSON value of [creditLimit].
50+
*
51+
* Unlike [creditLimit], this method doesn't throw if the JSON field has an unexpected type.
52+
*/
53+
fun _creditLimit(): JsonField<Long> = body._creditLimit()
54+
4055
/**
4156
* Returns the raw JSON value of [name].
4257
*
@@ -83,10 +98,23 @@ private constructor(
8398
*
8499
* This is generally only useful if you are already constructing the body separately.
85100
* Otherwise, it's more convenient to use the top-level setters instead:
101+
* - [creditLimit]
86102
* - [name]
87103
*/
88104
fun body(body: Body) = apply { this.body = body.toBuilder() }
89105

106+
/** The new credit limit of the Account, if and only if the Account is a loan account. */
107+
fun creditLimit(creditLimit: Long) = apply { body.creditLimit(creditLimit) }
108+
109+
/**
110+
* Sets [Builder.creditLimit] to an arbitrary JSON value.
111+
*
112+
* You should usually call [Builder.creditLimit] with a well-typed [Long] value instead.
113+
* This method is primarily for setting the field to an undocumented or not yet supported
114+
* value.
115+
*/
116+
fun creditLimit(creditLimit: JsonField<Long>) = apply { body.creditLimit(creditLimit) }
117+
90118
/** The new name of the Account. */
91119
fun name(name: String) = apply { body.name(name) }
92120

@@ -243,14 +271,26 @@ private constructor(
243271

244272
class Body
245273
private constructor(
274+
private val creditLimit: JsonField<Long>,
246275
private val name: JsonField<String>,
247276
private val additionalProperties: MutableMap<String, JsonValue>,
248277
) {
249278

250279
@JsonCreator
251280
private constructor(
252-
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of()
253-
) : this(name, mutableMapOf())
281+
@JsonProperty("credit_limit")
282+
@ExcludeMissing
283+
creditLimit: JsonField<Long> = JsonMissing.of(),
284+
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
285+
) : this(creditLimit, name, mutableMapOf())
286+
287+
/**
288+
* The new credit limit of the Account, if and only if the Account is a loan account.
289+
*
290+
* @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
291+
* the server responded with an unexpected value).
292+
*/
293+
fun creditLimit(): Long? = creditLimit.getNullable("credit_limit")
254294

255295
/**
256296
* The new name of the Account.
@@ -260,6 +300,15 @@ private constructor(
260300
*/
261301
fun name(): String? = name.getNullable("name")
262302

303+
/**
304+
* Returns the raw JSON value of [creditLimit].
305+
*
306+
* Unlike [creditLimit], this method doesn't throw if the JSON field has an unexpected type.
307+
*/
308+
@JsonProperty("credit_limit")
309+
@ExcludeMissing
310+
fun _creditLimit(): JsonField<Long> = creditLimit
311+
263312
/**
264313
* Returns the raw JSON value of [name].
265314
*
@@ -288,14 +337,30 @@ private constructor(
288337
/** A builder for [Body]. */
289338
class Builder internal constructor() {
290339

340+
private var creditLimit: JsonField<Long> = JsonMissing.of()
291341
private var name: JsonField<String> = JsonMissing.of()
292342
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
293343

294344
internal fun from(body: Body) = apply {
345+
creditLimit = body.creditLimit
295346
name = body.name
296347
additionalProperties = body.additionalProperties.toMutableMap()
297348
}
298349

350+
/**
351+
* The new credit limit of the Account, if and only if the Account is a loan account.
352+
*/
353+
fun creditLimit(creditLimit: Long) = creditLimit(JsonField.of(creditLimit))
354+
355+
/**
356+
* Sets [Builder.creditLimit] to an arbitrary JSON value.
357+
*
358+
* You should usually call [Builder.creditLimit] with a well-typed [Long] value instead.
359+
* This method is primarily for setting the field to an undocumented or not yet
360+
* supported value.
361+
*/
362+
fun creditLimit(creditLimit: JsonField<Long>) = apply { this.creditLimit = creditLimit }
363+
299364
/** The new name of the Account. */
300365
fun name(name: String) = name(JsonField.of(name))
301366

@@ -332,7 +397,7 @@ private constructor(
332397
*
333398
* Further updates to this [Builder] will not mutate the returned instance.
334399
*/
335-
fun build(): Body = Body(name, additionalProperties.toMutableMap())
400+
fun build(): Body = Body(creditLimit, name, additionalProperties.toMutableMap())
336401
}
337402

338403
private var validated: Boolean = false
@@ -342,6 +407,7 @@ private constructor(
342407
return@apply
343408
}
344409

410+
creditLimit()
345411
name()
346412
validated = true
347413
}
@@ -360,23 +426,25 @@ private constructor(
360426
*
361427
* Used for best match union deserialization.
362428
*/
363-
internal fun validity(): Int = (if (name.asKnown() == null) 0 else 1)
429+
internal fun validity(): Int =
430+
(if (creditLimit.asKnown() == null) 0 else 1) + (if (name.asKnown() == null) 0 else 1)
364431

365432
override fun equals(other: Any?): Boolean {
366433
if (this === other) {
367434
return true
368435
}
369436

370-
return /* spotless:off */ other is Body && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */
437+
return /* spotless:off */ other is Body && creditLimit == other.creditLimit && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */
371438
}
372439

373440
/* spotless:off */
374-
private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) }
441+
private val hashCode: Int by lazy { Objects.hash(creditLimit, name, additionalProperties) }
375442
/* spotless:on */
376443

377444
override fun hashCode(): Int = hashCode
378445

379-
override fun toString() = "Body{name=$name, additionalProperties=$additionalProperties}"
446+
override fun toString() =
447+
"Body{creditLimit=$creditLimit, name=$name, additionalProperties=$additionalProperties}"
380448
}
381449

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

increase-kotlin-core/src/test/kotlin/com/increase/api/models/accounts/AccountUpdateParamsTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ internal class AccountUpdateParamsTest {
1111
fun create() {
1212
AccountUpdateParams.builder()
1313
.accountId("account_in71c4amph0vgo2qllky")
14+
.creditLimit(0L)
1415
.name("My renamed account")
1516
.build()
1617
}
@@ -29,11 +30,13 @@ internal class AccountUpdateParamsTest {
2930
val params =
3031
AccountUpdateParams.builder()
3132
.accountId("account_in71c4amph0vgo2qllky")
33+
.creditLimit(0L)
3234
.name("My renamed account")
3335
.build()
3436

3537
val body = params._body()
3638

39+
assertThat(body.creditLimit()).isEqualTo(0L)
3740
assertThat(body.name()).isEqualTo("My renamed account")
3841
}
3942

increase-kotlin-core/src/test/kotlin/com/increase/api/services/async/AccountServiceAsyncTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ internal class AccountServiceAsyncTest {
6363
accountServiceAsync.update(
6464
AccountUpdateParams.builder()
6565
.accountId("account_in71c4amph0vgo2qllky")
66+
.creditLimit(0L)
6667
.name("My renamed account")
6768
.build()
6869
)

increase-kotlin-core/src/test/kotlin/com/increase/api/services/blocking/AccountServiceTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ internal class AccountServiceTest {
6363
accountService.update(
6464
AccountUpdateParams.builder()
6565
.accountId("account_in71c4amph0vgo2qllky")
66+
.creditLimit(0L)
6667
.name("My renamed account")
6768
.build()
6869
)

0 commit comments

Comments
 (0)