Skip to content

Commit 6a85087

Browse files
committed
Release 0.8.1
1 parent 0bb7733 commit 6a85087

File tree

472 files changed

+61798
-11910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

472 files changed

+61798
-11910
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
steps:
1010
- name: Checkout repo
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212

1313
- name: Set up Java
1414
id: setup-jre
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Checkout repo
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929

3030
- name: Set up Java
3131
id: setup-jre
@@ -43,7 +43,7 @@ jobs:
4343

4444
steps:
4545
- name: Checkout repo
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4
4747

4848
- name: Set up Java
4949
id: setup-jre

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ java {
4444

4545
group = 'dev.vapi'
4646

47-
version = 'v0.5.1'
47+
version = '0.8.1'
4848

4949
jar {
5050
dependsOn(":generatePomFileForMavenPublication")
@@ -71,7 +71,7 @@ publishing {
7171
maven(MavenPublication) {
7272
groupId = 'dev.vapi'
7373
artifactId = 'server-sdk'
74-
version = 'v0.5.1'
74+
version = '0.8.1'
7575
from components.java
7676
pom {
7777
licenses {

gradle/wrapper/gradle-wrapper.jar

181 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.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
118118

119119

120120
# Determine the Java command to use to start the JVM.
@@ -205,15 +205,15 @@ fi
205205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206206

207207
# Collect all arguments for the java command:
208-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209209
# and any embedded shellness will be escaped.
210210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211211
# treated as '${Hostname}' itself on the command line.
212212

213213
set -- \
214214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215215
-classpath "$CLASSPATH" \
216-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217217
"$@"
218218

219219
# Stop when "xargs" is not available.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
set CLASSPATH=
7474

7575

7676
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7878

7979
:end
8080
@rem End local scope for the variables with windows NT shell

sample-app/src/main/java/sample/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
public final class App {
1010
public static void main(String[] args) {
11-
// import com.vapi.api.Vapi
11+
// import com.vapi.api.AsyncVapi
1212
}
1313
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
package com.vapi.api;
5+
6+
import com.vapi.api.core.ClientOptions;
7+
import com.vapi.api.core.ObjectMappers;
8+
import com.vapi.api.core.RequestOptions;
9+
import com.vapi.api.core.VapiApiException;
10+
import com.vapi.api.core.VapiException;
11+
import com.vapi.api.core.VapiHttpResponse;
12+
import java.io.IOException;
13+
import java.util.concurrent.CompletableFuture;
14+
import okhttp3.Call;
15+
import okhttp3.Callback;
16+
import okhttp3.Headers;
17+
import okhttp3.HttpUrl;
18+
import okhttp3.OkHttpClient;
19+
import okhttp3.Request;
20+
import okhttp3.Response;
21+
import okhttp3.ResponseBody;
22+
import org.jetbrains.annotations.NotNull;
23+
24+
public class AsyncRawVapi {
25+
protected final ClientOptions clientOptions;
26+
27+
public AsyncRawVapi(ClientOptions clientOptions) {
28+
this.clientOptions = clientOptions;
29+
}
30+
31+
public CompletableFuture<VapiHttpResponse<Void>> prometheusControllerIndex() {
32+
return prometheusControllerIndex(null);
33+
}
34+
35+
public CompletableFuture<VapiHttpResponse<Void>> prometheusControllerIndex(RequestOptions requestOptions) {
36+
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
37+
.newBuilder()
38+
.addPathSegments("prometheus_metrics")
39+
.build();
40+
Request okhttpRequest = new Request.Builder()
41+
.url(httpUrl)
42+
.method("GET", null)
43+
.headers(Headers.of(clientOptions.headers(requestOptions)))
44+
.build();
45+
OkHttpClient client = clientOptions.httpClient();
46+
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
47+
client = clientOptions.httpClientWithTimeout(requestOptions);
48+
}
49+
CompletableFuture<VapiHttpResponse<Void>> future = new CompletableFuture<>();
50+
client.newCall(okhttpRequest).enqueue(new Callback() {
51+
@Override
52+
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
53+
try (ResponseBody responseBody = response.body()) {
54+
if (response.isSuccessful()) {
55+
future.complete(new VapiHttpResponse<>(null, response));
56+
return;
57+
}
58+
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
59+
future.completeExceptionally(new VapiApiException(
60+
"Error with status code " + response.code(),
61+
response.code(),
62+
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
63+
response));
64+
return;
65+
} catch (IOException e) {
66+
future.completeExceptionally(new VapiException("Network error executing HTTP request", e));
67+
}
68+
}
69+
70+
@Override
71+
public void onFailure(@NotNull Call call, @NotNull IOException e) {
72+
future.completeExceptionally(new VapiException("Network error executing HTTP request", e));
73+
}
74+
});
75+
return future;
76+
}
77+
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
package com.vapi.api;
5+
6+
import com.vapi.api.core.ClientOptions;
7+
import com.vapi.api.core.RequestOptions;
8+
import com.vapi.api.core.Suppliers;
9+
import com.vapi.api.resources.analytics.AsyncAnalyticsClient;
10+
import com.vapi.api.resources.assistants.AsyncAssistantsClient;
11+
import com.vapi.api.resources.calls.AsyncCallsClient;
12+
import com.vapi.api.resources.files.AsyncFilesClient;
13+
import com.vapi.api.resources.knowledgebases.AsyncKnowledgeBasesClient;
14+
import com.vapi.api.resources.logs.AsyncLogsClient;
15+
import com.vapi.api.resources.phonenumbers.AsyncPhoneNumbersClient;
16+
import com.vapi.api.resources.squads.AsyncSquadsClient;
17+
import com.vapi.api.resources.testsuiteruns.AsyncTestSuiteRunsClient;
18+
import com.vapi.api.resources.testsuites.AsyncTestSuitesClient;
19+
import com.vapi.api.resources.testsuitetests.AsyncTestSuiteTestsClient;
20+
import com.vapi.api.resources.tools.AsyncToolsClient;
21+
import com.vapi.api.resources.workflow.AsyncWorkflowClient;
22+
import java.util.concurrent.CompletableFuture;
23+
import java.util.function.Supplier;
24+
25+
public class AsyncVapi {
26+
protected final ClientOptions clientOptions;
27+
28+
private final AsyncRawVapi rawClient;
29+
30+
protected final Supplier<AsyncCallsClient> callsClient;
31+
32+
protected final Supplier<AsyncAssistantsClient> assistantsClient;
33+
34+
protected final Supplier<AsyncPhoneNumbersClient> phoneNumbersClient;
35+
36+
protected final Supplier<AsyncToolsClient> toolsClient;
37+
38+
protected final Supplier<AsyncFilesClient> filesClient;
39+
40+
protected final Supplier<AsyncKnowledgeBasesClient> knowledgeBasesClient;
41+
42+
protected final Supplier<AsyncWorkflowClient> workflowClient;
43+
44+
protected final Supplier<AsyncSquadsClient> squadsClient;
45+
46+
protected final Supplier<AsyncTestSuitesClient> testSuitesClient;
47+
48+
protected final Supplier<AsyncTestSuiteTestsClient> testSuiteTestsClient;
49+
50+
protected final Supplier<AsyncTestSuiteRunsClient> testSuiteRunsClient;
51+
52+
protected final Supplier<AsyncAnalyticsClient> analyticsClient;
53+
54+
protected final Supplier<AsyncLogsClient> logsClient;
55+
56+
public AsyncVapi(ClientOptions clientOptions) {
57+
this.clientOptions = clientOptions;
58+
this.rawClient = new AsyncRawVapi(clientOptions);
59+
this.callsClient = Suppliers.memoize(() -> new AsyncCallsClient(clientOptions));
60+
this.assistantsClient = Suppliers.memoize(() -> new AsyncAssistantsClient(clientOptions));
61+
this.phoneNumbersClient = Suppliers.memoize(() -> new AsyncPhoneNumbersClient(clientOptions));
62+
this.toolsClient = Suppliers.memoize(() -> new AsyncToolsClient(clientOptions));
63+
this.filesClient = Suppliers.memoize(() -> new AsyncFilesClient(clientOptions));
64+
this.knowledgeBasesClient = Suppliers.memoize(() -> new AsyncKnowledgeBasesClient(clientOptions));
65+
this.workflowClient = Suppliers.memoize(() -> new AsyncWorkflowClient(clientOptions));
66+
this.squadsClient = Suppliers.memoize(() -> new AsyncSquadsClient(clientOptions));
67+
this.testSuitesClient = Suppliers.memoize(() -> new AsyncTestSuitesClient(clientOptions));
68+
this.testSuiteTestsClient = Suppliers.memoize(() -> new AsyncTestSuiteTestsClient(clientOptions));
69+
this.testSuiteRunsClient = Suppliers.memoize(() -> new AsyncTestSuiteRunsClient(clientOptions));
70+
this.analyticsClient = Suppliers.memoize(() -> new AsyncAnalyticsClient(clientOptions));
71+
this.logsClient = Suppliers.memoize(() -> new AsyncLogsClient(clientOptions));
72+
}
73+
74+
/**
75+
* Get responses with HTTP metadata like headers
76+
*/
77+
public AsyncRawVapi withRawResponse() {
78+
return this.rawClient;
79+
}
80+
81+
public CompletableFuture<Void> prometheusControllerIndex() {
82+
return this.rawClient.prometheusControllerIndex().thenApply(response -> response.body());
83+
}
84+
85+
public CompletableFuture<Void> prometheusControllerIndex(RequestOptions requestOptions) {
86+
return this.rawClient.prometheusControllerIndex(requestOptions).thenApply(response -> response.body());
87+
}
88+
89+
public AsyncCallsClient calls() {
90+
return this.callsClient.get();
91+
}
92+
93+
public AsyncAssistantsClient assistants() {
94+
return this.assistantsClient.get();
95+
}
96+
97+
public AsyncPhoneNumbersClient phoneNumbers() {
98+
return this.phoneNumbersClient.get();
99+
}
100+
101+
public AsyncToolsClient tools() {
102+
return this.toolsClient.get();
103+
}
104+
105+
public AsyncFilesClient files() {
106+
return this.filesClient.get();
107+
}
108+
109+
public AsyncKnowledgeBasesClient knowledgeBases() {
110+
return this.knowledgeBasesClient.get();
111+
}
112+
113+
public AsyncWorkflowClient workflow() {
114+
return this.workflowClient.get();
115+
}
116+
117+
public AsyncSquadsClient squads() {
118+
return this.squadsClient.get();
119+
}
120+
121+
public AsyncTestSuitesClient testSuites() {
122+
return this.testSuitesClient.get();
123+
}
124+
125+
public AsyncTestSuiteTestsClient testSuiteTests() {
126+
return this.testSuiteTestsClient.get();
127+
}
128+
129+
public AsyncTestSuiteRunsClient testSuiteRuns() {
130+
return this.testSuiteRunsClient.get();
131+
}
132+
133+
public AsyncAnalyticsClient analytics() {
134+
return this.analyticsClient.get();
135+
}
136+
137+
public AsyncLogsClient logs() {
138+
return this.logsClient.get();
139+
}
140+
141+
public static AsyncVapiBuilder builder() {
142+
return new AsyncVapiBuilder();
143+
}
144+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
package com.vapi.api;
5+
6+
import com.vapi.api.core.ClientOptions;
7+
import com.vapi.api.core.Environment;
8+
import okhttp3.OkHttpClient;
9+
10+
public final class AsyncVapiBuilder {
11+
private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder();
12+
13+
private String token = null;
14+
15+
private Environment environment = Environment.DEFAULT;
16+
17+
/**
18+
* Sets token
19+
*/
20+
public AsyncVapiBuilder token(String token) {
21+
this.token = token;
22+
return this;
23+
}
24+
25+
public AsyncVapiBuilder environment(Environment environment) {
26+
this.environment = environment;
27+
return this;
28+
}
29+
30+
public AsyncVapiBuilder url(String url) {
31+
this.environment = Environment.custom(url);
32+
return this;
33+
}
34+
35+
/**
36+
* Sets the timeout (in seconds) for the client. Defaults to 60 seconds.
37+
*/
38+
public AsyncVapiBuilder timeout(int timeout) {
39+
this.clientOptionsBuilder.timeout(timeout);
40+
return this;
41+
}
42+
43+
/**
44+
* Sets the maximum number of retries for the client. Defaults to 2 retries.
45+
*/
46+
public AsyncVapiBuilder maxRetries(int maxRetries) {
47+
this.clientOptionsBuilder.maxRetries(maxRetries);
48+
return this;
49+
}
50+
51+
/**
52+
* Sets the underlying OkHttp client
53+
*/
54+
public AsyncVapiBuilder httpClient(OkHttpClient httpClient) {
55+
this.clientOptionsBuilder.httpClient(httpClient);
56+
return this;
57+
}
58+
59+
public AsyncVapi build() {
60+
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token);
61+
clientOptionsBuilder.environment(this.environment);
62+
return new AsyncVapi(clientOptionsBuilder.build());
63+
}
64+
}

0 commit comments

Comments
 (0)