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.262.0"
".": "0.263.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: 202
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-7f26440e2137fb4f39521c361e76d56bad7c56d81cd06d0677d7735e73f7c160.yml
openapi_spec_hash: aa475d425f493e41eb8485ae17a3d0f9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-2965cbcf43d274ee029249246f9e3760a82372b9120a033bd651cad24765a4fb.yml
openapi_spec_hash: ae42e357b1bedbf992105c2a37f1b544
config_hash: a185e9a72778cc4658ea73fb3a7f1354
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 0.263.0 (2025-07-21)

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

### Features

* **api:** api update ([146db20](https://github.com/Increase/increase-java/commit/146db20ddc3179d3fb7193c446f6584a8776d5a1))
* **client:** add https config options ([f22db91](https://github.com/Increase/increase-java/commit/f22db91567decbc8fd08b957e4ec01052675a570))
* **client:** allow configuring env via system properties ([13c25db](https://github.com/Increase/increase-java/commit/13c25dba41aaaacdc7a1c166fe3e3e827fd43089))
* **client:** allow setting additional multipart body props ([15bb03f](https://github.com/Increase/increase-java/commit/15bb03f8234293bd936c2ae617ade816a005e9c7))


### Chores

* **internal:** refactor delegating from client to options ([3dec230](https://github.com/Increase/increase-java/commit/3dec2305506bb528f5ab6b8258b0f23431a72765))

## 0.262.0 (2025-07-18)

Full Changelog: [v0.261.1...v0.262.0](https://github.com/Increase/increase-java/compare/v0.261.1...v0.262.0)
Expand Down
60 changes: 44 additions & 16 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.262.0)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.262.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.262.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.263.0)
[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.263.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.263.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.262.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.263.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.262.0")
implementation("com.increase.api:increase-java:0.263.0")
```

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

Expand All @@ -51,7 +51,8 @@ import com.increase.api.client.okhttp.IncreaseOkHttpClient;
import com.increase.api.models.accounts.Account;
import com.increase.api.models.accounts.AccountCreateParams;

// Configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
// Configures using the `increase.apiKey`, `increase.webhookSecret` and `increase.baseUrl` system properties
// Or configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
IncreaseClient client = IncreaseOkHttpClient.fromEnv();

AccountCreateParams params = AccountCreateParams.builder()
Expand All @@ -64,13 +65,14 @@ Account account = client.accounts().create(params);

## Client configuration

Configure the client using environment variables:
Configure the client using system properties or environment variables:

```java
import com.increase.api.client.IncreaseClient;
import com.increase.api.client.okhttp.IncreaseOkHttpClient;

// Configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
// Configures using the `increase.apiKey`, `increase.webhookSecret` and `increase.baseUrl` system properties
// Or configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
IncreaseClient client = IncreaseOkHttpClient.fromEnv();
```

Expand All @@ -92,19 +94,22 @@ import com.increase.api.client.IncreaseClient;
import com.increase.api.client.okhttp.IncreaseOkHttpClient;

IncreaseClient client = IncreaseOkHttpClient.builder()
// Configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
// Configures using the `increase.apiKey`, `increase.webhookSecret` and `increase.baseUrl` system properties
Or configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
.fromEnv()
.apiKey("My API Key")
.build();
```

See this table for the available options:

| Setter | Environment variable | Required | Default value |
| --------------- | ------------------------- | -------- | ---------------------------- |
| `apiKey` | `INCREASE_API_KEY` | true | - |
| `webhookSecret` | `INCREASE_WEBHOOK_SECRET` | false | - |
| `baseUrl` | `INCREASE_BASE_URL` | true | `"https://api.increase.com"` |
| Setter | System property | Environment variable | Required | Default value |
| --------------- | ------------------------ | ------------------------- | -------- | ---------------------------- |
| `apiKey` | `increase.apiKey` | `INCREASE_API_KEY` | true | - |
| `webhookSecret` | `increase.webhookSecret` | `INCREASE_WEBHOOK_SECRET` | false | - |
| `baseUrl` | `increase.baseUrl` | `INCREASE_BASE_URL` | true | `"https://api.increase.com"` |

System properties take precedence over environment variables.

> [!TIP]
> Don't create more than one client in the same application. Each client has a connection pool and
Expand Down Expand Up @@ -150,7 +155,8 @@ import com.increase.api.models.accounts.Account;
import com.increase.api.models.accounts.AccountCreateParams;
import java.util.concurrent.CompletableFuture;

// Configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
// Configures using the `increase.apiKey`, `increase.webhookSecret` and `increase.baseUrl` system properties
// Or configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
IncreaseClient client = IncreaseOkHttpClient.fromEnv();

AccountCreateParams params = AccountCreateParams.builder()
Expand All @@ -170,7 +176,8 @@ import com.increase.api.models.accounts.Account;
import com.increase.api.models.accounts.AccountCreateParams;
import java.util.concurrent.CompletableFuture;

// Configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
// Configures using the `increase.apiKey`, `increase.webhookSecret` and `increase.baseUrl` system properties
// Or configures using the `INCREASE_API_KEY`, `INCREASE_WEBHOOK_SECRET` and `INCREASE_BASE_URL` environment variables
IncreaseClientAsync client = IncreaseOkHttpClientAsync.fromEnv();

AccountCreateParams params = AccountCreateParams.builder()
Expand Down Expand Up @@ -513,6 +520,27 @@ IncreaseClient client = IncreaseOkHttpClient.builder()
.build();
```

### HTTPS

> [!NOTE]
> Most applications should not call these methods, and instead use the system defaults. The defaults include
> special optimizations that can be lost if the implementations are modified.

To configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:

```java
import com.increase.api.client.IncreaseClient;
import com.increase.api.client.okhttp.IncreaseOkHttpClient;

IncreaseClient client = IncreaseOkHttpClient.builder()
.fromEnv()
// If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.
.sslSocketFactory(yourSSLSocketFactory)
.trustManager(yourTrustManager)
.hostnameVerifier(yourHostnameVerifier)
.build();
```

### Environments

The SDK sends requests to the production by default. To send requests to a different environment, configure the client like so:
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.262.0" // x-release-please-version
version = "0.263.0" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ import com.increase.api.core.ClientOptions
import com.increase.api.core.Timeout
import com.increase.api.core.http.Headers
import com.increase.api.core.http.QueryParams
import com.increase.api.core.jsonMapper
import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
import java.util.concurrent.Executor
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import kotlin.jvm.optionals.getOrNull

class IncreaseOkHttpClient private constructor() {
Expand All @@ -30,12 +34,63 @@ class IncreaseOkHttpClient private constructor() {
class Builder internal constructor() {

private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
private var hostnameVerifier: HostnameVerifier? = null

fun sandbox() = apply { baseUrl(ClientOptions.SANDBOX_URL) }
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }

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

/**
* The socket factory used to secure HTTPS connections.
*
* If this is set, then [trustManager] must also be set.
*
* If unset, then the system default is used. Most applications should not call this method,
* and instead use the system default. The default include special optimizations that can be
* lost if the implementation is modified.
*/
fun sslSocketFactory(sslSocketFactory: SSLSocketFactory?) = apply {
this.sslSocketFactory = sslSocketFactory
}

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

/**
* The trust manager used to secure HTTPS connections.
*
* If this is set, then [sslSocketFactory] must also be set.
*
* If unset, then the system default is used. Most applications should not call this method,
* and instead use the system default. The default include special optimizations that can be
* lost if the implementation is modified.
*/
fun trustManager(trustManager: X509TrustManager?) = apply {
this.trustManager = trustManager
}

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

/**
* The verifier used to confirm that response certificates apply to requested hostnames for
* HTTPS connections.
*
* If unset, then a default hostname verifier is used.
*/
fun hostnameVerifier(hostnameVerifier: HostnameVerifier?) = apply {
this.hostnameVerifier = hostnameVerifier
}

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

/**
* Whether to throw an exception if any of the Jackson versions detected at runtime are
Expand All @@ -56,6 +111,40 @@ class IncreaseOkHttpClient private constructor() {

fun clock(clock: Clock) = apply { clientOptions.clock(clock) }

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())

fun sandbox() = apply { clientOptions.sandbox() }

fun responseValidation(responseValidation: Boolean) = apply {
clientOptions.responseValidation(responseValidation)
}

fun timeout(timeout: Timeout) = apply { clientOptions.timeout(timeout) }

/**
* Sets the maximum time allowed for a complete HTTP call, not including retries.
*
* See [Timeout.request] for more details.
*
* For fine-grained control, pass a [Timeout] object.
*/
fun timeout(timeout: Duration) = apply { clientOptions.timeout(timeout) }

fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }

fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }

fun webhookSecret(webhookSecret: String?) = apply {
clientOptions.webhookSecret(webhookSecret)
}

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

fun headers(headers: Headers) = apply { clientOptions.headers(headers) }

fun headers(headers: Map<String, Iterable<String>>) = apply {
Expand Down Expand Up @@ -136,38 +225,6 @@ class IncreaseOkHttpClient private constructor() {
clientOptions.removeAllQueryParams(keys)
}

fun timeout(timeout: Timeout) = apply {
clientOptions.timeout(timeout)
this.timeout = timeout
}

/**
* Sets the maximum time allowed for a complete HTTP call, not including retries.
*
* See [Timeout.request] for more details.
*
* For fine-grained control, pass a [Timeout] object.
*/
fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())

fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }

fun proxy(proxy: Proxy) = apply { this.proxy = proxy }

fun responseValidation(responseValidation: Boolean) = apply {
clientOptions.responseValidation(responseValidation)
}

fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }

fun webhookSecret(webhookSecret: String?) = apply {
clientOptions.webhookSecret(webhookSecret)
}

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

fun fromEnv() = apply { clientOptions.fromEnv() }

/**
Expand All @@ -178,7 +235,15 @@ class IncreaseOkHttpClient private constructor() {
fun build(): IncreaseClient =
IncreaseClientImpl(
clientOptions
.httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
.httpClient(
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
.sslSocketFactory(sslSocketFactory)
.trustManager(trustManager)
.hostnameVerifier(hostnameVerifier)
.build()
)
.build()
)
}
Expand Down
Loading