Skip to content

Commit

Permalink
Release 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 26, 2024
1 parent 2799d06 commit 0df2769
Show file tree
Hide file tree
Showing 356 changed files with 41,705 additions and 3,139 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Publish to maven
run: |
./gradlew publish
./gradlew publish
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
Expand Down
33 changes: 32 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,62 @@ dependencies {
sourceCompatibility = 1.8
targetCompatibility = 1.8

tasks.withType(Javadoc) {
failOnError false
options.addStringOption('Xdoclint:none', '-quiet')
}

spotless {
java {
palantirJavaFormat()
}
}


java {
withSourcesJar()
withJavadocJar()
}


group = 'dev.vapi'

version = '0.2.0'

jar {
dependsOn(":generatePomFileForMavenPublication")
archiveBaseName = "server-sdk"
}

sourcesJar {
archiveBaseName = "server-sdk"
}

javadocJar {
archiveBaseName = "server-sdk"
}

test {
useJUnitPlatform()
testLogging {
showStandardStreams = true
}
}

publishing {
publications {
maven(MavenPublication) {
groupId = 'dev.vapi'
artifactId = 'server-sdk'
version = '0.1.0'
version = '0.2.0'
from components.java
pom {
licenses {
license {
name = 'The MIT License (MIT)'
url = 'https://mit-license.org/'
}
}
scm {
connection = 'scm:git:git://github.com/VapiAI/server-sdk-java.git'
developerConnection = 'scm:git:git://github.com/VapiAI/server-sdk-java.git'
Expand Down
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.10.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
rootProject.name = 'server-sdk'

include 'sample-app'
8 changes: 8 additions & 0 deletions src/main/java/com/vapi/api/Vapi.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.vapi.api.resources.blocks.BlocksClient;
import com.vapi.api.resources.calls.CallsClient;
import com.vapi.api.resources.files.FilesClient;
import com.vapi.api.resources.knowledgebases.KnowledgeBasesClient;
import com.vapi.api.resources.logs.LogsClient;
import com.vapi.api.resources.phonenumbers.PhoneNumbersClient;
import com.vapi.api.resources.squads.SquadsClient;
Expand All @@ -27,6 +28,8 @@ public class Vapi {

protected final Supplier<SquadsClient> squadsClient;

protected final Supplier<KnowledgeBasesClient> knowledgeBasesClient;

protected final Supplier<BlocksClient> blocksClient;

protected final Supplier<ToolsClient> toolsClient;
Expand All @@ -43,6 +46,7 @@ public Vapi(ClientOptions clientOptions) {
this.assistantsClient = Suppliers.memoize(() -> new AssistantsClient(clientOptions));
this.phoneNumbersClient = Suppliers.memoize(() -> new PhoneNumbersClient(clientOptions));
this.squadsClient = Suppliers.memoize(() -> new SquadsClient(clientOptions));
this.knowledgeBasesClient = Suppliers.memoize(() -> new KnowledgeBasesClient(clientOptions));
this.blocksClient = Suppliers.memoize(() -> new BlocksClient(clientOptions));
this.toolsClient = Suppliers.memoize(() -> new ToolsClient(clientOptions));
this.filesClient = Suppliers.memoize(() -> new FilesClient(clientOptions));
Expand All @@ -66,6 +70,10 @@ public SquadsClient squads() {
return this.squadsClient.get();
}

public KnowledgeBasesClient knowledgeBases() {
return this.knowledgeBasesClient.get();
}

public BlocksClient blocks() {
return this.blocksClient.get();
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/vapi/api/VapiBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ public VapiBuilder url(String url) {
}

public Vapi build() {
if (token == null) {
throw new RuntimeException("Please provide token");
}
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + this.token);
clientOptionsBuilder.environment(this.environment);
return new Vapi(clientOptionsBuilder.build());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/vapi/api/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private ClientOptions(
{
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.vapi.fern:api-sdk");
put("X-Fern-SDK-Version", "0.1.0");
put("X-Fern-SDK-Version", "0.2.0");
}
});
this.headerSuppliers = headerSuppliers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
*/
package com.vapi.api.resources.analytics;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.vapi.api.core.ClientOptions;
import com.vapi.api.core.MediaTypes;
import com.vapi.api.core.ObjectMappers;
import com.vapi.api.core.RequestOptions;
import com.vapi.api.core.VapiApiException;
import com.vapi.api.core.VapiException;
import com.vapi.api.resources.analytics.requests.AnalyticsQueryDto;
import com.vapi.api.types.AnalyticsQueryResult;
import java.io.IOException;
import java.util.List;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
Expand All @@ -30,27 +24,19 @@ public AnalyticsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}

public List<AnalyticsQueryResult> get(AnalyticsQueryDto request) {
return get(request, null);
public void get() {
get(null);
}

public List<AnalyticsQueryResult> get(AnalyticsQueryDto request, RequestOptions requestOptions) {
public void get(RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("analytics")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new VapiException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.method("POST", RequestBody.create("", null))
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
Expand All @@ -59,8 +45,7 @@ public List<AnalyticsQueryResult> get(AnalyticsQueryDto request, RequestOptions
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), new TypeReference<List<AnalyticsQueryResult>>() {});
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
throw new VapiApiException(
Expand Down
Loading

0 comments on commit 0df2769

Please sign in to comment.