Skip to content

Commit e688672

Browse files
authored
Merge pull request #32 from brand-dot-dev/release-please--branches--main--changes--next
release: 0.1.0-alpha.30
2 parents 7dd38ad + b8a077f commit e688672

39 files changed

+2773
-451
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.29"
2+
".": "0.1.0-alpha.30"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 15
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-10f7ae53f4fe4f2394c22788b648d9db742a178ed41a87beb39de741660e646b.yml
3-
openapi_spec_hash: 9885c47a02677471a38f16dddbad1823
4-
config_hash: 6f10592c7d0c3bafefc1271472283217
1+
configured_endpoints: 16
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-98ef96cef5b06ad7a29dadba48258da7d9ea0a2b3938dc9e714ae06eb9afa1a3.yml
3+
openapi_spec_hash: 9e957a30999dff7d4ada925e437bd202
4+
config_hash: c3aaaa9794dba44d524c06591ab17894

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 0.1.0-alpha.30 (2026-02-22)
4+
5+
Full Changelog: [v0.1.0-alpha.29...v0.1.0-alpha.30](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.29...v0.1.0-alpha.30)
6+
7+
### Features
8+
9+
* **api:** api update ([e09f05c](https://github.com/brand-dot-dev/java-sdk/commit/e09f05c64e70af02954b142ea11b42983a7758d1))
10+
* **api:** api update ([176daa6](https://github.com/brand-dot-dev/java-sdk/commit/176daa6ade5920957e1afb073ab0f14b2dc93705))
11+
* **api:** manual updates ([8588622](https://github.com/brand-dot-dev/java-sdk/commit/8588622a8b75ea541a9be7fc2a47a4ddd1554416))
12+
* **client:** add connection pooling option ([50588f3](https://github.com/brand-dot-dev/java-sdk/commit/50588f3d193a48d8e764c93e72f579649f189558))
13+
* **client:** add more convenience service method overloads ([63d98a3](https://github.com/brand-dot-dev/java-sdk/commit/63d98a3572690648e96e2a16a8bc06874887cdcf))
14+
15+
16+
### Chores
17+
18+
* **internal:** make `OkHttp` constructor internal ([7176a5a](https://github.com/brand-dot-dev/java-sdk/commit/7176a5a3d63596c1f550864a28e4aedc1f751976))
19+
* **internal:** remove mock server code ([34d975a](https://github.com/brand-dot-dev/java-sdk/commit/34d975a09009a15f51c843d4c4f3e3ad8822109a))
20+
* **internal:** update `TestServerExtension` comment ([8ec7bbb](https://github.com/brand-dot-dev/java-sdk/commit/8ec7bbbdf6d8c8a3e62817f69120817f85a89f9f))
21+
* update mock server docs ([e7cf423](https://github.com/brand-dot-dev/java-sdk/commit/e7cf4232d2397f736fce8b3dbecc80bfde182144))
22+
323
## 0.1.0-alpha.29 (2026-02-07)
424

525
Full Changelog: [v0.1.0-alpha.28...v0.1.0-alpha.29](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.28...v0.1.0-alpha.29)

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

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

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.branddev.api/brand-dev-java)](https://central.sonatype.com/artifact/com.branddev.api/brand-dev-java/0.1.0-alpha.29)
6-
[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.29/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.29)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.branddev.api/brand-dev-java)](https://central.sonatype.com/artifact/com.branddev.api/brand-dev-java/0.1.0-alpha.30)
6+
[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.30/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.30)
77

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

@@ -22,7 +22,7 @@ Use the Brand Dev MCP Server to enable AI assistants to interact with this API,
2222
2323
<!-- x-release-please-start-version -->
2424

25-
The REST API documentation can be found on [docs.brand.dev](https://docs.brand.dev/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.29).
25+
The REST API documentation can be found on [docs.brand.dev](https://docs.brand.dev/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.30).
2626

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

@@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.brand.dev](https://docs.brand.d
3333
### Gradle
3434

3535
```kotlin
36-
implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.29")
36+
implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.30")
3737
```
3838

3939
### Maven
@@ -42,7 +42,7 @@ implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.29")
4242
<dependency>
4343
<groupId>com.branddev.api</groupId>
4444
<artifactId>brand-dev-java</artifactId>
45-
<version>0.1.0-alpha.29</version>
45+
<version>0.1.0-alpha.30</version>
4646
</dependency>
4747
```
4848

@@ -356,6 +356,25 @@ BrandDevClient client = BrandDevOkHttpClient.builder()
356356
.build();
357357
```
358358

359+
### Connection pooling
360+
361+
To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:
362+
363+
```java
364+
import com.branddev.api.client.BrandDevClient;
365+
import com.branddev.api.client.okhttp.BrandDevOkHttpClient;
366+
import java.time.Duration;
367+
368+
BrandDevClient client = BrandDevOkHttpClient.builder()
369+
.fromEnv()
370+
// If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.
371+
.maxIdleConnections(10)
372+
.keepAliveDuration(Duration.ofMinutes(2))
373+
.build();
374+
```
375+
376+
If both options are unset, OkHttp's default connection pool settings are used.
377+
359378
### HTTPS
360379

361380
> [!NOTE]

brand-dev-java-client-okhttp/src/main/kotlin/com/branddev/api/client/okhttp/BrandDevOkHttpClient.kt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class BrandDevOkHttpClient private constructor() {
4747
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
4848
private var dispatcherExecutorService: ExecutorService? = null
4949
private var proxy: Proxy? = null
50+
private var maxIdleConnections: Int? = null
51+
private var keepAliveDuration: Duration? = null
5052
private var sslSocketFactory: SSLSocketFactory? = null
5153
private var trustManager: X509TrustManager? = null
5254
private var hostnameVerifier: HostnameVerifier? = null
@@ -75,6 +77,46 @@ class BrandDevOkHttpClient private constructor() {
7577
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
7678
fun proxy(proxy: Optional<Proxy>) = proxy(proxy.getOrNull())
7779

80+
/**
81+
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
82+
*
83+
* If this is set, then [keepAliveDuration] must also be set.
84+
*
85+
* If unset, then OkHttp's default is used.
86+
*/
87+
fun maxIdleConnections(maxIdleConnections: Int?) = apply {
88+
this.maxIdleConnections = maxIdleConnections
89+
}
90+
91+
/**
92+
* Alias for [Builder.maxIdleConnections].
93+
*
94+
* This unboxed primitive overload exists for backwards compatibility.
95+
*/
96+
fun maxIdleConnections(maxIdleConnections: Int) =
97+
maxIdleConnections(maxIdleConnections as Int?)
98+
99+
/**
100+
* Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`.
101+
*/
102+
fun maxIdleConnections(maxIdleConnections: Optional<Int>) =
103+
maxIdleConnections(maxIdleConnections.getOrNull())
104+
105+
/**
106+
* The keep-alive duration for idle connections in the underlying OkHttp connection pool.
107+
*
108+
* If this is set, then [maxIdleConnections] must also be set.
109+
*
110+
* If unset, then OkHttp's default is used.
111+
*/
112+
fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
113+
this.keepAliveDuration = keepAliveDuration
114+
}
115+
116+
/** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */
117+
fun keepAliveDuration(keepAliveDuration: Optional<Duration>) =
118+
keepAliveDuration(keepAliveDuration.getOrNull())
119+
78120
/**
79121
* The socket factory used to secure HTTPS connections.
80122
*
@@ -317,6 +359,8 @@ class BrandDevOkHttpClient private constructor() {
317359
OkHttpClient.builder()
318360
.timeout(clientOptions.timeout())
319361
.proxy(proxy)
362+
.maxIdleConnections(maxIdleConnections)
363+
.keepAliveDuration(keepAliveDuration)
320364
.dispatcherExecutorService(dispatcherExecutorService)
321365
.sslSocketFactory(sslSocketFactory)
322366
.trustManager(trustManager)

brand-dev-java-client-okhttp/src/main/kotlin/com/branddev/api/client/okhttp/BrandDevOkHttpClientAsync.kt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class BrandDevOkHttpClientAsync private constructor() {
4747
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
4848
private var dispatcherExecutorService: ExecutorService? = null
4949
private var proxy: Proxy? = null
50+
private var maxIdleConnections: Int? = null
51+
private var keepAliveDuration: Duration? = null
5052
private var sslSocketFactory: SSLSocketFactory? = null
5153
private var trustManager: X509TrustManager? = null
5254
private var hostnameVerifier: HostnameVerifier? = null
@@ -75,6 +77,46 @@ class BrandDevOkHttpClientAsync private constructor() {
7577
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
7678
fun proxy(proxy: Optional<Proxy>) = proxy(proxy.getOrNull())
7779

80+
/**
81+
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
82+
*
83+
* If this is set, then [keepAliveDuration] must also be set.
84+
*
85+
* If unset, then OkHttp's default is used.
86+
*/
87+
fun maxIdleConnections(maxIdleConnections: Int?) = apply {
88+
this.maxIdleConnections = maxIdleConnections
89+
}
90+
91+
/**
92+
* Alias for [Builder.maxIdleConnections].
93+
*
94+
* This unboxed primitive overload exists for backwards compatibility.
95+
*/
96+
fun maxIdleConnections(maxIdleConnections: Int) =
97+
maxIdleConnections(maxIdleConnections as Int?)
98+
99+
/**
100+
* Alias for calling [Builder.maxIdleConnections] with `maxIdleConnections.orElse(null)`.
101+
*/
102+
fun maxIdleConnections(maxIdleConnections: Optional<Int>) =
103+
maxIdleConnections(maxIdleConnections.getOrNull())
104+
105+
/**
106+
* The keep-alive duration for idle connections in the underlying OkHttp connection pool.
107+
*
108+
* If this is set, then [maxIdleConnections] must also be set.
109+
*
110+
* If unset, then OkHttp's default is used.
111+
*/
112+
fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
113+
this.keepAliveDuration = keepAliveDuration
114+
}
115+
116+
/** Alias for calling [Builder.keepAliveDuration] with `keepAliveDuration.orElse(null)`. */
117+
fun keepAliveDuration(keepAliveDuration: Optional<Duration>) =
118+
keepAliveDuration(keepAliveDuration.getOrNull())
119+
78120
/**
79121
* The socket factory used to secure HTTPS connections.
80122
*
@@ -317,6 +359,8 @@ class BrandDevOkHttpClientAsync private constructor() {
317359
OkHttpClient.builder()
318360
.timeout(clientOptions.timeout())
319361
.proxy(proxy)
362+
.maxIdleConnections(maxIdleConnections)
363+
.keepAliveDuration(keepAliveDuration)
320364
.dispatcherExecutorService(dispatcherExecutorService)
321365
.sslSocketFactory(sslSocketFactory)
322366
.trustManager(trustManager)

brand-dev-java-client-okhttp/src/main/kotlin/com/branddev/api/client/okhttp/OkHttpClient.kt

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ import java.time.Duration
1616
import java.util.concurrent.CancellationException
1717
import java.util.concurrent.CompletableFuture
1818
import java.util.concurrent.ExecutorService
19+
import java.util.concurrent.TimeUnit
1920
import javax.net.ssl.HostnameVerifier
2021
import javax.net.ssl.SSLSocketFactory
2122
import javax.net.ssl.X509TrustManager
2223
import okhttp3.Call
2324
import okhttp3.Callback
25+
import okhttp3.ConnectionPool
2426
import okhttp3.Dispatcher
2527
import okhttp3.HttpUrl.Companion.toHttpUrl
2628
import okhttp3.MediaType
@@ -33,7 +35,7 @@ import okhttp3.logging.HttpLoggingInterceptor
3335
import okio.BufferedSink
3436

3537
class OkHttpClient
36-
private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient {
38+
internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient {
3739

3840
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
3941
val call = newCall(request, requestOptions)
@@ -200,6 +202,8 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
200202

201203
private var timeout: Timeout = Timeout.default()
202204
private var proxy: Proxy? = null
205+
private var maxIdleConnections: Int? = null
206+
private var keepAliveDuration: Duration? = null
203207
private var dispatcherExecutorService: ExecutorService? = null
204208
private var sslSocketFactory: SSLSocketFactory? = null
205209
private var trustManager: X509TrustManager? = null
@@ -211,6 +215,28 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
211215

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

218+
/**
219+
* Sets the maximum number of idle connections kept by the underlying [ConnectionPool].
220+
*
221+
* If this is set, then [keepAliveDuration] must also be set.
222+
*
223+
* If unset, then OkHttp's default is used.
224+
*/
225+
fun maxIdleConnections(maxIdleConnections: Int?) = apply {
226+
this.maxIdleConnections = maxIdleConnections
227+
}
228+
229+
/**
230+
* Sets the keep-alive duration for idle connections in the underlying [ConnectionPool].
231+
*
232+
* If this is set, then [maxIdleConnections] must also be set.
233+
*
234+
* If unset, then OkHttp's default is used.
235+
*/
236+
fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
237+
this.keepAliveDuration = keepAliveDuration
238+
}
239+
214240
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
215241
this.dispatcherExecutorService = dispatcherExecutorService
216242
}
@@ -240,6 +266,22 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
240266
.apply {
241267
dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) }
242268

269+
val maxIdleConnections = maxIdleConnections
270+
val keepAliveDuration = keepAliveDuration
271+
if (maxIdleConnections != null && keepAliveDuration != null) {
272+
connectionPool(
273+
ConnectionPool(
274+
maxIdleConnections,
275+
keepAliveDuration.toNanos(),
276+
TimeUnit.NANOSECONDS,
277+
)
278+
)
279+
} else {
280+
check((maxIdleConnections != null) == (keepAliveDuration != null)) {
281+
"Both or none of `maxIdleConnections` and `keepAliveDuration` must be set, but only one was set"
282+
}
283+
}
284+
243285
val sslSocketFactory = sslSocketFactory
244286
val trustManager = trustManager
245287
if (sslSocketFactory != null && trustManager != null) {

0 commit comments

Comments
 (0)