Skip to content

Commit de1675b

Browse files
committed
SDK regeneration
1 parent 3b3c656 commit de1675b

4 files changed

Lines changed: 45 additions & 126 deletions

File tree

.fern/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"enable-wire-tests": true
1313
},
14-
"originGitCommit": "0be656a350cef88f6586d6cb4aa28f8fc25b30ea",
14+
"originGitCommit": "a2c7ddbf260366af00a0e541a7e9ad4de19acabe",
1515
"originGitCommitIsDirty": true,
1616
"invokedBy": "manual",
1717
"sdkVersion": "0.5.1"

src/main/java/com/deepgram/core/ClientOptions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ private ClientOptions(
4141
this.headers.putAll(headers);
4242
this.headers.putAll(new HashMap<String, String>() {
4343
{
44-
put("User-Agent", "com.deepgram:deepgram-java-sdk/0.5.0"); // x-release-please-version
44+
put("User-Agent", "com.deepgram:deepgram-sdk/0.5.1");
4545
put("X-Fern-Language", "JAVA");
46-
put("X-Fern-SDK-Name", "com.deepgram:deepgram-java-sdk");
47-
put("X-Fern-SDK-Version", "0.5.0"); // x-release-please-version
46+
put("X-Fern-SDK-Name", "com.deepgram.fern:api-sdk");
47+
put("X-Fern-SDK-Version", "0.5.1");
4848
}
4949
});
5050
this.headerSuppliers = headerSuppliers;

src/main/java/com/deepgram/core/ReconnectingWebSocketListener.java

Lines changed: 9 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,16 @@
2525
* Provides production-ready resilience for WebSocket connections.
2626
*/
2727
public abstract class ReconnectingWebSocketListener extends WebSocketListener {
28-
// Option-derived fields are volatile (not final) so {@link #applyOptionsOverride} can rewire them
29-
// after construction — used by {@code TransportWebSocketFactory} to honour
30-
// {@code DeepgramTransportFactory.reconnectOptions()} without editing the generated WS clients.
31-
private volatile long minReconnectionDelayMs;
28+
private final long minReconnectionDelayMs;
3229

33-
private volatile long maxReconnectionDelayMs;
30+
private final long maxReconnectionDelayMs;
3431

35-
private volatile double reconnectionDelayGrowFactor;
32+
private final double reconnectionDelayGrowFactor;
3633

37-
private volatile int maxRetries;
34+
private final int maxRetries;
3835

3936
private final int maxEnqueuedMessages;
4037

41-
private volatile long connectionTimeoutMs;
42-
4338
private final AtomicInteger retryCount = new AtomicInteger(0);
4439

4540
private final AtomicBoolean connectLock = new AtomicBoolean(false);
@@ -71,44 +66,16 @@ public ReconnectingWebSocketListener(
7166
this.reconnectionDelayGrowFactor = options.reconnectionDelayGrowFactor;
7267
this.maxRetries = options.maxRetries;
7368
this.maxEnqueuedMessages = options.maxEnqueuedMessages;
74-
this.connectionTimeoutMs = options.connectionTimeoutMs;
7569
this.connectionSupplier = connectionSupplier;
7670
}
7771

78-
/**
79-
* Replaces the option-derived parameters on this listener at runtime. Used by
80-
* {@code TransportWebSocketFactory} to apply {@code DeepgramTransportFactory.reconnectOptions()}
81-
* without requiring edits to the generated per-resource WebSocket clients. {@code maxEnqueuedMessages}
82-
* is intentionally not overridden — the message queue is sized at construction.
83-
*
84-
* <p>Thread-safety: option-derived fields are volatile; reads observe the latest write. The
85-
* initial connect() call may have already started before the override lands, so for the very
86-
* first attempt the original options apply; the override takes effect from the next attempt
87-
* onwards. For the SageMaker storm-suppression case ({@code maxRetries(0)}) this is fine
88-
* because the initial attempt's gate ({@code retryCount > maxRetries} with {@code retryCount=0})
89-
* always passes regardless.
90-
*
91-
* @param options replacement options; {@code null} is a no-op.
92-
*/
93-
public void applyOptionsOverride(ReconnectOptions options) {
94-
if (options == null) {
95-
return;
96-
}
97-
this.minReconnectionDelayMs = options.minReconnectionDelayMs;
98-
this.maxReconnectionDelayMs = options.maxReconnectionDelayMs;
99-
this.reconnectionDelayGrowFactor = options.reconnectionDelayGrowFactor;
100-
this.maxRetries = options.maxRetries;
101-
this.connectionTimeoutMs = options.connectionTimeoutMs;
102-
}
103-
10472
/**
10573
* Initiates a WebSocket connection with automatic reconnection enabled.
10674
*
10775
* Connection behavior:
108-
* - Times out after {@code ReconnectOptions.connectionTimeoutMs} (default 4000ms)
76+
* - Times out after 4000 milliseconds
10977
* - Thread-safe via atomic lock (returns immediately if connection in progress)
110-
* - {@code maxRetries} counts retries only — the initial attempt always proceeds.
111-
* {@code maxRetries(0)} means "connect once, don't retry" (not "refuse to connect").
78+
* - Retry count not incremented for initial connection attempt
11279
*
11380
* Error handling:
11481
* - TimeoutException: Includes retry attempt context
@@ -119,21 +86,18 @@ public void connect() {
11986
if (!connectLock.compareAndSet(false, true)) {
12087
return;
12188
}
122-
// retryCount is incremented inside scheduleReconnect() before re-entering connect(),
123-
// so on the initial call retryCount == 0 and we always proceed. The cap applies to
124-
// retries only — maxRetries(0) blocks retries but allows the initial attempt.
125-
if (retryCount.get() > maxRetries) {
89+
if (retryCount.get() >= maxRetries) {
12690
connectLock.set(false);
12791
return;
12892
}
12993
try {
13094
CompletableFuture<? extends WebSocket> connectionFuture = CompletableFuture.supplyAsync(connectionSupplier);
13195
try {
132-
webSocket = connectionFuture.get(connectionTimeoutMs, MILLISECONDS);
96+
webSocket = connectionFuture.get(4000, MILLISECONDS);
13397
} catch (TimeoutException e) {
13498
connectionFuture.cancel(true);
13599
TimeoutException timeoutError =
136-
new TimeoutException("WebSocket connection timeout after " + connectionTimeoutMs + " milliseconds"
100+
new TimeoutException("WebSocket connection timeout after " + 4000 + " milliseconds"
137101
+ (retryCount.get() > 0
138102
? " (retry attempt #" + retryCount.get()
139103
: " (initial connection attempt)"));
@@ -435,15 +399,12 @@ public static final class ReconnectOptions {
435399

436400
public final int maxEnqueuedMessages;
437401

438-
public final long connectionTimeoutMs;
439-
440402
private ReconnectOptions(Builder builder) {
441403
this.minReconnectionDelayMs = builder.minReconnectionDelayMs;
442404
this.maxReconnectionDelayMs = builder.maxReconnectionDelayMs;
443405
this.reconnectionDelayGrowFactor = builder.reconnectionDelayGrowFactor;
444406
this.maxRetries = builder.maxRetries;
445407
this.maxEnqueuedMessages = builder.maxEnqueuedMessages;
446-
this.connectionTimeoutMs = builder.connectionTimeoutMs;
447408
}
448409

449410
public static Builder builder() {
@@ -461,15 +422,12 @@ public static final class Builder {
461422

462423
private int maxEnqueuedMessages;
463424

464-
private long connectionTimeoutMs;
465-
466425
public Builder() {
467426
this.minReconnectionDelayMs = 1000;
468427
this.maxReconnectionDelayMs = 10000;
469428
this.reconnectionDelayGrowFactor = 1.3;
470429
this.maxRetries = 2147483647;
471430
this.maxEnqueuedMessages = 1000;
472-
this.connectionTimeoutMs = 4000;
473431
}
474432

475433
public Builder minReconnectionDelayMs(long minReconnectionDelayMs) {
@@ -497,16 +455,6 @@ public Builder maxEnqueuedMessages(int maxEnqueuedMessages) {
497455
return this;
498456
}
499457

500-
/**
501-
* Sets the per-attempt connection timeout in milliseconds. Defaults to {@code 4000}.
502-
* Each call to {@link ReconnectingWebSocketListener#connect()} will wait at most
503-
* this long for the underlying WebSocket factory to produce a connected socket.
504-
*/
505-
public Builder connectionTimeoutMs(long connectionTimeoutMs) {
506-
this.connectionTimeoutMs = connectionTimeoutMs;
507-
return this;
508-
}
509-
510458
/**
511459
* Builds the ReconnectOptions with validation.
512460
*
@@ -515,7 +463,6 @@ public Builder connectionTimeoutMs(long connectionTimeoutMs) {
515463
* - minReconnectionDelayMs <= maxReconnectionDelayMs
516464
* - reconnectionDelayGrowFactor >= 1.0
517465
* - maxRetries and maxEnqueuedMessages are non-negative
518-
* - connectionTimeoutMs is positive
519466
*
520467
* @return The validated ReconnectOptions instance
521468
* @throws IllegalArgumentException if configuration is invalid
@@ -540,9 +487,6 @@ public ReconnectOptions build() {
540487
if (maxEnqueuedMessages < 0) {
541488
throw new IllegalArgumentException("maxEnqueuedMessages must be non-negative");
542489
}
543-
if (connectionTimeoutMs <= 0) {
544-
throw new IllegalArgumentException("connectionTimeoutMs must be positive");
545-
}
546490
return new ReconnectOptions(this);
547491
}
548492
}

src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfoWordsItem.java

Lines changed: 32 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
import com.fasterxml.jackson.annotation.JsonInclude;
1111
import com.fasterxml.jackson.annotation.JsonProperty;
1212
import com.fasterxml.jackson.annotation.JsonSetter;
13-
import com.fasterxml.jackson.annotation.Nulls;
1413
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
1514
import java.util.HashMap;
1615
import java.util.Map;
1716
import java.util.Objects;
18-
import java.util.Optional;
1917
import org.jetbrains.annotations.NotNull;
2018

2119
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@@ -25,18 +23,14 @@ public final class ListenV2TurnInfoWordsItem {
2523

2624
private final float confidence;
2725

28-
private final Optional<Float> start;
26+
private final double start;
2927

30-
private final Optional<Float> end;
28+
private final double end;
3129

3230
private final Map<String, Object> additionalProperties;
3331

3432
private ListenV2TurnInfoWordsItem(
35-
String word,
36-
float confidence,
37-
Optional<Float> start,
38-
Optional<Float> end,
39-
Map<String, Object> additionalProperties) {
33+
String word, float confidence, double start, double end, Map<String, Object> additionalProperties) {
4034
this.word = word;
4135
this.confidence = confidence;
4236
this.start = start;
@@ -64,15 +58,15 @@ public float getConfidence() {
6458
* @return The start time of the word
6559
*/
6660
@JsonProperty("start")
67-
public Optional<Float> getStart() {
61+
public double getStart() {
6862
return start;
6963
}
7064

7165
/**
7266
* @return The end time of the word
7367
*/
7468
@JsonProperty("end")
75-
public Optional<Float> getEnd() {
69+
public double getEnd() {
7670
return end;
7771
}
7872

@@ -88,10 +82,7 @@ public Map<String, Object> getAdditionalProperties() {
8882
}
8983

9084
private boolean equalTo(ListenV2TurnInfoWordsItem other) {
91-
return word.equals(other.word)
92-
&& confidence == other.confidence
93-
&& start.equals(other.start)
94-
&& end.equals(other.end);
85+
return word.equals(other.word) && confidence == other.confidence && start == other.start && end == other.end;
9586
}
9687

9788
@java.lang.Override
@@ -121,40 +112,40 @@ public interface ConfidenceStage {
121112
/**
122113
* <p>Confidence that this word was transcribed correctly</p>
123114
*/
124-
_FinalStage confidence(float confidence);
115+
StartStage confidence(float confidence);
125116
}
126117

127-
public interface _FinalStage {
128-
ListenV2TurnInfoWordsItem build();
129-
130-
_FinalStage additionalProperty(String key, Object value);
131-
132-
_FinalStage additionalProperties(Map<String, Object> additionalProperties);
133-
118+
public interface StartStage {
134119
/**
135120
* <p>The start time of the word</p>
136121
*/
137-
_FinalStage start(Optional<Float> start);
138-
139-
_FinalStage start(Float start);
122+
EndStage start(double start);
123+
}
140124

125+
public interface EndStage {
141126
/**
142127
* <p>The end time of the word</p>
143128
*/
144-
_FinalStage end(Optional<Float> end);
129+
_FinalStage end(double end);
130+
}
145131

146-
_FinalStage end(Float end);
132+
public interface _FinalStage {
133+
ListenV2TurnInfoWordsItem build();
134+
135+
_FinalStage additionalProperty(String key, Object value);
136+
137+
_FinalStage additionalProperties(Map<String, Object> additionalProperties);
147138
}
148139

149140
@JsonIgnoreProperties(ignoreUnknown = true)
150-
public static final class Builder implements WordStage, ConfidenceStage, _FinalStage {
141+
public static final class Builder implements WordStage, ConfidenceStage, StartStage, EndStage, _FinalStage {
151142
private String word;
152143

153144
private float confidence;
154145

155-
private Optional<Float> end = Optional.empty();
146+
private double start;
156147

157-
private Optional<Float> start = Optional.empty();
148+
private double end;
158149

159150
@JsonAnySetter
160151
private Map<String, Object> additionalProperties = new HashMap<>();
@@ -189,48 +180,32 @@ public ConfidenceStage word(@NotNull String word) {
189180
*/
190181
@java.lang.Override
191182
@JsonSetter("confidence")
192-
public _FinalStage confidence(float confidence) {
183+
public StartStage confidence(float confidence) {
193184
this.confidence = confidence;
194185
return this;
195186
}
196187

197188
/**
198-
* <p>The end time of the word</p>
189+
* <p>The start time of the word</p>
190+
* <p>The start time of the word</p>
199191
* @return Reference to {@code this} so that method calls can be chained together.
200192
*/
201193
@java.lang.Override
202-
public _FinalStage end(Float end) {
203-
this.end = Optional.ofNullable(end);
194+
@JsonSetter("start")
195+
public EndStage start(double start) {
196+
this.start = start;
204197
return this;
205198
}
206199

207200
/**
208201
* <p>The end time of the word</p>
209-
*/
210-
@java.lang.Override
211-
@JsonSetter(value = "end", nulls = Nulls.SKIP)
212-
public _FinalStage end(Optional<Float> end) {
213-
this.end = end;
214-
return this;
215-
}
216-
217-
/**
218-
* <p>The start time of the word</p>
202+
* <p>The end time of the word</p>
219203
* @return Reference to {@code this} so that method calls can be chained together.
220204
*/
221205
@java.lang.Override
222-
public _FinalStage start(Float start) {
223-
this.start = Optional.ofNullable(start);
224-
return this;
225-
}
226-
227-
/**
228-
* <p>The start time of the word</p>
229-
*/
230-
@java.lang.Override
231-
@JsonSetter(value = "start", nulls = Nulls.SKIP)
232-
public _FinalStage start(Optional<Float> start) {
233-
this.start = start;
206+
@JsonSetter("end")
207+
public _FinalStage end(double end) {
208+
this.end = end;
234209
return this;
235210
}
236211

0 commit comments

Comments
 (0)