Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 196eb9c

Browse files
🌿 Fern Regeneration -- May 22, 2024 (#104)
1 parent c032a1d commit 196eb9c

File tree

15 files changed

+1035
-145
lines changed

15 files changed

+1035
-145
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ jobs:
5858
env:
5959
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
6060
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
61-
MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/"
61+
MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/"

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
API reference documentation is available [here](https://www.assemblyai.com/docs/).
1414

15+
## Requirements
16+
17+
Java 8+
18+
1519
## Installation
1620

1721
### Gradle
@@ -49,10 +53,9 @@ AssemblyAI aai = AssemblyAI.builder()
4953
.apiKey("YOUR_API_KEY")
5054
.build();
5155

52-
TranscriptResponse transcriptResponse =
53-
aai.transcript().get("transcript-id");
56+
Transcript transcript = aai.transcripts().get("transcript-id");
5457

55-
System.out.printlin("Received response!" + transcriptResponse);
58+
System.out.printlin("Received response!" + transcript);
5659
```
5760

5861
### Handling Errors

build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,15 @@ publishing {
4747
maven(MavenPublication) {
4848
groupId = 'com.assemblyai'
4949
artifactId = 'assemblyai-java'
50-
version = '1.1.1'
50+
version = '1.1.2'
5151
from components.java
52+
pom {
53+
scm {
54+
connection = 'scm:git:git://github.com/AssemblyAI/assemblyai-java-sdk.git'
55+
developerConnection = 'scm:git:git://github.com/AssemblyAI/assemblyai-java-sdk.git'
56+
url = 'https://github.com/AssemblyAI/assemblyai-java-sdk'
57+
}
58+
}
5259
}
5360
}
5461
repositories {

gradle/wrapper/gradle-wrapper.jar

-9 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/com/assemblyai/api/core/ClientOptions.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ private ClientOptions(
2727
this.environment = environment;
2828
this.headers = new HashMap<>();
2929
this.headers.putAll(headers);
30-
this.headers.putAll(Map.of(
31-
"X-Fern-SDK-Name",
32-
"com.assemblyai.fern:api-sdk",
33-
"X-Fern-SDK-Version",
34-
"1.0.9",
35-
"X-Fern-Language",
36-
"JAVA"));
30+
this.headers.putAll(new HashMap<String, String>() {
31+
{
32+
put("X-Fern-SDK-Name", "com.assemblyai.fern:api-sdk");
33+
put("X-Fern-SDK-Version", "1.0.9");
34+
put("X-Fern-Language", "JAVA");
35+
}
36+
});
3737
this.headerSuppliers = headerSuppliers;
3838
this.httpClient = httpClient;
3939
}

src/main/java/com/assemblyai/api/resources/files/FilesClient.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import okhttp3.Request;
1616
import okhttp3.RequestBody;
1717
import okhttp3.Response;
18+
import okhttp3.ResponseBody;
1819

1920
public class FilesClient {
2021
protected final ClientOptions clientOptions;
@@ -24,14 +25,14 @@ public FilesClient(ClientOptions clientOptions) {
2425
}
2526

2627
/**
27-
* Upload your media file directly to the AssemblyAI API if it isn't accessible via a URL already.
28+
* Upload a media file to AssemblyAI's servers.
2829
*/
2930
public UploadedFile upload(byte[] request) {
3031
return upload(request, null);
3132
}
3233

3334
/**
34-
* Upload your media file directly to the AssemblyAI API if it isn't accessible via a URL already.
35+
* Upload a media file to AssemblyAI's servers.
3536
*/
3637
public UploadedFile upload(byte[] request, RequestOptions requestOptions) {
3738
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
@@ -51,12 +52,14 @@ public UploadedFile upload(byte[] request, RequestOptions requestOptions) {
5152
client = clientOptions.httpClientWithTimeout(requestOptions);
5253
}
5354
Response response = client.newCall(okhttpRequest).execute();
55+
ResponseBody responseBody = response.body();
5456
if (response.isSuccessful()) {
55-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UploadedFile.class);
57+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UploadedFile.class);
5658
}
5759
throw new ApiError(
5860
response.code(),
59-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
61+
ObjectMappers.JSON_MAPPER.readValue(
62+
responseBody != null ? responseBody.string() : "{}", Object.class));
6063
} catch (IOException e) {
6164
throw new RuntimeException(e);
6265
}

src/main/java/com/assemblyai/api/resources/lemur/LemurClient.java

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import okhttp3.Request;
2525
import okhttp3.RequestBody;
2626
import okhttp3.Response;
27+
import okhttp3.ResponseBody;
2728

2829
public class LemurClient {
2930
protected final ClientOptions clientOptions;
@@ -66,33 +67,38 @@ public LemurTaskResponse task(LemurTaskParams request, RequestOptions requestOpt
6667
client = clientOptions.httpClientWithTimeout(requestOptions);
6768
}
6869
Response response = client.newCall(okhttpRequest).execute();
70+
ResponseBody responseBody = response.body();
6971
if (response.isSuccessful()) {
70-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurTaskResponse.class);
72+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurTaskResponse.class);
7173
}
7274
throw new ApiError(
7375
response.code(),
74-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
76+
ObjectMappers.JSON_MAPPER.readValue(
77+
responseBody != null ? responseBody.string() : "{}", Object.class));
7578
} catch (IOException e) {
7679
throw new RuntimeException(e);
7780
}
7881
}
7982

8083
/**
81-
* 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.
84+
* Custom Summary allows you to distill a piece of audio into a few impactful sentences.
85+
* You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
8286
*/
8387
public LemurSummaryResponse summary() {
8488
return summary(LemurSummaryParams.builder().build());
8589
}
8690

8791
/**
88-
* 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.
92+
* Custom Summary allows you to distill a piece of audio into a few impactful sentences.
93+
* You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
8994
*/
9095
public LemurSummaryResponse summary(LemurSummaryParams request) {
9196
return summary(request, null);
9297
}
9398

9499
/**
95-
* 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.
100+
* Custom Summary allows you to distill a piece of audio into a few impactful sentences.
101+
* You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
96102
*/
97103
public LemurSummaryResponse summary(LemurSummaryParams request, RequestOptions requestOptions) {
98104
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
@@ -118,26 +124,30 @@ public LemurSummaryResponse summary(LemurSummaryParams request, RequestOptions r
118124
client = clientOptions.httpClientWithTimeout(requestOptions);
119125
}
120126
Response response = client.newCall(okhttpRequest).execute();
127+
ResponseBody responseBody = response.body();
121128
if (response.isSuccessful()) {
122-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurSummaryResponse.class);
129+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurSummaryResponse.class);
123130
}
124131
throw new ApiError(
125132
response.code(),
126-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
133+
ObjectMappers.JSON_MAPPER.readValue(
134+
responseBody != null ? responseBody.string() : "{}", Object.class));
127135
} catch (IOException e) {
128136
throw new RuntimeException(e);
129137
}
130138
}
131139

132140
/**
133-
* Question &amp; 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.
141+
* Question &amp; Answer allows you to ask free-form questions about a single transcript or a group of transcripts.
142+
* 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.
134143
*/
135144
public LemurQuestionAnswerResponse questionAnswer(LemurQuestionAnswerParams request) {
136145
return questionAnswer(request, null);
137146
}
138147

139148
/**
140-
* Question &amp; 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.
149+
* Question &amp; Answer allows you to ask free-form questions about a single transcript or a group of transcripts.
150+
* 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.
141151
*/
142152
public LemurQuestionAnswerResponse questionAnswer(
143153
LemurQuestionAnswerParams request, RequestOptions requestOptions) {
@@ -164,12 +174,14 @@ public LemurQuestionAnswerResponse questionAnswer(
164174
client = clientOptions.httpClientWithTimeout(requestOptions);
165175
}
166176
Response response = client.newCall(okhttpRequest).execute();
177+
ResponseBody responseBody = response.body();
167178
if (response.isSuccessful()) {
168-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurQuestionAnswerResponse.class);
179+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurQuestionAnswerResponse.class);
169180
}
170181
throw new ApiError(
171182
response.code(),
172-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
183+
ObjectMappers.JSON_MAPPER.readValue(
184+
responseBody != null ? responseBody.string() : "{}", Object.class));
173185
} catch (IOException e) {
174186
throw new RuntimeException(e);
175187
}
@@ -216,12 +228,14 @@ public LemurActionItemsResponse actionItems(LemurActionItemsParams request, Requ
216228
client = clientOptions.httpClientWithTimeout(requestOptions);
217229
}
218230
Response response = client.newCall(okhttpRequest).execute();
231+
ResponseBody responseBody = response.body();
219232
if (response.isSuccessful()) {
220-
return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LemurActionItemsResponse.class);
233+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LemurActionItemsResponse.class);
221234
}
222235
throw new ApiError(
223236
response.code(),
224-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
237+
ObjectMappers.JSON_MAPPER.readValue(
238+
responseBody != null ? responseBody.string() : "{}", Object.class));
225239
} catch (IOException e) {
226240
throw new RuntimeException(e);
227241
}
@@ -257,13 +271,14 @@ public PurgeLemurRequestDataResponse purgeRequestData(String requestId, RequestO
257271
client = clientOptions.httpClientWithTimeout(requestOptions);
258272
}
259273
Response response = client.newCall(okhttpRequest).execute();
274+
ResponseBody responseBody = response.body();
260275
if (response.isSuccessful()) {
261-
return ObjectMappers.JSON_MAPPER.readValue(
262-
response.body().string(), PurgeLemurRequestDataResponse.class);
276+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PurgeLemurRequestDataResponse.class);
263277
}
264278
throw new ApiError(
265279
response.code(),
266-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
280+
ObjectMappers.JSON_MAPPER.readValue(
281+
responseBody != null ? responseBody.string() : "{}", Object.class));
267282
} catch (IOException e) {
268283
throw new RuntimeException(e);
269284
}

src/main/java/com/assemblyai/api/resources/realtime/RealtimeClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import okhttp3.Request;
1818
import okhttp3.RequestBody;
1919
import okhttp3.Response;
20+
import okhttp3.ResponseBody;
2021

2122
public class RealtimeClient {
2223
protected final ClientOptions clientOptions;
@@ -60,13 +61,14 @@ public RealtimeTemporaryTokenResponse createTemporaryToken(
6061
client = clientOptions.httpClientWithTimeout(requestOptions);
6162
}
6263
Response response = client.newCall(okhttpRequest).execute();
64+
ResponseBody responseBody = response.body();
6365
if (response.isSuccessful()) {
64-
return ObjectMappers.JSON_MAPPER.readValue(
65-
response.body().string(), RealtimeTemporaryTokenResponse.class);
66+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RealtimeTemporaryTokenResponse.class);
6667
}
6768
throw new ApiError(
6869
response.code(),
69-
ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class));
70+
ObjectMappers.JSON_MAPPER.readValue(
71+
responseBody != null ? responseBody.string() : "{}", Object.class));
7072
} catch (IOException e) {
7173
throw new RuntimeException(e);
7274
}

0 commit comments

Comments
 (0)