diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 842d1edb2..2f62033bd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.396.0" + ".": "0.397.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 4b965774e..55843fe6f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-a559a6a1a1f3781fad8db5bcb96c40b69a78b952d659395840accce782098e0c.yml openapi_spec_hash: 2ae62041468e5cf6fe653d65b1b7a58a -config_hash: 8a9bb9e2d5dd0ccc3e78ad59f924fd3c +config_hash: 3ccb2793be25ae0b15e05dc9ef5da09c diff --git a/CHANGELOG.md b/CHANGELOG.md index 887ad68e4..2a541be33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.397.0 (2026-01-16) + +Full Changelog: [v0.396.0...v0.397.0](https://github.com/Increase/increase-java/compare/v0.396.0...v0.397.0) + +### Features + +* **api:** api update ([d270889](https://github.com/Increase/increase-java/commit/d270889d3821b24bce29d3b74cc2b7472fbc7db1)) + + +### Chores + +* **internal:** clean up maven repo artifact script and add html documentation to repo root ([cf9cda9](https://github.com/Increase/increase-java/commit/cf9cda9e2963052c860047c6d6795ae977b52c0b)) + ## 0.396.0 (2026-01-14) Full Changelog: [v0.395.0...v0.396.0](https://github.com/Increase/increase-java/compare/v0.395.0...v0.396.0) diff --git a/README.md b/README.md index 8b57c83a4..05fc9e3e6 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.396.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.396.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.396.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.397.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.397.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.397.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.396.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.397.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.396.0") +implementation("com.increase.api:increase-java:0.397.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.396.0") com.increase.api increase-java - 0.396.0 + 0.397.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 83eb758c8..e8740e0b2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.396.0" // x-release-please-version + version = "0.397.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/handlers/EmptyHandler.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/handlers/EmptyHandler.kt new file mode 100644 index 000000000..017902e09 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/core/handlers/EmptyHandler.kt @@ -0,0 +1,12 @@ +@file:JvmName("EmptyHandler") + +package com.increase.api.core.handlers + +import com.increase.api.core.http.HttpResponse +import com.increase.api.core.http.HttpResponse.Handler + +@JvmSynthetic internal fun emptyHandler(): Handler = EmptyHandlerInternal + +private object EmptyHandlerInternal : Handler { + override fun handle(response: HttpResponse): Void? = null +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/events/UnwrapWebhookEvent.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/events/UnwrapWebhookEvent.kt new file mode 100644 index 000000000..a4f66d543 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/events/UnwrapWebhookEvent.kt @@ -0,0 +1,113 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.events + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.increase.api.core.ExcludeMissing +import com.increase.api.core.JsonValue +import com.increase.api.errors.IncreaseInvalidDataException +import java.util.Collections +import java.util.Objects + +class UnwrapWebhookEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor(private val additionalProperties: MutableMap) { + + @JsonCreator private constructor() : this(mutableMapOf()) + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [UnwrapWebhookEvent]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnwrapWebhookEvent]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(unwrapWebhookEvent: UnwrapWebhookEvent) = apply { + additionalProperties = unwrapWebhookEvent.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [UnwrapWebhookEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): UnwrapWebhookEvent = UnwrapWebhookEvent(additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): UnwrapWebhookEvent = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = 0 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is UnwrapWebhookEvent && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "UnwrapWebhookEvent{additionalProperties=$additionalProperties}" +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsync.kt index 129d1066e..6dbc606a4 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsync.kt @@ -5,10 +5,12 @@ package com.increase.api.services.async import com.increase.api.core.ClientOptions import com.increase.api.core.RequestOptions import com.increase.api.core.http.HttpResponseFor +import com.increase.api.errors.IncreaseInvalidDataException import com.increase.api.models.events.Event import com.increase.api.models.events.EventListPageAsync import com.increase.api.models.events.EventListParams import com.increase.api.models.events.EventRetrieveParams +import com.increase.api.models.events.UnwrapWebhookEvent import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -76,6 +78,13 @@ interface EventServiceAsync { fun list(requestOptions: RequestOptions): CompletableFuture = list(EventListParams.none(), requestOptions) + /** + * Unwraps a webhook event from its JSON representation. + * + * @throws IncreaseInvalidDataException if the body could not be parsed. + */ + fun unwrap(body: String): UnwrapWebhookEvent + /** A view of [EventServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsyncImpl.kt index ab2e1b434..3c4229241 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EventServiceAsyncImpl.kt @@ -15,11 +15,14 @@ import com.increase.api.core.http.HttpResponse.Handler import com.increase.api.core.http.HttpResponseFor import com.increase.api.core.http.parseable import com.increase.api.core.prepareAsync +import com.increase.api.errors.IncreaseInvalidDataException import com.increase.api.models.events.Event import com.increase.api.models.events.EventListPageAsync import com.increase.api.models.events.EventListPageResponse import com.increase.api.models.events.EventListParams import com.increase.api.models.events.EventRetrieveParams +import com.increase.api.models.events.UnwrapWebhookEvent +import com.increase.api.services.blocking.EventServiceImpl import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -50,6 +53,14 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie // get /events withRawResponse().list(params, requestOptions).thenApply { it.parse() } + /** + * Unwraps a webhook event from its JSON representation. + * + * @throws IncreaseInvalidDataException if the body could not be parsed. + */ + override fun unwrap(body: String): UnwrapWebhookEvent = + EventServiceImpl(clientOptions).unwrap(body) + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EventServiceAsync.WithRawResponse { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventService.kt index b5ef780ae..737406268 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventService.kt @@ -6,10 +6,12 @@ import com.google.errorprone.annotations.MustBeClosed import com.increase.api.core.ClientOptions import com.increase.api.core.RequestOptions import com.increase.api.core.http.HttpResponseFor +import com.increase.api.errors.IncreaseInvalidDataException import com.increase.api.models.events.Event import com.increase.api.models.events.EventListPage import com.increase.api.models.events.EventListParams import com.increase.api.models.events.EventRetrieveParams +import com.increase.api.models.events.UnwrapWebhookEvent import java.util.function.Consumer interface EventService { @@ -70,6 +72,13 @@ interface EventService { fun list(requestOptions: RequestOptions): EventListPage = list(EventListParams.none(), requestOptions) + /** + * Unwraps a webhook event from its JSON representation. + * + * @throws IncreaseInvalidDataException if the body could not be parsed. + */ + fun unwrap(body: String): UnwrapWebhookEvent + /** A view of [EventService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventServiceImpl.kt index 1d9737984..59c35d52b 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EventServiceImpl.kt @@ -2,6 +2,7 @@ package com.increase.api.services.blocking +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.increase.api.core.ClientOptions import com.increase.api.core.RequestOptions import com.increase.api.core.checkRequired @@ -15,11 +16,13 @@ import com.increase.api.core.http.HttpResponse.Handler import com.increase.api.core.http.HttpResponseFor import com.increase.api.core.http.parseable import com.increase.api.core.prepare +import com.increase.api.errors.IncreaseInvalidDataException import com.increase.api.models.events.Event import com.increase.api.models.events.EventListPage import com.increase.api.models.events.EventListPageResponse import com.increase.api.models.events.EventListParams import com.increase.api.models.events.EventRetrieveParams +import com.increase.api.models.events.UnwrapWebhookEvent import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -43,6 +46,18 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt // get /events withRawResponse().list(params, requestOptions).parse() + /** + * Unwraps a webhook event from its JSON representation. + * + * @throws IncreaseInvalidDataException if the body could not be parsed. + */ + override fun unwrap(body: String): UnwrapWebhookEvent = + try { + clientOptions.jsonMapper.readValue(body, jacksonTypeRef()) + } catch (e: Exception) { + throw IncreaseInvalidDataException("Error parsing body", e) + } + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EventService.WithRawResponse { diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/events/UnwrapWebhookEventTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/events/UnwrapWebhookEventTest.kt new file mode 100644 index 000000000..70b5c210f --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/events/UnwrapWebhookEventTest.kt @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.events + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.increase.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class UnwrapWebhookEventTest { + + @Test + fun create() { + val unwrapWebhookEvent = UnwrapWebhookEvent.builder().build() + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val unwrapWebhookEvent = UnwrapWebhookEvent.builder().build() + + val roundtrippedUnwrapWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(unwrapWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedUnwrapWebhookEvent).isEqualTo(unwrapWebhookEvent) + } +} diff --git a/scripts/upload-artifacts b/scripts/upload-artifacts index 729e6f222..df0c8d9ff 100755 --- a/scripts/upload-artifacts +++ b/scripts/upload-artifacts @@ -7,6 +7,8 @@ GREEN='\033[32m' RED='\033[31m' NC='\033[0m' # No Color +MAVEN_REPO_PATH="./build/local-maven-repo" + log_error() { local msg="$1" local headers="$2" @@ -24,7 +26,7 @@ upload_file() { if [ -f "$file_name" ]; then echo -e "${GREEN}Processing file: $file_name${NC}" - pkg_file_name="mvn${file_name#./build/local-maven-repo}" + pkg_file_name="mvn${file_name#"${MAVEN_REPO_PATH}"}" # Get signed URL for uploading artifact file signed_url_response=$(curl -X POST -G "$URL" \ @@ -47,6 +49,7 @@ upload_file() { md5|sha1|sha256|sha512) content_type="text/plain" ;; module) content_type="application/json" ;; pom|xml) content_type="application/xml" ;; + html) content_type="text/html" ;; *) content_type="application/octet-stream" ;; esac @@ -81,6 +84,41 @@ walk_tree() { done } +generate_instructions() { + cat << EOF > "$MAVEN_REPO_PATH/index.html" + + + + Maven Repo + + +

Stainless SDK Maven Repository

+

This is the Maven repository for your Stainless Java SDK build.

+ +

Directions

+

To use the uploaded Maven repository, add the following to your project's pom.xml:

+
<repositories>
+    <repository>
+        <id>stainless-sdk-repo</id>
+        <url>https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn</url>
+    </repository>
+</repositories>
+ +

If you're using Gradle, add the following to your build.gradle file:

+
repositories {
+    maven {
+        url 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'
+    }
+}
+ + +EOF + upload_file "${MAVEN_REPO_PATH}/index.html" + + echo "Configure maven or gradle to use the repo located at 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'" + echo "For more details, see the directions in https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn/index.html" +} + cd "$(dirname "$0")/.." echo "::group::Creating local Maven content" @@ -88,9 +126,9 @@ echo "::group::Creating local Maven content" echo "::endgroup::" echo "::group::Uploading to pkg.stainless.com" -walk_tree "./build/local-maven-repo" +walk_tree "$MAVEN_REPO_PATH" echo "::endgroup::" echo "::group::Generating instructions" -echo "Configure maven or gradle to use the repo located at 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'" +generate_instructions echo "::endgroup::"