Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.290.0"
".": "0.291.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 215
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-ce8ac7ef645ad6089e9730ae2b44492a6a958a2abcc8bb50130c5ebd7ba1a390.yml
openapi_spec_hash: 90a27266ac1eeab3464f6825d8fd8650
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-3db2c20491e1218b324938f048e489f800270f608505ac2293f66d1691294f4f.yml
openapi_spec_hash: d821b4d13c8fc8257b34a544515e91f7
config_hash: 0b0a2503208283b283fc5bc6df6a07a5
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.291.0 (2025-08-20)

Full Changelog: [v0.290.0...v0.291.0](https://github.com/Increase/increase-java/compare/v0.290.0...v0.291.0)

### Features

* **api:** api update ([b36e5a2](https://github.com/Increase/increase-java/commit/b36e5a298e285fa6e7817b5b499498fde431f662))


### Chores

* **client:** refactor closing / shutdown ([d60429a](https://github.com/Increase/increase-java/commit/d60429a7493712e18d4fdd9f9ef3764b277dced6))
* **internal:** support running formatters directly ([320f9b0](https://github.com/Increase/increase-java/commit/320f9b0aeffa6ef5328d578e725d6dddb5d034c0))

## 0.290.0 (2025-08-20)

Full Changelog: [v0.289.1...v0.290.0](https://github.com/Increase/increase-java/compare/v0.289.1...v0.290.0)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![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.290.0)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.290.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.290.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.291.0)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.291.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.291.0)

<!-- x-release-please-end -->

Expand All @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe

<!-- x-release-please-start-version -->

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.290.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.291.0).

<!-- x-release-please-end -->

Expand All @@ -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.290.0")
implementation("com.increase.api:increase-java:0.291.0")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.290.0")
<dependency>
<groupId>com.increase.api</groupId>
<artifactId>increase-java</artifactId>
<version>0.290.0</version>
<version>0.291.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.increase.api"
version = "0.290.0" // x-release-please-version
version = "0.291.0" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class IncreaseOkHttpClient private constructor() {
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
*
* Defaults to a dedicated cached thread pool.
*
* This class takes ownership of the executor and shuts it down, if possible, when closed.
*/
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class IncreaseOkHttpClientAsync private constructor() {
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
*
* Defaults to a dedicated cached thread pool.
*
* This class takes ownership of the executor and shuts it down, if possible, when closed.
*/
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa

override fun simulations(): SimulationServiceAsync = simulations

override fun close() = clientOptions.httpClient.close()
override fun close() = clientOptions.close()

class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
IncreaseClientAsync.WithRawResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli

override fun simulations(): SimulationService = simulations

override fun close() = clientOptions.httpClient.close()
override fun close() = clientOptions.close()

class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
IncreaseClient.WithRawResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import java.time.Clock
import java.time.Duration
import java.util.Optional
import java.util.concurrent.Executor
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.ThreadFactory
import java.util.concurrent.atomic.AtomicLong
Expand All @@ -26,6 +27,8 @@ private constructor(
* The HTTP client to use in the SDK.
*
* Use the one published in `increase-java-client-okhttp` or implement your own.
*
* This class takes ownership of the client and closes it when closed.
*/
@get:JvmName("httpClient") val httpClient: HttpClient,
/**
Expand All @@ -47,6 +50,8 @@ private constructor(
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
*
* Defaults to a dedicated cached thread pool.
*
* This class takes ownership of the executor and shuts it down, if possible, when closed.
*/
@get:JvmName("streamHandlerExecutor") val streamHandlerExecutor: Executor,
/**
Expand Down Expand Up @@ -179,6 +184,8 @@ private constructor(
* The HTTP client to use in the SDK.
*
* Use the one published in `increase-java-client-okhttp` or implement your own.
*
* This class takes ownership of the client and closes it when closed.
*/
fun httpClient(httpClient: HttpClient) = apply {
this.httpClient = PhantomReachableClosingHttpClient(httpClient)
Expand Down Expand Up @@ -207,9 +214,14 @@ private constructor(
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
*
* Defaults to a dedicated cached thread pool.
*
* This class takes ownership of the executor and shuts it down, if possible, when closed.
*/
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
this.streamHandlerExecutor = streamHandlerExecutor
this.streamHandlerExecutor =
if (streamHandlerExecutor is ExecutorService)
PhantomReachableExecutorService(streamHandlerExecutor)
else streamHandlerExecutor
}

/**
Expand Down Expand Up @@ -467,4 +479,19 @@ private constructor(
)
}
}

/**
* Closes these client options, relinquishing any underlying resources.
*
* This is purposefully not inherited from [AutoCloseable] because the client options are
* long-lived and usually should not be synchronously closed via try-with-resources.
*
* It's also usually not necessary to call this method at all. the default client automatically
* releases threads and connections if they remain idle, but if you are writing an application
* that needs to aggressively release unused resources, then you may call this method.
*/
fun close() {
httpClient.close()
(streamHandlerExecutor as? ExecutorService)?.shutdown()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.increase.api.core

import java.util.concurrent.Callable
import java.util.concurrent.ExecutorService
import java.util.concurrent.Future
import java.util.concurrent.TimeUnit

/**
* A delegating wrapper around an [ExecutorService] that shuts it down once it's only phantom
* reachable.
*
* This class ensures the [ExecutorService] is shut down even if the user forgets to do it.
*/
internal class PhantomReachableExecutorService(private val executorService: ExecutorService) :
ExecutorService {
init {
closeWhenPhantomReachable(this) { executorService.shutdown() }
}

override fun execute(command: Runnable) = executorService.execute(command)

override fun shutdown() = executorService.shutdown()

override fun shutdownNow(): MutableList<Runnable> = executorService.shutdownNow()

override fun isShutdown(): Boolean = executorService.isShutdown

override fun isTerminated(): Boolean = executorService.isTerminated

override fun awaitTermination(timeout: Long, unit: TimeUnit): Boolean =
executorService.awaitTermination(timeout, unit)

override fun <T : Any?> submit(task: Callable<T>): Future<T> = executorService.submit(task)

override fun <T : Any?> submit(task: Runnable, result: T): Future<T> =
executorService.submit(task, result)

override fun submit(task: Runnable): Future<*> = executorService.submit(task)

override fun <T : Any?> invokeAll(
tasks: MutableCollection<out Callable<T>>
): MutableList<Future<T>> = executorService.invokeAll(tasks)

override fun <T : Any?> invokeAll(
tasks: MutableCollection<out Callable<T>>,
timeout: Long,
unit: TimeUnit,
): MutableList<Future<T>> = executorService.invokeAll(tasks, timeout, unit)

override fun <T : Any?> invokeAny(tasks: MutableCollection<out Callable<T>>): T =
executorService.invokeAny(tasks)

override fun <T : Any?> invokeAny(
tasks: MutableCollection<out Callable<T>>,
timeout: Long,
unit: TimeUnit,
): T = executorService.invokeAny(tasks, timeout, unit)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

/** Approves an Real-Time Payments Transfer in a pending_approval state. */
/** Approves a Real-Time Payments Transfer in a pending_approval state. */
class RealTimePaymentsTransferApproveParams
private constructor(
private val realTimePaymentsTransferId: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

/** Cancels an Real-Time Payments Transfer in a pending_approval state. */
/** Cancels a Real-Time Payments Transfer in a pending_approval state. */
class RealTimePaymentsTransferCancelParams
private constructor(
private val realTimePaymentsTransferId: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ interface RealTimePaymentsTransferServiceAsync {
): CompletableFuture<RealTimePaymentsTransferListPageAsync> =
list(RealTimePaymentsTransferListParams.none(), requestOptions)

/** Approves an Real-Time Payments Transfer in a pending_approval state. */
/** Approves a Real-Time Payments Transfer in a pending_approval state. */
fun approve(realTimePaymentsTransferId: String): CompletableFuture<RealTimePaymentsTransfer> =
approve(realTimePaymentsTransferId, RealTimePaymentsTransferApproveParams.none())

Expand Down Expand Up @@ -153,7 +153,7 @@ interface RealTimePaymentsTransferServiceAsync {
requestOptions,
)

/** Cancels an Real-Time Payments Transfer in a pending_approval state. */
/** Cancels a Real-Time Payments Transfer in a pending_approval state. */
fun cancel(realTimePaymentsTransferId: String): CompletableFuture<RealTimePaymentsTransfer> =
cancel(realTimePaymentsTransferId, RealTimePaymentsTransferCancelParams.none())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ interface RealTimePaymentsTransferService {
fun list(requestOptions: RequestOptions): RealTimePaymentsTransferListPage =
list(RealTimePaymentsTransferListParams.none(), requestOptions)

/** Approves an Real-Time Payments Transfer in a pending_approval state. */
/** Approves a Real-Time Payments Transfer in a pending_approval state. */
fun approve(realTimePaymentsTransferId: String): RealTimePaymentsTransfer =
approve(realTimePaymentsTransferId, RealTimePaymentsTransferApproveParams.none())

Expand Down Expand Up @@ -145,7 +145,7 @@ interface RealTimePaymentsTransferService {
requestOptions,
)

/** Cancels an Real-Time Payments Transfer in a pending_approval state. */
/** Cancels a Real-Time Payments Transfer in a pending_approval state. */
fun cancel(realTimePaymentsTransferId: String): RealTimePaymentsTransfer =
cancel(realTimePaymentsTransferId, RealTimePaymentsTransferCancelParams.none())

Expand Down
17 changes: 15 additions & 2 deletions scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,18 @@ set -e

cd "$(dirname "$0")/.."

echo "==> Running formatters"
./gradlew format
if command -v ktfmt &> /dev/null; then
echo "==> Running ktfmt"
./scripts/kotlin-format
else
echo "==> Running gradlew formatKotlin"
./gradlew formatKotlin
fi

if command -v palantir-java-format &> /dev/null; then
echo "==> Running palantir-java-format"
./scripts/java-format
else
echo "==> Running gradlew formatJava"
./gradlew formatJava
fi
7 changes: 7 additions & 0 deletions scripts/java-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

find . -name "*.java" -not -path "./buildSrc/build/*" -print0 | xargs -0 -r palantir-java-format --palantir --replace "$@"
7 changes: 7 additions & 0 deletions scripts/kotlin-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

find . -name "*.kt" -not -path "./buildSrc/build/*" -print0 | xargs -0 -r ktfmt --kotlinlang-style "$@"
17 changes: 16 additions & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,19 @@ set -e
cd "$(dirname "$0")/.."

echo "==> Running lints"
./gradlew lint

if command -v ktfmt &> /dev/null; then
echo "==> Checking ktfmt"
./scripts/kotlin-format --dry-run --set-exit-if-changed
else
echo "==> Running gradlew lintKotlin"
./gradlew lintKotlin
fi

if command -v palantir-java-format &> /dev/null; then
echo "==> Checking palantir-java-format"
./scripts/java-format --dry-run --set-exit-if-changed
else
echo "==> Running gradlew lintJava"
./gradlew lintJava
fi
Loading