Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Mar 11, 2024
1 parent c9e56da commit 77bffd2
Show file tree
Hide file tree
Showing 8 changed files with 363 additions and 65 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.assemblyai'
artifactId = 'assemblyai-java'
version = '1.0.7'
version = '1.0.8'
from components.java
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ public UploadedFile upload(byte[] request, RequestOptions requestOptions) {
.build();
try {
OkHttpClient client = clientOptions.httpClient();
if (requestOptions.getTimeout().isPresent()) {
client = client.newBuilder()
.readTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.build();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
if (response.isSuccessful()) {
Expand Down
30 changes: 10 additions & 20 deletions src/main/java/com/assemblyai/api/resources/lemur/LemurClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ public LemurTaskResponse task(LemurTaskParams request, RequestOptions requestOpt
.build();
try {
OkHttpClient client = clientOptions.httpClient();
if (requestOptions.getTimeout().isPresent()) {
client = client.newBuilder()
.readTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.build();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
if (response.isSuccessful()) {
Expand Down Expand Up @@ -116,10 +114,8 @@ public LemurSummaryResponse summary(LemurSummaryParams request, RequestOptions r
.build();
try {
OkHttpClient client = clientOptions.httpClient();
if (requestOptions.getTimeout().isPresent()) {
client = client.newBuilder()
.readTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.build();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
if (response.isSuccessful()) {
Expand Down Expand Up @@ -164,10 +160,8 @@ public LemurQuestionAnswerResponse questionAnswer(
.build();
try {
OkHttpClient client = clientOptions.httpClient();
if (requestOptions.getTimeout().isPresent()) {
client = client.newBuilder()
.readTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.build();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
if (response.isSuccessful()) {
Expand Down Expand Up @@ -218,10 +212,8 @@ public LemurActionItemsResponse actionItems(LemurActionItemsParams request, Requ
.build();
try {
OkHttpClient client = clientOptions.httpClient();
if (requestOptions.getTimeout().isPresent()) {
client = client.newBuilder()
.readTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.build();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
if (response.isSuccessful()) {
Expand Down Expand Up @@ -261,10 +253,8 @@ public PurgeLemurRequestDataResponse purgeRequestData(String requestId, RequestO
.build();
try {
OkHttpClient client = clientOptions.httpClient();
if (requestOptions.getTimeout().isPresent()) {
client = client.newBuilder()
.readTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.build();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
if (response.isSuccessful()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ public RealtimeTemporaryTokenResponse createTemporaryToken(
.build();
try {
OkHttpClient client = clientOptions.httpClient();
if (requestOptions.getTimeout().isPresent()) {
client = client.newBuilder()
.readTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit())
.build();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
if (response.isSuccessful()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.assemblyai.api.resources.realtime.types;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public final class Realtime {
public static final Realtime PCM_S16LE = new Realtime(Value.PCM_S16LE, "pcm_s16le");

public static final Realtime PCM_MULAW = new Realtime(Value.PCM_MULAW, "pcm_mulaw");

private final Value value;

private final String string;

Realtime(Value value, String string) {
this.value = value;
this.string = string;
}

public Value getEnumValue() {
return value;
}

@java.lang.Override
@JsonValue
public String toString() {
return this.string;
}

@java.lang.Override
public boolean equals(Object other) {
return (this == other) || (other instanceof Realtime && this.string.equals(((Realtime) other).string));
}

@java.lang.Override
public int hashCode() {
return this.string.hashCode();
}

public <T> T visit(Visitor<T> visitor) {
switch (value) {
case PCM_S16LE:
return visitor.visitPcmS16le();
case PCM_MULAW:
return visitor.visitPcmMulaw();
case UNKNOWN:
default:
return visitor.visitUnknown(string);
}
}

@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static Realtime valueOf(String value) {
switch (value) {
case "pcm_s16le":
return PCM_S16LE;
case "pcm_mulaw":
return PCM_MULAW;
default:
return new Realtime(Value.UNKNOWN, value);
}
}

public enum Value {
PCM_S16LE,

PCM_MULAW,

UNKNOWN
}

public interface Visitor<T> {
T visitPcmS16le();

T visitPcmMulaw();

T visitUnknown(String unknownType);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.assemblyai.api.resources.realtime.types;

import com.assemblyai.api.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.util.Objects;

@JsonDeserialize(using = ReceiveMessage.Deserializer.class)
public final class ReceiveMessage {
private final Object value;

private final int type;

private ReceiveMessage(Object value, int type) {
this.value = value;
this.type = type;
}

@JsonValue
public Object get() {
return this.value;
}

public <T> T visit(Visitor<T> visitor) {
if (this.type == 0) {
return visitor.visit((SessionBegins) this.value);
} else if (this.type == 1) {
return visitor.visit((PartialTranscript) this.value);
} else if (this.type == 2) {
return visitor.visit((FinalTranscript) this.value);
} else if (this.type == 3) {
return visitor.visit((SessionTerminated) this.value);
} else if (this.type == 4) {
return visitor.visit((RealtimeError) this.value);
}
throw new IllegalStateException("Failed to visit value. This should never happen.");
}

@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ReceiveMessage && equalTo((ReceiveMessage) other);
}

private boolean equalTo(ReceiveMessage other) {
return value.equals(other.value);
}

@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}

@java.lang.Override
public String toString() {
return this.value.toString();
}

public static ReceiveMessage of(SessionBegins value) {
return new ReceiveMessage(value, 0);
}

public static ReceiveMessage of(PartialTranscript value) {
return new ReceiveMessage(value, 1);
}

public static ReceiveMessage of(FinalTranscript value) {
return new ReceiveMessage(value, 2);
}

public static ReceiveMessage of(SessionTerminated value) {
return new ReceiveMessage(value, 3);
}

public static ReceiveMessage of(RealtimeError value) {
return new ReceiveMessage(value, 4);
}

public interface Visitor<T> {
T visit(SessionBegins value);

T visit(PartialTranscript value);

T visit(FinalTranscript value);

T visit(SessionTerminated value);

T visit(RealtimeError value);
}

static final class Deserializer extends StdDeserializer<ReceiveMessage> {
Deserializer() {
super(ReceiveMessage.class);
}

@java.lang.Override
public ReceiveMessage deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
Object value = p.readValueAs(Object.class);
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, SessionBegins.class));
} catch (IllegalArgumentException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, PartialTranscript.class));
} catch (IllegalArgumentException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, FinalTranscript.class));
} catch (IllegalArgumentException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, SessionTerminated.class));
} catch (IllegalArgumentException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, RealtimeError.class));
} catch (IllegalArgumentException e) {
}
throw new JsonParseException(p, "Failed to deserialize");
}
}
}
Loading

0 comments on commit 77bffd2

Please sign in to comment.