Skip to content

Commit 0f190ab

Browse files
release: 0.1.0-alpha.4 (#5)
* feat(client): support proxy authentication * release: 0.1.0-alpha.4 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 6db4f24 commit 0f190ab

8 files changed

Lines changed: 273 additions & 92 deletions

File tree

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

CHANGELOG.md

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

3+
## 0.1.0-alpha.4 (2026-05-06)
4+
5+
Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/HubSpot/hubspot-sdk-java/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
6+
7+
### Features
8+
9+
* **client:** support proxy authentication ([59950f7](https://github.com/HubSpot/hubspot-sdk-java/commit/59950f799fdca00a756378f15da57290f6bb0c0b))
10+
311
## 0.1.0-alpha.3 (2026-05-05)
412

513
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/HubSpot/hubspot-sdk-java/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)

README.md

Lines changed: 21 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.hubspot.sdk/hubspot-java)](https://central.sonatype.com/artifact/com.hubspot.sdk/hubspot-java/0.1.0-alpha.3)
6-
[![javadoc](https://javadoc.io/badge2/com.hubspot.sdk/hubspot-java/0.1.0-alpha.3/javadoc.svg)](https://javadoc.io/doc/com.hubspot.sdk/hubspot-java/0.1.0-alpha.3)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.hubspot.sdk/hubspot-java)](https://central.sonatype.com/artifact/com.hubspot.sdk/hubspot-java/0.1.0-alpha.4)
6+
[![javadoc](https://javadoc.io/badge2/com.hubspot.sdk/hubspot-java/0.1.0-alpha.4/javadoc.svg)](https://javadoc.io/doc/com.hubspot.sdk/hubspot-java/0.1.0-alpha.4)
77

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

@@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1313

1414
<!-- x-release-please-start-version -->
1515

16-
The REST API documentation can be found on [developers.hubspot.com](https://developers.hubspot.com/docs/api-reference/overview). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.hubspot.sdk/hubspot-java/0.1.0-alpha.3).
16+
The REST API documentation can be found on [developers.hubspot.com](https://developers.hubspot.com/docs/api-reference/overview). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.hubspot.sdk/hubspot-java/0.1.0-alpha.4).
1717

1818
<!-- x-release-please-end -->
1919

@@ -24,7 +24,7 @@ The REST API documentation can be found on [developers.hubspot.com](https://deve
2424
### Gradle
2525

2626
```kotlin
27-
implementation("com.hubspot.sdk:hubspot-java:0.1.0-alpha.3")
27+
implementation("com.hubspot.sdk:hubspot-java:0.1.0-alpha.4")
2828
```
2929

3030
### Maven
@@ -33,7 +33,7 @@ implementation("com.hubspot.sdk:hubspot-java:0.1.0-alpha.3")
3333
<dependency>
3434
<groupId>com.hubspot.sdk</groupId>
3535
<artifactId>hubspot-java</artifactId>
36-
<version>0.1.0-alpha.3</version>
36+
<version>0.1.0-alpha.4</version>
3737
</dependency>
3838
```
3939

@@ -579,6 +579,22 @@ HubSpotClient client = HubSpotOkHttpClient.builder()
579579
.build();
580580
```
581581

582+
If the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`:
583+
584+
```java
585+
import com.hubspot.sdk.client.HubSpotClient;
586+
import com.hubspot.sdk.client.okhttp.HubSpotOkHttpClient;
587+
import com.hubspot.sdk.core.http.ProxyAuthenticator;
588+
589+
HubSpotClient client = HubSpotOkHttpClient.builder()
590+
.fromEnv()
591+
.proxy(...)
592+
// Or a custom implementation of `ProxyAuthenticator`.
593+
.proxyAuthenticator(ProxyAuthenticator.basic("username", "password"))
594+
.accessToken("My Access Token")
595+
.build();
596+
```
597+
582598
### Connection pooling
583599

584600
To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:

build.gradle.kts

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

1010
allprojects {
1111
group = "com.hubspot.sdk"
12-
version = "0.1.0-alpha.3" // x-release-please-version
12+
version = "0.1.0-alpha.4" // x-release-please-version
1313
}
1414

1515
subprojects {

hubspot-java-client-okhttp/src/main/kotlin/com/hubspot/sdk/client/okhttp/HubSpotOkHttpClient.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.hubspot.sdk.core.Timeout
1111
import com.hubspot.sdk.core.http.AsyncStreamResponse
1212
import com.hubspot.sdk.core.http.Headers
1313
import com.hubspot.sdk.core.http.HttpClient
14+
import com.hubspot.sdk.core.http.ProxyAuthenticator
1415
import com.hubspot.sdk.core.http.QueryParams
1516
import com.hubspot.sdk.core.jsonMapper
1617
import java.net.Proxy
@@ -49,6 +50,7 @@ class HubSpotOkHttpClient private constructor() {
4950
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
5051
private var dispatcherExecutorService: ExecutorService? = null
5152
private var proxy: Proxy? = null
53+
private var proxyAuthenticator: ProxyAuthenticator? = null
5254
private var maxIdleConnections: Int? = null
5355
private var keepAliveDuration: Duration? = null
5456
private var sslSocketFactory: SSLSocketFactory? = null
@@ -79,6 +81,20 @@ class HubSpotOkHttpClient private constructor() {
7981
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
8082
fun proxy(proxy: Optional<Proxy>) = proxy(proxy.getOrNull())
8183

84+
/**
85+
* Provides credentials when an HTTP proxy responds with `407 Proxy Authentication
86+
* Required`.
87+
*/
88+
fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply {
89+
this.proxyAuthenticator = proxyAuthenticator
90+
}
91+
92+
/**
93+
* Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`.
94+
*/
95+
fun proxyAuthenticator(proxyAuthenticator: Optional<ProxyAuthenticator>) =
96+
proxyAuthenticator(proxyAuthenticator.getOrNull())
97+
8298
/**
8399
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
84100
*
@@ -386,6 +402,7 @@ class HubSpotOkHttpClient private constructor() {
386402
OkHttpClient.builder()
387403
.timeout(clientOptions.timeout())
388404
.proxy(proxy)
405+
.proxyAuthenticator(proxyAuthenticator)
389406
.maxIdleConnections(maxIdleConnections)
390407
.keepAliveDuration(keepAliveDuration)
391408
.dispatcherExecutorService(dispatcherExecutorService)

hubspot-java-client-okhttp/src/main/kotlin/com/hubspot/sdk/client/okhttp/HubSpotOkHttpClientAsync.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.hubspot.sdk.core.Timeout
1111
import com.hubspot.sdk.core.http.AsyncStreamResponse
1212
import com.hubspot.sdk.core.http.Headers
1313
import com.hubspot.sdk.core.http.HttpClient
14+
import com.hubspot.sdk.core.http.ProxyAuthenticator
1415
import com.hubspot.sdk.core.http.QueryParams
1516
import com.hubspot.sdk.core.jsonMapper
1617
import java.net.Proxy
@@ -49,6 +50,7 @@ class HubSpotOkHttpClientAsync private constructor() {
4950
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
5051
private var dispatcherExecutorService: ExecutorService? = null
5152
private var proxy: Proxy? = null
53+
private var proxyAuthenticator: ProxyAuthenticator? = null
5254
private var maxIdleConnections: Int? = null
5355
private var keepAliveDuration: Duration? = null
5456
private var sslSocketFactory: SSLSocketFactory? = null
@@ -79,6 +81,20 @@ class HubSpotOkHttpClientAsync private constructor() {
7981
/** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
8082
fun proxy(proxy: Optional<Proxy>) = proxy(proxy.getOrNull())
8183

84+
/**
85+
* Provides credentials when an HTTP proxy responds with `407 Proxy Authentication
86+
* Required`.
87+
*/
88+
fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply {
89+
this.proxyAuthenticator = proxyAuthenticator
90+
}
91+
92+
/**
93+
* Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`.
94+
*/
95+
fun proxyAuthenticator(proxyAuthenticator: Optional<ProxyAuthenticator>) =
96+
proxyAuthenticator(proxyAuthenticator.getOrNull())
97+
8298
/**
8399
* The maximum number of idle connections kept by the underlying OkHttp connection pool.
84100
*
@@ -386,6 +402,7 @@ class HubSpotOkHttpClientAsync private constructor() {
386402
OkHttpClient.builder()
387403
.timeout(clientOptions.timeout())
388404
.proxy(proxy)
405+
.proxyAuthenticator(proxyAuthenticator)
389406
.maxIdleConnections(maxIdleConnections)
390407
.keepAliveDuration(keepAliveDuration)
391408
.dispatcherExecutorService(dispatcherExecutorService)

0 commit comments

Comments
 (0)