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 May 22, 2024
1 parent c032a1d commit fb7f27e
Show file tree
Hide file tree
Showing 16 changed files with 1,115 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ jobs:
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/"
MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/"
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@ publishing {
maven(MavenPublication) {
groupId = 'com.assemblyai'
artifactId = 'assemblyai-java'
version = '1.1.1'
version = '1.1.2'
from components.java
pom {
scm {
connection = 'scm:git:git://github.com/AssemblyAI/assemblyai-java-sdk.git'
developerConnection = 'scm:git:git://github.com/AssemblyAI/assemblyai-java-sdk.git'
url = 'https://github.com/AssemblyAI/assemblyai-java-sdk'
}
}
}
}
repositories {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;

public class FilesClient {
protected final ClientOptions clientOptions;
Expand All @@ -24,14 +25,14 @@ public FilesClient(ClientOptions clientOptions) {
}

/**
* Upload your media file directly to the AssemblyAI API if it isn't accessible via a URL already.
* Upload a media file to AssemblyAI's servers.
*/
public UploadedFile upload(byte[] request) {
return upload(request, null);
}

/**
* Upload your media file directly to the AssemblyAI API if it isn't accessible via a URL already.
* Upload a media file to AssemblyAI's servers.
*/
public UploadedFile upload(byte[] request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
Expand All @@ -51,12 +52,14 @@ public UploadedFile upload(byte[] request, RequestOptions requestOptions) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UploadedFile.class);
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UploadedFile.class);
}
throw new ApiError(
response.code(),
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
ObjectMappers.JSON_MAPPER.readValue(
responseBody != null ? responseBody.string() : "{}", Object.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
47 changes: 31 additions & 16 deletions src/main/java/com/assemblyai/api/resources/lemur/LemurClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;

public class LemurClient {
protected final ClientOptions clientOptions;
Expand Down Expand Up @@ -66,33 +67,38 @@ public LemurTaskResponse task(LemurTaskParams request, RequestOptions requestOpt
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurTaskResponse.class);
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurTaskResponse.class);
}
throw new ApiError(
response.code(),
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
ObjectMappers.JSON_MAPPER.readValue(
responseBody != null ? responseBody.string() : "{}", Object.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
}

/**
* Custom Summary allows you to distill a piece of audio into a few impactful sentences. You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
* Custom Summary allows you to distill a piece of audio into a few impactful sentences.
* You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
*/
public LemurSummaryResponse summary() {
return summary(LemurSummaryParams.builder().build());
}

/**
* Custom Summary allows you to distill a piece of audio into a few impactful sentences. You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
* Custom Summary allows you to distill a piece of audio into a few impactful sentences.
* You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
*/
public LemurSummaryResponse summary(LemurSummaryParams request) {
return summary(request, null);
}

/**
* Custom Summary allows you to distill a piece of audio into a few impactful sentences. You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
* Custom Summary allows you to distill a piece of audio into a few impactful sentences.
* You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
*/
public LemurSummaryResponse summary(LemurSummaryParams request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
Expand All @@ -118,26 +124,30 @@ public LemurSummaryResponse summary(LemurSummaryParams request, RequestOptions r
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurSummaryResponse.class);
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurSummaryResponse.class);
}
throw new ApiError(
response.code(),
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
ObjectMappers.JSON_MAPPER.readValue(
responseBody != null ? responseBody.string() : "{}", Object.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
}

/**
* Question & Answer allows you to ask free-form questions about a single transcript or a group of transcripts. The questions can be any whose answers you find useful, such as judging whether a caller is likely to become a customer or whether all items on a meeting's agenda were covered.
* Question & Answer allows you to ask free-form questions about a single transcript or a group of transcripts.
* The questions can be any whose answers you find useful, such as judging whether a caller is likely to become a customer or whether all items on a meeting's agenda were covered.
*/
public LemurQuestionAnswerResponse questionAnswer(LemurQuestionAnswerParams request) {
return questionAnswer(request, null);
}

/**
* Question & Answer allows you to ask free-form questions about a single transcript or a group of transcripts. The questions can be any whose answers you find useful, such as judging whether a caller is likely to become a customer or whether all items on a meeting's agenda were covered.
* Question & Answer allows you to ask free-form questions about a single transcript or a group of transcripts.
* The questions can be any whose answers you find useful, such as judging whether a caller is likely to become a customer or whether all items on a meeting's agenda were covered.
*/
public LemurQuestionAnswerResponse questionAnswer(
LemurQuestionAnswerParams request, RequestOptions requestOptions) {
Expand All @@ -164,12 +174,14 @@ public LemurQuestionAnswerResponse questionAnswer(
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurQuestionAnswerResponse.class);
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurQuestionAnswerResponse.class);
}
throw new ApiError(
response.code(),
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
ObjectMappers.JSON_MAPPER.readValue(
responseBody != null ? responseBody.string() : "{}", Object.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -216,12 +228,14 @@ public LemurActionItemsResponse actionItems(LemurActionItemsParams request, Requ
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurActionItemsResponse.class);
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurActionItemsResponse.class);
}
throw new ApiError(
response.code(),
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
ObjectMappers.JSON_MAPPER.readValue(
responseBody != null ? responseBody.string() : "{}", Object.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -257,13 +271,14 @@ public PurgeLemurRequestDataResponse purgeRequestData(String requestId, RequestO
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(
response.body().string(), PurgeLemurRequestDataResponse.class);
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PurgeLemurRequestDataResponse.class);
}
throw new ApiError(
response.code(),
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
ObjectMappers.JSON_MAPPER.readValue(
responseBody != null ? responseBody.string() : "{}", Object.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;

public class RealtimeClient {
protected final ClientOptions clientOptions;
Expand Down Expand Up @@ -60,13 +61,14 @@ public RealtimeTemporaryTokenResponse createTemporaryToken(
client = clientOptions.httpClientWithTimeout(requestOptions);
}
Response response = client.newCall(okhttpRequest).execute();
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(
response.body().string(), RealtimeTemporaryTokenResponse.class);
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RealtimeTemporaryTokenResponse.class);
}
throw new ApiError(
response.code(),
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
ObjectMappers.JSON_MAPPER.readValue(
responseBody != null ? responseBody.string() : "{}", Object.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.assemblyai.api.resources.realtime.types;
package com.assemblyai.api.resources.streaming.types;

import com.assemblyai.api.core.ObjectMappers;
import com.assemblyai.api.resources.realtime.types.FinalTranscript;
import com.assemblyai.api.resources.realtime.types.PartialTranscript;
import com.assemblyai.api.resources.realtime.types.RealtimeError;
import com.assemblyai.api.resources.realtime.types.SessionBegins;
import com.assemblyai.api.resources.realtime.types.SessionInformation;
import com.assemblyai.api.resources.realtime.types.SessionTerminated;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.assemblyai.api.resources.realtime.types;
package com.assemblyai.api.resources.streaming.types;

import com.assemblyai.api.core.ObjectMappers;
import com.assemblyai.api.resources.realtime.types.ConfigureEndUtteranceSilenceThreshold;
import com.assemblyai.api.resources.realtime.types.ForceEndUtterance;
import com.assemblyai.api.resources.realtime.types.TerminateSession;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
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.streaming.types;

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

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

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

private final Value value;

private final String string;

Streaming(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 Streaming && this.string.equals(((Streaming) 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 Streaming valueOf(String value) {
switch (value) {
case "pcm_s16le":
return PCM_S16LE;
case "pcm_mulaw":
return PCM_MULAW;
default:
return new Streaming(Value.UNKNOWN, value);
}
}

public enum Value {
PCM_S16LE,

PCM_MULAW,

UNKNOWN
}

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

T visitPcmMulaw();

T visitUnknown(String unknownType);
}
}
Loading

0 comments on commit fb7f27e

Please sign in to comment.