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
The table of contents is too big for display.
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.266.0"
".": "0.266.1"
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.266.1 (2025-07-28)

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

### Bug Fixes

* **client:** some bad `_additionalBodyProperties` serialization ([4460cdc](https://github.com/Increase/increase-java/commit/4460cdc369dfbd69ebf1e364f3dbae08698010b2))


### Chores

* **internal:** remove unnecessary `[...]` in `[@see](https://github.com/see)` ([f9b79eb](https://github.com/Increase/increase-java/commit/f9b79ebc61e8d6fe9fc2c2ee2f9e70dffc2611ad))


### Documentation

* more code comments ([68f5533](https://github.com/Increase/increase-java/commit/68f5533bf7f13aba48372c441cca27dee53ca50a))

## 0.266.0 (2025-07-23)

Full Changelog: [v0.265.0...v0.266.0](https://github.com/Increase/increase-java/compare/v0.265.0...v0.266.0)
Expand Down
14 changes: 7 additions & 7 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.266.0)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.266.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.266.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.266.1)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.266.1/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.266.1)

<!-- 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.266.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.266.1).

<!-- 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.266.0")
implementation("com.increase.api:increase-java:0.266.1")
```

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

Expand Down Expand Up @@ -449,7 +449,7 @@ If the SDK threw an exception, but you're _certain_ the version is compatible, t

### Retries

The SDK automatically retries 2 times by default, with a short exponential backoff.
The SDK automatically retries 2 times by default, with a short exponential backoff between requests.

Only the following error types are retried:

Expand All @@ -459,7 +459,7 @@ Only the following error types are retried:
- 429 Rate Limit
- 5xx Internal

The API may also explicitly instruct the SDK to retry or not retry a response.
The API may also explicitly instruct the SDK to retry or not retry a request.

To set a custom number of retries, configure the client using the `maxRetries` method:

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.266.0" // x-release-please-version
version = "0.266.1" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import com.increase.api.client.IncreaseClient
import com.increase.api.client.IncreaseClientImpl
import com.increase.api.core.ClientOptions
import com.increase.api.core.Timeout
import com.increase.api.core.http.AsyncStreamResponse
import com.increase.api.core.http.Headers
import com.increase.api.core.http.HttpClient
import com.increase.api.core.http.QueryParams
import com.increase.api.core.jsonMapper
import java.net.Proxy
Expand All @@ -20,13 +22,22 @@ import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import kotlin.jvm.optionals.getOrNull

/**
* A class that allows building an instance of [IncreaseClient] with [OkHttpClient] as the
* underlying [HttpClient].
*/
class IncreaseOkHttpClient private constructor() {

companion object {

/** Returns a mutable builder for constructing an instance of [IncreaseOkHttpClient]. */
/** Returns a mutable builder for constructing an instance of [IncreaseClient]. */
@JvmStatic fun builder() = Builder()

/**
* Returns a client configured using system properties and environment variables.
*
* @see ClientOptions.Builder.fromEnv
*/
@JvmStatic fun fromEnv(): IncreaseClient = builder().fromEnv().build()
}

Expand Down Expand Up @@ -103,25 +114,64 @@ class IncreaseOkHttpClient private constructor() {
clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility)
}

/**
* The Jackson JSON mapper to use for serializing and deserializing JSON.
*
* Defaults to [com.increase.api.core.jsonMapper]. The default is usually sufficient and
* rarely needs to be overridden.
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }

/**
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
*
* Defaults to a dedicated cached thread pool.
*/
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
}

/**
* The clock to use for operations that require timing, like retries.
*
* This is primarily useful for using a fake clock in tests.
*
* Defaults to [Clock.systemUTC].
*/
fun clock(clock: Clock) = apply { clientOptions.clock(clock) }

/**
* The base URL to use for every request.
*
* Defaults to the production environment: `https://api.increase.com`.
*
* The following other environments, with dedicated builder methods, are available:
* - sandbox: `https://sandbox.increase.com`
*/
fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) }

/** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
fun baseUrl(baseUrl: Optional<String>) = baseUrl(baseUrl.getOrNull())

/** Sets [baseUrl] to `https://sandbox.increase.com`. */
fun sandbox() = apply { clientOptions.sandbox() }

/**
* Whether to call `validate` on every response before returning it.
*
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
fun responseValidation(responseValidation: Boolean) = apply {
clientOptions.responseValidation(responseValidation)
}

/**
* Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding
* retries.
*
* Defaults to [Timeout.default].
*/
fun timeout(timeout: Timeout) = apply { clientOptions.timeout(timeout) }

/**
Expand All @@ -133,6 +183,21 @@ class IncreaseOkHttpClient private constructor() {
*/
fun timeout(timeout: Duration) = apply { clientOptions.timeout(timeout) }

/**
* The maximum number of times to retry failed requests, with a short exponential backoff
* between requests.
*
* Only the following error types are retried:
* - Connection errors (for example, due to a network connectivity problem)
* - 408 Request Timeout
* - 409 Conflict
* - 429 Rate Limit
* - 5xx Internal
*
* The API may also explicitly instruct the SDK to retry or not retry a request.
*
* Defaults to 2.
*/
fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }

fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }
Expand Down Expand Up @@ -225,6 +290,11 @@ class IncreaseOkHttpClient private constructor() {
clientOptions.removeAllQueryParams(keys)
}

/**
* Updates configuration using system properties and environment variables.
*
* @see ClientOptions.Builder.fromEnv
*/
fun fromEnv() = apply { clientOptions.fromEnv() }

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import com.increase.api.client.IncreaseClientAsync
import com.increase.api.client.IncreaseClientAsyncImpl
import com.increase.api.core.ClientOptions
import com.increase.api.core.Timeout
import com.increase.api.core.http.AsyncStreamResponse
import com.increase.api.core.http.Headers
import com.increase.api.core.http.HttpClient
import com.increase.api.core.http.QueryParams
import com.increase.api.core.jsonMapper
import java.net.Proxy
Expand All @@ -20,15 +22,22 @@ import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import kotlin.jvm.optionals.getOrNull

/**
* A class that allows building an instance of [IncreaseClientAsync] with [OkHttpClient] as the
* underlying [HttpClient].
*/
class IncreaseOkHttpClientAsync private constructor() {

companion object {

/**
* Returns a mutable builder for constructing an instance of [IncreaseOkHttpClientAsync].
*/
/** Returns a mutable builder for constructing an instance of [IncreaseClientAsync]. */
@JvmStatic fun builder() = Builder()

/**
* Returns a client configured using system properties and environment variables.
*
* @see ClientOptions.Builder.fromEnv
*/
@JvmStatic fun fromEnv(): IncreaseClientAsync = builder().fromEnv().build()
}

Expand Down Expand Up @@ -105,25 +114,64 @@ class IncreaseOkHttpClientAsync private constructor() {
clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility)
}

/**
* The Jackson JSON mapper to use for serializing and deserializing JSON.
*
* Defaults to [com.increase.api.core.jsonMapper]. The default is usually sufficient and
* rarely needs to be overridden.
*/
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }

/**
* The executor to use for running [AsyncStreamResponse.Handler] callbacks.
*
* Defaults to a dedicated cached thread pool.
*/
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
}

/**
* The clock to use for operations that require timing, like retries.
*
* This is primarily useful for using a fake clock in tests.
*
* Defaults to [Clock.systemUTC].
*/
fun clock(clock: Clock) = apply { clientOptions.clock(clock) }

/**
* The base URL to use for every request.
*
* Defaults to the production environment: `https://api.increase.com`.
*
* The following other environments, with dedicated builder methods, are available:
* - sandbox: `https://sandbox.increase.com`
*/
fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) }

/** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
fun baseUrl(baseUrl: Optional<String>) = baseUrl(baseUrl.getOrNull())

/** Sets [baseUrl] to `https://sandbox.increase.com`. */
fun sandbox() = apply { clientOptions.sandbox() }

/**
* Whether to call `validate` on every response before returning it.
*
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
fun responseValidation(responseValidation: Boolean) = apply {
clientOptions.responseValidation(responseValidation)
}

/**
* Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding
* retries.
*
* Defaults to [Timeout.default].
*/
fun timeout(timeout: Timeout) = apply { clientOptions.timeout(timeout) }

/**
Expand All @@ -135,6 +183,21 @@ class IncreaseOkHttpClientAsync private constructor() {
*/
fun timeout(timeout: Duration) = apply { clientOptions.timeout(timeout) }

/**
* The maximum number of times to retry failed requests, with a short exponential backoff
* between requests.
*
* Only the following error types are retried:
* - Connection errors (for example, due to a network connectivity problem)
* - 408 Request Timeout
* - 409 Conflict
* - 429 Rate Limit
* - 5xx Internal
*
* The API may also explicitly instruct the SDK to retry or not retry a request.
*
* Defaults to 2.
*/
fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }

fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }
Expand Down Expand Up @@ -227,6 +290,11 @@ class IncreaseOkHttpClientAsync private constructor() {
clientOptions.removeAllQueryParams(keys)
}

/**
* Updates configuration using system properties and environment variables.
*
* @see ClientOptions.Builder.fromEnv
*/
fun fromEnv() = apply { clientOptions.fromEnv() }

/**
Expand Down
Loading
Loading