Skip to content

Commit f04df40

Browse files
authored
Merge pull request #29 from brand-dot-dev/release-please--branches--main--changes--next
release: 0.1.0-alpha.27
2 parents a6ddfc3 + b90c89e commit f04df40

File tree

27 files changed

+610
-135
lines changed

27 files changed

+610
-135
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v6
2424

2525
- name: Set up Java
26-
uses: actions/setup-java@v4
26+
uses: actions/setup-java@v5
2727
with:
2828
distribution: temurin
2929
java-version: |
@@ -40,14 +40,17 @@ jobs:
4040
build:
4141
timeout-minutes: 15
4242
name: build
43+
permissions:
44+
contents: read
45+
id-token: write
4346
runs-on: ${{ github.repository == 'stainless-sdks/brand.dev-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4447
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
4548

4649
steps:
47-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v6
4851

4952
- name: Set up Java
50-
uses: actions/setup-java@v4
53+
uses: actions/setup-java@v5
5154
with:
5255
distribution: temurin
5356
java-version: |
@@ -61,16 +64,31 @@ jobs:
6164
- name: Build SDK
6265
run: ./scripts/build
6366

67+
- name: Get GitHub OIDC Token
68+
if: github.repository == 'stainless-sdks/brand.dev-java'
69+
id: github-oidc
70+
uses: actions/github-script@v8
71+
with:
72+
script: core.setOutput('github_token', await core.getIDToken());
73+
74+
- name: Build and upload Maven artifacts
75+
if: github.repository == 'stainless-sdks/brand.dev-java'
76+
env:
77+
URL: https://pkg.stainless.com/s
78+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
79+
SHA: ${{ github.sha }}
80+
PROJECT: brand.dev-java
81+
run: ./scripts/upload-artifacts
6482
test:
6583
timeout-minutes: 15
6684
name: test
6785
runs-on: ${{ github.repository == 'stainless-sdks/brand.dev-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
6886
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
6987
steps:
70-
- uses: actions/checkout@v4
88+
- uses: actions/checkout@v6
7189

7290
- name: Set up Java
73-
uses: actions/setup-java@v4
91+
uses: actions/setup-java@v5
7492
with:
7593
distribution: temurin
7694
java-version: |

.github/workflows/publish-sonatype.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v6
1818

1919
- name: Set up Java
20-
uses: actions/setup-java@v4
20+
uses: actions/setup-java@v5
2121
with:
2222
distribution: temurin
2323
java-version: |

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
if: github.repository == 'brand-dot-dev/java-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
1313

1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616

1717
- name: Check release environment
1818
run: |

.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.26"
2+
".": "0.1.0-alpha.27"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 15
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-863ddc13e032497459a639cf02a16349831dda7e39557cbd5ce33da34d086b02.yml
3-
openapi_spec_hash: f972aac9618fe8df340d96344b3d0578
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-737dbedd830e2c989387e90a9bb5baa3915306ecfef2e46b09d02cb1879f043c.yml
3+
openapi_spec_hash: 7bc21f4c6d5fd39c1a3b22626846ca87
44
config_hash: 6f10592c7d0c3bafefc1271472283217

CHANGELOG.md

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

3+
## 0.1.0-alpha.27 (2026-02-02)
4+
5+
Full Changelog: [v0.1.0-alpha.26...v0.1.0-alpha.27](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.26...v0.1.0-alpha.27)
6+
7+
### Features
8+
9+
* **api:** api update ([fed044d](https://github.com/brand-dot-dev/java-sdk/commit/fed044d09175f814f8e0bad4df5f9555f6410e15))
10+
* **client:** add `HttpRequest#url()` method ([6cfde89](https://github.com/brand-dot-dev/java-sdk/commit/6cfde8967d8054950cf7bfb62c3b5e9022f79107))
11+
* **client:** allow configuring dispatcher executor service ([7eca573](https://github.com/brand-dot-dev/java-sdk/commit/7eca57352b72de96b78b7ee16be87ea844a10f89))
12+
* **client:** send `X-Stainless-Kotlin-Version` header ([a67a402](https://github.com/brand-dot-dev/java-sdk/commit/a67a40257d88d3d34379b2f704d50958292b04e3))
13+
14+
15+
### Bug Fixes
16+
17+
* **client:** disallow coercion from float to int ([f59913f](https://github.com/brand-dot-dev/java-sdk/commit/f59913f9452f71603dac23c42101f5f32696fe06))
18+
* **client:** fully respect max retries ([a0aa790](https://github.com/brand-dot-dev/java-sdk/commit/a0aa7903dfc548c4dd25ef4985e80937646539de))
19+
* **client:** preserve time zone in lenient date-time parsing ([615ebc2](https://github.com/brand-dot-dev/java-sdk/commit/615ebc293f66bbdd2ce451b0620a5cd37728212f))
20+
* **client:** send retry count header for max retries 0 ([a0aa790](https://github.com/brand-dot-dev/java-sdk/commit/a0aa7903dfc548c4dd25ef4985e80937646539de))
21+
* date time deserialization leniency ([0c299fe](https://github.com/brand-dot-dev/java-sdk/commit/0c299fefeefcbec581ad9c341d0a587eae6d2977))
22+
* **docs:** fix mcp installation instructions for remote servers ([0241743](https://github.com/brand-dot-dev/java-sdk/commit/02417434d1b53a5458346be5e14512bf5dcf092f))
23+
24+
25+
### Chores
26+
27+
* **ci:** upgrade `actions/github-script` ([b05460b](https://github.com/brand-dot-dev/java-sdk/commit/b05460be067f2336ff4c1aebbd5a29c2b9cdd8db))
28+
* **ci:** upgrade `actions/setup-java` ([376fbbd](https://github.com/brand-dot-dev/java-sdk/commit/376fbbd3410d63bd7306bba1ccde2d264fa0cd3b))
29+
* **internal:** allow passing args to `./scripts/test` ([e27c90d](https://github.com/brand-dot-dev/java-sdk/commit/e27c90dd180ba3a7cea0e0082f484138f07175a1))
30+
* **internal:** clean up maven repo artifact script and add html documentation to repo root ([4718679](https://github.com/brand-dot-dev/java-sdk/commit/47186793b72b219c12faa54c3e3b54197880ff5a))
31+
* **internal:** correct cache invalidation for `SKIP_MOCK_TESTS` ([0b13154](https://github.com/brand-dot-dev/java-sdk/commit/0b13154ffa5b630ca445371d68b676bc5eadcea3))
32+
* **internal:** depend on packages directly in example ([a0aa790](https://github.com/brand-dot-dev/java-sdk/commit/a0aa7903dfc548c4dd25ef4985e80937646539de))
33+
* **internal:** improve maven repo docs ([0e378d5](https://github.com/brand-dot-dev/java-sdk/commit/0e378d5bf0f3016be36b8ca0189d1ee9614bbd1b))
34+
* **internal:** support uploading Maven repo artifacts to stainless package server ([95ab800](https://github.com/brand-dot-dev/java-sdk/commit/95ab800f7fd4ce873d638764f1c86ab6d1d427c1))
35+
* **internal:** update `actions/checkout` version ([fec5d3a](https://github.com/brand-dot-dev/java-sdk/commit/fec5d3a47682efc4f92c4b9890de7fbf6588b906))
36+
* **internal:** update maven repo doc to include authentication ([b1ed94c](https://github.com/brand-dot-dev/java-sdk/commit/b1ed94ce0d3afefc3597f5978bafa9adecc0ff20))
37+
* test on Jackson 2.14.0 to avoid encountering FasterXML/jackson-databind[#3240](https://github.com/brand-dot-dev/java-sdk/issues/3240) in tests ([0c299fe](https://github.com/brand-dot-dev/java-sdk/commit/0c299fefeefcbec581ad9c341d0a587eae6d2977))
38+
39+
40+
### Documentation
41+
42+
* prominently feature MCP server setup in root SDK readmes ([18a0348](https://github.com/brand-dot-dev/java-sdk/commit/18a03480949d4afc6d8ed4a45a55c84094aadae6))
43+
344
## 0.1.0-alpha.26 (2026-01-05)
445

546
Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.25...v0.1.0-alpha.26)

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
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.26)
6-
[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.26/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.26)
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.27)
6+
[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.27/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.27)
77

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

1010
The Brand Dev Java SDK provides convenient access to the [Brand Dev REST API](https://docs.brand.dev/) from applications written in Java.
1111

1212
It is generated with [Stainless](https://www.stainless.com/).
1313

14+
## MCP Server
15+
16+
Use the Brand Dev MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
17+
18+
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=brand.dev-mcp&config=eyJuYW1lIjoiYnJhbmQuZGV2LW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL2JyYW5kLWRldi5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LWJyYW5kLWRldi1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)
19+
[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22brand.dev-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fbrand-dev.stlmcp.com%22%2C%22headers%22%3A%7B%22x-brand-dev-api-key%22%3A%22My%20API%20Key%22%7D%7D)
20+
21+
> Note: You may need to set environment variables in your MCP client.
22+
1423
<!-- x-release-please-start-version -->
1524

16-
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.26).
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.27).
1726

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

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

2635
```kotlin
27-
implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.26")
36+
implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.27")
2837
```
2938

3039
### Maven
@@ -33,7 +42,7 @@ implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.26")
3342
<dependency>
3443
<groupId>com.branddev.api</groupId>
3544
<artifactId>brand-dev-java</artifactId>
36-
<version>0.1.0-alpha.26</version>
45+
<version>0.1.0-alpha.27</version>
3746
</dependency>
3847
```
3948

@@ -270,6 +279,8 @@ If the SDK threw an exception, but you're _certain_ the version is compatible, t
270279
> [!CAUTION]
271280
> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.
272281
282+
Also note that there are bugs in older Jackson versions that can affect the SDK. We don't work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.
283+
273284
## Network options
274285

275286
### Retries
@@ -307,7 +318,9 @@ To set a custom timeout, configure the method call using the `timeout` method:
307318
```java
308319
import com.branddev.api.models.brand.BrandRetrieveResponse;
309320

310-
BrandRetrieveResponse brand = client.brand().retrieve(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());
321+
BrandRetrieveResponse brand = client.brand().retrieve(
322+
params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()
323+
);
311324
```
312325

313326
Or configure the default for all method calls at the client level:
@@ -491,10 +504,9 @@ To forcibly omit a required parameter or property, pass [`JsonMissing`](brand-de
491504

492505
```java
493506
import com.branddev.api.core.JsonMissing;
494-
import com.branddev.api.models.brand.BrandAiProductsParams;
495507
import com.branddev.api.models.brand.BrandRetrieveParams;
496508

497-
BrandRetrieveParams params = BrandAiProductsParams.builder()
509+
BrandRetrieveParams params = BrandRetrieveParams.builder()
498510
.domain(JsonMissing.of())
499511
.build();
500512
```
@@ -572,7 +584,9 @@ Or configure the method call to validate the response using the `responseValidat
572584
```java
573585
import com.branddev.api.models.brand.BrandRetrieveResponse;
574586

575-
BrandRetrieveResponse brand = client.brand().retrieve(RequestOptions.builder().responseValidation(true).build());
587+
BrandRetrieveResponse brand = client.brand().retrieve(
588+
params, RequestOptions.builder().responseValidation(true).build()
589+
);
576590
```
577591

578592
Or configure the default for all method calls at the client level:

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java.net.Proxy
1616
import java.time.Clock
1717
import java.time.Duration
1818
import java.util.Optional
19+
import java.util.concurrent.ExecutorService
1920
import javax.net.ssl.HostnameVerifier
2021
import javax.net.ssl.SSLSocketFactory
2122
import javax.net.ssl.X509TrustManager
@@ -44,11 +45,31 @@ class BrandDevOkHttpClient private constructor() {
4445
class Builder internal constructor() {
4546

4647
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
48+
private var dispatcherExecutorService: ExecutorService? = null
4749
private var proxy: Proxy? = null
4850
private var sslSocketFactory: SSLSocketFactory? = null
4951
private var trustManager: X509TrustManager? = null
5052
private var hostnameVerifier: HostnameVerifier? = null
5153

54+
/**
55+
* The executor service to use for running HTTP requests.
56+
*
57+
* Defaults to OkHttp's
58+
* [default executor service](https://github.com/square/okhttp/blob/ace792f443b2ffb17974f5c0d1cecdf589309f26/okhttp/src/commonJvmAndroid/kotlin/okhttp3/Dispatcher.kt#L98-L104).
59+
*
60+
* This class takes ownership of the executor service and shuts it down when closed.
61+
*/
62+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
63+
this.dispatcherExecutorService = dispatcherExecutorService
64+
}
65+
66+
/**
67+
* Alias for calling [Builder.dispatcherExecutorService] with
68+
* `dispatcherExecutorService.orElse(null)`.
69+
*/
70+
fun dispatcherExecutorService(dispatcherExecutorService: Optional<ExecutorService>) =
71+
dispatcherExecutorService(dispatcherExecutorService.getOrNull())
72+
5273
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
5374

5475
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
@@ -296,6 +317,7 @@ class BrandDevOkHttpClient private constructor() {
296317
OkHttpClient.builder()
297318
.timeout(clientOptions.timeout())
298319
.proxy(proxy)
320+
.dispatcherExecutorService(dispatcherExecutorService)
299321
.sslSocketFactory(sslSocketFactory)
300322
.trustManager(trustManager)
301323
.hostnameVerifier(hostnameVerifier)

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java.net.Proxy
1616
import java.time.Clock
1717
import java.time.Duration
1818
import java.util.Optional
19+
import java.util.concurrent.ExecutorService
1920
import javax.net.ssl.HostnameVerifier
2021
import javax.net.ssl.SSLSocketFactory
2122
import javax.net.ssl.X509TrustManager
@@ -44,11 +45,31 @@ class BrandDevOkHttpClientAsync private constructor() {
4445
class Builder internal constructor() {
4546

4647
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
48+
private var dispatcherExecutorService: ExecutorService? = null
4749
private var proxy: Proxy? = null
4850
private var sslSocketFactory: SSLSocketFactory? = null
4951
private var trustManager: X509TrustManager? = null
5052
private var hostnameVerifier: HostnameVerifier? = null
5153

54+
/**
55+
* The executor service to use for running HTTP requests.
56+
*
57+
* Defaults to OkHttp's
58+
* [default executor service](https://github.com/square/okhttp/blob/ace792f443b2ffb17974f5c0d1cecdf589309f26/okhttp/src/commonJvmAndroid/kotlin/okhttp3/Dispatcher.kt#L98-L104).
59+
*
60+
* This class takes ownership of the executor service and shuts it down when closed.
61+
*/
62+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
63+
this.dispatcherExecutorService = dispatcherExecutorService
64+
}
65+
66+
/**
67+
* Alias for calling [Builder.dispatcherExecutorService] with
68+
* `dispatcherExecutorService.orElse(null)`.
69+
*/
70+
fun dispatcherExecutorService(dispatcherExecutorService: Optional<ExecutorService>) =
71+
dispatcherExecutorService(dispatcherExecutorService.getOrNull())
72+
5273
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
5374

5475
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
@@ -296,6 +317,7 @@ class BrandDevOkHttpClientAsync private constructor() {
296317
OkHttpClient.builder()
297318
.timeout(clientOptions.timeout())
298319
.proxy(proxy)
320+
.dispatcherExecutorService(dispatcherExecutorService)
299321
.sslSocketFactory(sslSocketFactory)
300322
.trustManager(trustManager)
301323
.hostnameVerifier(hostnameVerifier)

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ import java.net.Proxy
1515
import java.time.Duration
1616
import java.util.concurrent.CancellationException
1717
import java.util.concurrent.CompletableFuture
18+
import java.util.concurrent.ExecutorService
1819
import javax.net.ssl.HostnameVerifier
1920
import javax.net.ssl.SSLSocketFactory
2021
import javax.net.ssl.X509TrustManager
2122
import okhttp3.Call
2223
import okhttp3.Callback
24+
import okhttp3.Dispatcher
2325
import okhttp3.HttpUrl.Companion.toHttpUrl
2426
import okhttp3.MediaType
2527
import okhttp3.MediaType.Companion.toMediaType
@@ -198,6 +200,7 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
198200

199201
private var timeout: Timeout = Timeout.default()
200202
private var proxy: Proxy? = null
203+
private var dispatcherExecutorService: ExecutorService? = null
201204
private var sslSocketFactory: SSLSocketFactory? = null
202205
private var trustManager: X509TrustManager? = null
203206
private var hostnameVerifier: HostnameVerifier? = null
@@ -208,6 +211,10 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
208211

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

214+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
215+
this.dispatcherExecutorService = dispatcherExecutorService
216+
}
217+
211218
fun sslSocketFactory(sslSocketFactory: SSLSocketFactory?) = apply {
212219
this.sslSocketFactory = sslSocketFactory
213220
}
@@ -223,12 +230,16 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
223230
fun build(): OkHttpClient =
224231
OkHttpClient(
225232
okhttp3.OkHttpClient.Builder()
233+
// `RetryingHttpClient` handles retries if the user enabled them.
234+
.retryOnConnectionFailure(false)
226235
.connectTimeout(timeout.connect())
227236
.readTimeout(timeout.read())
228237
.writeTimeout(timeout.write())
229238
.callTimeout(timeout.request())
230239
.proxy(proxy)
231240
.apply {
241+
dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) }
242+
232243
val sslSocketFactory = sslSocketFactory
233244
val trustManager = trustManager
234245
if (sslSocketFactory != null && trustManager != null) {

0 commit comments

Comments
 (0)