Skip to content

Commit fc42577

Browse files
committed
SDK regeneration
1 parent 77d4510 commit fc42577

31 files changed

Lines changed: 618 additions & 550 deletions

.fern/metadata.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"cliVersion": "4.107.0",
2+
"cliVersion": "5.44.6",
33
"generatorName": "fernapi/fern-java-sdk",
4-
"generatorVersion": "4.6.2",
4+
"generatorVersion": "4.10.1",
55
"generatorConfig": {
66
"package-prefix": "com.deepgram",
77
"base-api-exception-class-name": "DeepgramHttpException",
@@ -11,8 +11,8 @@
1111
},
1212
"enable-wire-tests": true
1313
},
14-
"originGitCommit": "d228f82e93aaa8aa77f978d458cf912f3daaa8c1",
14+
"originGitCommit": "0be656a350cef88f6586d6cb4aa28f8fc25b30ea",
1515
"originGitCommitIsDirty": true,
1616
"invokedBy": "manual",
17-
"sdkVersion": "0.5.0"
17+
"sdkVersion": "0.5.1"
1818
}

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/DateTimeDeserializer.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.time.OffsetDateTime;
1515
import java.time.ZoneOffset;
1616
import java.time.format.DateTimeFormatter;
17+
import java.time.format.DateTimeParseException;
1718
import java.time.temporal.TemporalAccessor;
1819
import java.time.temporal.TemporalQueries;
1920

@@ -42,8 +43,15 @@ public OffsetDateTime deserialize(JsonParser parser, DeserializationContext cont
4243
if (token == JsonToken.VALUE_NUMBER_INT) {
4344
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC);
4445
} else {
45-
TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(
46-
parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from);
46+
String value = parser.getValueAsString();
47+
TemporalAccessor temporal;
48+
try {
49+
temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(value, OffsetDateTime::from, LocalDateTime::from);
50+
} catch (DateTimeParseException e) {
51+
// Fall back to space-separated format (e.g. "2025-02-15 10:30:00+00:00").
52+
temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(
53+
value.replace(' ', 'T'), OffsetDateTime::from, LocalDateTime::from);
54+
}
4755

4856
if (temporal.query(TemporalQueries.offset()) == null) {
4957
return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC);

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/agent/v1/websocket/V1WebSocketClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.deepgram.core.DisconnectReason;
88
import com.deepgram.core.ObjectMappers;
99
import com.deepgram.core.ReconnectingWebSocketListener;
10+
import com.deepgram.core.RequestOptions;
1011
import com.deepgram.core.WebSocketReadyState;
1112
import com.deepgram.resources.agent.v1.types.AgentV1AgentAudioDone;
1213
import com.deepgram.resources.agent.v1.types.AgentV1AgentStartedSpeaking;
@@ -141,7 +142,7 @@ public CompletableFuture<Void> connect() {
141142
}
142143
HttpUrl.Builder urlBuilder = parsedUrl.newBuilder();
143144
Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build());
144-
clientOptions.headers(null).forEach(requestBuilder::addHeader);
145+
clientOptions.headers((RequestOptions) null).forEach(requestBuilder::addHeader);
145146
final Request request = requestBuilder.build();
146147
this.readyState = WebSocketReadyState.CONNECTING;
147148
ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = this.reconnectOptions != null

src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,15 @@ public Optional<Boolean> getDetectLanguage() {
336336
}
337337

338338
/**
339-
* @return Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0
339+
* @return Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.
340340
*/
341341
@JsonIgnore
342342
public Optional<Boolean> getDiarize() {
343343
return diarize;
344344
}
345345

346346
/**
347-
* @return Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.
347+
* @return Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.
348348
*/
349349
@JsonIgnore
350350
public Optional<MediaTranscribeRequestDiarizeModel> getDiarizeModel() {
@@ -752,14 +752,14 @@ public interface _FinalStage {
752752
_FinalStage detectLanguage(Boolean detectLanguage);
753753

754754
/**
755-
* <p>Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0</p>
755+
* <p>Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.</p>
756756
*/
757757
_FinalStage diarize(Optional<Boolean> diarize);
758758

759759
_FinalStage diarize(Boolean diarize);
760760

761761
/**
762-
* <p>Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.</p>
762+
* <p>Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.</p>
763763
*/
764764
_FinalStage diarizeModel(Optional<MediaTranscribeRequestDiarizeModel> diarizeModel);
765765

@@ -1359,7 +1359,7 @@ public _FinalStage dictation(Optional<Boolean> dictation) {
13591359
}
13601360

13611361
/**
1362-
* <p>Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.</p>
1362+
* <p>Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.</p>
13631363
* @return Reference to {@code this} so that method calls can be chained together.
13641364
*/
13651365
@java.lang.Override
@@ -1369,7 +1369,7 @@ public _FinalStage diarizeModel(MediaTranscribeRequestDiarizeModel diarizeModel)
13691369
}
13701370

13711371
/**
1372-
* <p>Select and enable a specific batch diarization model version. If specifying this parameter, you should not set the deprecated <code>diarize=true</code> parameter. Not accepted on streaming requests.</p>
1372+
* <p>Select and enable a specific diarization model version. Specifying this parameter enables diarization and selects the model — you do not need to also set the deprecated <code>diarize=true</code> parameter. For batch, supported values are <code>latest</code> (currently v2), <code>v1</code>, and <code>v2</code>. For streaming, supported values are <code>latest</code> (currently v1) and <code>v1</code>; <code>v2</code> returns a validation error on streaming requests.</p>
13731373
*/
13741374
@java.lang.Override
13751375
@JsonSetter(value = "diarize_model", nulls = Nulls.SKIP)
@@ -1379,7 +1379,7 @@ public _FinalStage diarizeModel(Optional<MediaTranscribeRequestDiarizeModel> dia
13791379
}
13801380

13811381
/**
1382-
* <p>Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0</p>
1382+
* <p>Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.</p>
13831383
* @return Reference to {@code this} so that method calls can be chained together.
13841384
*/
13851385
@java.lang.Override
@@ -1389,7 +1389,7 @@ public _FinalStage diarize(Boolean diarize) {
13891389
}
13901390

13911391
/**
1392-
* <p>Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0</p>
1392+
* <p>Deprecated: use <code>diarize_model</code> instead. Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0.</p>
13931393
*/
13941394
@java.lang.Override
13951395
@JsonSetter(value = "diarize", nulls = Nulls.SKIP)

0 commit comments

Comments
 (0)