GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - goatbytes/vapi-sdk-java: The official Java SDK for accessing Vapi's API

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
gradle/wrapper
gradle/wrapper
 
 
sample-app
sample-app
 
 
src
src
 
 
.fernignore
.fernignore
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle.kts
build.gradle.kts
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle.kts
settings.gradle.kts
 
 

Repository files navigation

Vapi Java Library

fern shield

The Vapi Java SDK provides convenient access to the Vapi API from Java or Kotlin.

Installation

Gradle

Add the dependency in your build.gradle:

dependencies {
    implementation 'dev.vapi:server-sdk:0.x.x'
}

Maven

Add the dependency in your pom.xml:

<dependency>
    <groupId>dev.vapi</groupId>
    <artifactId>server-sdk</artifactId>
    <version>0.x.x</version>
</dependency>

Usage

Instantiate and use the client with the following:

import com.vapi.api.Vapi;

Vapi vapi = Vapi.builder()
  .token("YOUR_TOKEN") 
  .build();

vapi.call.create();

Exception Handling

When the API returns a non-success status code (4xx or 5xx response), a subclass of VapiException will be thrown.

import com.vapi.api.core.VapiException;

try {
    vapi.call.create();
} catch (VapiException e) {
    System.out.println(e.message());
}

The SDK also supports error handling for first class exceptions with strongly typed body fields.

import com.vapi.api.errors.InvalidRequestError;

try {
    vapi.call.create();
} catch (InvalidRequestError e) {
    System.out.println(e.message());
    System.out.println(e.getBody().getMissingField());
}

Advanced

Callbacks

You can register callbacks with the Vapi client and the callbacks will be invoked after events have been sent or failed to send.

vapi.addCallback((event, statusCode) -> {
  if (statusCode >= 400) {
    // do something with event in error case    
  }    
});

Retries

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retriable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).

A request is deemed retriable when any of the following HTTP status codes is returned:

  • 408 (Timeout)
  • 429 (Too Many Requests)
  • 5XX (Internal Server Errors)

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

About

The official Java SDK for accessing Vapi's API

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.