Skip to content

Commit 1a7a006

Browse files
release: 4.10.0 (#91)
* fix(types): remove brand field from ElementalContent model * chore(internal): update `TestServerExtension` comment * chore(internal): make `OkHttp` constructor internal * feat(client): add connection pooling option * chore(internal): remove mock server code * chore: update mock server docs * codegen metadata * chore: make `Properties` more resilient to `null` * chore: drop apache dependency * chore(internal): expand imports * codegen metadata * codegen metadata * codegen metadata * fix(api): restructure token add single request body, rename pathToken to token * chore(internal): codegen related update * chore(internal): bump palantir-java-format * chore(ci): skip uploading artifacts on stainless-internal branches * fix(client): incorrect `Retry-After` parsing * feat(api): add journeys resource with list/invoke methods * fix: mark MessageDetails timestamp fields as optional * codegen metadata * release: 4.10.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Mike Miller <mike@mikemiller.design>
1 parent 905283a commit 1a7a006

111 files changed

Lines changed: 6558 additions & 2019 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,18 @@ jobs:
6565
run: ./scripts/build
6666

6767
- name: Get GitHub OIDC Token
68-
if: github.repository == 'stainless-sdks/courier-java'
68+
if: |-
69+
github.repository == 'stainless-sdks/courier-java' &&
70+
!startsWith(github.ref, 'refs/heads/stl/')
6971
id: github-oidc
7072
uses: actions/github-script@v8
7173
with:
7274
script: core.setOutput('github_token', await core.getIDToken());
7375

7476
- name: Build and upload Maven artifacts
75-
if: github.repository == 'stainless-sdks/courier-java'
77+
if: |-
78+
github.repository == 'stainless-sdks/courier-java' &&
79+
!startsWith(github.ref, 'refs/heads/stl/')
7680
env:
7781
URL: https://pkg.stainless.com/s
7882
AUTH: ${{ steps.github-oidc.outputs.github_token }}

.release-please-manifest.json

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

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 81
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-3fc1c86b4a83a16393aaf17d1fb3ac6098d30dd057ba872973b57285a7a3f0d0.yml
3-
openapi_spec_hash: 02a545d217b13399f311e99561f9de1d
4-
config_hash: 0789c3cddc625bb9712b3bded274ab6c
1+
configured_endpoints: 83
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-19330fca8fa9bbae835ec9d9f83b37b3df364d9b462090b9623bfc9b6eae99c2.yml
3+
openapi_spec_hash: 0bc6889464c9ac2542b4837f569c1837
4+
config_hash: 1ae49ed522c8423378d9463cdd0fb880

CHANGELOG.md

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

3+
## 4.10.0 (2026-03-12)
4+
5+
Full Changelog: [v4.9.1...v4.10.0](https://github.com/trycourier/courier-java/compare/v4.9.1...v4.10.0)
6+
7+
### Features
8+
9+
* **api:** add journeys resource with list/invoke methods ([2c7587e](https://github.com/trycourier/courier-java/commit/2c7587e7b3eb0ae29e77b5bbe26f96d19aed5076))
10+
* **client:** add connection pooling option ([b2e1bcb](https://github.com/trycourier/courier-java/commit/b2e1bcbd856bbe7d247497b2296dd8f368fdc6da))
11+
12+
13+
### Bug Fixes
14+
15+
* **api:** restructure token add single request body, rename pathToken to token ([9577dec](https://github.com/trycourier/courier-java/commit/9577decaf5da849b9c35d2c7a6302ef2b105193e))
16+
* **client:** incorrect `Retry-After` parsing ([4719954](https://github.com/trycourier/courier-java/commit/471995496d38e95ca4f0b832064ae529fc02dabf))
17+
* mark MessageDetails timestamp fields as optional ([e948f83](https://github.com/trycourier/courier-java/commit/e948f832f3ac9e5b71b24a3f02387e88ffb6be12))
18+
* **types:** remove brand field from ElementalContent model ([cb336a3](https://github.com/trycourier/courier-java/commit/cb336a3bb81b5e2bd25483be06c45bdfd518fe2b))
19+
20+
21+
### Chores
22+
23+
* **ci:** skip uploading artifacts on stainless-internal branches ([330979b](https://github.com/trycourier/courier-java/commit/330979bc70a21d68fa33ca16f949bc378aa818c9))
24+
* drop apache dependency ([90094b9](https://github.com/trycourier/courier-java/commit/90094b91bb84ab5f9b01d351031431990495e2fa))
25+
* **internal:** bump palantir-java-format ([0057417](https://github.com/trycourier/courier-java/commit/0057417ffd2fcb14a33a42ebb8d81bce4232197a))
26+
* **internal:** codegen related update ([6a1cfae](https://github.com/trycourier/courier-java/commit/6a1cfaeee2212a162513951b903778d4a35e48b3))
27+
* **internal:** expand imports ([b1b8ef3](https://github.com/trycourier/courier-java/commit/b1b8ef384a3acddc0ce6cd79cfca840e6da4c748))
28+
* **internal:** make `OkHttp` constructor internal ([4e39320](https://github.com/trycourier/courier-java/commit/4e393200781dd186e45a32ff8d18be7083e83b31))
29+
* **internal:** remove mock server code ([b63945e](https://github.com/trycourier/courier-java/commit/b63945ee56673ba3e736de9d2170b0a27e7dcd82))
30+
* **internal:** update `TestServerExtension` comment ([26b5aed](https://github.com/trycourier/courier-java/commit/26b5aede00f47e7a0bae77e058e36a00361060b0))
31+
* make `Properties` more resilient to `null` ([401bc43](https://github.com/trycourier/courier-java/commit/401bc435edc5a6798afb1c1619a0de37cdb7a9fe))
32+
* update mock server docs ([ff62ef0](https://github.com/trycourier/courier-java/commit/ff62ef0c2c8c232f96a3b3e5ade9c6ac22a1b248))
33+
34+
35+
### Documentation
36+
37+
* add AUTO-GENERATED-OVERVIEW markers for README sync ([#92](https://github.com/trycourier/courier-java/issues/92)) ([4bc2f46](https://github.com/trycourier/courier-java/commit/4bc2f4661c8c7d35d72234c1f5520eec71a39bcc))
38+
339
## 4.9.1 (2026-02-07)
440

541
Full Changelog: [v4.9.0...v4.9.1](https://github.com/trycourier/courier-java/compare/v4.9.0...v4.9.1)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Courier Java SDK provides typed access to the Courier REST API from applicat
88
### Gradle
99

1010
```kotlin
11-
implementation("com.courier:courier-java:4.9.1")
11+
implementation("com.courier:courier-java:4.10.0")
1212
```
1313

1414
### Maven
@@ -17,7 +17,7 @@ implementation("com.courier:courier-java:4.9.1")
1717
<dependency>
1818
<groupId>com.courier</groupId>
1919
<artifactId>courier-java</artifactId>
20-
<version>4.9.1</version>
20+
<version>4.10.0</version>
2121
</dependency>
2222
```
2323

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
allprojects {
1010
group = "com.courier"
11-
version = "4.9.1" // x-release-please-version
11+
version = "4.10.0" // x-release-please-version
1212
}
1313

1414
subprojects {

buildSrc/src/main/kotlin/courier.java.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ tasks.withType<Test>().configureEach {
4545

4646
val palantir by configurations.creating
4747
dependencies {
48-
palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
48+
palantir("com.palantir.javaformat:palantir-java-format:2.89.0")
4949
}
5050

5151
fun registerPalantir(

courier-java-client-okhttp/src/main/kotlin/com/courier/client/okhttp/CourierOkHttpClient.kt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class CourierOkHttpClient 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 CourierOkHttpClient 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 CourierOkHttpClient 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)

courier-java-client-okhttp/src/main/kotlin/com/courier/client/okhttp/CourierOkHttpClientAsync.kt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class CourierOkHttpClientAsync 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 CourierOkHttpClientAsync 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 CourierOkHttpClientAsync 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)

courier-java-client-okhttp/src/main/kotlin/com/courier/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)