From 98eeb9a7a085f1b28aeeacf4a713042bbfa54b6b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 21:38:44 +0000 Subject: [PATCH 1/3] perf(internal): make formatting faster Running the formatter through Spotless is slow because Spotless synchronously runs the formatter on each file. Running the formatter directly parallelizes the formatting across cores. --- .gitignore | 2 +- build.gradle.kts | 13 +++ buildSrc/build.gradle.kts | 1 - .../src/main/kotlin/increase.java.gradle.kts | 94 ++++++++++++++++--- .../main/kotlin/increase.kotlin.gradle.kts | 82 ++++++++++++++-- scripts/build | 8 ++ scripts/format | 4 +- scripts/lint | 4 +- 8 files changed, 183 insertions(+), 25 deletions(-) create mode 100755 scripts/build diff --git a/.gitignore b/.gitignore index 4e81838d6..b1346e6d1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,6 @@ .gradle .idea .kotlin -build +build/ codegen.log kls_database.db diff --git a/build.gradle.kts b/build.gradle.kts index b389ea4a1..9caa1bc4d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,6 +11,19 @@ allprojects { version = "0.280.0" // x-release-please-version } +subprojects { + // These are populated with dependencies by `buildSrc` scripts. + tasks.register("format") { + group = "Verification" + description = "Formats all source files." + } + tasks.register("lint") { + group = "Verification" + description = "Verifies all source files are formatted." + } + apply(plugin = "org.jetbrains.dokka") +} + subprojects { apply(plugin = "org.jetbrains.dokka") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 778c89de5..c6dc92ec5 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -10,7 +10,6 @@ repositories { } dependencies { - implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/increase.java.gradle.kts b/buildSrc/src/main/kotlin/increase.java.gradle.kts index dfbacb86e..70fc33f41 100644 --- a/buildSrc/src/main/kotlin/increase.java.gradle.kts +++ b/buildSrc/src/main/kotlin/increase.java.gradle.kts @@ -1,24 +1,13 @@ -import com.diffplug.gradle.spotless.SpotlessExtension import org.gradle.api.tasks.testing.logging.TestExceptionFormat plugins { `java-library` - id("com.diffplug.spotless") } repositories { mavenCentral() } -configure { - java { - importOrder() - removeUnusedImports() - palantirJavaFormat() - toggleOffOn() - } -} - java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) @@ -53,3 +42,86 @@ tasks.withType().configureEach { exceptionFormat = TestExceptionFormat.FULL } } + +val palantir by configurations.creating +dependencies { + palantir("com.palantir.javaformat:palantir-java-format:2.73.0") +} + +fun registerPalantir( + name: String, + description: String, +) { + val javaName = "${name}Java" + tasks.register(javaName) { + group = "Verification" + this.description = description + + classpath = palantir + mainClass = "com.palantir.javaformat.java.Main" + + // Avoid an `IllegalAccessError` on Java 9+. + jvmArgs( + "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", + ) + + // Use paths relative to the current module. + val argumentFile = + project.layout.buildDirectory.file("palantir-$name-args.txt").get().asFile + val lastRunTimeFile = + project.layout.buildDirectory.file("palantir-$name-last-run.txt").get().asFile + + // Read the time when this task was last executed for this module (if ever). + val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L + + // Use a `fileTree` relative to the module's source directory. + val javaFiles = project.fileTree("src") { include("**/*.java") } + + // Determine if any files need to be formatted or linted and continue only if there is at least + // one file. + onlyIf { javaFiles.any { it.lastModified() > lastRunTime } } + + inputs.files(javaFiles) + + doFirst { + // Create the argument file and set the preferred formatting style. + argumentFile.parentFile.mkdirs() + argumentFile.writeText("--palantir\n") + + if (name == "lint") { + // For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of + // the default 0) if any files need to be formatted, indicating that linting has failed. + argumentFile.appendText("--dry-run\n") + argumentFile.appendText("--set-exit-if-changed\n") + } else { + // `--dry-run` and `--replace` (for in-place formatting) are mutually exclusive. + argumentFile.appendText("--replace\n") + } + + // Write the modified files to the argument file. + javaFiles.filter { it.lastModified() > lastRunTime } + .forEach { argumentFile.appendText("${it.absolutePath}\n") } + } + + doLast { + // Record the last execution time for later up-to-date checking. + lastRunTimeFile.writeText(System.currentTimeMillis().toString()) + } + + // Pass the argument file using the @ symbol + args = listOf("@${argumentFile.absolutePath}") + + outputs.upToDateWhen { javaFiles.none { it.lastModified() > lastRunTime } } + } + + tasks.named(name) { + dependsOn(tasks.named(javaName)) + } +} + +registerPalantir(name = "format", description = "Formats all Java source files.") +registerPalantir(name = "lint", description = "Verifies all Java source files are formatted.") diff --git a/buildSrc/src/main/kotlin/increase.kotlin.gradle.kts b/buildSrc/src/main/kotlin/increase.kotlin.gradle.kts index 0fa82ddc4..f55a8f384 100644 --- a/buildSrc/src/main/kotlin/increase.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/increase.kotlin.gradle.kts @@ -1,4 +1,3 @@ -import com.diffplug.gradle.spotless.SpotlessExtension import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinVersion @@ -7,6 +6,10 @@ plugins { kotlin("jvm") } +repositories { + mavenCentral() +} + kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(21)) @@ -27,14 +30,77 @@ kotlin { } } -configure { - kotlin { - ktfmt().kotlinlangStyle() - toggleOffOn() - } -} - tasks.withType().configureEach { systemProperty("junit.jupiter.execution.parallel.enabled", true) systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent") } + +val ktfmt by configurations.creating +dependencies { + ktfmt("com.facebook:ktfmt:0.56") +} + +fun registerKtfmt( + name: String, + description: String, +) { + val kotlinName = "${name}Kotlin" + tasks.register(kotlinName) { + group = "Verification" + this.description = description + + classpath = ktfmt + mainClass = "com.facebook.ktfmt.cli.Main" + + // Use paths relative to the current module. + val argumentFile = project.layout.buildDirectory.file("ktfmt-$name-args.txt").get().asFile + val lastRunTimeFile = + project.layout.buildDirectory.file("ktfmt-$name-last-run.txt").get().asFile + + // Read the time when this task was last executed for this module (if ever). + val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L + + // Use a `fileTree` relative to the module's source directory. + val kotlinFiles = project.fileTree("src") { include("**/*.kt") } + + // Determine if any files need to be formatted or linted and continue only if there is at least + // one file (otherwise Ktfmt will fail). + onlyIf { kotlinFiles.any { it.lastModified() > lastRunTime } } + + inputs.files(kotlinFiles) + + doFirst { + // Create the argument file and set the preferred formatting style. + argumentFile.parentFile.mkdirs() + argumentFile.writeText("--kotlinlang-style\n") + + if (name == "lint") { + // For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of + // the default 0) if any files need to be formatted, indicating that linting has failed. + argumentFile.appendText("--dry-run\n") + argumentFile.appendText("--set-exit-if-changed\n") + } + + // Write the modified files to the argument file. + kotlinFiles.filter { it.lastModified() > lastRunTime } + .forEach { argumentFile.appendText("${it.absolutePath}\n") } + } + + doLast { + // Record the last execution time for later up-to-date checking. + lastRunTimeFile.writeText(System.currentTimeMillis().toString()) + } + + // Pass the argument file using the @ symbol + args = listOf("@${argumentFile.absolutePath}") + + outputs.upToDateWhen { kotlinFiles.none { it.lastModified() > lastRunTime } } + } + + tasks.named(name) { + dependsOn(tasks.named(kotlinName)) + } +} + +registerKtfmt(name = "format", description = "Formats all Kotlin source files.") +registerKtfmt(name = "lint", description = "Verifies all Kotlin source files are formatted.") diff --git a/scripts/build b/scripts/build new file mode 100755 index 000000000..f40634826 --- /dev/null +++ b/scripts/build @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Building classes" +./gradlew build testClasses -x test diff --git a/scripts/format b/scripts/format index 456a69db9..7c0be4d57 100755 --- a/scripts/format +++ b/scripts/format @@ -4,5 +4,5 @@ set -e cd "$(dirname "$0")/.." -echo "==> Running spotlessApply" -./gradlew spotlessApply +echo "==> Running formatters" +./gradlew format diff --git a/scripts/lint b/scripts/lint index e3a5f5e24..aea8af713 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,5 +4,5 @@ set -e cd "$(dirname "$0")/.." -echo "==> Build classes" -./gradlew build testClasses -x test +echo "==> Running lints" +./gradlew lint From 4cf2d0ea27d88667340a037d96d33f84f1b8b77b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 05:57:10 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 4 +- .../EntityCreateBeneficialOwnerParams.kt | 91 +++++++++---------- .../api/models/entities/EntityCreateParams.kt | 89 +++++++++--------- ...ntityUpdateBeneficialOwnerAddressParams.kt | 82 ++++++++--------- .../EntityCreateBeneficialOwnerParamsTest.kt | 9 +- .../models/entities/EntityCreateParamsTest.kt | 6 +- ...yUpdateBeneficialOwnerAddressParamsTest.kt | 9 +- .../services/async/EntityServiceAsyncTest.kt | 6 +- .../services/blocking/EntityServiceTest.kt | 6 +- 9 files changed, 153 insertions(+), 149 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4e2a1cd4e..c3a436da3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 202 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-86536168d84b951766d3c56adf7b371f15e15de83fff1de4b8052f55bb98034d.yml -openapi_spec_hash: 28053671bf8df1b93086dbe6123f8163 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-06c4af41ee358cc77681ee9eb3e3997fb985c94baa60639f3b21bba1a73dd990.yml +openapi_spec_hash: 636b35479a21d9be089b2d9b95646ba9 config_hash: a185e9a72778cc4658ea73fb3a7f1354 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt index 1b5363e11..2a69786ee 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt @@ -1029,9 +1029,9 @@ private constructor( */ class Address private constructor( + private val city: JsonField, private val country: JsonField, private val line1: JsonField, - private val city: JsonField, private val line2: JsonField, private val state: JsonField, private val zip: JsonField, @@ -1040,15 +1040,15 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - city: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), @@ -1056,34 +1056,34 @@ private constructor( @ExcludeMissing state: JsonField = JsonMissing.of(), @JsonProperty("zip") @ExcludeMissing zip: JsonField = JsonMissing.of(), - ) : this(country, line1, city, line2, state, zip, mutableMapOf()) + ) : this(city, country, line1, line2, state, zip, mutableMapOf()) /** - * The two-letter ISO 3166-1 alpha-2 code for the country of the address. + * The city, district, town, or village of the address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an * unexpected value). */ - fun country(): String = country.getRequired("country") + fun city(): String = city.getRequired("city") /** - * The first line of the address. This is usually the street number and street. + * The two-letter ISO 3166-1 alpha-2 code for the country of the address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an * unexpected value). */ - fun line1(): String = line1.getRequired("line1") + fun country(): String = country.getRequired("country") /** - * The city, district, town, or village of the address. Required in certain - * countries. + * The first line of the address. This is usually the street number and street. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun city(): Optional = city.getOptional("city") + fun line1(): String = line1.getRequired("line1") /** * The second line of the address. This might be the floor or room number. @@ -1110,6 +1110,14 @@ private constructor( */ fun zip(): Optional = zip.getOptional("zip") + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** * Returns the raw JSON value of [country]. * @@ -1126,14 +1134,6 @@ private constructor( */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 - /** - * Returns the raw JSON value of [city]. - * - * Unlike [city], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city - /** * Returns the raw JSON value of [line2]. * @@ -1176,6 +1176,7 @@ private constructor( * * The following fields are required: * ```java + * .city() * .country() * .line1() * ``` @@ -1186,9 +1187,9 @@ private constructor( /** A builder for [Address]. */ class Builder internal constructor() { + private var city: JsonField? = null private var country: JsonField? = null private var line1: JsonField? = null - private var city: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() private var state: JsonField = JsonMissing.of() private var zip: JsonField = JsonMissing.of() @@ -1196,15 +1197,27 @@ private constructor( @JvmSynthetic internal fun from(address: Address) = apply { + city = address.city country = address.country line1 = address.line1 - city = address.city line2 = address.line2 state = address.state zip = address.zip additionalProperties = address.additionalProperties.toMutableMap() } + /** The city, district, town, or village of the address. */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + /** The two-letter ISO 3166-1 alpha-2 code for the country of the address. */ fun country(country: String) = country(JsonField.of(country)) @@ -1231,21 +1244,6 @@ private constructor( */ fun line1(line1: JsonField) = apply { this.line1 = line1 } - /** - * The city, district, town, or village of the address. Required in certain - * countries. - */ - fun city(city: String) = city(JsonField.of(city)) - - /** - * Sets [Builder.city] to an arbitrary JSON value. - * - * You should usually call [Builder.city] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun city(city: JsonField) = apply { this.city = city } - /** The second line of the address. This might be the floor or room number. */ fun line2(line2: String) = line2(JsonField.of(line2)) @@ -1314,6 +1312,7 @@ private constructor( * * The following fields are required: * ```java + * .city() * .country() * .line1() * ``` @@ -1322,9 +1321,9 @@ private constructor( */ fun build(): Address = Address( + checkRequired("city", city), checkRequired("country", country), checkRequired("line1", line1), - city, line2, state, zip, @@ -1339,9 +1338,9 @@ private constructor( return@apply } + city() country() line1() - city() line2() state() zip() @@ -1364,9 +1363,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (country.asKnown().isPresent) 1 else 0) + + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + (if (line1.asKnown().isPresent) 1 else 0) + - (if (city.asKnown().isPresent) 1 else 0) + (if (line2.asKnown().isPresent) 1 else 0) + (if (state.asKnown().isPresent) 1 else 0) + (if (zip.asKnown().isPresent) 1 else 0) @@ -1377,9 +1376,9 @@ private constructor( } return other is Address && + city == other.city && country == other.country && line1 == other.line1 && - city == other.city && line2 == other.line2 && state == other.state && zip == other.zip && @@ -1387,13 +1386,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(country, line1, city, line2, state, zip, additionalProperties) + Objects.hash(city, country, line1, line2, state, zip, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Address{country=$country, line1=$line1, city=$city, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}" + "Address{city=$city, country=$country, line1=$line1, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}" } /** A means of verifying the person's identity. */ diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateParams.kt index 833f34338..580a4b5af 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateParams.kt @@ -2652,9 +2652,9 @@ private constructor( */ class Address private constructor( + private val city: JsonField, private val country: JsonField, private val line1: JsonField, - private val city: JsonField, private val line2: JsonField, private val state: JsonField, private val zip: JsonField, @@ -2663,15 +2663,15 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("city") + @ExcludeMissing + city: JsonField = JsonMissing.of(), @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), - @JsonProperty("city") - @ExcludeMissing - city: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), @@ -2681,34 +2681,34 @@ private constructor( @JsonProperty("zip") @ExcludeMissing zip: JsonField = JsonMissing.of(), - ) : this(country, line1, city, line2, state, zip, mutableMapOf()) + ) : this(city, country, line1, line2, state, zip, mutableMapOf()) /** - * The two-letter ISO 3166-1 alpha-2 code for the country of the address. + * The city, district, town, or village of the address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an * unexpected value). */ - fun country(): String = country.getRequired("country") + fun city(): String = city.getRequired("city") /** - * The first line of the address. This is usually the street number and street. + * The two-letter ISO 3166-1 alpha-2 code for the country of the address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an * unexpected value). */ - fun line1(): String = line1.getRequired("line1") + fun country(): String = country.getRequired("country") /** - * The city, district, town, or village of the address. Required in certain - * countries. + * The first line of the address. This is usually the street number and street. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). */ - fun city(): Optional = city.getOptional("city") + fun line1(): String = line1.getRequired("line1") /** * The second line of the address. This might be the floor or room number. @@ -2735,6 +2735,14 @@ private constructor( */ fun zip(): Optional = zip.getOptional("zip") + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** * Returns the raw JSON value of [country]. * @@ -2753,14 +2761,6 @@ private constructor( */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 - /** - * Returns the raw JSON value of [city]. - * - * Unlike [city], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city - /** * Returns the raw JSON value of [line2]. * @@ -2804,6 +2804,7 @@ private constructor( * * The following fields are required: * ```java + * .city() * .country() * .line1() * ``` @@ -2814,9 +2815,9 @@ private constructor( /** A builder for [Address]. */ class Builder internal constructor() { + private var city: JsonField? = null private var country: JsonField? = null private var line1: JsonField? = null - private var city: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() private var state: JsonField = JsonMissing.of() private var zip: JsonField = JsonMissing.of() @@ -2825,15 +2826,27 @@ private constructor( @JvmSynthetic internal fun from(address: Address) = apply { + city = address.city country = address.country line1 = address.line1 - city = address.city line2 = address.line2 state = address.state zip = address.zip additionalProperties = address.additionalProperties.toMutableMap() } + /** The city, district, town, or village of the address. */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + /** * The two-letter ISO 3166-1 alpha-2 code for the country of the address. */ @@ -2863,21 +2876,6 @@ private constructor( */ fun line1(line1: JsonField) = apply { this.line1 = line1 } - /** - * The city, district, town, or village of the address. Required in certain - * countries. - */ - fun city(city: String) = city(JsonField.of(city)) - - /** - * Sets [Builder.city] to an arbitrary JSON value. - * - * You should usually call [Builder.city] with a well-typed [String] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun city(city: JsonField) = apply { this.city = city } - /** * The second line of the address. This might be the floor or room number. */ @@ -2949,6 +2947,7 @@ private constructor( * * The following fields are required: * ```java + * .city() * .country() * .line1() * ``` @@ -2957,9 +2956,9 @@ private constructor( */ fun build(): Address = Address( + checkRequired("city", city), checkRequired("country", country), checkRequired("line1", line1), - city, line2, state, zip, @@ -2974,9 +2973,9 @@ private constructor( return@apply } + city() country() line1() - city() line2() state() zip() @@ -2999,9 +2998,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (country.asKnown().isPresent) 1 else 0) + + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + (if (line1.asKnown().isPresent) 1 else 0) + - (if (city.asKnown().isPresent) 1 else 0) + (if (line2.asKnown().isPresent) 1 else 0) + (if (state.asKnown().isPresent) 1 else 0) + (if (zip.asKnown().isPresent) 1 else 0) @@ -3012,9 +3011,9 @@ private constructor( } return other is Address && + city == other.city && country == other.country && line1 == other.line1 && - city == other.city && line2 == other.line2 && state == other.state && zip == other.zip && @@ -3022,13 +3021,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(country, line1, city, line2, state, zip, additionalProperties) + Objects.hash(city, country, line1, line2, state, zip, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Address{country=$country, line1=$line1, city=$city, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}" + "Address{city=$city, country=$country, line1=$line1, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}" } /** A means of verifying the person's identity. */ diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParams.kt index 031f9d6e2..22ffc1cd6 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParams.kt @@ -534,9 +534,9 @@ private constructor( */ class Address private constructor( + private val city: JsonField, private val country: JsonField, private val line1: JsonField, - private val city: JsonField, private val line2: JsonField, private val state: JsonField, private val zip: JsonField, @@ -545,37 +545,37 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), - @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), @JsonProperty("zip") @ExcludeMissing zip: JsonField = JsonMissing.of(), - ) : this(country, line1, city, line2, state, zip, mutableMapOf()) + ) : this(city, country, line1, line2, state, zip, mutableMapOf()) /** - * The two-letter ISO 3166-1 alpha-2 code for the country of the address. + * The city, district, town, or village of the address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun country(): String = country.getRequired("country") + fun city(): String = city.getRequired("city") /** - * The first line of the address. This is usually the street number and street. + * The two-letter ISO 3166-1 alpha-2 code for the country of the address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun line1(): String = line1.getRequired("line1") + fun country(): String = country.getRequired("country") /** - * The city, district, town, or village of the address. Required in certain countries. + * The first line of the address. This is usually the street number and street. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun city(): Optional = city.getOptional("city") + fun line1(): String = line1.getRequired("line1") /** * The second line of the address. This might be the floor or room number. @@ -602,6 +602,13 @@ private constructor( */ fun zip(): Optional = zip.getOptional("zip") + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + /** * Returns the raw JSON value of [country]. * @@ -616,13 +623,6 @@ private constructor( */ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 - /** - * Returns the raw JSON value of [city]. - * - * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city - /** * Returns the raw JSON value of [line2]. * @@ -663,6 +663,7 @@ private constructor( * * The following fields are required: * ```java + * .city() * .country() * .line1() * ``` @@ -673,9 +674,9 @@ private constructor( /** A builder for [Address]. */ class Builder internal constructor() { + private var city: JsonField? = null private var country: JsonField? = null private var line1: JsonField? = null - private var city: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() private var state: JsonField = JsonMissing.of() private var zip: JsonField = JsonMissing.of() @@ -683,15 +684,27 @@ private constructor( @JvmSynthetic internal fun from(address: Address) = apply { + city = address.city country = address.country line1 = address.line1 - city = address.city line2 = address.line2 state = address.state zip = address.zip additionalProperties = address.additionalProperties.toMutableMap() } + /** The city, district, town, or village of the address. */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun city(city: JsonField) = apply { this.city = city } + /** The two-letter ISO 3166-1 alpha-2 code for the country of the address. */ fun country(country: String) = country(JsonField.of(country)) @@ -716,20 +729,6 @@ private constructor( */ fun line1(line1: JsonField) = apply { this.line1 = line1 } - /** - * The city, district, town, or village of the address. Required in certain countries. - */ - fun city(city: String) = city(JsonField.of(city)) - - /** - * Sets [Builder.city] to an arbitrary JSON value. - * - * You should usually call [Builder.city] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun city(city: JsonField) = apply { this.city = city } - /** The second line of the address. This might be the floor or room number. */ fun line2(line2: String) = line2(JsonField.of(line2)) @@ -795,6 +794,7 @@ private constructor( * * The following fields are required: * ```java + * .city() * .country() * .line1() * ``` @@ -803,9 +803,9 @@ private constructor( */ fun build(): Address = Address( + checkRequired("city", city), checkRequired("country", country), checkRequired("line1", line1), - city, line2, state, zip, @@ -820,9 +820,9 @@ private constructor( return@apply } + city() country() line1() - city() line2() state() zip() @@ -845,9 +845,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (country.asKnown().isPresent) 1 else 0) + + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + (if (line1.asKnown().isPresent) 1 else 0) + - (if (city.asKnown().isPresent) 1 else 0) + (if (line2.asKnown().isPresent) 1 else 0) + (if (state.asKnown().isPresent) 1 else 0) + (if (zip.asKnown().isPresent) 1 else 0) @@ -858,9 +858,9 @@ private constructor( } return other is Address && + city == other.city && country == other.country && line1 == other.line1 && - city == other.city && line2 == other.line2 && state == other.state && zip == other.zip && @@ -868,13 +868,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(country, line1, city, line2, state, zip, additionalProperties) + Objects.hash(city, country, line1, line2, state, zip, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Address{country=$country, line1=$line1, city=$city, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}" + "Address{city=$city, country=$country, line1=$line1, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt index 76bd8a69b..383205c60 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt @@ -19,9 +19,9 @@ internal class EntityCreateBeneficialOwnerParamsTest { .address( EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -98,6 +98,7 @@ internal class EntityCreateBeneficialOwnerParamsTest { EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual .Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") .build() @@ -143,9 +144,9 @@ internal class EntityCreateBeneficialOwnerParamsTest { EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual .Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -222,9 +223,9 @@ internal class EntityCreateBeneficialOwnerParamsTest { .address( EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -300,6 +301,7 @@ internal class EntityCreateBeneficialOwnerParamsTest { EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual .Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") .build() @@ -337,6 +339,7 @@ internal class EntityCreateBeneficialOwnerParamsTest { .address( EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") .build() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateParamsTest.kt index aaee860f5..add6e3334 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateParamsTest.kt @@ -32,9 +32,9 @@ internal class EntityCreateParamsTest { EntityCreateParams.Corporation.BeneficialOwner.Individual .Address .builder() + .city("New York") .country("x") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -418,9 +418,9 @@ internal class EntityCreateParamsTest { .Individual .Address .builder() + .city("New York") .country("x") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -819,9 +819,9 @@ internal class EntityCreateParamsTest { EntityCreateParams.Corporation.BeneficialOwner.Individual .Address .builder() + .city("New York") .country("x") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParamsTest.kt index 952f1cb11..a1ec63b30 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateBeneficialOwnerAddressParamsTest.kt @@ -13,9 +13,9 @@ internal class EntityUpdateBeneficialOwnerAddressParamsTest { .entityId("entity_n8y8tnk2p9339ti393yi") .address( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("Unit 2") .state("NY") .zip("10045") @@ -32,6 +32,7 @@ internal class EntityUpdateBeneficialOwnerAddressParamsTest { .entityId("entity_n8y8tnk2p9339ti393yi") .address( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") .build() @@ -51,9 +52,9 @@ internal class EntityUpdateBeneficialOwnerAddressParamsTest { .entityId("entity_n8y8tnk2p9339ti393yi") .address( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("Unit 2") .state("NY") .zip("10045") @@ -67,9 +68,9 @@ internal class EntityUpdateBeneficialOwnerAddressParamsTest { assertThat(body.address()) .isEqualTo( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("Unit 2") .state("NY") .zip("10045") @@ -86,6 +87,7 @@ internal class EntityUpdateBeneficialOwnerAddressParamsTest { .entityId("entity_n8y8tnk2p9339ti393yi") .address( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") .build() @@ -98,6 +100,7 @@ internal class EntityUpdateBeneficialOwnerAddressParamsTest { assertThat(body.address()) .isEqualTo( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") .build() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt index 797713325..d4deaa104 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt @@ -53,9 +53,9 @@ internal class EntityServiceAsyncTest { .Individual .Address .builder() + .city("New York") .country("x") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -559,9 +559,9 @@ internal class EntityServiceAsyncTest { EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual .Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -679,9 +679,9 @@ internal class EntityServiceAsyncTest { .entityId("entity_n8y8tnk2p9339ti393yi") .address( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("Unit 2") .state("NY") .zip("10045") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt index f1e527c80..b7858c6ad 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt @@ -53,9 +53,9 @@ internal class EntityServiceTest { .Individual .Address .builder() + .city("New York") .country("x") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -553,9 +553,9 @@ internal class EntityServiceTest { EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual .Address .builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("x") .state("NY") .zip("10045") @@ -671,9 +671,9 @@ internal class EntityServiceTest { .entityId("entity_n8y8tnk2p9339ti393yi") .address( EntityUpdateBeneficialOwnerAddressParams.Address.builder() + .city("New York") .country("US") .line1("33 Liberty Street") - .city("New York") .line2("Unit 2") .state("NY") .zip("10045") From 45df011c7ab99c260d05733eb6c94f9cbf61d261 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 05:57:37 +0000 Subject: [PATCH 3/3] release: 0.281.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f3620a283..b8478cb7b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.280.0" + ".": "0.281.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d15e3fa36..e701702a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.281.0 (2025-08-14) + +Full Changelog: [v0.280.0...v0.281.0](https://github.com/Increase/increase-java/compare/v0.280.0...v0.281.0) + +### Features + +* **api:** api update ([4cf2d0e](https://github.com/Increase/increase-java/commit/4cf2d0ea27d88667340a037d96d33f84f1b8b77b)) + + +### Performance Improvements + +* **internal:** make formatting faster ([98eeb9a](https://github.com/Increase/increase-java/commit/98eeb9a7a085f1b28aeeacf4a713042bbfa54b6b)) + ## 0.280.0 (2025-08-13) Full Changelog: [v0.279.0...v0.280.0](https://github.com/Increase/increase-java/compare/v0.279.0...v0.280.0) diff --git a/README.md b/README.md index ea64f5504..4fac724ce 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.280.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.280.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.280.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.281.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.281.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.281.0) @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe -The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.280.0). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.281.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ### Gradle ```kotlin -implementation("com.increase.api:increase-java:0.280.0") +implementation("com.increase.api:increase-java:0.281.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.280.0") com.increase.api increase-java - 0.280.0 + 0.281.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 9caa1bc4d..d291b7aa9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.280.0" // x-release-please-version + version = "0.281.0" // x-release-please-version } subprojects {